[Bug optimization/12209] [3.4 Regression] GCC fails to bootstrap Cygwin with -funit-at-a-time
dannysmith at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Oct 9 22:41:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12209
------- Additional Comments From dannysmith at gcc dot gnu dot org 2003-10-09 22:41 -------
Hi,
My rather naive attempt to fix for unit-at-a-time optimization is just to mimic
fastcall.
The following patch seems to work on simple testcase, but I'm sure I missed
something. Bootstrap in progress. The building of libgcj will take some time
(overnight on my machine)
* config/i386.c (ix86_function_regparm): Return 2 for cgraph
local function optimization if TARGET_STACK_PROBE.
(init_cum_args): Set cum->fastcall for cgraph local function
optimization if TARGET_STACK_PROBE.
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.605
diff -c -3 -p -r1.605 i386.c
*** i386.c 6 Oct 2003 23:18:31 -0000 1.605
--- i386.c 9 Oct 2003 22:11:54 -0000
*************** ix86_function_regparm (tree type, tree d
*** 1699,1706 ****
if (i && i->local)
{
/* We can't use regparm(3) for nested functions as these use
! static chain pointer in third argument. */
! if (DECL_CONTEXT (decl) && !DECL_NO_STATIC_CHAIN (decl))
regparm = 2;
else
regparm = 3;
--- 1699,1708 ----
if (i && i->local)
{
/* We can't use regparm(3) for nested functions as these use
! static chain pointer in third argument.
! If maybe probing stack, use fastcall to avoid eax clobber. */
! if ((DECL_CONTEXT (decl) && !DECL_NO_STATIC_CHAIN (decl))
! || TARGET_STACK_PROBE)
regparm = 2;
else
regparm = 3;
*************** init_cumulative_args (CUMULATIVE_ARGS *c
*** 1855,1860 ****
--- 1857,1874 ----
|| (fntype && !TYPE_ARG_TYPES (fntype)))
cum->maybe_vaarg = 1;
+ if (TARGET_STACK_PROBE && flag_unit_at_a_time
+ && !cum->fastcall
+ && cum->nregs)
+ {
+ struct cgraph_local_info *i = cgraph_local_info (fndecl);
+ if (i && i->local)
+ {
+ cum->nregs = 2;
+ cum->fastcall = 1;
+ }
+ }
+
if (TARGET_DEBUG_ARG)
fprintf (stderr, ", nregs=%d )\n", cum->nregs);
More information about the Gcc-bugs
mailing list