From: Richard Biener Date: Fri, 13 Nov 2020 10:33:22 +0000 (+0100) Subject: remove almost all users of gimple_expr_code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4852c3266ec0887316b9fbbb106b8540e3e948d6;p=gcc.git 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 * 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. --- diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index b2d86859b39..1b7bdbc15be 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 47148fbd14f..ee84c8bb194 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 d5423a7e9b2..b755d7ec847 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 361c4019eec..3acbb86b75f 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 7361e0b8c1b..a4879fe1b7f 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)