From 6df11ca1befd286661b26a6a2a6774f4d4aa483c Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Mon, 27 Feb 2006 17:25:17 +0000 Subject: [PATCH] tree-ssa-structalias.c (get_constraint_for): Move code to deal with aggregates here. 2006-02-27 Daniel Berlin * tree-ssa-structalias.c (get_constraint_for): Move code to deal with aggregates here. (find_func_aliases): Remove code for & from here. From-SVN: r111487 --- gcc/ChangeLog | 6 ++++ gcc/tree-ssa-structalias.c | 73 ++++++++++++-------------------------- 2 files changed, 29 insertions(+), 50 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d54a48f6442..ca154bdd1fe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-02-27 Daniel Berlin + + * tree-ssa-structalias.c (get_constraint_for): Move code to deal + with aggregates here. + (find_func_aliases): Remove code for & from here. + 2006-02-26 Roger Sayle * fold-const.c (fold_binary) : Fold (~X & C) eq/ne 0 as diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 5d84f13fe60..79d4f90b1af 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -2484,6 +2484,7 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results) struct constraint_expr *c; unsigned int i; tree exp = TREE_OPERAND (t, 0); + tree pttype = TREE_TYPE (TREE_TYPE (t)); get_constraint_for (exp, results); /* Make sure we capture constraints to all elements @@ -2507,6 +2508,26 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results) VEC_safe_push (ce_s, heap, *results, &tmp); } } + else if (VEC_length (ce_s, *results) == 1 + && (AGGREGATE_TYPE_P (pttype) + || TREE_CODE (pttype) == COMPLEX_TYPE)) + { + struct constraint_expr *origrhs; + varinfo_t origvar; + struct constraint_expr tmp; + + gcc_assert (VEC_length (ce_s, *results) == 1); + origrhs = VEC_last (ce_s, *results); + tmp = *origrhs; + VEC_pop (ce_s, *results); + origvar = get_varinfo (origrhs->var); + for (; origvar; origvar = origvar->next) + { + tmp.var = origvar->id; + VEC_safe_push (ce_s, heap, *results, &tmp); + } + } + for (i = 0; VEC_iterate (ce_s, *results, i, c); i++) { if (c->type == DEREF) @@ -3220,10 +3241,11 @@ find_func_aliases (tree origt) /* Now build constraints expressions. */ if (TREE_CODE (t) == PHI_NODE) { + gcc_assert (!AGGREGATE_TYPE_P (TREE_TYPE (PHI_RESULT (t)))); + /* Only care about pointers and structures containing pointers. */ if (POINTER_TYPE_P (TREE_TYPE (PHI_RESULT (t))) - || AGGREGATE_TYPE_P (TREE_TYPE (PHI_RESULT (t))) || TREE_CODE (TREE_TYPE (PHI_RESULT (t))) == COMPLEX_TYPE) { int i; @@ -3241,27 +3263,6 @@ find_func_aliases (tree origt) rhstype = TREE_TYPE (strippedrhs); get_constraint_for (PHI_ARG_DEF (t, i), &rhsc); - if (TREE_CODE (strippedrhs) == ADDR_EXPR - && (AGGREGATE_TYPE_P (TREE_TYPE (rhstype)) - || TREE_CODE (TREE_TYPE (rhstype)) == COMPLEX_TYPE) - && VEC_length (ce_s, rhsc) == 1) - { - struct constraint_expr *origrhs; - varinfo_t origvar; - struct constraint_expr tmp; - - gcc_assert (VEC_length (ce_s, rhsc) == 1); - origrhs = VEC_last (ce_s, rhsc); - tmp = *origrhs; - VEC_pop (ce_s, rhsc); - origvar = get_varinfo (origrhs->var); - for (; origvar; origvar = origvar->next) - { - tmp.var = origvar->id; - VEC_safe_push (ce_s, heap, rhsc, &tmp); - } - } - for (j = 0; VEC_iterate (ce_s, lhsc, j, c); j++) { struct constraint_expr *c2; @@ -3413,36 +3414,8 @@ find_func_aliases (tree origt) case tcc_unary: { unsigned int j; - tree strippedrhs = rhsop; - tree rhstype; - /* XXX: Push this back into the ADDR_EXPR - case, and remove anyoffset handling. */ - STRIP_NOPS (strippedrhs); - rhstype = TREE_TYPE (strippedrhs); - get_constraint_for (rhsop, &rhsc); - if (TREE_CODE (strippedrhs) == ADDR_EXPR - && (AGGREGATE_TYPE_P (TREE_TYPE (rhstype)) - || TREE_CODE (TREE_TYPE (rhstype)) == COMPLEX_TYPE) - && VEC_length (ce_s, rhsc) == 1) - { - struct constraint_expr *origrhs; - varinfo_t origvar; - struct constraint_expr tmp; - - gcc_assert (VEC_length (ce_s, rhsc) == 1); - origrhs = VEC_last (ce_s, rhsc); - tmp = *origrhs; - VEC_pop (ce_s, rhsc); - origvar = get_varinfo (origrhs->var); - for (; origvar; origvar = origvar->next) - { - tmp.var = origvar->id; - VEC_safe_push (ce_s, heap, rhsc, &tmp); - } - } - for (j = 0; VEC_iterate (ce_s, lhsc, j, c); j++) { struct constraint_expr *c2;