* 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.
From-SVN: r86207
+2004-08-18 Richard Henderson <rth@redhat.com>
+
+ * 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.
+
2004-08-18 Steven Bosscher <stevenb@suse.de>
* Makefile.in (OBJS-common): Add postreload-gcse.c.
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);
(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;
}
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;
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 */
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));
#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
{
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)
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)
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)
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,
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;
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))
""
{
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"
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
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);
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));
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;
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;
}
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;
}
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;
}
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);
}
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);
}
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);
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));
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)
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;
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;
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. */
/* 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);
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)
{
#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));
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);
*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. */