Commit e38fe8e0 by Bernd Schmidt Committed by Bernd Schmidt

Extra arg for rtx_varies_p

From-SVN: r38590
parent 7d797311
2001-01-01 Bernd Schmidt <bernds@redhat.com>
* alias.c (fixed_scalar_and_varying_struct): Adjust prototype of
arg VARIES_P. Call it with extra arg.
(true_dependence): Likewise.
* rtl.h (rtx_addr_can_trap_p): Declare.
(rtx_varies_p, rtx_addr_varies_p, true_dependence): Update
prototypes.
* rtlanal.c (rtx_addr_can_trap_p): No longer static.
(rtx_varies_p): Accept extra arg FOR_ALIAS; only disallow
pic offset table register if it's zero. All callers changed.
(rtx_addr_varies_p): Accept extra arg FOR_ALIAS; all callers changed.
Mon Jan 1 07:38:33 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Mon Jan 1 07:38:33 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* explow.c (convert_memory_address, case SYMBOL_REF): Copy * explow.c (convert_memory_address, case SYMBOL_REF): Copy
......
...@@ -101,7 +101,7 @@ static int insert_subset_children PARAMS ((splay_tree_node, void*)); ...@@ -101,7 +101,7 @@ static int insert_subset_children PARAMS ((splay_tree_node, void*));
static tree find_base_decl PARAMS ((tree)); static tree find_base_decl PARAMS ((tree));
static alias_set_entry get_alias_set_entry PARAMS ((HOST_WIDE_INT)); static alias_set_entry get_alias_set_entry PARAMS ((HOST_WIDE_INT));
static rtx fixed_scalar_and_varying_struct_p PARAMS ((rtx, rtx, rtx, rtx, static rtx fixed_scalar_and_varying_struct_p PARAMS ((rtx, rtx, rtx, rtx,
int (*) (rtx))); int (*) (rtx, int)));
static int aliases_everything_p PARAMS ((rtx)); static int aliases_everything_p PARAMS ((rtx));
static int write_dependence_p PARAMS ((rtx, rtx, int)); static int write_dependence_p PARAMS ((rtx, rtx, int));
static int nonlocal_mentioned_p PARAMS ((rtx)); static int nonlocal_mentioned_p PARAMS ((rtx));
...@@ -1602,19 +1602,19 @@ static rtx ...@@ -1602,19 +1602,19 @@ static rtx
fixed_scalar_and_varying_struct_p (mem1, mem2, mem1_addr, mem2_addr, varies_p) fixed_scalar_and_varying_struct_p (mem1, mem2, mem1_addr, mem2_addr, varies_p)
rtx mem1, mem2; rtx mem1, mem2;
rtx mem1_addr, mem2_addr; rtx mem1_addr, mem2_addr;
int (*varies_p) PARAMS ((rtx)); int (*varies_p) PARAMS ((rtx, int));
{ {
if (! flag_strict_aliasing) if (! flag_strict_aliasing)
return NULL_RTX; return NULL_RTX;
if (MEM_SCALAR_P (mem1) && MEM_IN_STRUCT_P (mem2) if (MEM_SCALAR_P (mem1) && MEM_IN_STRUCT_P (mem2)
&& !varies_p (mem1_addr) && varies_p (mem2_addr)) && !varies_p (mem1_addr, 1) && varies_p (mem2_addr, 1))
/* MEM1 is a scalar at a fixed address; MEM2 is a struct at a /* MEM1 is a scalar at a fixed address; MEM2 is a struct at a
varying address. */ varying address. */
return mem1; return mem1;
if (MEM_IN_STRUCT_P (mem1) && MEM_SCALAR_P (mem2) if (MEM_IN_STRUCT_P (mem1) && MEM_SCALAR_P (mem2)
&& varies_p (mem1_addr) && !varies_p (mem2_addr)) && varies_p (mem1_addr, 1) && !varies_p (mem2_addr, 1))
/* MEM2 is a scalar at a fixed address; MEM1 is a struct at a /* MEM2 is a scalar at a fixed address; MEM1 is a struct at a
varying address. */ varying address. */
return mem2; return mem2;
...@@ -1644,7 +1644,7 @@ true_dependence (mem, mem_mode, x, varies) ...@@ -1644,7 +1644,7 @@ true_dependence (mem, mem_mode, x, varies)
rtx mem; rtx mem;
enum machine_mode mem_mode; enum machine_mode mem_mode;
rtx x; rtx x;
int (*varies) PARAMS ((rtx)); int (*varies) PARAMS ((rtx, int));
{ {
register rtx x_addr, mem_addr; register rtx x_addr, mem_addr;
rtx base; rtx base;
......
...@@ -995,7 +995,7 @@ extern const char *a29k_function_name; ...@@ -995,7 +995,7 @@ extern const char *a29k_function_name;
&& ! (needs_regstack_p () && uses_local_reg_p (PATTERN (INSN))) \ && ! (needs_regstack_p () && uses_local_reg_p (PATTERN (INSN))) \
&& (GET_CODE (PATTERN (INSN)) != SET \ && (GET_CODE (PATTERN (INSN)) != SET \
|| GET_CODE (SET_SRC (PATTERN (INSN))) != MEM \ || GET_CODE (SET_SRC (PATTERN (INSN))) != MEM \
|| ! rtx_varies_p (XEXP (SET_SRC (PATTERN (INSN)), 0)))) || ! rtx_varies_p (XEXP (SET_SRC (PATTERN (INSN)), 0), 0)))
/* Output assembler code for a block containing the constant parts /* Output assembler code for a block containing the constant parts
of a trampoline, leaving space for the variable parts. of a trampoline, leaving space for the variable parts.
......
...@@ -2745,7 +2745,7 @@ cse_rtx_varies_p (x) ...@@ -2745,7 +2745,7 @@ cse_rtx_varies_p (x)
return 0; return 0;
} }
return rtx_varies_p (x); return rtx_varies_p (x, 0);
} }
/* Canonicalize an expression: /* Canonicalize an expression:
......
...@@ -540,7 +540,7 @@ equiv_init_varies_p (x) ...@@ -540,7 +540,7 @@ equiv_init_varies_p (x)
return 0; return 0;
case REG: case REG:
return reg_equiv[REGNO (x)].replace == 0 && rtx_varies_p (x); return reg_equiv[REGNO (x)].replace == 0 && rtx_varies_p (x, 0);
case ASM_OPERANDS: case ASM_OPERANDS:
if (MEM_VOLATILE_P (x)) if (MEM_VOLATILE_P (x))
...@@ -604,7 +604,7 @@ equiv_init_movable_p (x, regno) ...@@ -604,7 +604,7 @@ equiv_init_movable_p (x, regno)
case REG: case REG:
return (reg_equiv[REGNO (x)].loop_depth >= reg_equiv[regno].loop_depth return (reg_equiv[REGNO (x)].loop_depth >= reg_equiv[regno].loop_depth
&& reg_equiv[REGNO (x)].replace) && reg_equiv[REGNO (x)].replace)
|| (REG_BASIC_BLOCK (REGNO (x)) < 0 && ! rtx_varies_p (x)); || (REG_BASIC_BLOCK (REGNO (x)) < 0 && ! rtx_varies_p (x, 0));
case UNSPEC_VOLATILE: case UNSPEC_VOLATILE:
return 0; return 0;
...@@ -933,7 +933,7 @@ update_equiv_regs () ...@@ -933,7 +933,7 @@ update_equiv_regs ()
/* cse sometimes generates function invariants, but doesn't put a /* cse sometimes generates function invariants, but doesn't put a
REG_EQUAL note on the insn. Since this note would be redundant, REG_EQUAL note on the insn. Since this note would be redundant,
there's no point creating it earlier than here. */ there's no point creating it earlier than here. */
if (! note && ! rtx_varies_p (src)) if (! note && ! rtx_varies_p (src, 0))
REG_NOTES (insn) REG_NOTES (insn)
= note = gen_rtx_EXPR_LIST (REG_EQUAL, src, REG_NOTES (insn)); = note = gen_rtx_EXPR_LIST (REG_EQUAL, src, REG_NOTES (insn));
...@@ -944,7 +944,7 @@ update_equiv_regs () ...@@ -944,7 +944,7 @@ update_equiv_regs ()
if (REG_N_SETS (regno) != 1 if (REG_N_SETS (regno) != 1
&& (! note && (! note
|| rtx_varies_p (XEXP (note, 0)) || rtx_varies_p (XEXP (note, 0), 0)
|| (reg_equiv[regno].replacement || (reg_equiv[regno].replacement
&& ! rtx_equal_p (XEXP (note, 0), && ! rtx_equal_p (XEXP (note, 0),
reg_equiv[regno].replacement)))) reg_equiv[regno].replacement))))
...@@ -958,7 +958,7 @@ update_equiv_regs () ...@@ -958,7 +958,7 @@ update_equiv_regs ()
/* If this register is known to be equal to a constant, record that /* If this register is known to be equal to a constant, record that
it is always equivalent to the constant. */ it is always equivalent to the constant. */
if (note && ! rtx_varies_p (XEXP (note, 0))) if (note && ! rtx_varies_p (XEXP (note, 0), 0))
PUT_MODE (note, (enum machine_mode) REG_EQUIV); PUT_MODE (note, (enum machine_mode) REG_EQUIV);
/* If this insn introduces a "constant" register, decrease the priority /* If this insn introduces a "constant" register, decrease the priority
......
...@@ -4431,7 +4431,7 @@ make_memloc (ad, regno) ...@@ -4431,7 +4431,7 @@ make_memloc (ad, regno)
/* If TEM might contain a pseudo, we must copy it to avoid /* If TEM might contain a pseudo, we must copy it to avoid
modifying it when we do the substitution for the reload. */ modifying it when we do the substitution for the reload. */
if (rtx_varies_p (tem)) if (rtx_varies_p (tem, 0))
tem = copy_rtx (tem); tem = copy_rtx (tem);
tem = gen_rtx_MEM (GET_MODE (ad), tem); tem = gen_rtx_MEM (GET_MODE (ad), tem);
......
...@@ -1352,9 +1352,10 @@ extern void set_unique_reg_note PARAMS ((rtx, enum reg_note, rtx)); ...@@ -1352,9 +1352,10 @@ extern void set_unique_reg_note PARAMS ((rtx, enum reg_note, rtx));
: NULL_RTX) : NULL_RTX)
#define single_set_1(I) single_set_2 (I, PATTERN (I)) #define single_set_1(I) single_set_2 (I, PATTERN (I))
extern int rtx_addr_can_trap_p PARAMS ((rtx));
extern int rtx_unstable_p PARAMS ((rtx)); extern int rtx_unstable_p PARAMS ((rtx));
extern int rtx_varies_p PARAMS ((rtx)); extern int rtx_varies_p PARAMS ((rtx, int));
extern int rtx_addr_varies_p PARAMS ((rtx)); extern int rtx_addr_varies_p PARAMS ((rtx, int));
extern HOST_WIDE_INT get_integer_term PARAMS ((rtx)); extern HOST_WIDE_INT get_integer_term PARAMS ((rtx));
extern rtx get_related_value PARAMS ((rtx)); extern rtx get_related_value PARAMS ((rtx));
extern int reg_mentioned_p PARAMS ((rtx, rtx)); extern int reg_mentioned_p PARAMS ((rtx, rtx));
...@@ -1986,7 +1987,7 @@ extern void fancy_abort PARAMS ((const char *, int, const char *)) ...@@ -1986,7 +1987,7 @@ extern void fancy_abort PARAMS ((const char *, int, const char *))
/* In alias.c */ /* In alias.c */
extern rtx canon_rtx PARAMS ((rtx)); extern rtx canon_rtx PARAMS ((rtx));
extern int true_dependence PARAMS ((rtx, enum machine_mode, rtx, extern int true_dependence PARAMS ((rtx, enum machine_mode, rtx,
int (*)(rtx))); int (*)(rtx, int)));
extern int read_dependence PARAMS ((rtx, rtx)); extern int read_dependence PARAMS ((rtx, rtx));
extern int anti_dependence PARAMS ((rtx, rtx)); extern int anti_dependence PARAMS ((rtx, rtx));
extern int output_dependence PARAMS ((rtx, rtx)); extern int output_dependence PARAMS ((rtx, rtx));
......
...@@ -25,7 +25,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -25,7 +25,6 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h" #include "toplev.h"
#include "rtl.h" #include "rtl.h"
static int rtx_addr_can_trap_p PARAMS ((rtx));
static void reg_set_p_1 PARAMS ((rtx, rtx, void *)); static void reg_set_p_1 PARAMS ((rtx, rtx, void *));
static void insn_dependent_p_1 PARAMS ((rtx, rtx, void *)); static void insn_dependent_p_1 PARAMS ((rtx, rtx, void *));
static void reg_set_last_1 PARAMS ((rtx, rtx, void *)); static void reg_set_last_1 PARAMS ((rtx, rtx, void *));
...@@ -113,11 +112,14 @@ rtx_unstable_p (x) ...@@ -113,11 +112,14 @@ rtx_unstable_p (x)
/* Return 1 if X has a value that can vary even between two /* Return 1 if X has a value that can vary even between two
executions of the program. 0 means X can be compared reliably executions of the program. 0 means X can be compared reliably
against certain constants or near-constants. against certain constants or near-constants.
FOR_ALIAS is nonzero if we are called from alias analysis; if it is
zero, we are slightly more conservative.
The frame pointer and the arg pointer are considered constant. */ The frame pointer and the arg pointer are considered constant. */
int int
rtx_varies_p (x) rtx_varies_p (x, for_alias)
rtx x; rtx x;
int for_alias;
{ {
register RTX_CODE code = GET_CODE (x); register RTX_CODE code = GET_CODE (x);
register int i; register int i;
...@@ -126,7 +128,7 @@ rtx_varies_p (x) ...@@ -126,7 +128,7 @@ rtx_varies_p (x)
switch (code) switch (code)
{ {
case MEM: case MEM:
return ! RTX_UNCHANGING_P (x) || rtx_varies_p (XEXP (x, 0)); return ! RTX_UNCHANGING_P (x) || rtx_varies_p (XEXP (x, 0), for_alias);
case QUEUED: case QUEUED:
return 1; return 1;
...@@ -146,19 +148,22 @@ rtx_varies_p (x) ...@@ -146,19 +148,22 @@ rtx_varies_p (x)
if (x == frame_pointer_rtx || x == hard_frame_pointer_rtx if (x == frame_pointer_rtx || x == hard_frame_pointer_rtx
|| x == arg_pointer_rtx) || x == arg_pointer_rtx)
return 0; return 0;
#ifndef PIC_OFFSET_TABLE_REG_CALL_CLOBBERED if (x == pic_offset_table_rtx
/* ??? When call-clobbered, the value is stable modulo the restore #ifdef PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
that must happen after a call. This currently screws up local-alloc /* ??? When call-clobbered, the value is stable modulo the restore
into believing that the restore is not needed. */ that must happen after a call. This currently screws up
if (x == pic_offset_table_rtx) local-alloc into believing that the restore is not needed, so we
return 0; must return 0 only if we are called from alias analysis. */
&& for_alias
#endif #endif
)
return 0;
return 1; return 1;
case LO_SUM: case LO_SUM:
/* The operand 0 of a LO_SUM is considered constant /* The operand 0 of a LO_SUM is considered constant
(in fact is it related specifically to operand 1). */ (in fact is it related specifically to operand 1). */
return rtx_varies_p (XEXP (x, 1)); return rtx_varies_p (XEXP (x, 1), for_alias);
case ASM_OPERANDS: case ASM_OPERANDS:
if (MEM_VOLATILE_P (x)) if (MEM_VOLATILE_P (x))
...@@ -174,14 +179,14 @@ rtx_varies_p (x) ...@@ -174,14 +179,14 @@ rtx_varies_p (x)
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
if (fmt[i] == 'e') if (fmt[i] == 'e')
{ {
if (rtx_varies_p (XEXP (x, i))) if (rtx_varies_p (XEXP (x, i), for_alias))
return 1; return 1;
} }
else if (fmt[i] == 'E') else if (fmt[i] == 'E')
{ {
int j; int j;
for (j = 0; j < XVECLEN (x, i); j++) for (j = 0; j < XVECLEN (x, i); j++)
if (rtx_varies_p (XVECEXP (x, i, j))) if (rtx_varies_p (XVECEXP (x, i, j), for_alias))
return 1; return 1;
} }
...@@ -190,7 +195,7 @@ rtx_varies_p (x) ...@@ -190,7 +195,7 @@ rtx_varies_p (x)
/* Return 0 if the use of X as an address in a MEM can cause a trap. */ /* Return 0 if the use of X as an address in a MEM can cause a trap. */
static int int
rtx_addr_can_trap_p (x) rtx_addr_can_trap_p (x)
register rtx x; register rtx x;
{ {
...@@ -236,11 +241,14 @@ rtx_addr_can_trap_p (x) ...@@ -236,11 +241,14 @@ rtx_addr_can_trap_p (x)
/* Return 1 if X refers to a memory location whose address /* Return 1 if X refers to a memory location whose address
cannot be compared reliably with constant addresses, cannot be compared reliably with constant addresses,
or if X refers to a BLKmode memory object. */ or if X refers to a BLKmode memory object.
FOR_ALIAS is nonzero if we are called from alias analysis; if it is
zero, we are slightly more conservative. */
int int
rtx_addr_varies_p (x) rtx_addr_varies_p (x, for_alias)
rtx x; rtx x;
int for_alias;
{ {
register enum rtx_code code; register enum rtx_code code;
register int i; register int i;
...@@ -251,20 +259,20 @@ rtx_addr_varies_p (x) ...@@ -251,20 +259,20 @@ rtx_addr_varies_p (x)
code = GET_CODE (x); code = GET_CODE (x);
if (code == MEM) if (code == MEM)
return GET_MODE (x) == BLKmode || rtx_varies_p (XEXP (x, 0)); return GET_MODE (x) == BLKmode || rtx_varies_p (XEXP (x, 0), for_alias);
fmt = GET_RTX_FORMAT (code); fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
if (fmt[i] == 'e') if (fmt[i] == 'e')
{ {
if (rtx_addr_varies_p (XEXP (x, i))) if (rtx_addr_varies_p (XEXP (x, i), for_alias))
return 1; return 1;
} }
else if (fmt[i] == 'E') else if (fmt[i] == 'E')
{ {
int j; int j;
for (j = 0; j < XVECLEN (x, i); j++) for (j = 0; j < XVECLEN (x, i); j++)
if (rtx_addr_varies_p (XVECEXP (x, i, j))) if (rtx_addr_varies_p (XVECEXP (x, i, j), for_alias))
return 1; return 1;
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment