+2004-06-29 Diego Novillo <dnovillo@redhat.com>
+
+ * 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 <ebotcazou@libertysurf.fr>
RTL prologue/epilogue for SPARC
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);
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)
/* 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))
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;
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
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);
/* 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 ();
}