aboutsummaryrefslogtreecommitdiff
path: root/gcc/alias.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2011-12-31 20:02:48 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2011-12-31 20:02:48 +0000
commit6f2ffb4b99ccfb64adc0edc9998329ee9de32eff (patch)
tree3e772ea68b4b52431218cb73789aabb374b906b9 /gcc/alias.c
parent32210fd616cd79ae540b9731e7efa9288ccc0b87 (diff)
downloadgcc-6f2ffb4b99ccfb64adc0edc9998329ee9de32eff.zip
gcc-6f2ffb4b99ccfb64adc0edc9998329ee9de32eff.tar.gz
gcc-6f2ffb4b99ccfb64adc0edc9998329ee9de32eff.tar.bz2
cselib.h (cselib_add_permanent_equiv): Declare.
* cselib.h (cselib_add_permanent_equiv): Declare. (canonical_cselib_val): New. * cselib.c (new_elt_loc_list): Rework to support value equivalences. Adjust all callers. (preserve_only_constants): Retain value equivalences. (references_value_p): Retain preserved values. (rtx_equal_for_cselib_1): Handle value equivalences. (cselib_invalidate_regno): Use canonical value. (cselib_add_permanent_equiv): New. * alias.c (find_base_term): Reset locs lists while recursing. * var-tracking.c (val_bind): New. Don't add equivalences present in cselib table, compared with code moved from... (val_store): ... here. (val_resolve): Use val_bind. (VAL_EXPR_HAS_REVERSE): Drop. (add_uses): Do not create MOps for addresses. Do not mark non-REG non-MEM expressions as requiring resolution. (reverse_op): Record reverse as a cselib equivalence. (add_stores): Use it. Do not create MOps for addresses. Do not require resolution for non-REG non-MEM expressions. Simplify support for reverse operations. (compute_bb_dataflow): Drop reverse support. (emit_notes_in_bb): Likewise. (create_entry_value): Rename to... (record_entry_value): ... this. Use cselib equivalences. (vt_add_function_parameter): Adjust. From-SVN: r182760
Diffstat (limited to 'gcc/alias.c')
-rw-r--r--gcc/alias.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/gcc/alias.c b/gcc/alias.c
index ef624a1..37c3fa0 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -1542,7 +1542,8 @@ rtx
find_base_term (rtx x)
{
cselib_val *val;
- struct elt_loc_list *l;
+ struct elt_loc_list *l, *f;
+ rtx ret;
#if defined (FIND_BASE_TERM)
/* Try machine-dependent ways to find the base term. */
@@ -1591,12 +1592,26 @@ find_base_term (rtx x)
case VALUE:
val = CSELIB_VAL_PTR (x);
+ ret = NULL_RTX;
+
if (!val)
- return 0;
- for (l = val->locs; l; l = l->next)
- if ((x = find_base_term (l->loc)) != 0)
- return x;
- return 0;
+ return ret;
+
+ f = val->locs;
+ /* Temporarily reset val->locs to avoid infinite recursion. */
+ val->locs = NULL;
+
+ for (l = f; l; l = l->next)
+ if (GET_CODE (l->loc) == VALUE
+ && CSELIB_VAL_PTR (l->loc)->locs
+ && !CSELIB_VAL_PTR (l->loc)->locs->next
+ && CSELIB_VAL_PTR (l->loc)->locs->loc == x)
+ continue;
+ else if ((ret = find_base_term (l->loc)) != 0)
+ break;
+
+ val->locs = f;
+ return ret;
case LO_SUM:
/* The standard form is (lo_sum reg sym) so look only at the