This corresponds to: [PATCH 42/89] Introduce gimple_omp_single https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01206.html from the original 89-patch kit
That earlier patch was approved by Jeff: > OK with expected changes due to renaming/updates to const handling. > Please repost the final patch for archival purposes. in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00807.html gcc/ * coretypes.h (gimple_omp_single): New typedef. (const_gimple_omp_single): New typedef. * gimple.h (gimple_build_omp_single): Return a gimple_omp_single rather than a plain gimple. (gimple_omp_single_set_clauses): Require a gimple_omp_single rather than a plain gimple. * gimple-pretty-print.c (dump_gimple_omp_single): Require a gimple_omp_single rather than a plain gimple. (pp_gimple_stmt_1): Add checked cast to gimple_omp_single within GIMPLE_OMP_SINGLE case of switch statement. * gimple.c (gimple_build_omp_single): Return a gimple_omp_single rather than a plain gimple. * omp-low.c (scan_omp_single): Require a gimple_omp_single rather than a plain gimple. (scan_omp_1_stmt): Add checked cast to gimple_omp_single within GIMPLE_OMP_SINGLE case of switch statement. (lower_omp_single_simple): Require a gimple_omp_single rather than a plain gimple. (lower_omp_single_copy): Likewise. (lower_omp_single): Strengthen local "single_stmt" from gimple to gimple_omp_single. --- gcc/ChangeLog.gimple-classes | 30 ++++++++++++++++++++++++++++++ gcc/coretypes.h | 4 ++++ gcc/gimple-pretty-print.c | 6 ++++-- gcc/gimple.c | 5 +++-- gcc/gimple.h | 8 +++----- gcc/omp-low.c | 12 +++++++----- 6 files changed, 51 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 5dfdc22..88ebaa9 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,35 @@ 2014-10-24 David Malcolm <dmalc...@redhat.com> + Introduce gimple_omp_single + + * coretypes.h (gimple_omp_single): New typedef. + (const_gimple_omp_single): New typedef. + + * gimple.h (gimple_build_omp_single): Return a gimple_omp_single + rather than a plain gimple. + (gimple_omp_single_set_clauses): Require a gimple_omp_single + rather than a plain gimple. + + * gimple-pretty-print.c (dump_gimple_omp_single): Require a + gimple_omp_single rather than a plain gimple. + (pp_gimple_stmt_1): Add checked cast to gimple_omp_single within + GIMPLE_OMP_SINGLE case of switch statement. + + * gimple.c (gimple_build_omp_single): Return a gimple_omp_single + rather than a plain gimple. + + * omp-low.c (scan_omp_single): Require a gimple_omp_single rather + than a plain gimple. + (scan_omp_1_stmt): Add checked cast to gimple_omp_single within + GIMPLE_OMP_SINGLE case of switch statement. + (lower_omp_single_simple): Require a gimple_omp_single rather + than a plain gimple. + (lower_omp_single_copy): Likewise. + (lower_omp_single): Strengthen local "single_stmt" from gimple to + gimple_omp_single. + +2014-10-24 David Malcolm <dmalc...@redhat.com> + Introduce gimple_omp_task * coretypes.h (gimple_omp_task): New typedef. diff --git a/gcc/coretypes.h b/gcc/coretypes.h index 323e23c..ea8f8f4 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -196,6 +196,10 @@ struct gimple_statement_omp_task; typedef struct gimple_statement_omp_task *gimple_omp_task; typedef const struct gimple_statement_omp_task *const_gimple_omp_task; +struct gimple_statement_omp_single; +typedef struct gimple_statement_omp_single *gimple_omp_single; +typedef const struct gimple_statement_omp_single *const_gimple_omp_single; + union section; typedef union section section; struct gcc_options; diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 2cb6fc8..61eacd2 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -1278,7 +1278,8 @@ dump_gimple_omp_continue (pretty_printer *buffer, gimple_omp_continue gs, /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_single (pretty_printer *buffer, gimple gs, int spc, int flags) +dump_gimple_omp_single (pretty_printer *buffer, gimple_omp_single gs, + int spc, int flags) { if (flags & TDF_RAW) { @@ -2166,7 +2167,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags) break; case GIMPLE_OMP_SINGLE: - dump_gimple_omp_single (buffer, gs, spc, flags); + dump_gimple_omp_single (buffer, as_a <gimple_omp_single> (gs), spc, + flags); break; case GIMPLE_OMP_TARGET: diff --git a/gcc/gimple.c b/gcc/gimple.c index 9510014..bf5f315 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -1034,10 +1034,11 @@ gimple_build_omp_sections_switch (void) CLAUSES are any of the OMP single construct's clauses: private, firstprivate, copyprivate, nowait. */ -gimple +gimple_omp_single gimple_build_omp_single (gimple_seq body, tree clauses) { - gimple p = gimple_alloc (GIMPLE_OMP_SINGLE, 0); + gimple_omp_single p = + as_a <gimple_omp_single> (gimple_alloc (GIMPLE_OMP_SINGLE, 0)); if (body) gimple_omp_set_body (p, body); gimple_omp_single_set_clauses (p, clauses); diff --git a/gcc/gimple.h b/gcc/gimple.h index a9903de..1caf745 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -1355,7 +1355,7 @@ gimple gimple_build_omp_ordered (gimple_seq); gimple gimple_build_omp_return (bool); gimple gimple_build_omp_sections (gimple_seq, tree); gimple gimple_build_omp_sections_switch (void); -gimple gimple_build_omp_single (gimple_seq, tree); +gimple_omp_single gimple_build_omp_single (gimple_seq, tree); gimple gimple_build_omp_target (gimple_seq, int, tree); gimple gimple_build_omp_teams (gimple_seq, tree); gimple_omp_atomic_load gimple_build_omp_atomic_load (tree, tree); @@ -5082,13 +5082,11 @@ gimple_omp_single_clauses_ptr (gimple gs) } -/* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */ +/* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */ static inline void -gimple_omp_single_set_clauses (gimple gs, tree clauses) +gimple_omp_single_set_clauses (gimple_omp_single omp_single_stmt, tree clauses) { - gimple_statement_omp_single *omp_single_stmt = - as_a <gimple_statement_omp_single *> (gs); omp_single_stmt->clauses = clauses; } diff --git a/gcc/omp-low.c b/gcc/omp-low.c index c51e6da..3f68ab2 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -2307,7 +2307,7 @@ scan_omp_sections (gimple stmt, omp_context *outer_ctx) /* Scan an OpenMP single directive. */ static void -scan_omp_single (gimple stmt, omp_context *outer_ctx) +scan_omp_single (gimple_omp_single stmt, omp_context *outer_ctx) { omp_context *ctx; tree name; @@ -2818,7 +2818,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, break; case GIMPLE_OMP_SINGLE: - scan_omp_single (stmt, ctx); + scan_omp_single (as_a <gimple_omp_single> (stmt), ctx); break; case GIMPLE_OMP_SECTION: @@ -8974,7 +8974,7 @@ lower_omp_sections (gimple_stmt_iterator *gsi_p, omp_context *ctx) to a synchronization analysis pass. */ static void -lower_omp_single_simple (gimple single_stmt, gimple_seq *pre_p) +lower_omp_single_simple (gimple_omp_single single_stmt, gimple_seq *pre_p) { location_t loc = gimple_location (single_stmt); tree tlabel = create_artificial_label (loc); @@ -9029,7 +9029,8 @@ lower_omp_single_simple (gimple single_stmt, gimple_seq *pre_p) to a synchronization analysis pass. */ static void -lower_omp_single_copy (gimple single_stmt, gimple_seq *pre_p, omp_context *ctx) +lower_omp_single_copy (gimple_omp_single single_stmt, gimple_seq *pre_p, + omp_context *ctx) { tree ptr_type, t, l0, l1, l2, bfn_decl; gimple_seq copyin_seq; @@ -9085,7 +9086,8 @@ static void lower_omp_single (gimple_stmt_iterator *gsi_p, omp_context *ctx) { tree block; - gimple t, single_stmt = gsi_stmt (*gsi_p); + gimple t; + gimple_omp_single single_stmt = as_a <gimple_omp_single> (gsi_stmt (*gsi_p)); gimple_bind bind; gimple_seq bind_body, bind_body_tail = NULL, dlist; -- 1.8.5.3