aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range.h
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2020-11-13 13:56:01 -0500
committerAndrew MacLeod <amacleod@redhat.com>2020-11-13 13:59:44 -0500
commitfcbb6018abaf04d30e2cf6fff2eb35115412cdd5 (patch)
treec727a4cb985b90cfcb860d5e8a09f54615a1bd45 /gcc/gimple-range.h
parent84096498a7bd788599d4a7ca63543fc7c297645e (diff)
downloadgcc-fcbb6018abaf04d30e2cf6fff2eb35115412cdd5.zip
gcc-fcbb6018abaf04d30e2cf6fff2eb35115412cdd5.tar.gz
gcc-fcbb6018abaf04d30e2cf6fff2eb35115412cdd5.tar.bz2
Re: Fix gimple_expr_code?
have gimple_expr_code return the correct code for GIMPLE_ASSIGN. use gassign and gcond in gimple_range_handler. * gimple-range.h (gimple_range_handler): Cast to gimple stmt kinds before asking for code and type. * gimple.h (gimple_expr_code): Call gassign and gcond routines to get their expr_code.
Diffstat (limited to 'gcc/gimple-range.h')
-rw-r--r--gcc/gimple-range.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/gimple-range.h b/gcc/gimple-range.h
index dde41e9..92bb530 100644
--- a/gcc/gimple-range.h
+++ b/gcc/gimple-range.h
@@ -97,12 +97,12 @@ extern bool gimple_range_calc_op2 (irange &r, const gimple *s,
static inline range_operator *
gimple_range_handler (const gimple *s)
{
- if (gimple_code (s) == GIMPLE_ASSIGN)
- return range_op_handler (gimple_assign_rhs_code (s),
- TREE_TYPE (gimple_assign_lhs (s)));
- if (gimple_code (s) == GIMPLE_COND)
- return range_op_handler (gimple_cond_code (s),
- TREE_TYPE (gimple_cond_lhs (s)));
+ if (const gassign *ass = dyn_cast<const gassign *> (s))
+ return range_op_handler (gimple_assign_rhs_code (ass),
+ TREE_TYPE (gimple_assign_lhs (ass)));
+ if (const gcond *cond = dyn_cast<const gcond *> (s))
+ return range_op_handler (gimple_cond_code (cond),
+ TREE_TYPE (gimple_cond_lhs (cond)));
return NULL;
}