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.
This commit is contained in:
parent
8299083667
commit
4852c3266e
5 changed files with 12 additions and 23 deletions
|
@ -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. */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue