diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ab7ad93ad123..9133f1bb7bfa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2012-04-21 Richard Sandiford + + PR bootstrap/53021 + * rtl.def (ADDRESS): Use "i" rather than "w". + * rtl.h (find_base_term): Delete. + (may_be_sp_based_p): Declare. + * rtl.c (rtx_code_size): Remove ADDRESS special case. + * alias.h (UNIQUE_BASE_VALUE_SP, UNIQUE_BASE_VALUE_ARGP) + (UNIQUE_BASE_VALUE_FP, UNIQUE_BASE_VALUE_HFP): Move to... + * alias.c: ...here. + (find_base_term): Make static. + (may_be_sp_based_p): New function. + * dse.c (record_store): Use it. + * store-motion.c (store_killed_in_insn): Likewise. + 2012-04-21 Richard Sandiford * fold-const.c (fold_checksum_tree): Fix VECTOR_CST case. diff --git a/gcc/alias.c b/gcc/alias.c index 7b1986c0923e..8366f9c3a5e1 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -228,6 +228,13 @@ static int unique_id; array. */ static GTY((deletable)) VEC(rtx,gc) *old_reg_base_value; +/* Values of XINT (address, 0) of Pmode ADDRESS rtxes for special + registers. */ +#define UNIQUE_BASE_VALUE_SP -1 +#define UNIQUE_BASE_VALUE_ARGP -2 +#define UNIQUE_BASE_VALUE_FP -3 +#define UNIQUE_BASE_VALUE_HFP -4 + #define static_reg_base_value \ (this_target_rtl->x_static_reg_base_value) @@ -1584,7 +1591,7 @@ rtx_equal_for_memref_p (const_rtx x, const_rtx y) return 1; } -rtx +static rtx find_base_term (rtx x) { cselib_val *val; @@ -1740,6 +1747,16 @@ find_base_term (rtx x) } } +/* Return true if accesses to address X may alias accesses based + on the stack pointer. */ + +bool +may_be_sp_based_p (rtx x) +{ + rtx base = find_base_term (x); + return !base || base == static_reg_base_value[STACK_POINTER_REGNUM]; +} + /* Return 0 if the addresses X and Y are known to point to different objects, 1 if they might be pointers to the same object. */ diff --git a/gcc/alias.h b/gcc/alias.h index d4dd3038292f..9e0d1872658d 100644 --- a/gcc/alias.h +++ b/gcc/alias.h @@ -51,11 +51,4 @@ extern int nonoverlapping_memrefs_p (const_rtx, const_rtx, bool); memory barriers, including an address of SCRATCH. */ #define ALIAS_SET_MEMORY_BARRIER ((alias_set_type) -1) -/* Values of XWINT (address, 0) of Pmode ADDRESS rtxes for special - registers. */ -#define UNIQUE_BASE_VALUE_SP -1 -#define UNIQUE_BASE_VALUE_ARGP -2 -#define UNIQUE_BASE_VALUE_FP -3 -#define UNIQUE_BASE_VALUE_HFP -4 - #endif /* GCC_ALIAS_H */ diff --git a/gcc/dse.c b/gcc/dse.c index 9f57613d5141..19d938301bb9 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -1499,11 +1499,7 @@ record_store (rtx body, bb_info_t bb_info) } else { - rtx base_term = find_base_term (XEXP (mem, 0)); - if (!base_term - || (GET_CODE (base_term) == ADDRESS - && GET_MODE (base_term) == Pmode - && XWINT (base_term, 0) == UNIQUE_BASE_VALUE_SP)) + if (may_be_sp_based_p (XEXP (mem, 0))) insn_info->stack_pointer_based = true; insn_info->contains_cselib_groups = true; diff --git a/gcc/rtl.c b/gcc/rtl.c index 9ca6da2c1f60..ec48839f61e1 100644 --- a/gcc/rtl.c +++ b/gcc/rtl.c @@ -111,7 +111,7 @@ const enum rtx_class rtx_class[NUM_RTX_CODE] = { const unsigned char rtx_code_size[NUM_RTX_CODE] = { #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) \ (((ENUM) == CONST_INT || (ENUM) == CONST_DOUBLE \ - || (ENUM) == CONST_FIXED || (ENUM) == ADDRESS) \ + || (ENUM) == CONST_FIXED) \ ? RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (HOST_WIDE_INT) \ : RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (rtunion)), diff --git a/gcc/rtl.def b/gcc/rtl.def index 83326b31f551..955e8e4709b6 100644 --- a/gcc/rtl.def +++ b/gcc/rtl.def @@ -110,7 +110,7 @@ DEF_RTL_EXPR(INSN_LIST, "insn_list", "ue", RTX_EXTRA) DEF_RTL_EXPR(SEQUENCE, "sequence", "E", RTX_EXTRA) /* Represents a non-global base address. This is only used in alias.c. */ -DEF_RTL_EXPR(ADDRESS, "address", "w", RTX_EXTRA) +DEF_RTL_EXPR(ADDRESS, "address", "i", RTX_EXTRA) /* ---------------------------------------------------------------------- Expression types used for things in the instruction chain. diff --git a/gcc/rtl.h b/gcc/rtl.h index 795a75f1a9c8..1da1792d1a31 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2597,7 +2597,7 @@ extern void init_alias_analysis (void); extern void end_alias_analysis (void); extern void vt_equate_reg_base_value (const_rtx, const_rtx); extern bool memory_modified_in_insn_p (const_rtx, const_rtx); -extern rtx find_base_term (rtx); +extern bool may_be_sp_based_p (rtx); extern rtx gen_hard_reg_clobber (enum machine_mode, unsigned int); extern rtx get_reg_known_value (unsigned int); extern bool get_reg_known_equiv_p (unsigned int); diff --git a/gcc/store-motion.c b/gcc/store-motion.c index 03b2c3d4c841..e00cb16d16f6 100644 --- a/gcc/store-motion.c +++ b/gcc/store-motion.c @@ -395,7 +395,7 @@ store_killed_in_pat (const_rtx x, const_rtx pat, int after) static bool store_killed_in_insn (const_rtx x, const_rtx x_regs, const_rtx insn, int after) { - const_rtx reg, base, note, pat; + const_rtx reg, note, pat; if (! NONDEBUG_INSN_P (insn)) return false; @@ -410,14 +410,8 @@ store_killed_in_insn (const_rtx x, const_rtx x_regs, const_rtx insn, int after) /* But even a const call reads its parameters. Check whether the base of some of registers used in mem is stack pointer. */ for (reg = x_regs; reg; reg = XEXP (reg, 1)) - { - base = find_base_term (XEXP (reg, 0)); - if (!base - || (GET_CODE (base) == ADDRESS - && GET_MODE (base) == Pmode - && XEXP (base, 0) == stack_pointer_rtx)) - return true; - } + if (may_be_sp_based_p (XEXP (reg, 0))) + return true; return false; }