diff options
author | Aditya Kumar <hiraditya@msn.com> | 2015-05-22 09:10:29 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-05-22 09:10:29 +0000 |
commit | 9dbe0d83c865375f99e776e82087e653b2214380 (patch) | |
tree | 49f4c33b182379b36c9044973b04b61fd288519f /gcc/gimple.h | |
parent | 476c12802dc41b7f425075e00181a9dc5968ac69 (diff) | |
download | gcc-9dbe0d83c865375f99e776e82087e653b2214380.zip gcc-9dbe0d83c865375f99e776e82087e653b2214380.tar.gz gcc-9dbe0d83c865375f99e776e82087e653b2214380.tar.bz2 |
gimple.h (gimple_expr_type): Refactor to make it concise.
2015-05-22 hiraditya <hiraditya@msn.com>
* gimple.h (gimple_expr_type): Refactor to make it concise.
Remove redundant if.
From-SVN: r223529
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r-- | gcc/gimple.h | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h index 95e4fc8..3a83e8f 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -5717,36 +5717,26 @@ static inline tree gimple_expr_type (const_gimple stmt) { enum gimple_code code = gimple_code (stmt); - - if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL) + /* In general we want to pass out a type that can be substituted + for both the RHS and the LHS types if there is a possibly + useless conversion involved. That means returning the + original RHS type as far as we can reconstruct it. */ + if (code == GIMPLE_CALL) { - tree type; - /* In general we want to pass out a type that can be substituted - for both the RHS and the LHS types if there is a possibly - useless conversion involved. That means returning the - original RHS type as far as we can reconstruct it. */ - if (code == GIMPLE_CALL) - { - const gcall *call_stmt = as_a <const gcall *> (stmt); - if (gimple_call_internal_p (call_stmt) - && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE) - type = TREE_TYPE (gimple_call_arg (call_stmt, 3)); - else - type = gimple_call_return_type (call_stmt); - } + const gcall *call_stmt = as_a <const gcall *> (stmt); + if (gimple_call_internal_p (call_stmt) + && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE) + return TREE_TYPE (gimple_call_arg (call_stmt, 3)); + else + return gimple_call_return_type (call_stmt); + } + else if (code == GIMPLE_ASSIGN) + { + if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) + return TREE_TYPE (gimple_assign_rhs1 (stmt)); else - switch (gimple_assign_rhs_code (stmt)) - { - case POINTER_PLUS_EXPR: - type = TREE_TYPE (gimple_assign_rhs1 (stmt)); - break; - - default: - /* As fallback use the type of the LHS. */ - type = TREE_TYPE (gimple_get_lhs (stmt)); - break; - } - return type; + /* As fallback use the type of the LHS. */ + return TREE_TYPE (gimple_get_lhs (stmt)); } else if (code == GIMPLE_COND) return boolean_type_node; |