aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJohn Wehle <john@feith.com>2000-08-23 03:54:23 +0000
committerJohn Wehle <wehle@gcc.gnu.org>2000-08-23 03:54:23 +0000
commit55efb413f8db156d8419aa6ca65d8e0b35e3ff60 (patch)
treeb033d3e0a235bd6b290d0387a72344825b7163b6 /gcc
parentaac625acc6303ce268562ee24ca2cb6d220ea9a4 (diff)
downloadgcc-55efb413f8db156d8419aa6ca65d8e0b35e3ff60.zip
gcc-55efb413f8db156d8419aa6ca65d8e0b35e3ff60.tar.gz
gcc-55efb413f8db156d8419aa6ca65d8e0b35e3ff60.tar.bz2
rtlanal.c (rtx_unstable_p): The pic register is stable (within one function) and the actual rtx should be...
* rtlanal.c (rtx_unstable_p): The pic register is stable (within one function) and the actual rtx should be used when checking the registers. (rtx_addr_can_trap_p): Pic memory addresses can't trap. * alias.c (true_dependence, write_dependence_p): Fix bug in previous patch. * i386.c (ix86_GOT_alias_set): New. (legitimize_pic_address): Use it. * rtlanal.c (rtx_unstable_p): An unchanging MEM is only stable if its address is stable. (rtx_varies_p): An unchanging MEM can't vary if its address doesn't vary. From-SVN: r35900
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/alias.c27
-rw-r--r--gcc/config/i386/i386.c13
-rw-r--r--gcc/rtlanal.c19
4 files changed, 56 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 303aea5..cef5759 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,21 @@
+Tue Aug 22 23:53:27 EDT 2000 John Wehle (john@feith.com)
+
+ * rtlanal.c (rtx_unstable_p): The pic register is stable
+ (within one function) and the actual rtx should be used
+ when checking the registers.
+ (rtx_addr_can_trap_p): Pic memory addresses can't trap.
+
+ * alias.c (true_dependence, write_dependence_p): Fix
+ bug in previous patch.
+
+ * i386.c (ix86_GOT_alias_set): New.
+ (legitimize_pic_address): Use it.
+
+ * rtlanal.c (rtx_unstable_p): An unchanging MEM is
+ only stable if its address is stable.
+ (rtx_varies_p): An unchanging MEM can't vary if
+ its address doesn't vary.
+
2000-08-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-parse.in (unop +): Restrict -Wtraditional warnings to user code.
diff --git a/gcc/alias.c b/gcc/alias.c
index bfa4505..5d96dad 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -1584,18 +1584,18 @@ true_dependence (mem, mem_mode, x, varies)
if (RTX_UNCHANGING_P (x) && ! RTX_UNCHANGING_P (mem))
return 0;
- base = find_base_term (x);
- if (base && (GET_CODE (base) == LABEL_REF
- || (GET_CODE (base) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (base))))
- return 0;
-
if (mem_mode == VOIDmode)
mem_mode = GET_MODE (mem);
x_addr = get_addr (XEXP (x, 0));
mem_addr = get_addr (XEXP (mem, 0));
+ base = find_base_term (x_addr);
+ if (base && (GET_CODE (base) == LABEL_REF
+ || (GET_CODE (base) == SYMBOL_REF
+ && CONSTANT_POOL_ADDRESS_P (base))))
+ return 0;
+
if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
return 0;
@@ -1645,22 +1645,21 @@ write_dependence_p (mem, x, writep)
/* If MEM is an unchanging read, then it can't possibly conflict with
the store to X, because there is at most one store to MEM, and it must
have occurred somewhere before MEM. */
+ if (! writep && RTX_UNCHANGING_P (mem))
+ return 0;
+
+ x_addr = get_addr (XEXP (x, 0));
+ mem_addr = get_addr (XEXP (mem, 0));
+
if (! writep)
{
- if (RTX_UNCHANGING_P (mem))
- return 0;
-
- base = find_base_term (mem);
+ base = find_base_term (mem_addr);
if (base && (GET_CODE (base) == LABEL_REF
|| (GET_CODE (base) == SYMBOL_REF
&& CONSTANT_POOL_ADDRESS_P (base))))
return 0;
}
-
- x_addr = get_addr (XEXP (x, 0));
- mem_addr = get_addr (XEXP (mem, 0));
-
if (! base_alias_check (x_addr, mem_addr, GET_MODE (x),
GET_MODE (mem)))
return 0;
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 4898538..4c21a88 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -427,6 +427,7 @@ static void ix86_emit_restore_regs_using_mov PARAMS ((rtx, int));
static void ix86_emit_epilogue_esp_adjustment PARAMS((int));
static void ix86_sched_reorder_pentium PARAMS((rtx *, rtx *));
static void ix86_sched_reorder_ppro PARAMS((rtx *, rtx *));
+static HOST_WIDE_INT ix86_GOT_alias_set PARAMS ((void));
struct ix86_address
{
@@ -2553,6 +2554,17 @@ report_error:
return FALSE;
}
+/* Return an unique alias set for the GOT. */
+
+static HOST_WIDE_INT
+ix86_GOT_alias_set ()
+{
+ static HOST_WIDE_INT set = -1;
+ if (set == -1)
+ set = new_alias_set ();
+ return set;
+}
+
/* Return a legitimate reference for ORIG (an address) using the
register REG. If REG is 0, a new pseudo is generated.
@@ -2610,6 +2622,7 @@ legitimize_pic_address (orig, reg)
new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);
new = gen_rtx_MEM (Pmode, new);
RTX_UNCHANGING_P (new) = 1;
+ MEM_ALIAS_SET (new) = ix86_GOT_alias_set ();
if (reg == 0)
reg = gen_reg_rtx (Pmode);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 5c69a50..8424b8e 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -53,7 +53,7 @@ rtx_unstable_p (x)
register const char *fmt;
if (code == MEM)
- return ! RTX_UNCHANGING_P (x);
+ return ! RTX_UNCHANGING_P (x) || rtx_unstable_p (XEXP (x, 0));
if (code == QUEUED)
return 1;
@@ -62,9 +62,9 @@ rtx_unstable_p (x)
return 0;
if (code == REG)
- return ! (REGNO (x) == FRAME_POINTER_REGNUM
- || REGNO (x) == HARD_FRAME_POINTER_REGNUM
- || REGNO (x) == ARG_POINTER_REGNUM
+ /* As in rtx_varies_p, we have to use the actual rtx, not reg number. */
+ return ! (x == frame_pointer_rtx || x == hard_frame_pointer_rtx
+ || x == arg_pointer_rtx || x == pic_offset_table_rtx
|| RTX_UNCHANGING_P (x));
fmt = GET_RTX_FORMAT (code);
@@ -101,6 +101,8 @@ rtx_varies_p (x)
switch (code)
{
case MEM:
+ return ! RTX_UNCHANGING_P (x) || rtx_varies_p (XEXP (x, 0));
+
case QUEUED:
return 1;
@@ -174,9 +176,12 @@ rtx_addr_can_trap_p (x)
case PLUS:
/* An address is assumed not to trap if it is an address that can't
- trap plus a constant integer. */
- return (rtx_addr_can_trap_p (XEXP (x, 0))
- || GET_CODE (XEXP (x, 1)) != CONST_INT);
+ trap plus a constant integer or it is the pic register plus a
+ constant. */
+ return ! ((! rtx_addr_can_trap_p (XEXP (x, 0))
+ && GET_CODE (XEXP (x, 1)) == CONST_INT)
+ || (XEXP (x, 0) == pic_offset_table_rtx
+ && CONSTANT_P (XEXP (x, 1))));
case LO_SUM:
return rtx_addr_can_trap_p (XEXP (x, 1));