gcc/ChangeLog.gimple-classes: * doc/gimple.texi (Class hierarchy of GIMPLE statements): Update for renaming of gimple_statement_wce to gwce. * gimple-walk.c (walk_gimple_stmt): Add checked cast to gwce * within case GIMPLE_WITH_CLEANUP_EXPR. * gimple.c (gimple_build_wce): Strengthen return type and local "p" from gimple to gwce *. (gimple_copy): Add checked casts to gwce * within case GIMPLE_WITH_CLEANUP_EXPR. * gimple.h (struct gimple_statement_wce): Rename to... (struct gwce): ...this. (is_a_helper <gimple_statement_wce *>::test): Rename to... (is_a_helper <gwce *>::test): ...this. (gimple_build_wce): Strengthen return type from gimple to gwce *. (gimple_wce_cleanup_ptr): Strengthen param from gimple to gwce *. (gimple_wce_cleanup): Likewise. (gimple_wce_set_cleanup): Likewise. (gimple_wce_cleanup_eh_only): Strengthen param from const_gimple to const gwce *. (gimple_wce_set_cleanup_eh_only): Strengthen param from gimple to gwce *. * gimplify.c (gimplify_cleanup_point_expr): Replace check against GIMPLE_WITH_CLEANUP_EXPR with a dyn_cast <gwce *>, strengthening local "wce" from gimple to gwce *. (gimple_push_cleanup): Strengthen local "wce" from gimple to gwce *. * gsstruct.def (GSS_WCE): Update for renaming of gimple_statement_wce to gwce. * tree-inline.c (remap_gimple_stmt): Add checked cast to gwce * within case GIMPLE_WITH_CLEANUP_EXPR. --- gcc/ChangeLog.gimple-classes | 32 ++++++++++++++++++++++++++++++++ gcc/doc/gimple.texi | 2 +- gcc/gimple-walk.c | 5 +++-- gcc/gimple.c | 8 ++++---- gcc/gimple.h | 25 +++++++++++-------------- gcc/gimplify.c | 6 +++--- gcc/gsstruct.def | 2 +- gcc/tree-inline.c | 3 ++- 8 files changed, 57 insertions(+), 26 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 133965c..b7a62de 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,37 @@ 2014-10-28 David Malcolm <dmalc...@redhat.com> + * doc/gimple.texi (Class hierarchy of GIMPLE statements): Update + for renaming of gimple_statement_wce to gwce. + * gimple-walk.c (walk_gimple_stmt): Add checked cast to gwce * + within case GIMPLE_WITH_CLEANUP_EXPR. + * gimple.c (gimple_build_wce): Strengthen return type and local + "p" from gimple to gwce *. + (gimple_copy): Add checked casts to gwce * within case + GIMPLE_WITH_CLEANUP_EXPR. + * gimple.h (struct gimple_statement_wce): Rename to... + (struct gwce): ...this. + (is_a_helper <gimple_statement_wce *>::test): Rename to... + (is_a_helper <gwce *>::test): ...this. + (gimple_build_wce): Strengthen return type from gimple to gwce *. + (gimple_wce_cleanup_ptr): Strengthen param from gimple to gwce *. + (gimple_wce_cleanup): Likewise. + (gimple_wce_set_cleanup): Likewise. + (gimple_wce_cleanup_eh_only): Strengthen param from const_gimple + to const gwce *. + (gimple_wce_set_cleanup_eh_only): Strengthen param from gimple to + gwce *. + * gimplify.c (gimplify_cleanup_point_expr): Replace check against + GIMPLE_WITH_CLEANUP_EXPR with a dyn_cast <gwce *>, strengthening + local "wce" from gimple to gwce *. + (gimple_push_cleanup): Strengthen local "wce" from gimple to + gwce *. + * gsstruct.def (GSS_WCE): Update for renaming of + gimple_statement_wce to gwce. + * tree-inline.c (remap_gimple_stmt): Add checked cast to gwce * + within case GIMPLE_WITH_CLEANUP_EXPR. + +2014-10-28 David Malcolm <dmalc...@redhat.com> + * auto-profile.c (autofdo::function_instance::find_icall_target_map): Strengthen param "stmt" from gimple to gcall *. (autofdo::autofdo_source_profile::update_inlined_ind_target): diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi index 621c860..de7345e 100644 --- a/gcc/doc/gimple.texi +++ b/gcc/doc/gimple.texi @@ -414,7 +414,7 @@ kinds, along with their relationships to @code{GSS_} values (layouts) and + gtry | layout: GSS_TRY, code: GIMPLE_TRY | - + gimple_statement_wce + + gwce | layout: GSS_WCE, code: GIMPLE_WITH_CLEANUP_EXPR | + gomp_continue diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c index a6ea1ec..002308c 100644 --- a/gcc/gimple-walk.c +++ b/gcc/gimple-walk.c @@ -635,8 +635,9 @@ walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt, break; case GIMPLE_WITH_CLEANUP_EXPR: - ret = walk_gimple_seq_mod (gimple_wce_cleanup_ptr (stmt), callback_stmt, - callback_op, wi); + ret = walk_gimple_seq_mod (gimple_wce_cleanup_ptr (as_a <gwce *> (stmt)), + callback_stmt, + callback_op, wi); if (ret) return wi->callback_result; break; diff --git a/gcc/gimple.c b/gcc/gimple.c index 061a7a1..c6d0f7a 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -708,10 +708,10 @@ gimple_build_try (gimple_seq eval, gimple_seq cleanup, CLEANUP is the cleanup expression. */ -gimple +gwce * gimple_build_wce (gimple_seq cleanup) { - gimple p = gimple_alloc (GIMPLE_WITH_CLEANUP_EXPR, 0); + gwce *p = as_a <gwce *> (gimple_alloc (GIMPLE_WITH_CLEANUP_EXPR, 0)); if (cleanup) gimple_wce_set_cleanup (p, cleanup); @@ -1818,8 +1818,8 @@ gimple_copy (gimple stmt) break; case GIMPLE_WITH_CLEANUP_EXPR: - new_seq = gimple_seq_copy (gimple_wce_cleanup (stmt)); - gimple_wce_set_cleanup (copy, new_seq); + new_seq = gimple_seq_copy (gimple_wce_cleanup (as_a <gwce *> (stmt))); + gimple_wce_set_cleanup (as_a <gwce *> (copy), new_seq); break; default: diff --git a/gcc/gimple.h b/gcc/gimple.h index ccafde5..ba4d084 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -459,7 +459,7 @@ enum gimple_try_flags /* GIMPLE_WITH_CLEANUP_EXPR */ struct GTY((tag("GSS_WCE"))) - gimple_statement_wce : public gimple_statement_base + gwce : public gimple_statement_base { /* [ WORD 1-6 ] : base class */ @@ -1094,7 +1094,7 @@ is_a_helper <gtry *>::test (gimple gs) template <> template <> inline bool -is_a_helper <gimple_statement_wce *>::test (gimple gs) +is_a_helper <gwce *>::test (gimple gs) { return gs->code == GIMPLE_WITH_CLEANUP_EXPR; } @@ -1319,7 +1319,7 @@ geh_mnt *gimple_build_eh_must_not_throw (tree); geh_else *gimple_build_eh_else (gimple_seq, gimple_seq); gtry *gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags); -gimple gimple_build_wce (gimple_seq); +gwce *gimple_build_wce (gimple_seq); gresx *gimple_build_resx (int); gswitch *gimple_build_switch_nlabels (unsigned, tree, tree); gswitch *gimple_build_switch (tree, tree, vec<tree> ); @@ -3776,12 +3776,12 @@ gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup) } -/* Return a pointer to the cleanup sequence for cleanup statement GS. */ +/* Return a pointer to the cleanup sequence for cleanup statement + WCE_STMT. */ static inline gimple_seq * -gimple_wce_cleanup_ptr (gimple gs) +gimple_wce_cleanup_ptr (gwce *wce_stmt) { - gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs); return &wce_stmt->cleanup; } @@ -3789,18 +3789,17 @@ gimple_wce_cleanup_ptr (gimple gs) /* Return the cleanup sequence for cleanup statement GS. */ static inline gimple_seq -gimple_wce_cleanup (gimple gs) +gimple_wce_cleanup (gwce *gs) { return *gimple_wce_cleanup_ptr (gs); } -/* Set CLEANUP to be the cleanup sequence for GS. */ +/* Set CLEANUP to be the cleanup sequence for WCE_STMT. */ static inline void -gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup) +gimple_wce_set_cleanup (gwce *wce_stmt, gimple_seq cleanup) { - gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs); wce_stmt->cleanup = cleanup; } @@ -3808,9 +3807,8 @@ gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup) /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */ static inline bool -gimple_wce_cleanup_eh_only (const_gimple gs) +gimple_wce_cleanup_eh_only (const gwce *gs) { - GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); return gs->subcode != 0; } @@ -3818,9 +3816,8 @@ gimple_wce_cleanup_eh_only (const_gimple gs) /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */ static inline void -gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p) +gimple_wce_set_cleanup_eh_only (gwce *gs, bool eh_only_p) { - GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); gs->subcode = (unsigned int) eh_only_p; } diff --git a/gcc/gimplify.c b/gcc/gimplify.c index bef38c3..36367fe 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5201,9 +5201,9 @@ gimplify_cleanup_point_expr (tree *expr_p, gimple_seq *pre_p) for (iter = gsi_start (body_sequence); !gsi_end_p (iter); ) { - gimple wce = gsi_stmt (iter); + gwce *wce = dyn_cast <gwce *> (gsi_stmt (iter)); - if (gimple_code (wce) == GIMPLE_WITH_CLEANUP_EXPR) + if (wce) { if (gsi_one_before_end_p (iter)) { @@ -5259,7 +5259,7 @@ gimplify_cleanup_point_expr (tree *expr_p, gimple_seq *pre_p) static void gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p) { - gimple wce; + gwce *wce; gimple_seq cleanup_stmts = NULL; /* Errors can result in improperly nested cleanups. Which results in diff --git a/gcc/gsstruct.def b/gcc/gsstruct.def index ed4caa1..4d708d3 100644 --- a/gcc/gsstruct.def +++ b/gcc/gsstruct.def @@ -39,7 +39,7 @@ DEFGSSTRUCT(GSS_EH_FILTER, geh_filter, false) DEFGSSTRUCT(GSS_EH_MNT, geh_mnt, false) DEFGSSTRUCT(GSS_EH_CTRL, gimple_statement_eh_ctrl, false) DEFGSSTRUCT(GSS_EH_ELSE, geh_else, false) -DEFGSSTRUCT(GSS_WCE, gimple_statement_wce, false) +DEFGSSTRUCT(GSS_WCE, gwce, false) DEFGSSTRUCT(GSS_OMP, gimple_statement_omp, false) DEFGSSTRUCT(GSS_OMP_CRITICAL, gomp_critical, false) DEFGSSTRUCT(GSS_OMP_FOR, gomp_for, false) diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index e005da1..3ed11b5 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1365,7 +1365,8 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id) break; case GIMPLE_WITH_CLEANUP_EXPR: - s1 = remap_gimple_seq (gimple_wce_cleanup (stmt), id); + s1 = remap_gimple_seq (gimple_wce_cleanup (as_a <gwce *> (stmt)), + id); copy = gimple_build_wce (s1); break; -- 1.7.11.7