Diff of my local tree with cygwin-mingw branch shows missing fastcall and ms-bitfield stuff in i386.c.
Index: gcc/gcc/config/i386/i386.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v retrieving revision 1.368.2.19.2.2 diff -u -p -r1.368.2.19.2.2 i386.c --- gcc/gcc/config/i386/i386.c 7 Aug 2002 18:10:57 -0000 1.368.2.19.2.2 +++ gcc/gcc/config/i386/i386.c 10 Aug 2002 09:09:31 -0000 @@ -724,6 +724,7 @@ static int ix86_comp_type_attributes PAR const struct attribute_spec ix86_attribute_table[]; static tree ix86_handle_cdecl_attribute PARAMS ((tree *, tree, tree, int, bool *)); static tree ix86_handle_regparm_attribute PARAMS ((tree *, tree, tree, int, bool *)); +static bool ix86_ms_bitfield_layout_p PARAMS ((tree)); #ifdef DO_GLOBAL_CTORS_BODY static void ix86_svr3_asm_out_constructor PARAMS ((rtx, int)); @@ -820,6 +821,9 @@ static enum x86_64_reg_class merge_class #undef TARGET_SCHED_REORDER #define TARGET_SCHED_REORDER ix86_sched_reorder +#undef TARGET_MS_BITFIELD_LAYOUT_P +#define TARGET_MS_BITFIELD_LAYOUT_P ix86_ms_bitfield_layout_p + struct gcc_target targetm = TARGET_INITIALIZER; /* Sometimes certain combinations of command options do not make @@ -1229,6 +1233,9 @@ const struct attribute_spec ix86_attribu /* Stdcall attribute says callee is responsible for popping arguments if they are not variable. */ { "stdcall", 0, 0, false, true, true, ix86_handle_cdecl_attribute }, + /* Fastcall attribute says callee is responsible for popping arguments + if they are not variable. */ + { "fastcall", 0, 0, false, true, true, ix86_handle_cdecl_attribute }, /* Cdecl attribute says the callee is a normal C declaration */ { "cdecl", 0, 0, false, true, true, ix86_handle_cdecl_attribute }, /* Regparm attribute specifies how many integer arguments are to be @@ -1426,6 +1433,11 @@ ix86_comp_type_attributes (type1, type2) if (TREE_CODE (type1) != FUNCTION_TYPE) return 1; + /* Check for mismatched fastcall types */ + if (!lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type1)) + != !lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type2))) + return 0; + /* Check for mismatched return types (cdecl vs stdcall). */ if (!lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type1)) != !lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type2))) @@ -1461,8 +1473,9 @@ ix86_return_pops_args (fundecl, funtype, /* Cdecl functions override -mrtd, and never pop the stack. */ if (! lookup_attribute ("cdecl", TYPE_ATTRIBUTES (funtype))) { - /* Stdcall functions will pop the stack if not variable args. */ - if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (funtype))) + /* Stdcall and fastcall functions will pop the stack if not variable args. */ + if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (funtype)) + || lookup_attribute ("fastcall", TYPE_ATTRIBUTES (funtype))) rtd = 1; if (rtd @@ -1556,6 +1569,16 @@ init_cumulative_args (cum, fntype, libna } cum->maybe_vaarg = false; + /* Use ecx and edx registers if function has fastcall attribute */ + if (fntype && !TARGET_64BIT) + { + if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (fntype))) + { + cum->nregs = 2; + cum->fastcall = 1; + } + } + /* Determine if this function has variable arguments. This is indicated by the last argument being 'void_type_mode' if there are no variable arguments. If there are variable arguments, then @@ -1570,7 +1593,10 @@ init_cumulative_args (cum, fntype, libna if (next_param == 0 && TREE_VALUE (param) != void_type_node) { if (!TARGET_64BIT) - cum->nregs = 0; + { + cum->nregs = 0; + cum->fastcall = 0; + } cum->maybe_vaarg = true; } } @@ -2211,7 +2237,22 @@ function_arg (cum, mode, type, named) case HImode: case QImode: if (words <= cum->nregs) - ret = gen_rtx_REG (mode, cum->regno); + { + int regno = cum->regno; + + /* Fastcall allocates the first two DWORD (SImode) or + smaller arguments to ECX and EDX. */ + if (cum->fastcall) + { + if (mode == BLKmode || mode == DImode) + break; + + /* ECX not EAX is the first allocated register. */ + if (regno == 0) + regno = 2; + } + ret = gen_rtx_REG (mode, regno); + } break; case TImode: if (cum->sse_nregs) @@ -12557,6 +12598,17 @@ x86_order_regs_for_local_alloc () at all. */ while (pos < FIRST_PSEUDO_REGISTER) reg_alloc_order [pos++] = 0; +} + +#ifndef TARGET_USE_MS_BITFIELD_LAYOUT +#define TARGET_USE_MS_BITFIELD_LAYOUT 0 +#endif + +static bool +ix86_ms_bitfield_layout_p (record_type) + tree record_type ATTRIBUTE_UNUSED; +{ + return TARGET_USE_MS_BITFIELD_LAYOUT; } void http://digital.yahoo.com.au - Yahoo! Digital How To - Get the best out of your PC!