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]

cleanup after mem_readonly_p


In doing the transformation, I noticed that with few exceptions,
most places that set MEM_READONLY_P forgot that MEM_NOTRAP_P is
also a good thing to set.

Corrected by creating a helper function to do both.


r~


        * emit-rtl.c (gen_const_mem): New.
        * rtl.h (gen_const_mem): Declare.
        * expr.c (do_tablejump): Use it.
        * varasm.c (force_const_mem): Likewise.
        * config/darwin.c (machopic_indirect_data_reference): Likewise.
        (machopic_legitimize_pic_address): Likewise.
        * config/arm/arm.c (legitimize_pic_address): Likewise.
        * config/i386/i386.c (legitimize_pic_address): Likewise.
        (legitimize_tls_address): Likewise.
        * config/ia64/ia64.c (ia64_expand_tls_address): Likewise.
        * config/ia64/ia64.md (load_fptr): Likewise.
        * config/m32r/m32r.c (m32r_legitimize_pic_address): Likewise.
        * config/pa/pa.c (legitimize_pic_address): Likewise.
        * config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Likewise.
        (rs6000_emit_move): Likewise.
        * config/s390/s390.c (legitimize_pic_address): Likewise.
        (legitimize_tls_address): Likewise.
        * config/s390/s390.md (casesi): Likewise.
        * config/sh/sh.c (sh_reorg): Likewise.
        * config/sparc/sparc.c (legitimize_pic_address): Likewise.
        * config/v850/v850.md (casesi): Likewise.
                                                                                
        * config/darwin.c (machopic_indirect_call_target): Set MEM_NOTRAP_P.
        * config/sh/sh.c (prepare_move_operands): Remove incorrect
        use of MEM_READONLY_P.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.409
diff -c -p -d -u -r1.409 emit-rtl.c
--- emit-rtl.c	18 Aug 2004 08:23:41 -0000	1.409
+++ emit-rtl.c	18 Aug 2004 21:00:13 -0000
@@ -607,6 +607,17 @@ gen_rtx_MEM (enum machine_mode mode, rtx
   return rt;
 }
 
+/* Generate a memory referring to non-trapping constant memory.  */
+
+rtx
+gen_const_mem (enum machine_mode mode, rtx addr)
+{
+  rtx mem = gen_rtx_MEM (mode, addr);
+  MEM_READONLY_P (mem) = 1;
+  MEM_NOTRAP_P (mem) = 1;
+  return mem;
+}
+
 rtx
 gen_rtx_SUBREG (enum machine_mode mode, rtx reg, int offset)
 {
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.706
diff -c -p -d -u -r1.706 expr.c
--- expr.c	18 Aug 2004 08:23:43 -0000	1.706
+++ expr.c	18 Aug 2004 21:00:13 -0000
@@ -8737,9 +8737,7 @@ do_tablejump (rtx index, enum machine_mo
 #endif
     index = memory_address_noforce (CASE_VECTOR_MODE, index);
   temp = gen_reg_rtx (CASE_VECTOR_MODE);
-  vector = gen_rtx_MEM (CASE_VECTOR_MODE, index);
-  MEM_READONLY_P (vector) = 1;
-  MEM_NOTRAP_P (vector) = 1;
+  vector = gen_const_mem (CASE_VECTOR_MODE, index);
   convert_move (temp, vector, 0);
 
   emit_jump_insn (gen_tablejump (temp, table_label));
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.502
diff -c -p -d -u -r1.502 rtl.h
--- rtl.h	18 Aug 2004 08:24:11 -0000	1.502
+++ rtl.h	18 Aug 2004 21:00:13 -0000
@@ -2193,6 +2193,7 @@ extern rtx unlink_insn_chain (rtx, rtx);
 extern rtx delete_insn_and_edges (rtx);
 extern void delete_insn_chain_and_edges (rtx, rtx);
 extern rtx gen_lowpart_SUBREG (enum machine_mode, rtx);
+extern rtx gen_const_mem (enum machine_mode, rtx);
 
 /* In combine.c */
 extern int combine_instructions (rtx, unsigned int);
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.443
diff -c -p -d -u -r1.443 varasm.c
--- varasm.c	18 Aug 2004 16:22:01 -0000	1.443
+++ varasm.c	18 Aug 2004 21:00:13 -0000
@@ -2979,9 +2979,8 @@ force_const_mem (enum machine_mode mode,
   *slot = desc;
 
   /* Construct the MEM.  */
-  desc->mem = def = gen_rtx_MEM (mode, symbol);
+  desc->mem = def = gen_const_mem (mode, symbol);
   set_mem_attributes (def, lang_hooks.types.type_for_mode (mode, 0), 1);
-  MEM_READONLY_P (def) = 1;
 
   /* If we're dropping a label to the constant pool, make sure we
      don't delete it.  */
Index: config/darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.81
diff -c -p -d -u -r1.81 darwin.c
--- config/darwin.c	18 Aug 2004 18:51:36 -0000	1.81
+++ config/darwin.c	18 Aug 2004 21:00:13 -0000
@@ -386,10 +386,9 @@ machopic_indirect_data_reference (rtx or
 		 (Pmode, 
 		  machopic_indirection_name (orig, /*stub_p=*/false)));
 
-     SYMBOL_REF_DECL (ptr_ref) = SYMBOL_REF_DECL (orig);
+      SYMBOL_REF_DECL (ptr_ref) = SYMBOL_REF_DECL (orig);
 
-      ptr_ref = gen_rtx_MEM (Pmode, ptr_ref);
-      MEM_READONLY_P (ptr_ref) = 1;
+      ptr_ref = gen_const_mem (Pmode, ptr_ref);
 
       return ptr_ref;
     }
@@ -474,6 +473,7 @@ machopic_indirect_call_target (rtx targe
       XEXP (target, 0) = gen_rtx_SYMBOL_REF (mode, stub_name);
       SYMBOL_REF_DECL (XEXP (target, 0)) = decl;
       MEM_READONLY_P (target) = 1;
+      MEM_NOTRAP_P (target) = 1;
     }
 
   return target;
@@ -536,9 +536,8 @@ machopic_legitimize_pic_address (rtx ori
 	      emit_insn (mode == DImode
 			 ? gen_macho_high_di (temp_reg, asym)
 			 : gen_macho_high (temp_reg, asym));
-	      mem = gen_rtx_MEM (GET_MODE (orig),
-				 gen_rtx_LO_SUM (Pmode, temp_reg, asym));
-	      MEM_READONLY_P (mem) = 1;
+	      mem = gen_const_mem (GET_MODE (orig),
+				   gen_rtx_LO_SUM (Pmode, temp_reg, asym));
 	      emit_insn (gen_rtx_SET (VOIDmode, reg, mem));
 #else
 	      /* Some other CPU -- WriteMe! but right now there are no other platform that can use dynamic-no-pic  */
@@ -568,10 +567,9 @@ machopic_legitimize_pic_address (rtx ori
 
 	      emit_insn (gen_rtx_SET (Pmode, hi_sum_reg, sum));
 
-	      mem = gen_rtx_MEM (GET_MODE (orig),
-				 gen_rtx_LO_SUM (Pmode, 
-						 hi_sum_reg, offset));
-	      MEM_READONLY_P (mem) = 1;
+	      mem = gen_const_mem (GET_MODE (orig),
+				  gen_rtx_LO_SUM (Pmode, 
+						  hi_sum_reg, offset));
 	      insn = emit_insn (gen_rtx_SET (VOIDmode, reg, mem));
 	      REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, pic_ref, 
 						    REG_NOTES (insn));
@@ -618,8 +616,7 @@ machopic_legitimize_pic_address (rtx ori
 
 #if !defined (TARGET_TOC)
 	  emit_move_insn (reg, pic_ref);
-	  pic_ref = gen_rtx_MEM (GET_MODE (orig), reg);
-	  MEM_READONLY_P (pic_ref) = 1;
+	  pic_ref = gen_const_mem (GET_MODE (orig), reg);
 #endif
 	}
       else
Index: config/arm/arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.391
diff -c -p -d -u -r1.391 arm.c
--- config/arm/arm.c	18 Aug 2004 08:24:25 -0000	1.391
+++ config/arm/arm.c	18 Aug 2004 21:00:14 -0000
@@ -2921,10 +2921,9 @@ legitimize_pic_address (rtx orig, enum m
 	pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, address);
       else
 	{
-	  pic_ref = gen_rtx_MEM (Pmode,
-				 gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
-					       address));
-	  MEM_READONLY_P (pic_ref) = 1;
+	  pic_ref = gen_const_mem (Pmode,
+				   gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
+					         address));
 	}
 
       insn = emit_move_insn (reg, pic_ref);
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.712
diff -c -p -d -u -r1.712 i386.c
--- config/i386/i386.c	18 Aug 2004 17:05:06 -0000	1.712
+++ config/i386/i386.c	18 Aug 2004 21:00:15 -0000
@@ -5306,8 +5306,7 @@ legitimize_pic_address (rtx orig, rtx re
 	{
 	  new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTPCREL);
 	  new = gen_rtx_CONST (Pmode, new);
-	  new = gen_rtx_MEM (Pmode, new);
-	  MEM_READONLY_P (new) = 1;
+	  new = gen_const_mem (Pmode, new);
 	  set_mem_alias_set (new, ix86_GOT_alias_set ());
 
 	  if (reg == 0)
@@ -5328,8 +5327,7 @@ legitimize_pic_address (rtx orig, rtx re
 	  new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOT);
 	  new = gen_rtx_CONST (Pmode, new);
 	  new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);
-	  new = gen_rtx_MEM (Pmode, new);
-	  MEM_READONLY_P (new) = 1;
+	  new = gen_const_mem (Pmode, new);
 	  set_mem_alias_set (new, ix86_GOT_alias_set ());
 
 	  if (reg == 0)
@@ -5508,8 +5506,7 @@ legitimize_tls_address (rtx x, enum tls_
       off = gen_rtx_CONST (Pmode, off);
       if (pic)
 	off = gen_rtx_PLUS (Pmode, pic, off);
-      off = gen_rtx_MEM (Pmode, off);
-      MEM_READONLY_P (off) = 1;
+      off = gen_const_mem (Pmode, off);
       set_mem_alias_set (off, ix86_GOT_alias_set ());
 
       if (TARGET_64BIT || TARGET_GNU_TLS)
Index: config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.318
diff -c -p -d -u -r1.318 ia64.c
--- config/ia64/ia64.c	18 Aug 2004 08:24:32 -0000	1.318
+++ config/ia64/ia64.c	18 Aug 2004 21:00:15 -0000
@@ -686,13 +686,11 @@ ia64_expand_tls_address (enum tls_model 
 
       tga_op1 = gen_reg_rtx (Pmode);
       emit_insn (gen_load_ltoff_dtpmod (tga_op1, op1));
-      tga_op1 = gen_rtx_MEM (Pmode, tga_op1);
-      MEM_READONLY_P (tga_op1) = 1;
+      tga_op1 = gen_const_mem (Pmode, tga_op1);
 
       tga_op2 = gen_reg_rtx (Pmode);
       emit_insn (gen_load_ltoff_dtprel (tga_op2, op1));
-      tga_op2 = gen_rtx_MEM (Pmode, tga_op2);
-      MEM_READONLY_P (tga_op2) = 1;
+      tga_op2 = gen_const_mem (Pmode, tga_op2);
 
       tga_ret = emit_library_call_value (gen_tls_get_addr (), NULL_RTX,
 					 LCT_CONST, Pmode, 2, tga_op1,
@@ -715,8 +713,7 @@ ia64_expand_tls_address (enum tls_model 
 
       tga_op1 = gen_reg_rtx (Pmode);
       emit_insn (gen_load_ltoff_dtpmod (tga_op1, op1));
-      tga_op1 = gen_rtx_MEM (Pmode, tga_op1);
-      MEM_READONLY_P (tga_op1) = 1;
+      tga_op1 = gen_const_mem (Pmode, tga_op1);
 
       tga_op2 = const0_rtx;
 
@@ -746,8 +743,7 @@ ia64_expand_tls_address (enum tls_model 
     case TLS_MODEL_INITIAL_EXEC:
       tmp = gen_reg_rtx (Pmode);
       emit_insn (gen_load_ltoff_tprel (tmp, op1));
-      tmp = gen_rtx_MEM (Pmode, tmp);
-      MEM_READONLY_P (tmp) = 1;
+      tmp = gen_const_mem (Pmode, tmp);
       tmp = force_reg (Pmode, tmp);
 
       if (!register_operand (op0, Pmode))
Index: config/ia64/ia64.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.md,v
retrieving revision 1.134
diff -c -p -d -u -r1.134 ia64.md
--- config/ia64/ia64.md	18 Aug 2004 08:24:34 -0000	1.134
+++ config/ia64/ia64.md	18 Aug 2004 21:00:15 -0000
@@ -718,8 +718,7 @@
   ""
 {
   operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
-  operands[3] = gen_rtx_MEM (DImode, operands[2]);
-  MEM_READONLY_P (operands[3]) = 1;
+  operands[3] = gen_const_mem (DImode, operands[2]);
 })
 
 (define_insn "*load_fptr_internal1"
Index: config/m32r/m32r.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.c,v
retrieving revision 1.104
diff -c -p -d -u -r1.104 m32r.c
--- config/m32r/m32r.c	18 Aug 2004 08:24:36 -0000	1.104
+++ config/m32r/m32r.c	18 Aug 2004 21:00:15 -0000
@@ -1993,9 +1993,7 @@ m32r_legitimize_pic_address (rtx orig, r
       emit_insn (gen_pic_load_addr (address, orig));
 
       emit_insn (gen_addsi3 (address, address, pic_offset_table_rtx));
-      pic_ref = gen_rtx_MEM (Pmode, address);
-
-      MEM_READONLY_P (pic_ref) = 1;
+      pic_ref = gen_const_mem (Pmode, address);
       insn = emit_move_insn (reg, pic_ref);
       current_function_uses_pic_offset_table = 1;
 #if 0
Index: config/pa/pa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.c,v
retrieving revision 1.271
diff -c -p -d -u -r1.271 pa.c
--- config/pa/pa.c	18 Aug 2004 08:24:43 -0000	1.271
+++ config/pa/pa.c	18 Aug 2004 21:00:16 -0000
@@ -1013,15 +1013,13 @@ legitimize_pic_address (rtx orig, enum m
 		      gen_rtx_PLUS (word_mode, pic_offset_table_rtx,
 				    gen_rtx_HIGH (word_mode, orig)));
       pic_ref
-	= gen_rtx_MEM (Pmode,
-		       gen_rtx_LO_SUM (Pmode, tmp_reg,
-				       gen_rtx_UNSPEC (Pmode,
-						       gen_rtvec (1, orig),
-						       UNSPEC_DLTIND14R)));
+	= gen_const_mem (Pmode,
+		         gen_rtx_LO_SUM (Pmode, tmp_reg,
+				         gen_rtx_UNSPEC (Pmode,
+						         gen_rtvec (1, orig),
+						         UNSPEC_DLTIND14R)));
 
       current_function_uses_pic_offset_table = 1;
-      MEM_NOTRAP_P (pic_ref) = 1;
-      MEM_READONLY_P (pic_ref) = 1;
       mark_reg_pointer (reg, BITS_PER_UNIT);
       insn = emit_move_insn (reg, pic_ref);
 
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.691
diff -c -p -d -u -r1.691 rs6000.c
--- config/rs6000/rs6000.c	18 Aug 2004 18:51:36 -0000	1.691
+++ config/rs6000/rs6000.c	18 Aug 2004 21:00:16 -0000
@@ -3460,8 +3460,7 @@ rs6000_legitimize_tls_address (rtx addr,
 		  tmp1 = gen_reg_rtx (Pmode);
 		  tmp2 = gen_reg_rtx (Pmode);
 		  tmp3 = gen_reg_rtx (Pmode);
-		  mem = gen_rtx_MEM (Pmode, tmp1);
-		  MEM_READONLY_P (mem) = 1;
+		  mem = gen_const_mem (Pmode, tmp1);
 
 		  first = emit_insn (gen_load_toc_v4_PIC_1b (tempLR, lab,
 							     gsym));
@@ -4418,10 +4417,9 @@ rs6000_emit_move (rtx dest, rtx source, 
 			get_pool_mode (XEXP (operands[1], 0))))
 	    {
 	      operands[1]
-		= gen_rtx_MEM (mode,
-			       create_TOC_reference (XEXP (operands[1], 0)));
+		= gen_const_mem (mode,
+			         create_TOC_reference (XEXP (operands[1], 0)));
 	      set_mem_alias_set (operands[1], get_TOC_alias_set ());
-	      MEM_READONLY_P (operands[1]) = 1;
 	    }
 	}
       break;
Index: config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.168
diff -c -p -d -u -r1.168 s390.c
--- config/s390/s390.c	18 Aug 2004 08:24:51 -0000	1.168
+++ config/s390/s390.c	18 Aug 2004 21:00:17 -0000
@@ -2604,8 +2604,7 @@ legitimize_pic_address (rtx orig, rtx re
           new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOT);
           new = gen_rtx_CONST (Pmode, new);
           new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);
-          new = gen_rtx_MEM (Pmode, new);
-	  MEM_READONLY_P (new) = 1;
+          new = gen_const_mem (Pmode, new);
           emit_move_insn (reg, new);
           new = reg;
         }
@@ -2620,8 +2619,7 @@ legitimize_pic_address (rtx orig, rtx re
           new = gen_rtx_CONST (Pmode, new);
           emit_move_insn (temp, new);
 
-          new = gen_rtx_MEM (Pmode, temp);
-	  MEM_READONLY_P (new) = 1;
+          new = gen_const_mem (Pmode, temp);
           emit_move_insn (reg, new);
           new = reg;
         }
@@ -2641,8 +2639,7 @@ legitimize_pic_address (rtx orig, rtx re
           emit_move_insn (temp, addr);
 
           new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
-          new = gen_rtx_MEM (Pmode, new);
-	  MEM_READONLY_P (new) = 1;
+          new = gen_const_mem (Pmode, new);
           emit_move_insn (reg, new);
           new = reg;
         }
@@ -2932,8 +2929,7 @@ legitimize_tls_address (rtx addr, rtx re
 	    new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTNTPOFF);
 	    new = gen_rtx_CONST (Pmode, new);
 	    new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);
-	    new = gen_rtx_MEM (Pmode, new);
-	    MEM_READONLY_P (new) = 1;
+	    new = gen_const_mem (Pmode, new);
 	    temp = gen_reg_rtx (Pmode);
 	    emit_move_insn (temp, new);
 	  }
@@ -2947,8 +2943,7 @@ legitimize_tls_address (rtx addr, rtx re
 	    temp = gen_reg_rtx (Pmode);
 	    emit_move_insn (temp, new);
 
-	    new = gen_rtx_MEM (Pmode, temp);
-	    MEM_READONLY_P (new) = 1;
+	    new = gen_const_mem (Pmode, temp);
 	    temp = gen_reg_rtx (Pmode);
 	    emit_move_insn (temp, new);
 	  }
@@ -2967,8 +2962,7 @@ legitimize_tls_address (rtx addr, rtx re
 	    emit_move_insn (temp, new);
 
             new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, temp);
-	    new = gen_rtx_MEM (Pmode, new);
-	    MEM_READONLY_P (new) = 1;
+	    new = gen_const_mem (Pmode, new);
 
 	    new = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, new, addr), UNSPEC_TLS_LOAD);
 	    temp = gen_reg_rtx (Pmode);
@@ -2986,9 +2980,7 @@ legitimize_tls_address (rtx addr, rtx re
 	    emit_move_insn (temp, new);
 
 	    new = temp;
-	    new = gen_rtx_MEM (Pmode, new);
-	    MEM_READONLY_P (new) = 1;
-
+	    new = gen_const_mem (Pmode, new);
 	    new = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, new, addr), UNSPEC_TLS_LOAD);
 	    temp = gen_reg_rtx (Pmode);
 	    emit_insn (gen_rtx_SET (Pmode, temp, new));
Index: config/s390/s390.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.md,v
retrieving revision 1.122
diff -c -p -d -u -r1.122 s390.md
--- config/s390/s390.md	18 Aug 2004 08:24:52 -0000	1.122
+++ config/s390/s390.md	18 Aug 2004 21:00:17 -0000
@@ -6840,9 +6840,7 @@
 
    emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
 
-   index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
-   MEM_READONLY_P (index) = 1;
-   MEM_NOTRAP_P (index) = 1;
+   index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
    emit_move_insn (target, index);
 
    if (flag_pic)
Index: config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.292
diff -c -p -d -u -r1.292 sh.c
--- config/sh/sh.c	18 Aug 2004 17:42:54 -0000	1.292
+++ config/sh/sh.c	18 Aug 2004 21:00:17 -0000
@@ -1042,7 +1042,6 @@ prepare_move_operands (rtx operands[], e
 	      emit_insn (gen_load_gbr (tmp2));
 	      tmp = gen_reg_rtx (Pmode);
 	      emit_insn (gen_symTPOFF2reg (tmp, op1));
-	      MEM_READONLY_P (tmp) = 1;
 
 	      if (register_operand (op0, Pmode))
 		op1 = op0;
@@ -4398,9 +4397,8 @@ sh_reorg (void)
 		  else
 		    {
 		      lab = add_constant (src, mode, 0);
-		      newsrc = gen_rtx_MEM (mode,
-					    gen_rtx_LABEL_REF (VOIDmode, lab));
-		      MEM_READONLY_P (newsrc) = 1;
+		      newsrc = gen_rtx_LABEL_REF (VOIDmode, lab);
+		      newsrc = gen_const_mem (mode, newsrc);
 		    }
 		  *patp = gen_rtx_SET (VOIDmode, dst, newsrc);
 		  INSN_CODE (scan) = -1;
Index: config/sparc/sparc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v
retrieving revision 1.328
diff -c -p -d -u -r1.328 sparc.c
--- config/sparc/sparc.c	18 Aug 2004 08:24:58 -0000	1.328
+++ config/sparc/sparc.c	18 Aug 2004 21:00:18 -0000
@@ -3805,11 +3805,10 @@ legitimize_pic_address (rtx orig, enum m
       else
 	address = orig;
 
-      pic_ref = gen_rtx_MEM (Pmode,
-			     gen_rtx_PLUS (Pmode,
-					   pic_offset_table_rtx, address));
+      pic_ref = gen_const_mem (Pmode,
+			       gen_rtx_PLUS (Pmode,
+					     pic_offset_table_rtx, address));
       current_function_uses_pic_offset_table = 1;
-      MEM_READONLY_P (pic_ref) = 1;
       insn = emit_move_insn (reg, pic_ref);
       /* Put a REG_EQUAL note on this insn, so that it can be optimized
 	 by loop.  */
Index: config/v850/v850.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/v850.md,v
retrieving revision 1.30
diff -c -p -d -u -r1.30 v850.md
--- config/v850/v850.md	18 Aug 2004 08:25:00 -0000	1.30
+++ config/v850/v850.md	18 Aug 2004 21:00:18 -0000
@@ -1320,8 +1320,7 @@
   /* Add the table address to the index.  */
   emit_insn (gen_addsi3 (reg, reg, tableaddress));
   /* Load the table entry.  */
-  mem = gen_rtx_MEM (CASE_VECTOR_MODE, reg);
-  MEM_READONLY_P (mem) = 1;
+  mem = gen_const_mem (CASE_VECTOR_MODE, reg);
   if (! TARGET_BIG_SWITCH)
     {
       rtx reg2 = gen_reg_rtx (HImode);


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