This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Frame-related delay slot insns


Richard Henderson <rth@redhat.com> writes:
> I'd rather keep all the hackery in the same place.
> I.e. no change to dwarf2out, and slightly different
> changes to final_scan_insn.

Sorry for the wild goose chase.  I was taking this code at face value:

#if defined (DWARF2_UNWIND_INFO)
	if (GET_CODE (insn) == CALL_INSN && dwarf2out_do_frame ())
	  dwarf2out_frame_debug (insn);
#endif

but looking through the back ends, I don't think any of them generate
such a thing as a frame-related call.  I guess the snippet above is
really there to flush the register save queue.

For delayed calls, we would want to flush the queue after recording
the frame info for the delay slots.  That means recording the delay
slots first and the delayed call second.

So I'd like to go back to my first patch, but cleaned up a little.
Tested on mips-sgi-irix6.5, mipsel-linux-gnu, mips64vrel-elf &
i686-pc-linux-gnu.  OK to install?

Richard


	* final.c (final_scan_insn): Apply the effects of frame-related
	delay slot insns before emitting a delayed branch.

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_]\|#define\) -r1.275 final.c
*** final.c	25 Jan 2003 23:32:20 -0000	1.275
--- final.c	13 May 2003 06:50:31 -0000
*************** final_scan_insn (insn, file, optimize, p
*** 2160,2165 ****
--- 2160,2173 ----
  	      break;
  	    final_sequence = body;
  
+ 	    /* Record the delay slots' frame information before the branch.
+ 	       This is needed for delayed calls: see execute_cfa_program().  */
+ #if defined (DWARF2_UNWIND_INFO)
+ 	    if (dwarf2out_do_frame ())
+ 	      for (i = 1; i < XVECLEN (body, 0); i++)
+ 		dwarf2out_frame_debug (XVECEXP (body, 0, i));
+ #endif
+ 
  	    /* The first insn in this SEQUENCE might be a JUMP_INSN that will
  	       force the restoration of a comparison that was previously
  	       thought unnecessary.  If that happens, cancel this sequence
*************** final_scan_insn (insn, file, optimize, p
*** 2514,2529 ****
  
  	output_asm_insn (template, recog_data.operand);
  
  #if defined (DWARF2_UNWIND_INFO)
! #if defined (HAVE_prologue)
! 	if (GET_CODE (insn) == INSN && dwarf2out_do_frame ())
! 	  dwarf2out_frame_debug (insn);
! #else
! 	if (!ACCUMULATE_OUTGOING_ARGS
! 	    && GET_CODE (insn) == INSN
  	    && dwarf2out_do_frame ())
  	  dwarf2out_frame_debug (insn);
- #endif
  #endif
  
  #if 0
--- 2522,2538 ----
  
  	output_asm_insn (template, recog_data.operand);
  
+ 	/* If necessary, report the effect that the instruction has on
+ 	   the unwind info.   We've already done this for delay slots
+ 	   and call instructions.  */
  #if defined (DWARF2_UNWIND_INFO)
! 	if (GET_CODE (insn) == INSN
! #if !defined (HAVE_prologue)
! 	    && !ACCUMULATE_OUTGOING_ARGS
! #endif
! 	    && final_sequence == 0
  	    && dwarf2out_do_frame ())
  	  dwarf2out_frame_debug (insn);
  #endif
  
  #if 0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]