gcc/ * coretypes.h (gimple_omp_teams): New typedef. (const_gimple_omp_teams): New typedef.
* gimple.h (gimple_statement_base::as_a_gimple_omp_teams): New. (gimple_build_omp_teams): Return a gimple_omp_teams rather than a plain gimple. (gimple_omp_teams_set_clauses): Require a gimple_omp_teams rather than a plain gimple. * gimple-pretty-print.c (dump_gimple_omp_teams): Require a gimple_omp_teams rather than a plain gimple. (pp_gimple_stmt_1): Add checked cast to gimple_omp_teams within GIMPLE_OMP_TEAMS case of switch statement. * gimple.c (gimple_build_omp_teams): Return a gimple_omp_teams rather than a plain gimple. * omp-low.c (scan_omp_teams): Likewise. (scan_omp_1_stmt): Add checked cast to gimple_omp_teams within GIMPLE_OMP_TEAMS case of switch statement. (lower_omp_teams): Strengthen local "teams_stmt" from gimple to gimple_omp_teams. --- gcc/coretypes.h | 4 ++++ gcc/gimple-pretty-print.c | 6 ++++-- gcc/gimple.c | 5 +++-- gcc/gimple.h | 14 +++++++++----- gcc/omp-low.c | 6 +++--- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/gcc/coretypes.h b/gcc/coretypes.h index 1ac8765..529dc96 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -183,6 +183,10 @@ struct gimple_statement_omp_target; typedef struct gimple_statement_omp_target *gimple_omp_target; typedef const struct gimple_statement_omp_target *const_gimple_omp_target; +struct gimple_statement_omp_teams; +typedef struct gimple_statement_omp_teams *gimple_omp_teams; +typedef const struct gimple_statement_omp_teams *const_gimple_omp_teams; + union section; typedef union section section; struct gcc_options; diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index a5d8706..3787136 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -1333,7 +1333,8 @@ dump_gimple_omp_target (pretty_printer *buffer, gimple_omp_target gs, /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_teams (pretty_printer *buffer, gimple gs, int spc, int flags) +dump_gimple_omp_teams (pretty_printer *buffer, gimple_omp_teams gs, int spc, + int flags) { if (flags & TDF_RAW) { @@ -2184,7 +2185,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags) break; case GIMPLE_OMP_TEAMS: - dump_gimple_omp_teams (buffer, gs, spc, flags); + dump_gimple_omp_teams (buffer, gs->as_a_gimple_omp_teams (), spc, + flags); break; case GIMPLE_OMP_RETURN: diff --git a/gcc/gimple.c b/gcc/gimple.c index 2ba7c5b..310839f 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -1070,10 +1070,11 @@ gimple_build_omp_target (gimple_seq body, int kind, tree clauses) BODY is the sequence of statements that will be executed. CLAUSES are any of the OMP teams construct's clauses. */ -gimple +gimple_omp_teams gimple_build_omp_teams (gimple_seq body, tree clauses) { - gimple p = gimple_alloc (GIMPLE_OMP_TEAMS, 0); + gimple_omp_teams p = + gimple_alloc (GIMPLE_OMP_TEAMS, 0)->as_a_gimple_omp_teams (); if (body) gimple_omp_set_body (p, body); gimple_omp_teams_set_clauses (p, clauses); diff --git a/gcc/gimple.h b/gcc/gimple.h index d791a28..0a06620 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -390,6 +390,12 @@ public: return as_a <gimple_statement_omp_target> (this); } + inline gimple_omp_teams + as_a_gimple_omp_teams () + { + return as_a <gimple_statement_omp_teams> (this); + } + /* Dynamic casting methods, where the cast returns NULL if the stmt is not of the required kind. @@ -1650,7 +1656,7 @@ gimple gimple_build_omp_sections (gimple_seq, tree); gimple gimple_build_omp_sections_switch (void); gimple_omp_single gimple_build_omp_single (gimple_seq, tree); gimple_omp_target gimple_build_omp_target (gimple_seq, int, tree); -gimple gimple_build_omp_teams (gimple_seq, tree); +gimple_omp_teams gimple_build_omp_teams (gimple_seq, tree); gimple_omp_atomic_load gimple_build_omp_atomic_load (tree, tree); gimple_omp_atomic_store gimple_build_omp_atomic_store (tree); gimple_transaction gimple_build_transaction (gimple_seq, tree); @@ -5482,13 +5488,11 @@ gimple_omp_teams_clauses_ptr (gimple gs) } -/* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */ +/* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */ static inline void -gimple_omp_teams_set_clauses (gimple gs, tree clauses) +gimple_omp_teams_set_clauses (gimple_omp_teams omp_teams_stmt, tree clauses) { - gimple_statement_omp_teams *omp_teams_stmt = - as_a <gimple_statement_omp_teams> (gs); omp_teams_stmt->clauses = clauses; } diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 9809cf4..680c21f 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -2228,7 +2228,7 @@ scan_omp_target (gimple_omp_target stmt, omp_context *outer_ctx) /* Scan an OpenMP teams directive. */ static void -scan_omp_teams (gimple stmt, omp_context *outer_ctx) +scan_omp_teams (gimple_omp_teams stmt, omp_context *outer_ctx) { omp_context *ctx = new_omp_context (stmt, outer_ctx); scan_sharing_clauses (gimple_omp_teams_clauses (stmt), ctx); @@ -2668,7 +2668,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, break; case GIMPLE_OMP_TEAMS: - scan_omp_teams (stmt, ctx); + scan_omp_teams (stmt->as_a_gimple_omp_teams (), ctx); break; case GIMPLE_BIND: @@ -9899,7 +9899,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) static void lower_omp_teams (gimple_stmt_iterator *gsi_p, omp_context *ctx) { - gimple teams_stmt = gsi_stmt (*gsi_p); + gimple_omp_teams teams_stmt = gsi_stmt (*gsi_p)->as_a_gimple_omp_teams (); push_gimplify_context (); tree block = make_node (BLOCK); -- 1.8.5.3