[MIPS 17/30] Use gen_frame_mem and gen_const_mem

Richard Sandiford rsandifo@nildram.co.uk
Fri Oct 19 09:10:00 GMT 2007


There were various calls to gen_rtx_MEM that would be better using
gen_frame_mem or gen_const_mem instead.

Richard


gcc/
	* config/mips/mips.c (mips_call_tls_get_addr): Use gen_const_mem
	rather then gen_rtx_MEM.
	(mips_setup_incoming_varargs): Use gen_frame_mem rather than
	gen_rtx_MEM.
	(mips_set_return_address): Likewise.
	(mips_restore_gp): Likewise.

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	2007-10-18 11:07:11.000000000 +0100
+++ gcc/config/mips/mips.c	2007-10-18 11:07:12.000000000 +0100
@@ -2418,7 +2418,7 @@ mips_call_tls_get_addr (rtx sym, enum mi
 
   emit_insn (gen_rtx_SET (Pmode, a0,
 			  gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, loc)));
-  tga = gen_rtx_MEM (Pmode, mips_tls_symbol);
+  tga = gen_const_mem (Pmode, mips_tls_symbol);
   insn = emit_call_insn (gen_call_value (v0, tga, const0_rtx, const0_rtx));
   CONST_OR_PURE_CALL_P (insn) = 1;
   use_reg (&CALL_INSN_FUNCTION_USAGE (insn), v0);
@@ -4720,7 +4720,7 @@ mips_setup_incoming_varargs (CUMULATIVE_
 	  ptr = plus_constant (virtual_incoming_args_rtx,
 			       REG_PARM_STACK_SPACE (cfun->decl)
 			       - gp_saved * UNITS_PER_WORD);
-	  mem = gen_rtx_MEM (BLKmode, ptr);
+	  mem = gen_frame_mem (BLKmode, ptr);
 	  set_mem_alias_set (mem, get_varargs_alias_set ());
 
 	  move_block_from_reg (local_cum.num_gprs + GP_ARG_FIRST,
@@ -4748,7 +4748,7 @@ mips_setup_incoming_varargs (CUMULATIVE_
 	      rtx ptr, mem;
 
 	      ptr = plus_constant (virtual_incoming_args_rtx, off);
-	      mem = gen_rtx_MEM (mode, ptr);
+	      mem = gen_frame_mem (mode, ptr);
 	      set_mem_alias_set (mem, get_varargs_alias_set ());
 	      mips_emit_move (mem, gen_rtx_REG (mode, FP_ARG_FIRST + i));
 	      off += UNITS_PER_HWFPVALUE;
@@ -8131,7 +8131,7 @@ mips_set_return_address (rtx address, rt
   slot_address = mips_add_offset (scratch, stack_pointer_rtx,
 				  cfun->machine->frame.gp_sp_offset);
 
-  mips_emit_move (gen_rtx_MEM (GET_MODE (address), slot_address), address);
+  mips_emit_move (gen_frame_mem (GET_MODE (address), slot_address), address);
 }
 
 /* Restore $gp from its save slot.  Valid only when using o32 or
@@ -8140,7 +8140,7 @@ mips_set_return_address (rtx address, rt
 void
 mips_restore_gp (void)
 {
-  rtx address, slot;
+  rtx address;
 
   gcc_assert (TARGET_ABICALLS && TARGET_OLDABI);
 
@@ -8149,9 +8149,8 @@ mips_restore_gp (void)
 			     ? hard_frame_pointer_rtx
 			     : stack_pointer_rtx,
 			     current_function_outgoing_args_size);
-  slot = gen_rtx_MEM (Pmode, address);
 
-  mips_emit_move (pic_offset_table_rtx, slot);
+  mips_emit_move (pic_offset_table_rtx, gen_frame_mem (Pmode, address));
   if (!TARGET_EXPLICIT_RELOCS)
     emit_insn (gen_blockage ());
 }



More information about the Gcc-patches mailing list