This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
[GCC3.2]: Merge conflict in i386.c?
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- To: dj at redhat dot com, charlet at act-europe dot fr, gcc-bugs at gcc dot gnu dot org, Yura Bidas <yuri_b at mail dot com>, binutils <binutils at sources dot redhat dot com>, Sam Blackburn <sam_blackburn at pobox dot com>, J Boddy <J dot Boddy at massey dot ac dot nz>, Boris <fbp at stlport dot org>, Cygwin <cygwin at cygwin dot com>, Cygwin <cygwin at sources dot redhat dot com>, cygwin-apps <cygwin-apps at cygwin dot com>, cygwin-patches <cygwin-patches at cygwin dot com>, Christopher Faylor <cgf at redhat dot com>, Wayne F Foggat <frogway at voyager dot co dot nz>, GCC <gcc at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>, "Javier_González" <xaviergonz at hotmail dot com>, Mumit Khan <khan at nanotech dot wisc dot edu>, Eric Kohl <ekohl at rz-online dot de>, MasseyLibrary <libextm at massey dot ac dot nz>, Mingw <mingw-users at lists dot sourceforge dot net>, mingw-dvlpr <mingw-dvlpr at lists dot sourceforge dot net>, Paul Muir <paul dot muir at agresearch dot co dot nz>, newlib list <newlib at sources dot redhat dot com>, Thomas Pfaff <tpfaff at gmx dot net>, pthreads <pthreads-win32 at sources dot redhat dot com>, Sandy Smith <sandy dot smith at hawkesbaydhb dot govt dot nz>, Thomas Smith <thomas_smith10 at hotmail dot com>, Paul Sokolovsky <paul-ml at is dot lg dot ua>, Charles Wilson <cwilson at ece dot gatech dot edu>
- Date: Sun, 11 Aug 2002 10:27:08 +1000 (EST)
- Subject: [GCC3.2]: Merge conflict in i386.c?
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!