diff mbox

[2/6] Unique return rtx

Message ID 4D8A07FB.7030707@codesourcery.com
State New
Headers show

Commit Message

Bernd Schmidt March 23, 2011, 2:47 p.m. UTC
We'll start putting "return" into JUMP_LABELS in a subsequent patch, so
I've decided to make it unique as a small cleanup.

There's already another macro called "return_rtx", so the new one goes
by the name of "ret_rtx".


Bernd
* gengenrtl.c (special_rtx): PC, CC0 and RETURN are special.
	* genemit.c (gen_exp): Handle RETURN.
	* emit-rtl.c (verify_rtx_sharing): Likewise.
	(init_emit_regs): Create pc_rtx, ret_rtx and cc0_rtx specially.
	* rtl.c (copy_rtx): RETURN is shared.
	* rtl.h (enum global_rtl_index): Add GR_RETURN.
	(ret_rtx): New.
	* jump.c (redirect_exp_1): Don't use gen_rtx_RETURN.
	* config/s390/s390.c (s390_emit_epilogue): Likewise.
	* config/rx/rx.c (gen_rx_rtsd_vector): Likewise.
	* config/m68hc11/m68hc11.md (return): Likewise.
	* config/cris/cris.c (cris_expand_return): Likewise.
	* config/m68k/m68k.c (m68k_expand_epilogue): Likewise.
	* config/rs6000/rs6000.c (rs6000_make_savres_rtx,
	rs6000_emit_epilogue, rs6000_output_mi_thunk): Likewise.
	* config/picochip/picochip.c (picochip_expand_epilogue): Likewise.
	* config/h8300/h8300.c (h8300_push_pop, h8300_expand_epilogue):
	Likewise.
	* config/v850/v850.c (expand_epilogue): Likewise.
	* config/bfin/bfin.c (bfin_expand_call): Likewise.
	* config/arm/arm.md (epilogue): Likewise.

Comments

Jeff Law March 31, 2011, 1:17 p.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/23/11 08:47, Bernd Schmidt wrote:
> We'll start putting "return" into JUMP_LABELS in a subsequent patch, so
> I've decided to make it unique as a small cleanup.
> 
> There's already another macro called "return_rtx", so the new one goes
> by the name of "ret_rtx".
OK.
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNlH7oAAoJEBRtltQi2kC7HzUIAILc84OamkwdrFzp/Y4y8C+r
4zYJnn3IYxUcr9fb7kvssK+A8ABZF3qO34v9xzFkmEf7nsOSeivoM6qyo4ai/uuo
CJ7sKgHg44JcBC4eS6qJQIYAJ9VJH2etQTrFyaI2zORQg0LzuU+iG/wEIuWlRVj7
4C46JIzeNJ9ntPXvXJwjUjWimHlPH5WhTdxa+6fchEuZwkRK2ckGJ/nsZ+XEUZJJ
HmizaKR5icGj3CIEiJEAxltuCMy4wOLes/fawfLGah6o/q51rSRsiPZrSO3teK15
VM+8lvdOyRR0O1npDgIERCOV/L2qiWkmkYQDdwoPy11YxMin2JPhxBkOb+lx9Eg=
=Wd06
-----END PGP SIGNATURE-----
diff mbox

Patch

Index: gcc/gengenrtl.c
===================================================================
--- gcc.orig/gengenrtl.c
+++ gcc/gengenrtl.c
@@ -128,6 +128,9 @@  special_rtx (int idx)
 	  || strcmp (defs[idx].enumname, "REG") == 0
 	  || strcmp (defs[idx].enumname, "SUBREG") == 0
 	  || strcmp (defs[idx].enumname, "MEM") == 0
+	  || strcmp (defs[idx].enumname, "PC") == 0
+	  || strcmp (defs[idx].enumname, "CC0") == 0
+	  || strcmp (defs[idx].enumname, "RETURN") == 0
 	  || strcmp (defs[idx].enumname, "CONST_VECTOR") == 0);
 }
 
Index: gcc/genemit.c
===================================================================
--- gcc.orig/genemit.c
+++ gcc/genemit.c
@@ -223,6 +223,9 @@  gen_exp (rtx x, enum rtx_code subroutine
     case PC:
       printf ("pc_rtx");
       return;
+    case RETURN:
+      printf ("ret_rtx");
+      return;
     case CLOBBER:
       if (REG_P (XEXP (x, 0)))
 	{
Index: gcc/emit-rtl.c
===================================================================
--- gcc.orig/emit-rtl.c
+++ gcc/emit-rtl.c
@@ -2447,6 +2447,7 @@  verify_rtx_sharing (rtx orig, rtx insn)
     case CODE_LABEL:
     case PC:
     case CC0:
+    case RETURN:
     case SCRATCH:
       return;
       /* SCRATCH must be shared because they represent distinct values.  */
@@ -5651,8 +5652,9 @@  init_emit_regs (void)
   init_reg_modes_target ();
 
   /* Assign register numbers to the globally defined register rtx.  */
-  pc_rtx = gen_rtx_PC (VOIDmode);
-  cc0_rtx = gen_rtx_CC0 (VOIDmode);
+  pc_rtx = gen_rtx_fmt_ (PC, VOIDmode);
+  ret_rtx = gen_rtx_fmt_ (RETURN, VOIDmode);
+  cc0_rtx = gen_rtx_fmt_ (CC0, VOIDmode);
   stack_pointer_rtx = gen_raw_REG (Pmode, STACK_POINTER_REGNUM);
   frame_pointer_rtx = gen_raw_REG (Pmode, FRAME_POINTER_REGNUM);
   hard_frame_pointer_rtx = gen_raw_REG (Pmode, HARD_FRAME_POINTER_REGNUM);
Index: gcc/rtl.c
===================================================================
--- gcc.orig/rtl.c
+++ gcc/rtl.c
@@ -255,6 +255,7 @@  copy_rtx (rtx orig)
     case CODE_LABEL:
     case PC:
     case CC0:
+    case RETURN:
     case SCRATCH:
       /* SCRATCH must be shared because they represent distinct values.  */
       return orig;
Index: gcc/rtl.h
===================================================================
--- gcc.orig/rtl.h
+++ gcc/rtl.h
@@ -2045,6 +2045,7 @@  enum global_rtl_index
 {
   GR_PC,
   GR_CC0,
+  GR_RETURN,
   GR_STACK_POINTER,
   GR_FRAME_POINTER,
 /* For register elimination to work properly these hard_frame_pointer_rtx,
@@ -2134,6 +2135,7 @@  extern struct target_rtl *this_target_rt
 
 /* Standard pieces of rtx, to be substituted directly into things.  */
 #define pc_rtx                  (global_rtl[GR_PC])
+#define ret_rtx                 (global_rtl[GR_RETURN])
 #define cc0_rtx                 (global_rtl[GR_CC0])
 
 /* All references to certain hard regs, except those created
Index: gcc/config/s390/s390.c
===================================================================
--- gcc.orig/config/s390/s390.c
+++ gcc/config/s390/s390.c
@@ -8516,7 +8516,7 @@  s390_emit_epilogue (bool sibcall)
 
       p = rtvec_alloc (2);
 
-      RTVEC_ELT (p, 0) = gen_rtx_RETURN (VOIDmode);
+      RTVEC_ELT (p, 0) = ret_rtx;
       RTVEC_ELT (p, 1) = gen_rtx_USE (VOIDmode, return_reg);
       emit_jump_insn (gen_rtx_PARALLEL (VOIDmode, p));
     }
Index: gcc/config/rx/rx.c
===================================================================
--- gcc.orig/config/rx/rx.c
+++ gcc/config/rx/rx.c
@@ -1550,7 +1550,7 @@  gen_rx_rtsd_vector (unsigned int adjust,
 				: plus_constant (stack_pointer_rtx,
 						 i * UNITS_PER_WORD)));
 
-  XVECEXP (vector, 0, count - 1) = gen_rtx_RETURN (VOIDmode);
+  XVECEXP (vector, 0, count - 1) = ret_rtx;
 
   return vector;
 }
Index: gcc/config/m68hc11/m68hc11.md
===================================================================
--- gcc.orig/config/m68hc11/m68hc11.md
+++ gcc/config/m68hc11/m68hc11.md
@@ -6576,7 +6576,7 @@ 
   if (ret_size && ret_size <= 2)
     {
       emit_jump_insn (gen_rtx_PARALLEL (VOIDmode,
-		      gen_rtvec (2, gen_rtx_RETURN (VOIDmode),
+		      gen_rtvec (2, ret_rtx,
 			         gen_rtx_USE (VOIDmode,
 					      gen_rtx_REG (HImode, 1)))));
       DONE;
@@ -6584,7 +6584,7 @@ 
   if (ret_size)
     {
       emit_jump_insn (gen_rtx_PARALLEL (VOIDmode,
-		      gen_rtvec (2, gen_rtx_RETURN (VOIDmode),
+		      gen_rtvec (2, ret_rtx,
 			         gen_rtx_USE (VOIDmode,
 					      gen_rtx_REG (SImode, 0)))));
       DONE;
Index: gcc/config/cris/cris.c
===================================================================
--- gcc.orig/config/cris/cris.c
+++ gcc/config/cris/cris.c
@@ -1788,7 +1788,7 @@  cris_expand_return (bool on_stack)
      we do that until they're fixed.  Currently, all return insns in a
      function must be the same (not really a limiting factor) so we need
      to check that it doesn't change half-way through.  */
-  emit_jump_insn (gen_rtx_RETURN (VOIDmode));
+  emit_jump_insn (ret_rtx);
 
   CRIS_ASSERT (cfun->machine->return_type != CRIS_RETINSN_RET || !on_stack);
   CRIS_ASSERT (cfun->machine->return_type != CRIS_RETINSN_JUMP || on_stack);
Index: gcc/config/m68k/m68k.c
===================================================================
--- gcc.orig/config/m68k/m68k.c
+++ gcc/config/m68k/m68k.c
@@ -1384,7 +1384,7 @@  m68k_expand_epilogue (bool sibcall_p)
 			   EH_RETURN_STACKADJ_RTX));
 
   if (!sibcall_p)
-    emit_jump_insn (gen_rtx_RETURN (VOIDmode));
+    emit_jump_insn (ret_rtx);
 }
 
 /* Return true if X is a valid comparison operator for the dbcc 
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc.orig/config/rs6000/rs6000.c
+++ gcc/config/rs6000/rs6000.c
@@ -20277,7 +20277,7 @@  rs6000_make_savres_rtx (rs6000_stack_t *
   p = rtvec_alloc ((lr ? 4 : 3) + n_regs);
 
   if (!savep && lr)
-    RTVEC_ELT (p, offset++) = gen_rtx_RETURN (VOIDmode);
+    RTVEC_ELT (p, offset++) = ret_rtx;
 
   RTVEC_ELT (p, offset++)
     = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 65));
@@ -21269,7 +21269,7 @@  rs6000_emit_epilogue (int sibcall)
       alloc_rname = ggc_strdup (rname);
 
       j = 0;
-      RTVEC_ELT (p, j++) = gen_rtx_RETURN (VOIDmode);
+      RTVEC_ELT (p, j++) = ret_rtx;
       RTVEC_ELT (p, j++) = gen_rtx_USE (VOIDmode,
 					gen_rtx_REG (Pmode,
 						     LR_REGNO));
@@ -21885,7 +21885,7 @@  rs6000_emit_epilogue (int sibcall)
       else
 	p = rtvec_alloc (2);
 
-      RTVEC_ELT (p, 0) = gen_rtx_RETURN (VOIDmode);
+      RTVEC_ELT (p, 0) = ret_rtx;
       RTVEC_ELT (p, 1) = ((restoring_FPRs_inline || !lr)
 			  ? gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, 65))
 			  : gen_rtx_CLOBBER (VOIDmode,
@@ -22323,7 +22323,7 @@  rs6000_output_mi_thunk (FILE *file, tree
 			gen_rtx_USE (VOIDmode,
 				     gen_rtx_REG (SImode,
 						  LR_REGNO)),
-			gen_rtx_RETURN (VOIDmode))));
+			ret_rtx)));
   SIBLING_CALL_P (insn) = 1;
   emit_barrier ();
 
Index: gcc/config/picochip/picochip.c
===================================================================
--- gcc.orig/config/picochip/picochip.c
+++ gcc/config/picochip/picochip.c
@@ -2273,7 +2273,7 @@  picochip_expand_epilogue (int is_sibling
     rtvec p;
     p = rtvec_alloc (2);
 
-    RTVEC_ELT (p, 0) = gen_rtx_RETURN (VOIDmode);
+    RTVEC_ELT (p, 0) = ret_rtx;
     RTVEC_ELT (p, 1) = gen_rtx_USE (VOIDmode,
 				    gen_rtx_REG (Pmode, LINK_REGNUM));
     emit_jump_insn (gen_rtx_PARALLEL (VOIDmode, p));
Index: gcc/config/h8300/h8300.c
===================================================================
--- gcc.orig/config/h8300/h8300.c
+++ gcc/config/h8300/h8300.c
@@ -702,7 +702,7 @@  h8300_push_pop (int regno, int nregs, bo
   /* Add the return instruction.  */
   if (return_p)
     {
-      RTVEC_ELT (vec, i) = gen_rtx_RETURN (VOIDmode);
+      RTVEC_ELT (vec, i) = ret_rtx;
       i++;
     }
 
@@ -986,7 +986,7 @@  h8300_expand_epilogue (void)
     }
 
   if (!returned_p)
-    emit_jump_insn (gen_rtx_RETURN (VOIDmode));
+    emit_jump_insn (ret_rtx);
 }
 
 /* Return nonzero if the current function is an interrupt
Index: gcc/config/v850/v850.c
===================================================================
--- gcc.orig/config/v850/v850.c
+++ gcc/config/v850/v850.c
@@ -1886,7 +1886,7 @@  expand_epilogue (void)
 	  int offset;
 	  restore_all = gen_rtx_PARALLEL (VOIDmode,
 					  rtvec_alloc (num_restore + 2));
-	  XVECEXP (restore_all, 0, 0) = gen_rtx_RETURN (VOIDmode);
+	  XVECEXP (restore_all, 0, 0) = ret_rtx;
 	  XVECEXP (restore_all, 0, 1)
 	    = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
 			    gen_rtx_PLUS (Pmode,
Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc.orig/config/bfin/bfin.c
+++ gcc/config/bfin/bfin.c
@@ -2347,7 +2347,7 @@  bfin_expand_call (rtx retval, rtx fnaddr
     XVECEXP (pat, 0, n++) = gen_rtx_USE (VOIDmode, picreg);
   XVECEXP (pat, 0, n++) = gen_rtx_USE (VOIDmode, cookie);
   if (sibcall)
-    XVECEXP (pat, 0, n++) = gen_rtx_RETURN (VOIDmode);
+    XVECEXP (pat, 0, n++) = ret_rtx;
   else
     XVECEXP (pat, 0, n++) = gen_rtx_CLOBBER (VOIDmode, retsreg);
   call = emit_call_insn (pat);
Index: gcc/config/arm/arm.md
===================================================================
--- gcc.orig/config/arm/arm.md
+++ gcc/config/arm/arm.md
@@ -9970,9 +9970,7 @@ 
       DONE;
     }
   emit_jump_insn (gen_rtx_UNSPEC_VOLATILE (VOIDmode,
-	gen_rtvec (1,
-		gen_rtx_RETURN (VOIDmode)),
-	VUNSPEC_EPILOGUE));
+	gen_rtvec (1, ret_rtx), VUNSPEC_EPILOGUE));
   DONE;
   "
 )
Index: gcc/jump.c
===================================================================
--- gcc.orig/jump.c
+++ gcc/jump.c
@@ -1349,7 +1349,7 @@  redirect_exp_1 (rtx *loc, rtx olabel, rt
 	  if (nlabel)
 	    n = gen_rtx_LABEL_REF (Pmode, nlabel);
 	  else
-	    n = gen_rtx_RETURN (VOIDmode);
+	    n = ret_rtx;
 
 	  validate_change (insn, loc, n, 1);
 	  return;
@@ -1360,7 +1360,7 @@  redirect_exp_1 (rtx *loc, rtx olabel, rt
       if (nlabel)
 	x = gen_rtx_LABEL_REF (Pmode, nlabel);
       else
-	x = gen_rtx_RETURN (VOIDmode);
+	x = ret_rtx;
       if (loc == &PATTERN (insn))
 	x = gen_rtx_SET (VOIDmode, pc_rtx, x);
       validate_change (insn, loc, x, 1);
@@ -1371,7 +1371,7 @@  redirect_exp_1 (rtx *loc, rtx olabel, rt
       && GET_CODE (SET_SRC (x)) == LABEL_REF
       && XEXP (SET_SRC (x), 0) == olabel)
     {
-      validate_change (insn, loc, gen_rtx_RETURN (VOIDmode), 1);
+      validate_change (insn, loc, ret_rtx, 1);
       return;
     }