aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-09-24 13:38:29 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-09-24 11:38:29 +0000
commit90acd49f6ba247e4549224c2178910aee95a2617 (patch)
treef15a675e455fcdce2a341e15074a7799dfe078a6 /gcc/tree-ssa-forwprop.c
parent231f75463c25e2a27c21c19f31bfbda421e12f49 (diff)
downloadgcc-90acd49f6ba247e4549224c2178910aee95a2617.zip
gcc-90acd49f6ba247e4549224c2178910aee95a2617.tar.gz
gcc-90acd49f6ba247e4549224c2178910aee95a2617.tar.bz2
Use more switch statements.
2019-09-24 Martin Liska <mliska@suse.cz> * cfgexpand.c (gimple_assign_rhs_to_tree): Use switch statement instead of if-elseif-elseif-... * gimple-expr.c (extract_ops_from_tree): Likewise. * gimple.c (get_gimple_rhs_num_ops): Likewise. * tree-ssa-forwprop.c (rhs_to_tree): Likewise. From-SVN: r276095
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index c464c89..221f140 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -347,19 +347,22 @@ rhs_to_tree (tree type, gimple *stmt)
{
location_t loc = gimple_location (stmt);
enum tree_code code = gimple_assign_rhs_code (stmt);
- if (get_gimple_rhs_class (code) == GIMPLE_TERNARY_RHS)
- return fold_build3_loc (loc, code, type, gimple_assign_rhs1 (stmt),
- gimple_assign_rhs2 (stmt),
- gimple_assign_rhs3 (stmt));
- else if (get_gimple_rhs_class (code) == GIMPLE_BINARY_RHS)
- return fold_build2_loc (loc, code, type, gimple_assign_rhs1 (stmt),
- gimple_assign_rhs2 (stmt));
- else if (get_gimple_rhs_class (code) == GIMPLE_UNARY_RHS)
- return build1 (code, type, gimple_assign_rhs1 (stmt));
- else if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
- return gimple_assign_rhs1 (stmt);
- else
- gcc_unreachable ();
+ switch (get_gimple_rhs_class (code))
+ {
+ case GIMPLE_TERNARY_RHS:
+ return fold_build3_loc (loc, code, type, gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt),
+ gimple_assign_rhs3 (stmt));
+ case GIMPLE_BINARY_RHS:
+ return fold_build2_loc (loc, code, type, gimple_assign_rhs1 (stmt),
+ gimple_assign_rhs2 (stmt));
+ case GIMPLE_UNARY_RHS:
+ return build1 (code, type, gimple_assign_rhs1 (stmt));
+ case GIMPLE_SINGLE_RHS:
+ return gimple_assign_rhs1 (stmt);
+ default:
+ gcc_unreachable ();
+ }
}
/* Combine OP0 CODE OP1 in the context of a COND_EXPR. Returns