aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-11-13 11:33:22 +0100
committerRichard Biener <rguenther@suse.de>2020-11-13 11:35:01 +0100
commit4852c3266ec0887316b9fbbb106b8540e3e948d6 (patch)
treedd05735207cada3ebd0d71d889e99d03a85c0267
parent82990836679f1972141a2f93666bd6d39323a435 (diff)
downloadgcc-4852c3266ec0887316b9fbbb106b8540e3e948d6.zip
gcc-4852c3266ec0887316b9fbbb106b8540e3e948d6.tar.gz
gcc-4852c3266ec0887316b9fbbb106b8540e3e948d6.tar.bz2
remove almost all users of gimple_expr_code
This replaces the old-school gimple_expr_code with more selective functions throughout the compiler, in all cases making the code shorter or more clear. 2020-11-13 Richard Biener <rguenther@suse.de> * cfgexpand.c (gimple_assign_rhs_to_tree): Use gimple_assign_rhs_class. (expand_gimple_stmt_1): Likewise. * gimplify-me.c (gimple_regimplify_operands): Use gimple_assign_single_p. * ipa-icf-gimple.c (func_checker::compare_gimple_assign): Remove redundant compare. (func_checker::compare_gimple_cond): Use gimple_cond_code. * tree-ssa-tail-merge.c (gimple_equal_p): Likewise. * predict.c (predict_loops): Use gimple_assign_rhs_code.
-rw-r--r--gcc/cfgexpand.c7
-rw-r--r--gcc/gimplify-me.c12
-rw-r--r--gcc/ipa-icf-gimple.c10
-rw-r--r--gcc/predict.c2
-rw-r--r--gcc/tree-ssa-tail-merge.c4
5 files changed, 12 insertions, 23 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index b2d8685..1b7bdbc 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -103,7 +103,7 @@ tree
gimple_assign_rhs_to_tree (gimple *stmt)
{
tree t;
- switch (get_gimple_rhs_class (gimple_expr_code (stmt)))
+ switch (gimple_assign_rhs_class (stmt))
{
case GIMPLE_TERNARY_RHS:
t = build3 (gimple_assign_rhs_code (stmt),
@@ -3741,11 +3741,10 @@ expand_gimple_stmt_1 (gimple *stmt)
of binary assigns must be a gimple reg. */
if (TREE_CODE (lhs) != SSA_NAME
- || get_gimple_rhs_class (gimple_expr_code (stmt))
- == GIMPLE_SINGLE_RHS)
+ || gimple_assign_rhs_class (assign_stmt) == GIMPLE_SINGLE_RHS)
{
tree rhs = gimple_assign_rhs1 (assign_stmt);
- gcc_assert (get_gimple_rhs_class (gimple_expr_code (stmt))
+ gcc_assert (gimple_assign_rhs_class (assign_stmt)
== GIMPLE_SINGLE_RHS);
if (gimple_has_location (stmt) && CAN_HAVE_LOCATION_P (rhs)
/* Do not put locations on possibly shared trees. */
diff --git a/gcc/gimplify-me.c b/gcc/gimplify-me.c
index 47148fb..ee84c8b 100644
--- a/gcc/gimplify-me.c
+++ b/gcc/gimplify-me.c
@@ -230,10 +230,8 @@ gimple_regimplify_operands (gimple *stmt, gimple_stmt_iterator *gsi_p)
if (i == 1 && (is_gimple_call (stmt) || is_gimple_assign (stmt)))
gimplify_expr (&op, &pre, NULL, is_gimple_lvalue, fb_lvalue);
else if (i == 2
- && is_gimple_assign (stmt)
- && num_ops == 2
- && get_gimple_rhs_class (gimple_expr_code (stmt))
- == GIMPLE_SINGLE_RHS)
+ && gimple_assign_single_p (stmt)
+ && num_ops == 2)
gimplify_expr (&op, &pre, NULL,
rhs_predicate_for (gimple_assign_lhs (stmt)),
fb_rvalue);
@@ -255,10 +253,8 @@ gimple_regimplify_operands (gimple *stmt, gimple_stmt_iterator *gsi_p)
{
bool need_temp = false;
- if (is_gimple_assign (stmt)
- && num_ops == 2
- && get_gimple_rhs_class (gimple_expr_code (stmt))
- == GIMPLE_SINGLE_RHS)
+ if (gimple_assign_single_p (stmt)
+ && num_ops == 2)
gimplify_expr (gimple_assign_rhs1_ptr (stmt), &pre, NULL,
rhs_predicate_for (gimple_assign_lhs (stmt)),
fb_rvalue);
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index d5423a7..b755d7e 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -610,12 +610,6 @@ func_checker::compare_gimple_assign (gimple *s1, gimple *s2)
tree_code code1, code2;
unsigned i;
- code1 = gimple_expr_code (s1);
- code2 = gimple_expr_code (s2);
-
- if (code1 != code2)
- return false;
-
code1 = gimple_assign_rhs_code (s1);
code2 = gimple_assign_rhs_code (s2);
@@ -652,8 +646,8 @@ func_checker::compare_gimple_cond (gimple *s1, gimple *s2)
tree t1, t2;
tree_code code1, code2;
- code1 = gimple_expr_code (s1);
- code2 = gimple_expr_code (s2);
+ code1 = gimple_cond_code (s1);
+ code2 = gimple_cond_code (s2);
if (code1 != code2)
return false;
diff --git a/gcc/predict.c b/gcc/predict.c
index 361c401..3acbb86 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2204,7 +2204,7 @@ predict_loops (void)
{
gimple *call_stmt = SSA_NAME_DEF_STMT (gimple_cond_lhs (stmt));
if (gimple_code (call_stmt) == GIMPLE_ASSIGN
- && gimple_expr_code (call_stmt) == NOP_EXPR
+ && CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (call_stmt))
&& TREE_CODE (gimple_assign_rhs1 (call_stmt)) == SSA_NAME)
call_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (call_stmt));
if (gimple_call_internal_p (call_stmt, IFN_BUILTIN_EXPECT)
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index 7361e0b..a4879fe 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -1189,8 +1189,8 @@ gimple_equal_p (same_succ *same_succ, gimple *s1, gimple *s2)
if (!gimple_operand_equal_value_p (t1, t2))
return false;
- code1 = gimple_expr_code (s1);
- code2 = gimple_expr_code (s2);
+ code1 = gimple_cond_code (s1);
+ code2 = gimple_cond_code (s2);
inv_cond = (bitmap_bit_p (same_succ->inverse, bb1->index)
!= bitmap_bit_p (same_succ->inverse, bb2->index));
if (inv_cond)