[patch] Use COMPARISON_CLASS_P and its friends where appropriate.
Kazu Hirata
kazu@cs.umass.edu
Sun Apr 24 14:17:00 GMT 2005
Hi,
Attached is a patch to use COMPARISON_CLASS_P and its friends where
appropriate.
Tested on i686-pc-linux-gnu. Committed as obvious.
Kazu Hirata
2005-04-24 Kazu Hirata <kazu@cs.umass.edu>
* tree-ssa-copy.c (copy_prop_visit_cond_stmt): Use
COMPARISON_CLASS_P.
* tree-ssa-pre.c (create_value_expr_from): Use
CONSTANT_CLASS_P and REFERENCE_CLASS_P.
* tree-ssa-propagate.c (stmt_makes_single_load,
stmt_makes_single_store): Use REFERENCE_CLASS_P.
* tree-vect-transform.c (vect_is_simple_cond): Use
COMPARISON_CLASS_P.
* tree-vrp.c (extract_range_from_assert,
build_assert_expr_for, fp_predicate, has_assert_expr): Use
COMPARISON_CLASS_P.
Index: tree-ssa-copy.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-copy.c,v
retrieving revision 2.27
diff -u -d -p -r2.27 tree-ssa-copy.c
--- tree-ssa-copy.c 19 Apr 2005 11:43:24 -0000 2.27
+++ tree-ssa-copy.c 24 Apr 2005 14:03:50 -0000
@@ -604,7 +604,7 @@ copy_prop_visit_cond_stmt (tree stmt, ed
/* The only conditionals that we may be able to compute statically
are predicates involving at least one SSA_NAME. */
- if (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison
+ if (COMPARISON_CLASS_P (cond)
&& NUM_USES (uses) >= 1)
{
unsigned i;
Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-pre.c,v
retrieving revision 2.80
diff -u -d -p -r2.80 tree-ssa-pre.c
--- tree-ssa-pre.c 21 Apr 2005 18:05:27 -0000 2.80
+++ tree-ssa-pre.c 24 Apr 2005 14:03:51 -0000
@@ -1851,7 +1851,7 @@ create_value_expr_from (tree expr, basic
/* If OP is a constant that has overflowed, do not value number
this expression. */
- if (TREE_CODE_CLASS (TREE_CODE (op)) == tcc_constant
+ if (CONSTANT_CLASS_P (op)
&& TREE_OVERFLOW (op))
{
pool_free (pool, vexpr);
@@ -1859,7 +1859,7 @@ create_value_expr_from (tree expr, basic
}
/* Recursively value-numberize reference ops */
- if (TREE_CODE_CLASS (TREE_CODE (op)) == tcc_reference)
+ if (REFERENCE_CLASS_P (op))
{
tree tempop = create_value_expr_from (op, block, vuses);
op = tempop ? tempop : op;
Index: tree-ssa-propagate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-propagate.c,v
retrieving revision 2.14
diff -u -d -p -r2.14 tree-ssa-propagate.c
--- tree-ssa-propagate.c 21 Apr 2005 09:17:29 -0000 2.14
+++ tree-ssa-propagate.c 24 Apr 2005 14:03:52 -0000
@@ -709,7 +709,7 @@ stmt_makes_single_load (tree stmt)
return (!TREE_THIS_VOLATILE (rhs)
&& (DECL_P (rhs)
- || TREE_CODE_CLASS (TREE_CODE (rhs)) == tcc_reference));
+ || REFERENCE_CLASS_P (rhs)));
}
@@ -735,7 +735,7 @@ stmt_makes_single_store (tree stmt)
return (!TREE_THIS_VOLATILE (lhs)
&& (DECL_P (lhs)
- || TREE_CODE_CLASS (TREE_CODE (lhs)) == tcc_reference));
+ || REFERENCE_CLASS_P (lhs)));
}
Index: tree-vect-transform.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vect-transform.c,v
retrieving revision 2.16
diff -u -d -p -r2.16 tree-vect-transform.c
--- tree-vect-transform.c 23 Apr 2005 00:59:31 -0000 2.16
+++ tree-vect-transform.c 24 Apr 2005 14:03:54 -0000
@@ -1151,7 +1151,7 @@ vect_is_simple_cond (tree cond, loop_vec
{
tree lhs, rhs;
- if (TREE_CODE_CLASS (TREE_CODE (cond)) != tcc_comparison)
+ if (!COMPARISON_CLASS_P (cond))
return false;
lhs = TREE_OPERAND (cond, 0);
Index: tree-vrp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vrp.c,v
retrieving revision 2.12
diff -u -d -p -r2.12 tree-vrp.c
--- tree-vrp.c 23 Apr 2005 02:01:53 -0000 2.12
+++ tree-vrp.c 24 Apr 2005 14:03:55 -0000
@@ -481,7 +481,7 @@ extract_range_from_assert (value_range *
var = ASSERT_EXPR_VAR (expr);
cond = ASSERT_EXPR_COND (expr);
- gcc_assert (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison);
+ gcc_assert (COMPARISON_CLASS_P (cond));
/* Find VAR in the ASSERT_EXPR conditional. */
limit = get_opposite_operand (cond, var);
@@ -1228,7 +1228,7 @@ build_assert_expr_for (tree cond, tree v
gcc_assert (TREE_CODE (v) == SSA_NAME);
n = duplicate_ssa_name (v, NULL_TREE);
- if (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison)
+ if (COMPARISON_CLASS_P (cond))
{
/* Build N = ASSERT_EXPR <V, COND>. As a special case, if the
conditional is an EQ_EXPR (V == Z), just build the assignment
@@ -1276,8 +1276,8 @@ build_assert_expr_for (tree cond, tree v
static inline bool
fp_predicate (tree expr)
{
- return TREE_CODE_CLASS (TREE_CODE (expr)) == tcc_comparison
- && FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0)));
+ return (COMPARISON_CLASS_P (expr)
+ && FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0))));
}
@@ -1335,7 +1335,7 @@ has_assert_expr (tree op, tree cond)
tree t1, t2;
/* If COND is not a comparison predicate, something is wrong. */
- gcc_assert (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison);
+ gcc_assert (COMPARISON_CLASS_P (cond));
/* Note that we only need to compare against one of the operands
of OTHER_COND.
More information about the Gcc-patches
mailing list