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]

[named-addr-space] Remove memory_address_addr_space_p


This is the cleanup patch to eliminate memory_address_addr_space_p
and simply call the hook directly.

2009-06-07  Paolo Bonzini  <bonzini@gnu.org>

	* recog.c (memory_address_addr_space_p): Delete.
	* recog.h (memory_address_addr_space_p,
	strict_memory_address_addr_space_p): Delete.
	* explow.c (memory_address_addr_space, validize_mem): Use
	hook directly.
	* emit-rtl.c (change_address_1, adjust_address_1,
	offset_address): Likewise.
	* expr.h (emit_move_insn, expand_expr_real_1): Likewise.
	

Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c	(branch nas-cleanup)
+++ gcc/emit-rtl.c	(working copy)
@@ -1961,13 +1961,13 @@ change_address_1 (rtx memref, enum machi
   if (addr == 0)
     addr = XEXP (memref, 0);
   if (mode == GET_MODE (memref) && addr == XEXP (memref, 0)
-      && (!validate || memory_address_addr_space_p (mode, addr, as)))
+      && (!validate || targetm.legitimate_address_p (mode, addr, 0, as)))
     return memref;
 
   if (validate)
     {
       if (reload_in_progress || reload_completed)
-	gcc_assert (memory_address_addr_space_p (mode, addr, as));
+	gcc_assert (targetm.legitimate_address_p (mode, addr, 0, as));
       else
 	addr = memory_address_addr_space (mode, addr, as);
     }
@@ -2057,7 +2057,7 @@ adjust_address_1 (rtx memref, enum machi
 
   /* If there are no changes, just return the original memory reference.  */
   if (mode == GET_MODE (memref) && !offset
-      && (!validate || memory_address_addr_space_p (mode, addr, as)))
+      && (!validate || targetm.legitimate_address_p (mode, addr, 0, as)))
     return memref;
 
   /* ??? Prefer to create garbage instead of creating shared rtl.
@@ -2160,7 +2160,7 @@ offset_address (rtx memref, rtx offset, 
      being able to recognize the magic around pic_offset_table_rtx.
      This stuff is fragile, and is yet another example of why it is
      bad to expose PIC machinery too early.  */
-  if (! memory_address_addr_space_p (GET_MODE (memref), new_rtx, as)
+  if (! targetm.legitimate_address_p (GET_MODE (memref), new_rtx, 0, as)
       && GET_CODE (addr) == PLUS
       && XEXP (addr, 0) == pic_offset_table_rtx)
     {
Index: gcc/explow.c
===================================================================
--- gcc/explow.c	(branch nas-cleanup)
+++ gcc/explow.c	(working copy)
@@ -435,12 +435,12 @@ memory_address_addr_space (enum machine_
 	x = break_out_memory_refs (x);
 
       /* At this point, any valid address is accepted.  */
-      if (memory_address_addr_space_p (mode, x, as))
+      if (targetm.legitimate_address_p (mode, x, 0, as))
 	goto done;
 
       /* If it was valid before but breaking out memory refs invalidated it,
 	 use it the old way.  */
-      if (memory_address_addr_space_p (mode, oldx, as))
+      if (targetm.legitimate_address_p (mode, oldx, 0, as))
 	{
 	  x = oldx;
 	  goto done;
@@ -452,7 +452,7 @@ memory_address_addr_space (enum machine_
 	 transformations can make better code.  */
       x = targetm.legitimize_address (x, oldx, mode, as);
 
-      if (oldx != x && memory_address_addr_space_p (mode, x, as))
+      if (oldx != x && targetm.legitimate_address_p (mode, x, 0, as))
 	goto done;
 
       /* PLUS and MULT can appear in special ways
@@ -469,12 +469,12 @@ memory_address_addr_space (enum machine_
 	  rtx constant_term = const0_rtx;
 	  rtx y = eliminate_constant_term (x, &constant_term);
 	  if (constant_term == const0_rtx
-	      || ! memory_address_addr_space_p (mode, y, as))
+	      || ! targetm.legitimate_address_p (mode, y, 0, as))
 	    x = force_operand (x, NULL_RTX);
 	  else
 	    {
 	      y = gen_rtx_PLUS (GET_MODE (x), copy_to_reg (y), constant_term);
-	      if (! memory_address_addr_space_p (mode, y, as))
+	      if (! targetm.legitimate_address_p (mode, y, 0, as))
 		x = force_operand (x, NULL_RTX);
 	      else
 		x = y;
@@ -496,7 +496,7 @@ memory_address_addr_space (enum machine_
 
  done:
 
-  gcc_assert (memory_address_addr_space_p (mode, x, as));
+  gcc_assert (targetm.legitimate_address_p (mode, x, 0, as));
   /* If we didn't change the address, we are done.  Otherwise, mark
      a reg as a pointer if we have REG or REG + CONST_INT.  */
   if (oldx == x)
@@ -531,7 +531,7 @@ validize_mem (rtx ref)
   mode = GET_MODE (ref);
   mem = XEXP (ref, 0);
   as = MEM_ADDR_SPACE (ref);
-  if (memory_address_addr_space_p (mode, mem, as))
+  if (targetm.legitimate_address_p (mode, mem, 0, as))
     return ref;
 
   /* Don't alter REF itself, since that is probably a stack slot.  */
Index: gcc/recog.c
===================================================================
--- gcc/recog.c	(branch nas-cleanup)
+++ gcc/recog.c	(working copy)
@@ -1248,7 +1248,9 @@ pop_operand (rtx op, enum machine_mode m
   return XEXP (op, 0) == stack_pointer_rtx;
 }
 
-/* Return 1 if ADDR is a valid memory address for mode MODE.  */
+/* Invoke targetm.legitimate_address_p for the generic address space.
+   This function is also the body of the implementation when the old
+   GO_IF_LEGITIMATE_ADDRESS macro is used.  */
 
 int
 memory_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx addr)
@@ -1264,14 +1266,6 @@ memory_address_p (enum machine_mode mode
 #endif
 }
 
-/* Like memory_address_p, expect for a distinct named address space.  */
-
-int
-memory_address_addr_space_p (enum machine_mode mode, rtx addr, addr_space_t as)
-{
-  return targetm.legitimate_address_p (mode, addr, 0, as);
-}
-
 /* Return 1 if OP is a valid memory reference with mode MODE,
    including a valid address.
 
Index: gcc/recog.h
===================================================================
--- gcc/recog.h	(branch nas-cleanup)
+++ gcc/recog.h	(working copy)
@@ -85,10 +85,7 @@ extern void cancel_changes (int);
 extern int constrain_operands (int);
 extern int constrain_operands_cached (int);
 extern int memory_address_p (enum machine_mode, rtx);
-extern int memory_address_addr_space_p (enum machine_mode, rtx, addr_space_t);
 extern int strict_memory_address_p (enum machine_mode, rtx);
-extern int strict_memory_address_addr_space_p (enum machine_mode, rtx,
-					       addr_space_t);
 extern int validate_replace_rtx (rtx, rtx, rtx);
 extern int validate_replace_rtx_part (rtx, rtx, rtx *, rtx);
 extern int validate_replace_rtx_part_nosimplify (rtx, rtx, rtx *, rtx);
Index: gcc/expr.c
===================================================================
--- gcc/expr.c	(branch nas-cleanup)
+++ gcc/expr.c	(working copy)
@@ -3432,14 +3432,14 @@ emit_move_insn (rtx x, rtx y)
   /* If X or Y are memory references, verify that their addresses are valid
      for the machine.  */
   if (MEM_P (x)
-      && (! memory_address_addr_space_p (GET_MODE (x), XEXP (x, 0),
-					 MEM_ADDR_SPACE (x))
+      && (! targetm.legitimate_address_p (GET_MODE (x), XEXP (x, 0),
+					  0, MEM_ADDR_SPACE (x))
 	  && ! push_operand (x, GET_MODE (x))))
     x = validize_mem (x);
 
   if (MEM_P (y)
-      && ! memory_address_addr_space_p (GET_MODE (y), XEXP (y, 0),
-					MEM_ADDR_SPACE (y)))
+      && ! targetm.legitimate_address_p (GET_MODE (y), XEXP (y, 0),
+					 0, MEM_ADDR_SPACE (y)))
     y = validize_mem (y);
 
   gcc_assert (mode != BLKmode);
@@ -7344,8 +7344,8 @@ expand_expr_real_1 (tree exp, rtx target
 	  decl_rtl = use_anchored_address (decl_rtl);
 	  if (modifier != EXPAND_CONST_ADDRESS
 	      && modifier != EXPAND_SUM
-	      && !memory_address_addr_space_p (DECL_MODE (exp),
-					       XEXP (decl_rtl, 0),
+	      && !targetm.legitimate_address_p (DECL_MODE (exp),
+					       XEXP (decl_rtl, 0), 0,
 					       MEM_ADDR_SPACE (decl_rtl)))
 	    temp = replace_equiv_address (decl_rtl,
 					  copy_rtx (XEXP (decl_rtl, 0)));
@@ -7468,8 +7468,8 @@ expand_expr_real_1 (tree exp, rtx target
       if (modifier != EXPAND_CONST_ADDRESS
 	  && modifier != EXPAND_INITIALIZER
 	  && modifier != EXPAND_SUM
-	  && ! memory_address_addr_space_p (mode, XEXP (temp, 0),
-					    MEM_ADDR_SPACE (temp)))
+	  && ! targetm.legitimate_address_p (mode, XEXP (temp, 0), 0,
+					     MEM_ADDR_SPACE (temp)))
 	return replace_equiv_address (temp,
 				      copy_rtx (XEXP (temp, 0)));
       return temp;


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