diff mbox

[ARM] Clean up dead code in thumb_pushpop

Message ID 4E0A567B.8050604@redhat.com
State New
Headers show

Commit Message

Richard Henderson June 28, 2011, 10:32 p.m. UTC
When I presented the patch that converted thumb1 prologue
to rtl, I said I didn't clean up thumb_pushpop.  I had 
thought about converting the epilogue to rtl as well and
deleting the function entirely.

However, for my immediate purposes cleaning up dwarf2out,
I need to remove the text-based interface to the unwind
info, and that means cleaning out the dead code from
thumb_pushpop now.

Tested with crosses to arm-elf and arm-eabi, -mthumb.
Committed as obvious.


r~
* config/arm/arm.c (thumb_pop): Rename from thumb_pushpop.  Delete
        all code and arguments that handled pushes.  Update all callers.
diff mbox

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index be03659..4c6041a 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -20188,16 +20188,9 @@  thumb1_emit_multi_reg_push (unsigned long mask, unsigned long real_regs)
 }
 
 /* Emit code to push or pop registers to or from the stack.  F is the
-   assembly file.  MASK is the registers to push or pop.  PUSH is
-   nonzero if we should push, and zero if we should pop.  For debugging
-   output, if pushing, adjust CFA_OFFSET by the amount of space added
-   to the stack.  REAL_REGS should have the same number of bits set as
-   MASK, and will be used instead (in the same order) to describe which
-   registers were saved - this is used to mark the save slots when we
-   push high registers after moving them to low registers.  */
+   assembly file.  MASK is the registers to pop.  */
 static void
-thumb_pushpop (FILE *f, unsigned long mask, int push, int *cfa_offset,
-	       unsigned long real_regs)
+thumb_pop (FILE *f, unsigned long mask)
 {
   int regno;
   int lo_mask = mask & 0xFF;
@@ -20205,7 +20198,7 @@  thumb_pushpop (FILE *f, unsigned long mask, int push, int *cfa_offset,
 
   gcc_assert (mask);
 
-  if (lo_mask == 0 && !push && (mask & (1 << PC_REGNUM)))
+  if (lo_mask == 0 && (mask & (1 << PC_REGNUM)))
     {
       /* Special case.  Do not generate a POP PC statement here, do it in
 	 thumb_exit() */
@@ -20213,22 +20206,7 @@  thumb_pushpop (FILE *f, unsigned long mask, int push, int *cfa_offset,
       return;
     }
 
-  if (push && arm_except_unwind_info (&global_options) == UI_TARGET)
-    {
-      fprintf (f, "\t.save\t{");
-      for (regno = 0; regno < 15; regno++)
-	{
-	  if (real_regs & (1 << regno))
-	    {
-	      if (real_regs & ((1 << regno) -1))
-		fprintf (f, ", ");
-	      asm_fprintf (f, "%r", regno);
-	    }
-	}
-      fprintf (f, "}\n");
-    }
-
-  fprintf (f, "\t%s\t{", push ? "push" : "pop");
+  fprintf (f, "\tpop\t{");
 
   /* Look at the low registers first.  */
   for (regno = 0; regno <= LAST_LO_REGNUM; regno++, lo_mask >>= 1)
@@ -20244,17 +20222,7 @@  thumb_pushpop (FILE *f, unsigned long mask, int push, int *cfa_offset,
 	}
     }
 
-  if (push && (mask & (1 << LR_REGNUM)))
-    {
-      /* Catch pushing the LR.  */
-      if (mask & 0xFF)
-	fprintf (f, ", ");
-
-      asm_fprintf (f, "%r", LR_REGNUM);
-
-      pushed_words++;
-    }
-  else if (!push && (mask & (1 << PC_REGNUM)))
+  if (mask & (1 << PC_REGNUM))
     {
       /* Catch popping the PC.  */
       if (TARGET_INTERWORK || TARGET_BACKTRACE
@@ -20278,23 +20246,6 @@  thumb_pushpop (FILE *f, unsigned long mask, int push, int *cfa_offset,
     }
 
   fprintf (f, "}\n");
-
-  if (push && pushed_words && dwarf2out_do_frame ())
-    {
-      char *l = dwarf2out_cfi_label (false);
-      int pushed_mask = real_regs;
-
-      *cfa_offset += pushed_words * 4;
-      dwarf2out_def_cfa (l, SP_REGNUM, *cfa_offset);
-
-      pushed_words = 0;
-      pushed_mask = real_regs;
-      for (regno = 0; regno <= 14; regno++, pushed_mask >>= 1)
-	{
-	  if (pushed_mask & 1)
-	    dwarf2out_reg_save (l, regno, 4 * pushed_words++ - *cfa_offset);
-	}
-    }
 }
 
 /* Generate code to return from a thumb function.
@@ -20440,8 +20391,7 @@  thumb_exit (FILE *f, int reg_containing_return_addr)
     }
 
   /* Pop as many registers as we can.  */
-  thumb_pushpop (f, regs_available_for_popping, FALSE, NULL,
-		 regs_available_for_popping);
+  thumb_pop (f, regs_available_for_popping);
 
   /* Process the registers we popped.  */
   if (reg_containing_return_addr == -1)
@@ -20522,8 +20472,7 @@  thumb_exit (FILE *f, int reg_containing_return_addr)
       int  popped_into;
       int  move_to;
 
-      thumb_pushpop (f, regs_available_for_popping, FALSE, NULL,
-		     regs_available_for_popping);
+      thumb_pop (f, regs_available_for_popping);
 
       /* We have popped either FP or SP.
 	 Move whichever one it is into the correct register.  */
@@ -20543,8 +20492,7 @@  thumb_exit (FILE *f, int reg_containing_return_addr)
     {
       int  popped_into;
 
-      thumb_pushpop (f, regs_available_for_popping, FALSE, NULL,
-		     regs_available_for_popping);
+      thumb_pop (f, regs_available_for_popping);
 
       popped_into = number_of_first_bit_set (regs_available_for_popping);
 
@@ -20876,7 +20824,7 @@  thumb_unexpanded_epilogue (void)
 	  mask &= (2 << regno) - 1;	/* A noop if regno == 8 */
 
 	  /* Pop the values into the low register(s).  */
-	  thumb_pushpop (asm_out_file, mask, 0, NULL, mask);
+	  thumb_pop (asm_out_file, mask);
 
 	  /* Move the value(s) into the high registers.  */
 	  for (regno = 0; regno <= LAST_LO_REGNUM; regno++)
@@ -20908,12 +20856,11 @@  thumb_unexpanded_epilogue (void)
 	 structure was created which includes an adjusted stack
 	 pointer, so just pop everything.  */
       if (live_regs_mask)
-	thumb_pushpop (asm_out_file, live_regs_mask, FALSE, NULL,
-		       live_regs_mask);
+	thumb_pop (asm_out_file, live_regs_mask);
 
       /* We have either just popped the return address into the
 	 PC or it is was kept in LR for the entire function.
-	 Note that thumb_pushpop has already called thumb_exit if the
+	 Note that thumb_pop has already called thumb_exit if the
 	 PC was in the list.  */
       if (!had_to_push_lr)
 	thumb_exit (asm_out_file, LR_REGNUM);
@@ -20922,8 +20869,7 @@  thumb_unexpanded_epilogue (void)
     {
       /* Pop everything but the return address.  */
       if (live_regs_mask)
-	thumb_pushpop (asm_out_file, live_regs_mask, FALSE, NULL,
-		       live_regs_mask);
+	thumb_pop (asm_out_file, live_regs_mask);
 
       if (had_to_push_lr)
 	{
@@ -20935,8 +20881,7 @@  thumb_unexpanded_epilogue (void)
 	    }
 
 	  /* Get the return address into a temporary register.  */
-	  thumb_pushpop (asm_out_file, 1 << LAST_ARG_REGNUM, 0, NULL,
-			 1 << LAST_ARG_REGNUM);
+	  thumb_pop (asm_out_file, 1 << LAST_ARG_REGNUM);
 
 	  if (size > 12)
 	    {