SHA256
1
0
forked from pool/qemu
qemu/gcc-aliasing12.diff

92 lines
3.5 KiB
Diff

Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.374.2.10
diff -u -p -r1.374.2.10 rtl.h
--- gcc/rtl.h 21 Jun 2003 22:47:01 -0000 1.374.2.10
+++ gcc/rtl.h 10 Aug 2003 21:20:12 -0000
@@ -141,7 +141,8 @@ struct rtx_def GTY((chain_next ("RTX_NEX
In a CODE_LABEL, part of the two-bit alternate entry field. */
unsigned int jump : 1;
/* In a CODE_LABEL, part of the two-bit alternate entry field.
- 1 in a MEM if it cannot trap. */
+ 1 in a MEM if it cannot trap.
+ 1 in a SYMBOL_REF which refers to a read-only object. */
unsigned int call : 1;
/* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
1 in a SUBREG if it references an unsigned object whose mode has been
@@ -1241,6 +1242,10 @@ do { \
/* 1 if RTX is a symbol_ref for a weak symbol. */
#define SYMBOL_REF_WEAK(RTX) \
(RTL_FLAG_CHECK1("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->integrated)
+
+/* 1 if RTX is a symbol_ref for a readonly object. */
+#define SYMBOL_REF_READONLY(RTX) \
+ (RTL_FLAG_CHECK1("SYMBOL_REF_READONLY", (RTX), SYMBOL_REF)->call)
/* Define a macro to look for REG_INC notes,
but save time on machines where they never exist. */
Index: alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/alias.c,v
retrieving revision 1.180.2.4
diff -u -p -r1.180.2.4 alias.c
--- gcc/alias.c 21 Jun 2003 22:47:00 -0000 1.180.2.4
+++ gcc/alias.c 10 Aug 2003 21:20:12 -0000
@@ -2071,7 +2071,7 @@ true_dependence (mem, mem_mode, x, varie
int (*varies) PARAMS ((rtx, int));
{
rtx x_addr, mem_addr;
- rtx base;
+ rtx base, mem_base;
if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
return 1;
@@ -2109,9 +2109,12 @@ true_dependence (mem, mem_mode, x, varie
mem_addr = get_addr (XEXP (mem, 0));
base = find_base_term (x_addr);
+ mem_base = find_base_term (mem_addr);
if (base && (GET_CODE (base) == LABEL_REF
|| (GET_CODE (base) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (base))))
+ && ((SYMBOL_REF_READONLY (base)
+ && !rtx_equal_p (base, mem_base))
+ || CONSTANT_POOL_ADDRESS_P (base)))))
return 0;
if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.318.2.11
diff -u -p -r1.318.2.11 varasm.c
--- gcc/varasm.c 19 Jul 2003 14:57:43 -0000 1.318.2.11
+++ gcc/varasm.c 10 Aug 2003 21:20:12 -0000
@@ -941,6 +941,8 @@ make_decl_rtl (decl, asmspec)
SYMBOL_REF_WEAK (XEXP (x, 0)) = DECL_WEAK (decl);
if (TREE_CODE (decl) != FUNCTION_DECL)
set_mem_attributes (x, decl, 1);
+ if (RTX_UNCHANGING_P (x))
+ SYMBOL_REF_READONLY (XEXP (x, 0)) = 1;
SET_DECL_RTL (decl, x);
/* Optionally set flags or add text to the name to record information
@@ -2731,6 +2733,8 @@ output_constant_def (exp, defer)
gen_rtx_SYMBOL_REF (Pmode, desc->label));
set_mem_attributes (rtl, exp, 1);
+ if (RTX_UNCHANGING_P (rtl))
+ SYMBOL_REF_READONLY (XEXP (rtl, 0)) = 1;
set_mem_alias_set (rtl, 0);
set_mem_alias_set (rtl, const_alias_set);
@@ -3299,6 +3303,7 @@ force_const_mem (mode, x)
set_mem_alias_set (def, const_alias_set);
set_mem_attributes (def, (*lang_hooks.types.type_for_mode) (mode, 0), 1);
RTX_UNCHANGING_P (def) = 1;
+ SYMBOL_REF_READONLY (XEXP (def, 0)) = 1;
/* Add label to symbol hash table. */
hash = SYMHASH (XSTR (XEXP (def, 0), 0));