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: arm.c: add REG_MAYBE_DEAD notes for frame pointer initialisation.


Hi Richard,

> > Doh!  Yes, sorry about that.  I should be adding a USE like this.
> 
> No, see the bit Jakub just changed in the ia64 prologue.

Ahh, I see.  Something like this then ?

Cheers
        Nick

2002-01-23  Nick Clifton  <nickc@cambridge.redhat.com>

	* config/arm/arm.md (UNSPEC_PROLOGUE_USE): New unspec constant.
	(prologue_use): New pattern.
	* config/arm/arm.c (expand_prologue): Use gen_prologue_use in
	preference to gen_rtx_USE.
	(thumb_expand_prologue): Use gen_prologue_use in preference to
	gen_rtx_USE.
	(thumb_expand_epilogue): Use gen_prologue_use in preference to
	gen_rtx_USE.

Index: config/arm/arm.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.md,v
retrieving revision 1.87
diff -c -3 -p -w -r1.87 arm.md
*** arm.md	2001/12/21 09:31:37	1.87
--- arm.md	2002/01/23 10:58:30
***************
*** 64,69 ****
--- 64,74 ----
     (UNSPEC_CLZ	     5) ; `clz' instruction, count leading zeros (SImode):
  			;   operand 0 is the result,
  			;   operand 1 is the parameter.
+    (UNSPEC_PROLOGUE_USE 6) ; As USE insns are not meaningful after reload,
+    			; this unspec is used to prevent the deletion of
+    			; instructions setting registers for EH handling
+    			; and stack frame generation.  Operand 0 is the
+    			; register to "use".
    ]
  )
  
***************
*** 9187,9189 ****
--- 9192,9199 ----
    ""
  )
  
+ (define_insn "prologue_use"
+   [(unspec:SI [(match_operand:SI 0 "register_operand" "")] UNSPEC_PROLOGUE_USE)]
+   ""
+   "%@ %0 needed for prologue"
+ )

Index: config/arm/arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.189
diff -c -3 -p -w -r1.189 arm.c
*** arm.c	2002/01/22 17:35:27	1.189
--- arm.c	2002/01/23 10:58:33
*************** arm_expand_prologue ()
*** 8331,8337 ****
  
  	  emit_insn (gen_rtx_SET (SImode, ip_rtx, insn));
  	  /* Add a USE to stop propagate_one_insn() from barfing.  */
! 	  emit_insn (gen_rtx_USE (VOIDmode, ip_rtx));
  	}
      }
  
--- 8331,8337 ----
  
  	  emit_insn (gen_rtx_SET (SImode, ip_rtx, insn));
  	  /* Add a USE to stop propagate_one_insn() from barfing.  */
! 	  emit_insn (gen_prologue_use (ip_rtx));
  	}
      }
  
*************** arm_expand_prologue ()
*** 8377,8383 ****
       then make sure that it does not get reused by the ce2 pass.  */
    if ((live_regs_mask & (1 << LR_REGNUM)) == 0)
      {
!       emit_insn (gen_rtx_USE (VOIDmode, gen_rtx_REG (SImode, LR_REGNUM)));
        cfun->machine->lr_save_eliminated = 1;
      }
  }
--- 8377,8383 ----
       then make sure that it does not get reused by the ce2 pass.  */
    if ((live_regs_mask & (1 << LR_REGNUM)) == 0)
      {
!       emit_insn (gen_prologue_use (gen_rtx_REG (SImode, LR_REGNUM)));
        cfun->machine->lr_save_eliminated = 1;
      }
  }
*************** thumb_expand_prologue ()
*** 10186,10192 ****
  	      /* Save it by copying it into a high, scratch register.  */
  	      emit_insn (gen_movsi (spare, reg));
  	      /* Add a USE to stop propagate_one_insn() from barfing.  */
! 	      emit_insn (gen_rtx_USE (VOIDmode, spare));
  
  	      /* Decrement the stack.  */
  	      emit_insn (gen_movsi (reg, GEN_INT (- amount)));
--- 10186,10192 ----
  	      /* Save it by copying it into a high, scratch register.  */
  	      emit_insn (gen_movsi (spare, reg));
  	      /* Add a USE to stop propagate_one_insn() from barfing.  */
! 	      emit_insn (gen_prologue_use (spare));
  
  	      /* Decrement the stack.  */
  	      emit_insn (gen_movsi (reg, GEN_INT (- amount)));
*************** thumb_expand_prologue ()
*** 10200,10206 ****
  		 analysis will not consider the restore redundant.  The
  		 register won't be used again in this function and isn't
  		 restored by the epilogue.  */
! 	      emit_insn (gen_rtx_USE (VOIDmode, reg));
  	    }
  	  else
  	    {
--- 10200,10206 ----
  		 analysis will not consider the restore redundant.  The
  		 register won't be used again in this function and isn't
  		 restored by the epilogue.  */
! 	      emit_insn (gen_prologue_use (reg));
  	    }
  	  else
  	    {
*************** thumb_expand_epilogue ()
*** 10248,10254 ****
        
    /* Emit a USE (stack_pointer_rtx), so that
       the stack adjustment will not be deleted.  */
!   emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
  
    if (current_function_profile || TARGET_NO_SCHED_PRO)
      emit_insn (gen_blockage ());
--- 10248,10254 ----
        
    /* Emit a USE (stack_pointer_rtx), so that
       the stack adjustment will not be deleted.  */
!   emit_insn (gen_prologue_use (stack_pointer_rtx));
  
    if (current_function_profile || TARGET_NO_SCHED_PRO)
      emit_insn (gen_blockage ());


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