This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Nonlocal gotos: wrong frame pointer handling
- From: Andreas Krebbel <krebbel1 at de dot ibm dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 11 Nov 2003 10:26:00 +0100
- Subject: Re: Nonlocal gotos: wrong frame pointer handling
- Organization: IBM Entwicklung GmbH
Hi,
as you recommended I've added the memory clobbers to expand_goto (stmt.c). But the testcase from
my first email still fails.
Index: gcc/stmt.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.334
diff -p -c -r1.334 stmt.c
*** gcc/stmt.c 9 Oct 2003 05:44:51 -0000 1.334
--- gcc/stmt.c 11 Nov 2003 09:14:38 -0000
*************** expand_goto (tree label)
*** 646,651 ****
--- 646,657 ----
else
#endif
{
+ emit_insn (gen_rtx_CLOBBER (VOIDmode,
+ gen_rtx_MEM (BLKmode,
+ gen_rtx_SCRATCH (VOIDmode))));
+ emit_insn (gen_rtx_CLOBBER (VOIDmode,
+ gen_rtx_MEM (BLKmode, stack_pointer_rtx)));
+
/* Restore frame pointer for containing function.
This sets the actual hard register used for the frame pointer
to the location of the function's incoming static chain info.
With this patch the insns are separated through the mem clobbers as expected.
nonlocal.c.01.rtl:
(insn 30 29 31 (set (reg:DI 49)
(mem:DI (reg:DI 48) [0 S8 A8])) -1 (nil)
(nil))
(insn 31 30 32 (clobber (mem:BLK (scratch) [0 A8])) -1 (nil)
(nil))
(insn 32 31 33 (clobber (mem:BLK (reg/f:DI %r15) [0 A8])) -1 (nil)
(nil))
(insn 33 32 34 (set (reg/f:DI %r11)
(reg:DI 48)) -1 (nil)
(nil))
But the scheduler does not care very much about it and exchanges the insns (30 <-> 33) anyway.
Any ideas why?
nonlocal.c.39.mach:
(insn 33 36 88 (set (reg/f:DI %r11)
(mem:DI (plus:DI (reg/f:DI %r11)
(const_int 216 [0xd8])) [6 S8 A8])) 53 {*movdi_64} (nil)
(nil))
(insn 88 33 30 (set (reg:DI %r2)
(mem:DI (plus:DI (reg/f:DI %r11)
(const_int 216 [0xd8])) [6 S8 A8])) 53 {*movdi_64} (insn_list 33 (nil))
(nil))
(insn 30 88 31 (set (reg:DI %r1 [49])
(mem:DI (reg:DI %r2) [0 S8 A8])) 53 {*movdi_64} (insn_list 88 (nil))
(expr_list:REG_DEAD (reg:DI %r2)
(nil)))
(insn 31 30 32 (clobber (mem:BLK (scratch) [0 A8])) -1 (insn_list:REG_DEP_ANTI 33 (insn_list:REG_
DEP_ANTI 88 (insn_list:REG_DEP_ANTI 30 (nil))))
(nil))
(insn 32 31 34 (clobber (mem:BLK (reg/f:DI %r15) [0 A8])) -1 (insn_list:REG_DEP_OUTPUT 31 (insn_l
ist:REG_DEP_ANTI 33 (insn_list:REG_DEP_ANTI 88 (insn_list:REG_DEP_ANTI 30 (nil)))))
(nil))
Bye,
-Andreas-