This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Frame-related delay slot insns
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: gcc-patches at gcc dot gnu dot org, law at redhat dot com
- Date: 06 May 2003 19:25:34 +0100
- Subject: Re: Frame-related delay slot insns
- References: <200305061553.h46FrZS4003808@hiauly1.hia.nrc.ca>
"John David Anglin" <dave@hiauly1.hia.nrc.ca> writes:
> With respect to dwarf2 debug and exception support, we don't allow
> frame related instructions in the delay slot of branches on hppa-linux.
> This is the only PA port that supports dwarf2 exceptions. We emit
> a blockage at the end of the prologue when doing frame notes. This
> isn't optimal but it's the only solution so far.
I wondered about doing the same for mips, or at least changing
the delay attributes such that frame-related insns never went
into a call's delay slot. I guess it's still plan B if the
patches to final aren't accepted.
FWIW, the in-sequence alternative might look something like
the patch below (untested).
Richard
* dwarf2out.c (dwarf2out_frame_debug): Do nothing within delayed
branch sequences.
* final.c (final_scan_insn): Pass delayed branch sequences through
dwarf2out_frame_debug before emitting them.
Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.275
diff -c -d -p -F^[(a-zA-Z0-9_^#] -r1.275 final.c
*** final.c 25 Jan 2003 23:32:20 -0000 1.275
--- final.c 6 May 2003 16:57:04 -0000
*************** #endif
*** 2158,2163 ****
--- 2158,2173 ----
if (prescan > 0)
break;
+
+ /* When a call's delay slots include frame-related insns,
+ their effect must be described before the call. See
+ execute_cfa_program(). */
+ #if defined (DWARF2_UNWIND_INFO)
+ if (dwarf2out_do_frame ())
+ for (i = 0; i < XVECLEN (body, 0); i++)
+ dwarf2out_frame_debug (XVECEXP (body, 0, i));
+ #endif
+
final_sequence = body;
/* The first insn in this SEQUENCE might be a JUMP_INSN that will
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.423
diff -c -d -p -F^[(a-zA-Z0-9_^#] -r1.423 dwarf2out.c
*** dwarf2out.c 29 Apr 2003 20:42:55 -0000 1.423
--- dwarf2out.c 6 May 2003 16:57:10 -0000
*************** dwarf2out_frame_debug (insn)
*** 1685,1690 ****
--- 1685,1695 ----
return;
}
+ /* Ignore insns passed during a delayed-branch sequence. Their effects
+ should have been described before the start of the sequence. */
+ if (final_sequence != 0)
+ return;
+
if (GET_CODE (insn) != INSN || clobbers_queued_reg_save (insn))
flush_queued_reg_saves ();