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]

PING: [PATCH] Add SUBREG_REG_P predicate and change REG_SUBREG_P to be global


The previous patch is at http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01173.html

The updated patch is fixed to follow the GNU coding conventions and against current trunk.

It is retested on i686-pc-linux-gnu with no regressions.

Pearly
2009-06-16  Shujing Zhao  <pearly.zhao@oracle.com>

	* ira-conflicts.c (REG_SUBREG_P): Move ...
	* rtl.h: ... to here.
	  (SUBREG_REG_P): New predicate.
	* caller-save.c: Use REG_SUBREG_P and SUBREG_REG_P where applicable.
	* calls.c: Ditto.
	* combine.c: Ditto.
	* cse.c: Ditto.
	* function.c: Ditto.
	* fwprop.c: Ditto.
	* ifcvt.c: Ditto.
	* jump.c: Ditto.
	* loop-unroll.c: Ditto.
	* mode-switching.c: Ditto.
	* reg-stack.c: Ditto.
	* reload1.c: Ditto.
	* reload.c: Ditto.
	* resource.c: Ditto.
	* rtlanal.c: Ditto.
	* simplify-rtx.c: Ditto.

Index: caller-save.c
===================================================================
--- caller-save.c	(revision 148829)
+++ caller-save.c	(working copy)
@@ -921,8 +921,7 @@ add_stored_regs (rtx reg, const_rtx sett
   if (GET_CODE (setter) == CLOBBER)
     return;
 
-  if (GET_CODE (reg) == SUBREG
-      && REG_P (SUBREG_REG (reg))
+  if (SUBREG_REG_P (reg)
       && REGNO (SUBREG_REG (reg)) < FIRST_PSEUDO_REGISTER)
     {
       offset = subreg_regno_offset (REGNO (SUBREG_REG (reg)),
@@ -961,7 +960,7 @@ mark_referenced_regs (rtx x)
       code = GET_CODE (x);
       if ((code == REG && REGNO (x) < FIRST_PSEUDO_REGISTER)
 	  || code == PC || code == CC0
-	  || (code == SUBREG && REG_P (SUBREG_REG (x))
+	  || (SUBREG_REG_P (x)
 	      && REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER
 	      /* If we're setting only part of a multi-word register,
 		 we shall mark it as referenced, because the words
Index: calls.c
===================================================================
--- calls.c	(revision 148829)
+++ calls.c	(working copy)
@@ -713,9 +713,7 @@ precompute_register_parameters (int num_
 	   register parameters.  This is to avoid reload conflicts while
 	   loading the parameters registers.  */
 
-	else if ((! (REG_P (args[i].value)
-		     || (GET_CODE (args[i].value) == SUBREG
-			 && REG_P (SUBREG_REG (args[i].value)))))
+	else if (!REG_SUBREG_P (args[i].value)
 		 && args[i].mode != BLKmode
 		 && rtx_cost (args[i].value, SET, optimize_insn_for_speed_p ())
 		    > COSTS_N_INSNS (1)
Index: combine.c
===================================================================
--- combine.c	(revision 148829)
+++ combine.c	(working copy)
@@ -525,8 +525,7 @@ find_single_use_1 (rtx dest, rtx *loc)
       if (GET_CODE (SET_DEST (x)) != CC0
 	  && GET_CODE (SET_DEST (x)) != PC
 	  && !REG_P (SET_DEST (x))
-	  && ! (GET_CODE (SET_DEST (x)) == SUBREG
-		&& REG_P (SUBREG_REG (SET_DEST (x)))
+	  && !(SUBREG_REG_P (SET_DEST (x))
 		&& (((GET_MODE_SIZE (GET_MODE (SUBREG_REG (SET_DEST (x))))
 		      + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
 		    == ((GET_MODE_SIZE (GET_MODE (SET_DEST (x)))
@@ -4871,9 +4870,7 @@ combine_simplify_rtx (rtx x, enum machin
 	 or a SUBREG of one since we'd be making the expression more
 	 complex if it was just a register.  */
 
-      if (!REG_P (temp)
-	  && ! (GET_CODE (temp) == SUBREG
-		&& REG_P (SUBREG_REG (temp)))
+      if (!REG_SUBREG_P (temp)
 	  && (i = exact_log2 (nonzero_bits (temp, mode))) >= 0)
 	{
 	  rtx temp1 = simplify_shift_const
@@ -4965,9 +4962,7 @@ combine_simplify_rtx (rtx x, enum machin
 	 the bitsize of the mode - 1.  This allows simplification of
 	 "a = (b & 8) == 0;"  */
       if (XEXP (x, 1) == constm1_rtx
-	  && !REG_P (XEXP (x, 0))
-	  && ! (GET_CODE (XEXP (x, 0)) == SUBREG
-		&& REG_P (SUBREG_REG (XEXP (x, 0))))
+	  && !REG_SUBREG_P (XEXP (x, 0))
 	  && nonzero_bits (XEXP (x, 0), mode) == 1)
 	return simplify_shift_const (NULL_RTX, ASHIFTRT, mode,
 	   simplify_shift_const (NULL_RTX, ASHIFT, mode,
@@ -5803,9 +5798,7 @@ simplify_set (rtx x)
 					 GET_MODE (SUBREG_REG (src)),
 					 GET_MODE (src)))
 #endif
-      && (REG_P (dest)
-	  || (GET_CODE (dest) == SUBREG
-	      && REG_P (SUBREG_REG (dest)))))
+      && REG_SUBREG_P (dest))
     {
       SUBST (SET_DEST (x),
 	     gen_lowpart (GET_MODE (SUBREG_REG (src)),
@@ -11625,7 +11618,7 @@ record_truncated_value (rtx *p, void *da
   enum machine_mode truncated_mode;
   reg_stat_type *rsp;
 
-  if (GET_CODE (x) == SUBREG && REG_P (SUBREG_REG (x)))
+  if (SUBREG_REG_P (x))
     {
       enum machine_mode original_mode = GET_MODE (SUBREG_REG (x));
       truncated_mode = GET_MODE (x);
@@ -11675,9 +11668,8 @@ record_truncated_values (rtx *x, void *d
 static void
 check_promoted_subreg (rtx insn, rtx x)
 {
-  if (GET_CODE (x) == SUBREG
-      && SUBREG_PROMOTED_VAR_P (x)
-      && REG_P (SUBREG_REG (x)))
+  if (SUBREG_REG_P (x)
+      && SUBREG_PROMOTED_VAR_P (x))
     record_promoted_value (insn, x);
   else
     {
Index: cse.c
===================================================================
--- cse.c	(revision 148829)
+++ cse.c	(working copy)
@@ -755,8 +755,7 @@ preferable (int cost_a, int regcost_a, i
 static int
 notreg_cost (rtx x, enum rtx_code outer)
 {
-  return ((GET_CODE (x) == SUBREG
-	   && REG_P (SUBREG_REG (x))
+  return ((SUBREG_REG_P (x)
 	   && GET_MODE_CLASS (GET_MODE (x)) == MODE_INT
 	   && GET_MODE_CLASS (GET_MODE (SUBREG_REG (x))) == MODE_INT
 	   && (GET_MODE_SIZE (GET_MODE (x))
@@ -1059,7 +1058,7 @@ mention_regs (rtx x)
   /* If this is a SUBREG, we don't want to discard other SUBREGs of the same
      pseudo if they don't use overlapping words.  We handle only pseudos
      here for simplicity.  */
-  if (code == SUBREG && REG_P (SUBREG_REG (x))
+  if (SUBREG_REG_P (x)
       && REGNO (SUBREG_REG (x)) >= FIRST_PSEUDO_REGISTER)
     {
       unsigned int i = REGNO (SUBREG_REG (x));
@@ -1209,7 +1208,7 @@ insert_regs (rtx x, struct table_elt *cl
      not be accessible because its hash code will have changed.  So assign
      a quantity number now.  */
 
-  else if (GET_CODE (x) == SUBREG && REG_P (SUBREG_REG (x))
+  else if (SUBREG_REG_P (x)
 	   && ! REGNO_QTY_VALID_P (REGNO (SUBREG_REG (x))))
     {
       insert_regs (SUBREG_REG (x), NULL, 0);
@@ -2031,8 +2030,7 @@ remove_invalid_subreg_refs (unsigned int
 	next = p->next_same_hash;
 
 	if (!REG_P (exp)
-	    && (GET_CODE (exp) != SUBREG
-		|| !REG_P (SUBREG_REG (exp))
+	    && (!SUBREG_REG_P (exp)
 		|| REGNO (SUBREG_REG (exp)) != regno
 		|| (((SUBREG_BYTE (exp)
 		      + (GET_MODE_SIZE (GET_MODE (exp)) - 1)) >= offset)
Index: function.c
===================================================================
--- function.c	(revision 148829)
+++ function.c	(working copy)
@@ -2829,9 +2829,8 @@ assign_parm_setup_reg (struct assign_par
       push_to_sequence2 (all->first_conversion_insn, all->last_conversion_insn);
       tempreg = convert_to_mode (data->nominal_mode, tempreg, unsignedp);
 
-      if (GET_CODE (tempreg) == SUBREG
+      if (SUBREG_REG_P (tempreg)
 	  && GET_MODE (tempreg) == data->nominal_mode
-	  && REG_P (SUBREG_REG (tempreg))
 	  && data->nominal_mode == data->passed_mode
 	  && GET_MODE (SUBREG_REG (tempreg)) == GET_MODE (data->entry_parm)
 	  && GET_MODE_SIZE (GET_MODE (tempreg))
Index: fwprop.c
===================================================================
--- fwprop.c	(revision 148829)
+++ fwprop.c	(working copy)
@@ -771,9 +771,7 @@ find_occurrence (rtx *px, rtx find)
 {
   struct find_occurrence_data data;
 
-  gcc_assert (REG_P (find)
-	      || (GET_CODE (find) == SUBREG
-		  && REG_P (SUBREG_REG (find))));
+  gcc_assert (REG_SUBREG_P (find));
 
   data.find = find;
   data.retval = NULL;
@@ -947,8 +945,7 @@ forward_propagate_subreg (df_ref use, rt
      these SUBREGs just say how to treat the register.  */
   use_insn = DF_REF_INSN (use);
   src = SET_SRC (def_set);
-  if (GET_CODE (src) == SUBREG
-      && REG_P (SUBREG_REG (src))
+  if (SUBREG_REG_P (src)
       && GET_MODE (SUBREG_REG (src)) == use_mode
       && subreg_lowpart_p (src)
       && all_uses_available_at (def_insn, use_insn))
Index: ifcvt.c
===================================================================
--- ifcvt.c	(revision 148829)
+++ ifcvt.c	(working copy)
@@ -2506,7 +2506,7 @@ check_cond_move_block (basic_block bb, r
 	 modified earlier in the block.  */
       if ((REG_P (src)
 	   && vals[REGNO (src)] != NULL)
-	  || (GET_CODE (src) == SUBREG && REG_P (SUBREG_REG (src))
+	  || (SUBREG_REG_P (src)
 	      && vals[REGNO (SUBREG_REG (src))] != NULL))
 	return FALSE;
 
Index: ira-conflicts.c
===================================================================
--- ira-conflicts.c	(revision 148829)
+++ ira-conflicts.c	(working copy)
@@ -317,10 +317,6 @@ get_dup (int op_num, bool use_commut_op_
     return recog_data.operand[n];
 }
 
-/* Check that X is REG or SUBREG of REG.  */
-#define REG_SUBREG_P(x)							\
-   (REG_P (x) || (GET_CODE (x) == SUBREG && REG_P (SUBREG_REG (x))))
-
 /* Return X if X is a REG, otherwise it should be SUBREG of REG and
    the function returns the reg in this case.  *OFFSET will be set to
    0 in the first case or the regno offset in the first case.  */
Index: jump.c
===================================================================
--- jump.c	(revision 148829)
+++ jump.c	(working copy)
@@ -1564,9 +1564,7 @@ rtx_renumbered_equal_p (const_rtx x, con
   if (x == y)
     return 1;
 
-  if ((code == REG || (code == SUBREG && REG_P (SUBREG_REG (x))))
-      && (REG_P (y) || (GET_CODE (y) == SUBREG
-				  && REG_P (SUBREG_REG (y)))))
+  if (REG_SUBREG_P (x) && REG_SUBREG_P (y))
     {
       int reg_x = -1, reg_y = -1;
       int byte_x = 0, byte_y = 0;
Index: loop-unroll.c
===================================================================
--- loop-unroll.c	(revision 148829)
+++ loop-unroll.c	(working copy)
@@ -1607,9 +1607,7 @@ analyze_insn_to_expand_var (struct loop 
   op1 = XEXP (src, 0);
   op2 = XEXP (src, 1);
   
-  if (!REG_P (dest)
-      && !(GET_CODE (dest) == SUBREG
-           && REG_P (SUBREG_REG (dest))))
+  if (!REG_SUBREG_P (dest))
     return NULL;
   
   if (rtx_equal_p (dest, op1))
Index: mode-switching.c
===================================================================
--- mode-switching.c	(revision 148829)
+++ mode-switching.c	(working copy)
@@ -319,8 +319,7 @@ create_pre_exit (int n_entities, int *en
 		    copy_reg = SET_DEST (return_copy_pat);
 		    if (GET_CODE (copy_reg) == REG)
 		      copy_start = REGNO (copy_reg);
-		    else if (GET_CODE (copy_reg) == SUBREG
-			     && GET_CODE (SUBREG_REG (copy_reg)) == REG)
+		    else if (SUBREG_REG_P (copy_reg))
 		      copy_start = REGNO (SUBREG_REG (copy_reg));
 		    else
 		      break;
Index: reg-stack.c
===================================================================
--- reg-stack.c	(revision 148829)
+++ reg-stack.c	(working copy)
@@ -493,8 +493,7 @@ check_asm_stack_operands (rtx insn)
 
   /* Strip SUBREGs here to make the following code simpler.  */
   for (i = 0; i < recog_data.n_operands; i++)
-    if (GET_CODE (recog_data.operand[i]) == SUBREG
-	&& REG_P (SUBREG_REG (recog_data.operand[i])))
+    if (SUBREG_REG_P (recog_data.operand[i]))
       recog_data.operand[i] = SUBREG_REG (recog_data.operand[i]);
 
   /* Set up CLOBBER_REG.  */
@@ -511,7 +510,7 @@ check_asm_stack_operands (rtx insn)
 	    rtx clobber = XVECEXP (body, 0, i);
 	    rtx reg = XEXP (clobber, 0);
 
-	    if (GET_CODE (reg) == SUBREG && REG_P (SUBREG_REG (reg)))
+	    if (SUBREG_REG_P (reg))
 	      reg = SUBREG_REG (reg);
 
 	    if (STACK_REG_P (reg))
@@ -2014,8 +2013,7 @@ subst_asm_stack_regs (rtx insn, stack re
 
   /* Strip SUBREGs here to make the following code simpler.  */
   for (i = 0; i < recog_data.n_operands; i++)
-    if (GET_CODE (recog_data.operand[i]) == SUBREG
-	&& REG_P (SUBREG_REG (recog_data.operand[i])))
+    if (SUBREG_REG_P (recog_data.operand[i]))
       {
 	recog_data.operand_loc[i] = & SUBREG_REG (recog_data.operand[i]);
 	recog_data.operand[i] = SUBREG_REG (recog_data.operand[i]);
@@ -2036,7 +2034,7 @@ subst_asm_stack_regs (rtx insn, stack re
       rtx reg = XEXP (note, 0);
       rtx *loc = & XEXP (note, 0);
 
-      if (GET_CODE (reg) == SUBREG && REG_P (SUBREG_REG (reg)))
+      if (SUBREG_REG_P (reg))
 	{
 	  loc = & SUBREG_REG (reg);
 	  reg = SUBREG_REG (reg);
@@ -2069,7 +2067,7 @@ subst_asm_stack_regs (rtx insn, stack re
 	    rtx reg = XEXP (clobber, 0);
 	    rtx *loc = & XEXP (clobber, 0);
 
-	    if (GET_CODE (reg) == SUBREG && REG_P (SUBREG_REG (reg)))
+	    if (SUBREG_REG_P (reg))
 	      {
 		loc = & SUBREG_REG (reg);
 		reg = SUBREG_REG (reg);
Index: reload1.c
===================================================================
--- reload1.c	(revision 148829)
+++ reload1.c	(working copy)
@@ -6011,8 +6011,7 @@ choose_reload_regs (struct insn_chain *c
 		  regno = REGNO (rld[r].in_reg);
 		  mode = GET_MODE (rld[r].in_reg);
 		}
-	      else if (GET_CODE (rld[r].in_reg) == SUBREG
-		       && REG_P (SUBREG_REG (rld[r].in_reg)))
+	      else if (SUBREG_REG_P (rld[r].in_reg))
 		{
 		  regno = REGNO (SUBREG_REG (rld[r].in_reg));
 		  if (regno < FIRST_PSEUDO_REGISTER)
@@ -7225,8 +7224,7 @@ emit_input_reload_insns (struct insn_cha
 	   && REGNO (oldequiv) >= FIRST_PSEUDO_REGISTER
 	   && (reg_equiv_memory_loc[REGNO (oldequiv)] != 0
 	       || reg_equiv_constant[REGNO (oldequiv)] != 0))
-	  || (GET_CODE (oldequiv) == SUBREG
-	      && REG_P (SUBREG_REG (oldequiv))
+	  || (SUBREG_REG_P (oldequiv)
 	      && (REGNO (SUBREG_REG (oldequiv))
 		  >= FIRST_PSEUDO_REGISTER)
 	      && ((reg_equiv_memory_loc
@@ -7641,8 +7639,7 @@ do_output_reload (struct insn_chain *cha
       return;
     }
   /* Likewise for a SUBREG of an operand that dies.  */
-  else if (GET_CODE (old) == SUBREG
-	   && REG_P (SUBREG_REG (old))
+  else if (SUBREG_REG_P (old)
 	   && 0 != (note = find_reg_note (insn, REG_UNUSED,
 					  SUBREG_REG (old))))
     {
@@ -8288,11 +8285,9 @@ gen_reload (rtx out, rtx in, int opnum, 
 
 #ifdef SECONDARY_MEMORY_NEEDED
   /* If we need a memory location to do the move, do it that way.  */
-  else if ((REG_P (in)
-            || (GET_CODE (in) == SUBREG && REG_P (SUBREG_REG (in))))
+  else if (REG_SUBREG_P (in)
 	   && reg_or_subregno (in) < FIRST_PSEUDO_REGISTER
-	   && (REG_P (out)
-	       || (GET_CODE (out) == SUBREG && REG_P (SUBREG_REG (out))))
+	   && REG_SUBREG_P (out)
 	   && reg_or_subregno (out) < FIRST_PSEUDO_REGISTER
 	   && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (reg_or_subregno (in)),
 				       REGNO_REG_CLASS (reg_or_subregno (out)),
Index: reload.c
===================================================================
--- reload.c	(revision 148829)
+++ reload.c	(working copy)
@@ -1197,14 +1197,13 @@ push_reload (rtx in, rtx out, rtx *inloc
   /* If IN is a SUBREG of a hard register, make a new REG.  This
      simplifies some of the cases below.  */
 
-  if (in != 0 && GET_CODE (in) == SUBREG && REG_P (SUBREG_REG (in))
+  if (in != 0 && SUBREG_REG_P (in)
       && REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER
       && ! dont_remove_subreg)
     in = gen_rtx_REG (GET_MODE (in), subreg_regno (in));
 
   /* Similarly for OUT.  */
-  if (out != 0 && GET_CODE (out) == SUBREG
-      && REG_P (SUBREG_REG (out))
+  if (out != 0 && SUBREG_REG_P (out)
       && REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER
       && ! dont_remove_subreg)
     out = gen_rtx_REG (GET_MODE (out), subreg_regno (out));
@@ -1317,8 +1316,7 @@ push_reload (rtx in, rtx out, rtx *inloc
 #ifdef SECONDARY_MEMORY_NEEDED
       /* If a memory location is needed for the copy, make one.  */
       if (in != 0
-	  && (REG_P (in)
-	      || (GET_CODE (in) == SUBREG && REG_P (SUBREG_REG (in))))
+	  && REG_SUBREG_P (in)
 	  && reg_or_subregno (in) < FIRST_PSEUDO_REGISTER
 	  && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (reg_or_subregno (in)),
 				      rclass, inmode))
@@ -1349,8 +1347,7 @@ push_reload (rtx in, rtx out, rtx *inloc
 
 #ifdef SECONDARY_MEMORY_NEEDED
       if (out != 0
-          && (REG_P (out)
-	      || (GET_CODE (out) == SUBREG && REG_P (SUBREG_REG (out))))
+          && REG_SUBREG_P (out)
 	  && reg_or_subregno (out) < FIRST_PSEUDO_REGISTER
 	  && SECONDARY_MEMORY_NEEDED (rclass,
 				      REGNO_REG_CLASS (reg_or_subregno (out)),
@@ -2171,9 +2168,7 @@ operands_match_p (rtx x, rtx y)
 
   if (x == y)
     return 1;
-  if ((code == REG || (code == SUBREG && REG_P (SUBREG_REG (x))))
-      && (REG_P (y) || (GET_CODE (y) == SUBREG
-				  && REG_P (SUBREG_REG (y)))))
+  if (REG_SUBREG_P (x) && REG_SUBREG_P (y))
     {
       int j;
 
@@ -4676,7 +4671,7 @@ find_reloads_toplev (rtx x, int opnum, e
       return tem;
     }
 
-  if (code == SUBREG && REG_P (SUBREG_REG (x)))
+  if (SUBREG_REG_P (x))
     {
       /* Check for SUBREG containing a REG that's equivalent to a
 	 constant.  If the constant has a known value, truncate it
@@ -6471,9 +6466,8 @@ refers_to_regno_for_reload_p (unsigned i
 	  /* Note setting a SUBREG counts as referring to the REG it is in for
 	     a pseudo but not for hard registers since we can
 	     treat each word individually.  */
-	  && ((GET_CODE (SET_DEST (x)) == SUBREG
+	  && ((SUBREG_REG_P (SET_DEST (x))
 	       && loc != &SUBREG_REG (SET_DEST (x))
-	       && REG_P (SUBREG_REG (SET_DEST (x)))
 	       && REGNO (SUBREG_REG (SET_DEST (x))) >= FIRST_PSEUDO_REGISTER
 	       && refers_to_regno_for_reload_p (regno, endregno,
 						SUBREG_REG (SET_DEST (x)),
Index: resource.c
===================================================================
--- resource.c	(revision 148829)
+++ resource.c	(working copy)
@@ -94,8 +94,7 @@ update_live_status (rtx dest, const_rtx 
   int first_regno, last_regno;
   int i;
 
-  if (!REG_P (dest)
-      && (GET_CODE (dest) != SUBREG || !REG_P (SUBREG_REG (dest))))
+  if (!REG_SUBREG_P(dest))
     return;
 
   if (GET_CODE (dest) == SUBREG)
Index: rtlanal.c
===================================================================
--- rtlanal.c	(revision 148829)
+++ rtlanal.c	(working copy)
@@ -769,8 +769,7 @@ reg_referenced_p (const_rtx x, const_rtx
       if (GET_CODE (SET_DEST (body)) != CC0
 	  && GET_CODE (SET_DEST (body)) != PC
 	  && !REG_P (SET_DEST (body))
-	  && ! (GET_CODE (SET_DEST (body)) == SUBREG
-		&& REG_P (SUBREG_REG (SET_DEST (body)))
+	  && !(SUBREG_REG_P (SET_DEST (body))
 		&& (((GET_MODE_SIZE (GET_MODE (SUBREG_REG (SET_DEST (body))))
 		      + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
 		    == ((GET_MODE_SIZE (GET_MODE (SET_DEST (body)))
@@ -1281,9 +1280,8 @@ refers_to_regno_p (unsigned int regno, u
 	  /* Note setting a SUBREG counts as referring to the REG it is in for
 	     a pseudo but not for hard registers since we can
 	     treat each word individually.  */
-	  && ((GET_CODE (SET_DEST (x)) == SUBREG
+	  && ((SUBREG_REG_P (SET_DEST (x))
 	       && loc != &SUBREG_REG (SET_DEST (x))
-	       && REG_P (SUBREG_REG (SET_DEST (x)))
 	       && REGNO (SUBREG_REG (SET_DEST (x))) >= FIRST_PSEUDO_REGISTER
 	       && refers_to_regno_p (regno, endregno,
 				     SUBREG_REG (SET_DEST (x)), loc))
Index: rtl.h
===================================================================
--- rtl.h	(revision 148829)
+++ rtl.h	(working copy)
@@ -395,6 +395,14 @@ struct GTY(()) rtvec_def {
 /* Predicate yielding nonzero iff X is a barrier insn.  */
 #define BARRIER_P(X) (GET_CODE (X) == BARRIER)
 
+/* Predicate yielding nonzero iff X is a subreg of a register.  */
+#define SUBREG_REG_P(X) \
+  (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)))
+
+/* Predicate yielding nonzero iff X is a register or subreg of a register.  */
+#define REG_SUBREG_P(X) \
+   (REG_P (X) || SUBREG_REG_P(X))
+
 /* Predicate yielding nonzero iff X is a data for a jump table.  */
 #define JUMP_TABLE_DATA_P(INSN) \
   (JUMP_P (INSN) && (GET_CODE (PATTERN (INSN)) == ADDR_VEC || \
Index: simplify-rtx.c
===================================================================
--- simplify-rtx.c	(revision 148829)
+++ simplify-rtx.c	(working copy)
@@ -866,8 +866,7 @@ simplify_unary_operation_1 (enum rtx_cod
       if (! POINTERS_EXTEND_UNSIGNED
 	  && mode == Pmode && GET_MODE (op) == ptr_mode
 	  && (CONSTANT_P (op)
-	      || (GET_CODE (op) == SUBREG
-		  && REG_P (SUBREG_REG (op))
+	      || (SUBREG_REG_P(op)
 		  && REG_POINTER (SUBREG_REG (op))
 		  && GET_MODE (SUBREG_REG (op)) == Pmode)))
 	return convert_memory_address (Pmode, op);
@@ -888,8 +887,7 @@ simplify_unary_operation_1 (enum rtx_cod
       if (POINTERS_EXTEND_UNSIGNED > 0
 	  && mode == Pmode && GET_MODE (op) == ptr_mode
 	  && (CONSTANT_P (op)
-	      || (GET_CODE (op) == SUBREG
-		  && REG_P (SUBREG_REG (op))
+	      || (SUBREG_REG_P(op)
 		  && REG_POINTER (SUBREG_REG (op))
 		  && GET_MODE (SUBREG_REG (op)) == Pmode)))
 	return convert_memory_address (Pmode, op);

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