RFA: New flag in struct rtx_def

Nick Clifton nickc@cygnus.com
Mon Jul 17 11:59:00 GMT 2000


Hi Jason,

: That seems unfair; it's taken a while because we've been talking
: about how properly to fix the problem.  Anyway, does this do the
: trick for you?

Your patch almost worked.  It was just missing a test of cfa_old_reg
when setting the frame pointer.  I have added this to your code (see
the patch below) and now the arm-elf toolchain builds for me.  (This
does also need a seperate patch to arm.c which I will post if this
modified patch to dwarf2out.c gets accepted).

Any objections to applying this patch ?

Cheers
	Nick


2000-07-17  Jason Merrill <jason@redhat.com>
	    Nick Clifton  <nickc@cygnus.com>

	* dwarf2out.c (cfa_old_reg): New static variable.  Records the
	old CFA register when indirect addressing appears to change it.
	(dwarf2out_frame_debug_expr): Reset the CFA indirect flag when
	the CFA register is initialised.
	Allow the frame pointer to be set from either the current CFA
	register or the old CFA register (if indirect CFA addressing
	is in use).
	Record the old CFA register when indirect addressing is
	detected.
	
Index: gcc/dwarf2out.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/dwarf2out.c,v
retrieving revision 1.143
diff -p -w -r1.143 dwarf2out.c
*** dwarf2out.c	2000/07/14 17:44:40	1.143
--- dwarf2out.c	2000/07/17 18:55:23
*************** static unsigned cfa_temp_reg;
*** 1208,1213 ****
--- 1208,1215 ----
  /* A temporary value used in adjusting SP or setting up the store_reg.  */
  static long cfa_temp_value;
  
+ static unsigned cfa_old_reg;
+ 
  /* Record call frame debugging information for an expression, which either
     sets SP or FP (adjusting how we calculate the frame address) or saves a
     register to the stack. */
*************** dwarf2out_frame_debug_expr (expr, label)
*** 1266,1271 ****
--- 1268,1274 ----
  	     FP.  So we just rely on the backends to only set
  	     RTX_FRAME_RELATED_P on appropriate insns.  */
            cfa.reg = REGNO (dest);
+ 	  cfa.indirect = 0;
            break;
  
          case PLUS:
*************** dwarf2out_frame_debug_expr (expr, label)
*** 1307,1318 ****
            else if (dest == hard_frame_pointer_rtx)
              {
  	      /* Either setting the FP from an offset of the SP,
! 		 or adjusting the FP */
  	      if (! frame_pointer_needed)
  		abort ();
  
  	      if (GET_CODE (XEXP (src, 0)) == REG
! 		  && (unsigned) REGNO (XEXP (src, 0)) == cfa.reg
  		  && GET_CODE (XEXP (src, 1)) == CONST_INT)
  		{
  		  offset = INTVAL (XEXP (src, 1));
--- 1310,1323 ----
            else if (dest == hard_frame_pointer_rtx)
              {
  	      /* Either setting the FP from an offset of the SP,
! 		 or adjusting the FP.  */
  	      if (! frame_pointer_needed)
  		abort ();
  
  	      if (GET_CODE (XEXP (src, 0)) == REG
! 		  && ((unsigned) REGNO (XEXP (src, 0)) == cfa.reg
! 		      || (cfa.indirect
! 			  && (unsigned) REGNO (XEXP (src, 0)) == cfa_old_reg))
  		  && GET_CODE (XEXP (src, 1)) == CONST_INT)
  		{
  		  offset = INTVAL (XEXP (src, 1));
*************** dwarf2out_frame_debug_expr (expr, label)
*** 1403,1408 ****
--- 1408,1414 ----
  	    }
  	  if (GET_CODE (x) != REG)
  	    abort ();
+ 	  cfa_old_reg = cfa.reg;
  	  cfa.reg = (unsigned) REGNO (x);
  	  cfa.base_offset = offset;
  	  cfa.indirect = 1;


More information about the Gcc-patches mailing list