gcc/
* coretypes.h (gimple_omp_task): New typedef.
(const_gimple_omp_task): New typedef.
* gimple.h (gimple_statement_base::as_a_gimple_omp_task): New.
(gimple_build_omp_task): Return a gimple_omp_task
rather than a plain gimple.
* gimple-pretty-print.c (dump_gimple_omp_task): Require a
gimple_omp_task rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_omp_task within
GIMPLE_OMP_TASK case of switch statement.
* gimple.c (gimple_build_omp_task): Return a gimple_omp_task
rather than a plain gimple.
* omp-low.c (finalize_task_copyfn): Require a gimple_omp_task
rather than a plain gimple.
(delete_omp_context): Add checked cast to gimple_omp_task.
(scan_omp_task): Strengthen local "stmt" from gimple to
gimple_omp_task.
(expand_task_call): Require a gimple_omp_task rather than a plain
gimple.
(expand_omp_taskreg): Add checked cast to gimple_omp_task.
(create_task_copyfn): Require a gimple_omp_task rather than a
plain gimple.
(lower_omp_taskreg): Add checked cast to gimple_omp_task.
---
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 4 ++--
gcc/gimple.c | 5 +++--
gcc/gimple.h | 9 ++++++++-
gcc/omp-low.c | 14 +++++++-------
5 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 2647189..9564ab7 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -171,6 +171,10 @@ struct gimple_statement_omp_parallel;
typedef struct gimple_statement_omp_parallel *gimple_omp_parallel;
typedef const struct gimple_statement_omp_parallel *const_gimple_omp_parallel;
+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;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index bf77f87..d249373 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1905,7 +1905,7 @@ dump_gimple_omp_parallel (pretty_printer *buffer,
gimple_omp_parallel gs,
dumpfile.h). */
static void
-dump_gimple_omp_task (pretty_printer *buffer, gimple gs, int spc,
+dump_gimple_omp_task (pretty_printer *buffer, gimple_omp_task gs, int spc,
int flags)
{
if (flags & TDF_RAW)
@@ -2148,7 +2148,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int
spc, int flags)
break;
case GIMPLE_OMP_TASK:
- dump_gimple_omp_task (buffer, gs, spc, flags);
+ dump_gimple_omp_task (buffer, gs->as_a_gimple_omp_task (), spc, flags);
break;
case GIMPLE_OMP_ATOMIC_LOAD:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 0b35d00..1f58a03 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -889,12 +889,13 @@ gimple_build_omp_parallel (gimple_seq body, tree clauses,
tree child_fn,
COPY_FN is the optional function for firstprivate initialization.
ARG_SIZE and ARG_ALIGN are size and alignment of the data block. */
-gimple
+gimple_omp_task
gimple_build_omp_task (gimple_seq body, tree clauses, tree child_fn,
tree data_arg, tree copy_fn, tree arg_size,
tree arg_align)
{
- gimple p = gimple_alloc (GIMPLE_OMP_TASK, 0);
+ gimple_omp_task p =
+ gimple_alloc (GIMPLE_OMP_TASK, 0)->as_a_gimple_omp_task ();
if (body)
gimple_omp_set_body (p, body);
gimple_omp_task_set_clauses (p, clauses);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index d391db8..6675d9b 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -372,6 +372,12 @@ public:
return as_a <gimple_statement_omp_parallel> (this);
}
+ inline gimple_omp_task
+ as_a_gimple_omp_task ()
+ {
+ return as_a <gimple_statement_omp_task> (this);
+ }
+
/* Dynamic casting methods, where the cast returns NULL if the
stmt is not of the required kind.
@@ -1620,7 +1626,8 @@ gimple_debug gimple_build_debug_source_bind_stat (tree,
tree, gimple MEM_STAT_DE
gimple_omp_critical gimple_build_omp_critical (gimple_seq, tree);
gimple_omp_for gimple_build_omp_for (gimple_seq, int, tree, size_t,
gimple_seq);
gimple_omp_parallel gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
-gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
+gimple_omp_task gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
+ tree, tree);
gimple gimple_build_omp_section (gimple_seq);
gimple gimple_build_omp_master (gimple_seq);
gimple gimple_build_omp_taskgroup (gimple_seq);
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 1602857..990b985 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1368,7 +1368,7 @@ static gimple_seq maybe_catch_exception (gimple_seq);
/* Finalize task copyfn. */
static void
-finalize_task_copyfn (gimple task_stmt)
+finalize_task_copyfn (gimple_omp_task task_stmt)
{
struct function *child_cfun;
tree child_fn;
@@ -1430,7 +1430,7 @@ delete_omp_context (splay_tree_value value)
}
if (is_task_ctx (ctx))
- finalize_task_copyfn (ctx->stmt);
+ finalize_task_copyfn (ctx->stmt->as_a_gimple_omp_task ());
XDELETE (ctx);
}
@@ -2037,7 +2037,7 @@ scan_omp_task (gimple_stmt_iterator *gsi, omp_context
*outer_ctx)
{
omp_context *ctx;
tree name, t;
- gimple stmt = gsi_stmt (*gsi);
+ gimple_omp_task stmt = gsi_stmt (*gsi)->as_a_gimple_omp_task ();
location_t loc = gimple_location (stmt);
/* Ignore task directives with empty bodies. */
@@ -4325,7 +4325,7 @@ expand_parallel_call (struct omp_region *region,
basic_block bb,
generate the task operation. BB is the block where to insert the code. */
static void
-expand_task_call (basic_block bb, gimple entry_stmt)
+expand_task_call (basic_block bb, gimple_omp_task entry_stmt)
{
tree t, t1, t2, t3, flags, cond, c, c2, clauses, depend;
gimple_stmt_iterator gsi;
@@ -4874,7 +4874,7 @@ expand_omp_taskreg (struct omp_region *region)
expand_parallel_call (region, new_bb,
entry_stmt->as_a_gimple_omp_parallel (), ws_args);
else
- expand_task_call (new_bb, entry_stmt);
+ expand_task_call (new_bb, entry_stmt->as_a_gimple_omp_task ());
if (gimple_in_ssa_p (cfun))
update_ssa (TODO_update_ssa_only_virtuals);
}
@@ -9168,7 +9168,7 @@ task_copyfn_remap_type (struct omp_taskcopy_context
*tcctx, tree orig_type)
/* Create task copyfn. */
static void
-create_task_copyfn (gimple task_stmt, omp_context *ctx)
+create_task_copyfn (gimple_omp_task task_stmt, omp_context *ctx)
{
struct function *child_cfun;
tree child_fn, t, c, src, dst, f, sf, arg, sarg, decl;
@@ -9498,7 +9498,7 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p,
omp_context *ctx)
}
if (ctx->srecord_type)
- create_task_copyfn (stmt, ctx);
+ create_task_copyfn (stmt->as_a_gimple_omp_task (), ctx);
push_gimplify_context ();
--
1.8.5.3