This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Sparc 'nop' fixlet
- From: "David S. Miller" <davem at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 16 Jul 2003 01:29:36 -0700
- Subject: [PATCH] Sparc 'nop' fixlet
In order to fix a gdb backtrace bug on Sparc we had
to emit a nop if the last part of a function was
"call; delay_slot;" and said function was transformed
into a sibling call.
Unfortunately, I changed it to emit the nop all the time
which is just stupid.
This borrows the test from similar code in the HPPA backend.
Approved for 3.3 branch by Mark, and also added to mainline.
2003-07-15 David S. Miller <davem@redhat.com>
* config/sparc/sparc.c (sparc_nonflat_function_epilogue): Only
emit nop if the last real insn is CALL_INSN.
--- config/sparc/sparc.c.~1~ Sun May 4 08:48:00 2003
+++ config/sparc/sparc.c Sun May 4 09:09:27 2003
@@ -4037,11 +4037,19 @@
of a function were call foo; dslot; this can make the return
PC of foo (ie. address of call instruction plus 8) point to
the first instruction in the next function. */
- rtx insn;
-
- fputs("\tnop\n", file);
+ rtx insn, last_real_insn;
insn = get_last_insn ();
+
+ last_real_insn = prev_real_insn (insn);
+ if (last_real_insn
+ && GET_CODE (last_real_insn) == INSN
+ && GET_CODE (PATTERN (last_real_insn)) == SEQUENCE)
+ last_real_insn = XVECEXP (PATTERN (last_real_insn), 0, 0);
+
+ if (last_real_insn && GET_CODE (last_real_insn) == CALL_INSN)
+ fputs("\tnop\n", file);
+
if (GET_CODE (insn) == NOTE)
insn = prev_nonnote_insn (insn);
if (insn && GET_CODE (insn) == BARRIER)