summaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-10-29 14:06:31 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2014-10-29 14:06:31 -0400
commit6929530c31ab3090b77ba9ee1e6c1c26ffe6ce27 (patch)
treefc84ad26abd7c532e060374a16d277169b6777c2 /gcc/gimple.c
parent1ec4ecdc58006a4343068334a386596fda09c361 (diff)
downloadgcc-6929530c31ab3090b77ba9ee1e6c1c26ffe6ce27.tar.gz
Introduce gpredict subclass and use it for all gimple_predict_ accessors
gcc/ChangeLog.gimple-classes: * coretypes.h (struct gpredict): Add forward declaration. * doc/gimple.texi (Class hierarchy of GIMPLE statements): Add gpredict. * gimple-pretty-print.c (pp_gimple_stmt_1): Within case GIMPLE_PREDICT, add local "predict_stmt" via a checked cast and use it in place of "stmt". * gimple.c (gimple_build_predict): Strengthen return type and local "p" from gimple to gpredict *. * gimple.h (struct gpredict): New subclass of gimple_statement_base, adding invariant that code is GIMPLE_PREDICT. (is_a_helper <gpredict *>::test): New. (gimple_build_predict): Strengthen return type from gimple to gpredict *. (gimple_predict_predictor): Strengthen param from const_gimple to const gpredict *. (gimple_predict_outcome): Likewise. (gimple_predict_set_predictor): Strengthen param from gimple to gpredict *. (gimple_predict_set_outcome): Likewise. * predict.c (tree_bb_level_predictions): Convert check for GIMPLE_PREDICT to a dyn_cast, introducing local "predict_stmt" and using it in place of "stmt" for typesafety.
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r--gcc/gimple.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 1421afe1c37..b58c9db800b 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1136,10 +1136,10 @@ gimple_build_transaction (gimple_seq body, tree label)
/* Build a GIMPLE_PREDICT statement. PREDICT is one of the predictors from
predict.def, OUTCOME is NOT_TAKEN or TAKEN. */
-gimple
+gpredict *
gimple_build_predict (enum br_predictor predictor, enum prediction outcome)
{
- gimple p = gimple_alloc (GIMPLE_PREDICT, 0);
+ gpredict *p = as_a <gpredict *> (gimple_alloc (GIMPLE_PREDICT, 0));
/* Ensure all the predictors fit into the lower bits of the subcode. */
gcc_assert ((int) END_PREDICTORS <= GF_PREDICT_TAKEN);
gimple_predict_set_predictor (p, predictor);