From bddeccfe5d319972ef8dbf23b97870969654e8b1 Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Wed, 30 Jun 2004 11:06:28 +0000 Subject: [PATCH] tree-ssa-pre.c (phi_trans_add): Use is_gimple_min_invariant to check for constants. * tree-ssa-pre.c (phi_trans_add): Use is_gimple_min_invariant to check for constants. (set_remove): Likewise. (value_replace_in_set): Likewise. (find_leader): Likewise. * tree-vn.c (set_value_handle): Likewise. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. From-SVN: r83902 --- gcc/ChangeLog | 11 +++++++++++ gcc/tree-ssa-pre.c | 36 +++++++----------------------------- gcc/tree-vn.c | 12 +++++++----- 3 files changed, 25 insertions(+), 34 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b680a35e861..3d74a3c520f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2004-06-29 Diego Novillo + + * tree-ssa-pre.c (phi_trans_add): Use is_gimple_min_invariant + to check for constants. + (set_remove): Likewise. + (value_replace_in_set): Likewise. + (find_leader): Likewise. + * tree-vn.c (set_value_handle): Likewise. + (vn_lookup): Likewise. + (vn_lookup_or_add): Likewise. + 2004-06-30 Eric Botcazou RTL prologue/epilogue for SPARC diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index e9d888a684b..712c3464078 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -393,20 +393,9 @@ phi_trans_add (tree e, tree v, basic_block pred) void add_to_value (tree v, tree e) { - /* For values representing non-CST nodes, but still function - invariant things we mark TREE_CONSTANT as true and set the tree - chain to the actual constant. This is because unlike values - involving expressions, which are only available to use where the - expressions are live, a function invariant can be remade - anywhere, and thus, is available everywhere, just like a constant. */ - if (TREE_CODE_CLASS (TREE_CODE (v)) == 'c') + /* Constants have no expression sets. */ + if (is_gimple_min_invariant (v)) return; - else if (is_gimple_min_invariant (v)) - { - TREE_CONSTANT (v) = true; - TREE_CHAIN (v) = e; - return; - } if (VALUE_HANDLE_EXPR_SET (v) == NULL) VALUE_HANDLE_EXPR_SET (v) = set_new (false); @@ -565,14 +554,8 @@ set_remove (value_set_t set, tree expr) static bool set_contains_value (value_set_t set, tree val) { - /* All true constants are in every set. */ - if (TREE_CODE_CLASS (TREE_CODE (val)) == 'c') - return true; - /* This is only referring to the flag above that we set on - values referring to invariants, because we know that we - are dealing with one of the value handles we created. */ - - if (TREE_CONSTANT (val)) + /* All constants are in every set. */ + if (is_gimple_min_invariant (val)) return true; if (set->length == 0) @@ -679,7 +662,7 @@ value_insert_into_set (value_set_t set, tree expr) /* Constant and invariant values exist everywhere, and thus, actually keeping them in the sets is pointless. */ - if (TREE_CONSTANT (val)) + if (is_gimple_min_invariant (val)) return; if (!set_contains_value (set, val)) @@ -880,15 +863,10 @@ find_leader (value_set_t set, tree val) if (val == NULL) return NULL; - /* True constants represent themselves. */ - if (TREE_CODE_CLASS (TREE_CODE (val)) == 'c') + /* Constants represent themselves. */ + if (is_gimple_min_invariant (val)) return val; - /* Invariants are still represented by values, since they may be - more than a single _CST node. */ - if (TREE_CONSTANT (val)) - return TREE_CHAIN (val); - if (set->length == 0) return NULL; diff --git a/gcc/tree-vn.c b/gcc/tree-vn.c index d83f75c3a61..b686af296af 100644 --- a/gcc/tree-vn.c +++ b/gcc/tree-vn.c @@ -168,7 +168,7 @@ set_value_handle (tree e, tree v) SSA_NAME_VALUE (e) = v; else if (EXPR_P (e) || DECL_P (e)) get_tree_ann (e)->common.value_handle = v; - else if (TREE_CODE_CLASS (TREE_CODE (e)) == 'c') + else if (is_gimple_min_invariant (e)) /* Do nothing. Constants are their own value handles. */ ; else @@ -214,8 +214,10 @@ vn_lookup (tree expr, vuse_optype vuses) void **slot; struct val_expr_pair_d vep = {NULL, NULL, NULL, 0}; - if (TREE_CODE_CLASS (TREE_CODE (expr)) == 'c') + /* Constants are their own value. */ + if (is_gimple_min_invariant (expr)) return expr; + vep.e = expr; vep.vuses = vuses; vep.hashcode = vn_compute (expr, 0, vuses); @@ -261,20 +263,20 @@ vn_lookup_or_add (tree expr, vuse_optype vuses) /* Get the value handle of EXPR. This is the only correct way to get the value handle for a "thing". If EXPR does not have a value - handle associated, it generates and returns a new one. */ + handle associated, it returns NULL_TREE. */ tree get_value_handle (tree expr) { if (TREE_CODE (expr) == SSA_NAME) return SSA_NAME_VALUE (expr); - else if (TREE_CODE_CLASS (TREE_CODE (expr)) == 'c') - return expr; else if (EXPR_P (expr) || DECL_P (expr)) { tree_ann_t ann = tree_ann (expr); return ((ann) ? ann->common.value_handle : NULL_TREE); } + else if (is_gimple_min_invariant (expr)) + return expr; abort (); } -- 2.30.2