[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] x86_64: second struct va_arg fails
From: |
grischka |
Subject: |
Re: [Tinycc-devel] x86_64: second struct va_arg fails |
Date: |
Mon, 20 Dec 2010 13:01:04 +0100 |
User-agent: |
Thunderbird 2.0.0.23 (Windows/20090812) |
shinichiro hamaji wrote:
This is one of my TODO. I think the easiest way would be adding a
builtin function like __builtin_aggregate_types_p and using it in
stdarg.h. I hesitated to do this because any other compilers don't
have such extensions. A better way would be defining __builtin_va_arg
just like GCC. I guess I will have some spare time this year end. I'll
try working on this if no one don't fix.
Maybe you can use a support function in combination with a builtin.
This would keep the generated code reasonably small and most of the
logic could be in convenient C. Such as:
in stdarg.h:
#define va_arg(ap,type) *(type)*__va_arg(ap, __builtin_va_type(type))
and in libtcc1.c:
enum va_type { va_reg, va_double, va_aggregate, ... };
void *__va_arg(va_list ap, int va_type)
{
switch(va_type) [
...
Btw, I was wondering whether alignment '4' for structures is correct.
Basically registers and mmx would possibly go on top of some structure
in the overflow_area when the register space is used up. There could
also be doubles in a structure. Just wondering.
--- grischka