]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
remove almost all users of gimple_expr_code
authorRichard Biener <rguenther@suse.de>
Fri, 13 Nov 2020 10:33:22 +0000 (11:33 +0100)
committerRichard Biener <rguenther@suse.de>
Fri, 13 Nov 2020 10:35:01 +0000 (11:35 +0100)
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.

gcc/cfgexpand.c
gcc/gimplify-me.c
gcc/ipa-icf-gimple.c
gcc/predict.c
gcc/tree-ssa-tail-merge.c

index b2d86859b3922e61d78a6b7e5944958de8c8daa5..1b7bdbc15be0711575ed486cdebae707c5efc2a2 100644 (file)
@@ -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.  */
index 47148fbd14fc27e0807c781a39b204af331e9c96..ee84c8bb194e3ec8c2a45f02712ae1729a697b58 100644 (file)
@@ -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);
index d5423a7e9b21afe5b0b5f70c145772bd6a52bc17..b755d7ec847a78038bb4df19774f647b2e23c8c3 100644 (file)
@@ -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;
index 361c4019eec0b9526027bd348b59e0a32ca30a54..3acbb86b75f99cb5e4d53955122fe0da77963334 100644 (file)
@@ -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)
index 7361e0b8c1b92aaf16842a92e37c1be483a9d0f9..a4879fe1b7f01fbd895d79f885512afb638ec5d5 100644 (file)
@@ -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)