Patchwork [ARM] cleanup prologue_use pattern

login
register
mail settings
Submitter Greta Yorsh
Date Oct. 10, 2012, 3:13 p.m.
Message ID <002701cda6f9$d3204f70$7960ee50$@yorsh@arm.com>
Download mbox | patch
Permalink /patch/190690/
State New
Headers show

Comments

Greta Yorsh - Oct. 10, 2012, 3:13 p.m.
The pattern prologue_use is emitted for both prologue and epilogue.
In particular, the assembly comment
"@sp needed for prologue"
is printed out for both prologue and epilogue.

This patch adds a separate pattern for epilogue_use and replaces
prologue_use with epilogue_use where appropriate.

No regression on qemu for arm-none-eabi.

Ok for trunk?

Thanks,
Greta

2012-09-17  Greta Yorsh  <Greta.Yorsh@arm.com>

        * config/arm/arm.md (UNSPEC_EPILOGUE_USE): New unspec value.
        (sibcall_epilogue): Use UNSPEC_EPILOGUE_USE instead of
        UNSPEC_PROLOGUE_USE.
        (epilogue_use): New define_insn.
        (epilogue): Use gen_epilogue_use instead of gen_prologue_use.
        * config/arm/arm.c (arm_expand_epilogue): Likewise.
        (thumb1_expand_epilogue) Likewise.

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index dd073da..f23c2d0 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -22581,7 +22581,7 @@  thumb1_expand_epilogue (void)
 
   /* Emit a USE (stack_pointer_rtx), so that
      the stack adjustment will not be deleted.  */
-  emit_insn (gen_prologue_use (stack_pointer_rtx));
+  emit_insn (gen_epilogue_use (stack_pointer_rtx));
 
   if (crtl->profile || !TARGET_SCHED_PROLOG)
     emit_insn (gen_blockage ());
@@ -22805,7 +22805,7 @@  arm_expand_epilogue (bool really_return)
 
           /* Emit USE(stack_pointer_rtx) to ensure that stack adjustment is not
              deleted.  */
-          emit_insn (gen_prologue_use (stack_pointer_rtx));
+          emit_insn (gen_epilogue_use (stack_pointer_rtx));
         }
       else
         {
@@ -22823,7 +22823,7 @@  arm_expand_epilogue (bool really_return)
           emit_insn (gen_movsi (stack_pointer_rtx, hard_frame_pointer_rtx));
           /* Emit USE(stack_pointer_rtx) to ensure that stack adjustment is not
              deleted.  */
-          emit_insn (gen_prologue_use (stack_pointer_rtx));
+          emit_insn (gen_epilogue_use (stack_pointer_rtx));
         }
     }
   else
@@ -22841,7 +22841,7 @@  arm_expand_epilogue (bool really_return)
                                  GEN_INT (amount)));
           /* Emit USE(stack_pointer_rtx) to ensure that stack adjustment is
              not deleted.  */
-          emit_insn (gen_prologue_use (stack_pointer_rtx));
+          emit_insn (gen_epilogue_use (stack_pointer_rtx));
         }
     }
 
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index a60e659..6a910a3 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -81,6 +81,7 @@ 
                         ; instructions setting registers for EH handling
                         ; and stack frame generation.  Operand 0 is the
                         ; register to "use".
+  UNSPEC_EPILOGUE_USE   ; Same for epilogue.
   UNSPEC_CHECK_ARCH     ; Set CCs to indicate 26-bit or 32-bit mode.
   UNSPEC_WSHUFH         ; Used by the intrinsic form of the iWMMXt WSHUFH instruction.
   UNSPEC_WACC           ; Used by the intrinsic form of the iWMMXt WACC instruction.
@@ -10610,7 +10611,7 @@ 
   "TARGET_EITHER"
   "
   if (crtl->calls_eh_return)
-    emit_insn (gen_prologue_use (gen_rtx_REG (Pmode, 2)));
+    emit_insn (gen_epilogue_use (gen_rtx_REG (Pmode, 2)));
   if (TARGET_THUMB1)
    {
      thumb1_expand_epilogue ();
@@ -10644,7 +10645,7 @@ 
 ;; does not think that it is unused by the sibcall branch that
 ;; will replace the standard function epilogue.
 (define_expand "sibcall_epilogue"
-   [(parallel [(unspec:SI [(reg:SI LR_REGNUM)] UNSPEC_PROLOGUE_USE)
+   [(parallel [(unspec:SI [(reg:SI LR_REGNUM)] UNSPEC_EPILOGUE_USE)
                (unspec_volatile [(return)] VUNSPEC_EPILOGUE)])]
    "TARGET_32BIT"
    "
@@ -11267,6 +11268,12 @@ 
   [(set_attr "length" "0")]
 )
 
+(define_insn "epilogue_use"
+  [(unspec:SI [(match_operand:SI 0 "register_operand" "")] UNSPEC_EPILOGUE_USE)]
+  ""
+  "%@ %0 needed for epilogue"
+  [(set_attr "length" "0")]
+)
 
 ;; Patterns for exception handling