diff options
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r-- | gcc/gimple.h | 183 |
1 files changed, 162 insertions, 21 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h index cdd711d..145e9ad 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -151,6 +151,7 @@ enum gf_mask { GF_OMP_PARALLEL_COMBINED = 1 << 0, GF_OMP_PARALLEL_GRID_PHONY = 1 << 1, GF_OMP_TASK_TASKLOOP = 1 << 0, + GF_OMP_TASK_TASKWAIT = 1 << 1, GF_OMP_FOR_KIND_MASK = (1 << 4) - 1, GF_OMP_FOR_KIND_FOR = 0, GF_OMP_FOR_KIND_DISTRIBUTE = 1, @@ -183,6 +184,7 @@ enum gf_mask { GF_OMP_TARGET_KIND_OACC_DECLARE = 10, GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11, GF_OMP_TEAMS_GRID_PHONY = 1 << 0, + GF_OMP_TEAMS_HOST = 1 << 1, /* True on an GIMPLE_OMP_RETURN statement if the return does not require a thread synchronization via some sort of barrier. The exact barrier @@ -191,8 +193,8 @@ enum gf_mask { GF_OMP_RETURN_NOWAIT = 1 << 0, GF_OMP_SECTION_LAST = 1 << 0, - GF_OMP_ATOMIC_NEED_VALUE = 1 << 0, - GF_OMP_ATOMIC_SEQ_CST = 1 << 1, + GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 3) - 1, + GF_OMP_ATOMIC_NEED_VALUE = 1 << 3, GF_PREDICT_TAKEN = 1 << 15 }; @@ -637,7 +639,7 @@ struct GTY((tag("GSS_OMP_FOR"))) }; -/* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */ +/* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */ struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) gimple_statement_omp_parallel_layout : public gimple_statement_omp @@ -663,7 +665,8 @@ struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) { /* No extra fields; adds invariant: stmt->code == GIMPLE_OMP_PARALLEL - || stmt->code == GIMPLE_OMP_TASK. */ + || stmt->code == GIMPLE_OMP_TASK + || stmt->code == GIMPLE_OMP_TEAMS. */ }; /* GIMPLE_OMP_PARALLEL */ @@ -737,7 +740,7 @@ struct GTY((tag("GSS_OMP_CONTINUE"))) tree control_use; }; -/* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */ +/* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP. */ struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) gimple_statement_omp_single_layout : public gimple_statement_omp @@ -755,8 +758,8 @@ struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) stmt->code == GIMPLE_OMP_SINGLE. */ }; -struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) - gomp_teams : public gimple_statement_omp_single_layout +struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) + gomp_teams : public gimple_statement_omp_taskreg { /* No extra fields; adds invariant: stmt->code == GIMPLE_OMP_TEAMS. */ @@ -1121,7 +1124,9 @@ template <> inline bool is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs) { - return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK; + return (gs->code == GIMPLE_OMP_PARALLEL + || gs->code == GIMPLE_OMP_TASK + || gs->code == GIMPLE_OMP_TEAMS); } template <> @@ -1337,7 +1342,9 @@ template <> inline bool is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs) { - return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK; + return (gs->code == GIMPLE_OMP_PARALLEL + || gs->code == GIMPLE_OMP_TASK + || gs->code == GIMPLE_OMP_TEAMS); } template <> @@ -1463,7 +1470,7 @@ gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, gimple *gimple_build_omp_section (gimple_seq); gimple *gimple_build_omp_master (gimple_seq); gimple *gimple_build_omp_grid_body (gimple_seq); -gimple *gimple_build_omp_taskgroup (gimple_seq); +gimple *gimple_build_omp_taskgroup (gimple_seq, tree); gomp_continue *gimple_build_omp_continue (tree, tree); gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree); gimple *gimple_build_omp_return (bool); @@ -1472,8 +1479,9 @@ gimple *gimple_build_omp_sections_switch (void); gomp_single *gimple_build_omp_single (gimple_seq, tree); gomp_target *gimple_build_omp_target (gimple_seq, int, tree); gomp_teams *gimple_build_omp_teams (gimple_seq, tree); -gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree); -gomp_atomic_store *gimple_build_omp_atomic_store (tree); +gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree, + enum omp_memory_order); +gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order); gtransaction *gimple_build_transaction (gimple_seq); extern void gimple_seq_add_stmt (gimple_seq *, gimple *); extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *); @@ -2193,7 +2201,7 @@ static inline unsigned gimple_omp_subcode (const gimple *s) { gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD - && gimple_code (s) <= GIMPLE_OMP_TEAMS); + && gimple_code (s) <= GIMPLE_OMP_TEAMS); return s->subcode; } @@ -2331,26 +2339,27 @@ gimple_omp_atomic_set_need_value (gimple *g) } -/* Return true if OMP atomic load/store statement G has the - GF_OMP_ATOMIC_SEQ_CST flag set. */ +/* Return the memory order of the OMP atomic load/store statement G. */ -static inline bool -gimple_omp_atomic_seq_cst_p (const gimple *g) +static inline enum omp_memory_order +gimple_omp_atomic_memory_order (const gimple *g) { if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); - return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0; + return (enum omp_memory_order) + (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER); } -/* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */ +/* Set the memory order on G. */ static inline void -gimple_omp_atomic_set_seq_cst (gimple *g) +gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo) { if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); - g->subcode |= GF_OMP_ATOMIC_SEQ_CST; + g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER) + | (mo & GF_OMP_ATOMIC_MEMORY_ORDER)); } @@ -4915,6 +4924,40 @@ gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses) } +/* Return the clauses associated with OMP_TASKGROUP statement GS. */ + +static inline tree +gimple_omp_taskgroup_clauses (const gimple *gs) +{ + GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP); + return + static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses; +} + + +/* Return a pointer to the clauses associated with OMP taskgroup statement + GS. */ + +static inline tree * +gimple_omp_taskgroup_clauses_ptr (gimple *gs) +{ + GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP); + return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses; +} + + +/* Set CLAUSES to be the clauses associated with OMP taskgroup statement + GS. */ + +static inline void +gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses) +{ + GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP); + static_cast <gimple_statement_omp_single_layout *> (gs)->clauses + = clauses; +} + + /* Return the kind of the OMP_FOR statemement G. */ static inline int @@ -5441,6 +5484,31 @@ gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p) } +/* Return true if OMP task statement G has the + GF_OMP_TASK_TASKWAIT flag set. */ + +static inline bool +gimple_omp_task_taskwait_p (const gimple *g) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_TASK); + return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0; +} + + +/* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean + value of TASKWAIT_P. */ + +static inline void +gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_TASK); + if (taskwait_p) + g->subcode |= GF_OMP_TASK_TASKWAIT; + else + g->subcode &= ~GF_OMP_TASK_TASKWAIT; +} + + /* Return the child function used to hold the body of OMP_TASK GS. */ static inline tree @@ -5857,6 +5925,60 @@ gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses) omp_teams_stmt->clauses = clauses; } +/* Return the child function used to hold the body of OMP_TEAMS_STMT. */ + +static inline tree +gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt) +{ + return omp_teams_stmt->child_fn; +} + +/* Return a pointer to the child function used to hold the body of + OMP_TEAMS_STMT. */ + +static inline tree * +gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt) +{ + return &omp_teams_stmt->child_fn; +} + + +/* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */ + +static inline void +gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn) +{ + omp_teams_stmt->child_fn = child_fn; +} + + +/* Return the artificial argument used to send variables and values + from the parent to the children threads in OMP_TEAMS_STMT. */ + +static inline tree +gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt) +{ + return omp_teams_stmt->data_arg; +} + + +/* Return a pointer to the data argument for OMP_TEAMS_STMT. */ + +static inline tree * +gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt) +{ + return &omp_teams_stmt->data_arg; +} + + +/* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */ + +static inline void +gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg) +{ + omp_teams_stmt->data_arg = data_arg; +} + /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */ static inline bool @@ -5876,6 +5998,25 @@ gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value) omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY; } +/* Return the host flag of an OMP_TEAMS_STMT. */ + +static inline bool +gimple_omp_teams_host (const gomp_teams *omp_teams_stmt) +{ + return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0; +} + +/* Set host flag of an OMP_TEAMS_STMT to VALUE. */ + +static inline void +gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value) +{ + if (value) + omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST; + else + omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST; +} + /* Return the clauses associated with OMP_SECTIONS GS. */ static inline tree |