From 07ec6b8258c4fae6d160a7d63e869e4f933a50f7 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 17 Dec 2013 10:25:47 -0500 Subject: Introduce gimple_omp_parallel This corresponds to: [PATCH 39/89] Introduce gimple_omp_parallel https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01159.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/msg00827.html gcc/ * coretypes.h (gimple_omp_parallel): New typedef. (const_gimple_omp_parallel): New typedef. * cgraphbuild.c (build_cgraph_edges): Convert check of code against GIMPLE_OMP_PARALLEL to a dyn_cast and new local. * gimple-pretty-print.c (dump_gimple_omp_parallel): Require a gimple_omp_parallel rather than a plain gimple. (pp_gimple_stmt_1): Add a checked cast to gimple_omp_parallel within GIMPLE_OMP_PARALLEL case of switch statement. * gimple-walk.c (walk_gimple_op): Likewise, introducing a local. * gimple.c (gimple_build_omp_parallel): Return a gimple_omp_parallel rather than a plain gimple. (gimple_copy): Add checked casts to gimple_omp_parallel within GIMPLE_OMP_PARALLEL case of switch statement, introducing locals. * gimple.h (gimple_build_omp_parallel): Return a gimple_omp_parallel rather than a plain gimple. (gimple_omp_parallel_clauses_ptr): Require a gimple_omp_parallel rather than a plain gimple. (gimple_omp_parallel_set_clauses): Likewise. (gimple_omp_parallel_data_arg_ptr): Likewise. (gimple_omp_parallel_set_data_arg): Likewise. (gimple_omp_parallel_child_fn_ptr): Likewise. (gimple_omp_parallel_set_child_fn): Likewise. (gimple_omp_parallel_child_fn): Require a const_gimple_omp_parallel rather than a plain const_gimple. (gimple_omp_parallel_data_arg): Likewise. * omp-low.c (scan_omp_parallel): Strengthen local "stmt" from gimple to gimple_omp_parallel. (expand_parallel_call): Require a gimple_omp_parallel for "entry_stmt" rather than a plain gimple. (remove_exit_barrier): Strengthen local "parallel_stmt" from gimple to gimple_omp_parallel. (expand_omp_taskreg): Add checked casts to gimple_omp_parallel. * tree-inline.c (remap_gimple_stmt): Add a checked cast to gimple_omp_parallel within GIMPLE_OMP_PARALLEL case of switch statement, introducing local. --- gcc/gimple.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'gcc/gimple.c') diff --git a/gcc/gimple.c b/gcc/gimple.c index 3d8fd4485af..26bd5090eaa 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -865,11 +865,12 @@ gimple_build_omp_for (gimple_seq body, int kind, tree clauses, size_t collapse, CHILD_FN is the function created for the parallel threads to execute. DATA_ARG are the shared data argument(s). */ -gimple +gimple_omp_parallel gimple_build_omp_parallel (gimple_seq body, tree clauses, tree child_fn, tree data_arg) { - gimple p = gimple_alloc (GIMPLE_OMP_PARALLEL, 0); + gimple_omp_parallel p = + as_a (gimple_alloc (GIMPLE_OMP_PARALLEL, 0)); if (body) gimple_omp_set_body (p, body); gimple_omp_parallel_set_clauses (p, clauses); @@ -1730,12 +1731,18 @@ gimple_copy (gimple stmt) goto copy_omp_body; case GIMPLE_OMP_PARALLEL: - t = unshare_expr (gimple_omp_parallel_clauses (stmt)); - gimple_omp_parallel_set_clauses (copy, t); - t = unshare_expr (gimple_omp_parallel_child_fn (stmt)); - gimple_omp_parallel_set_child_fn (copy, t); - t = unshare_expr (gimple_omp_parallel_data_arg (stmt)); - gimple_omp_parallel_set_data_arg (copy, t); + { + gimple_omp_parallel omp_par_stmt = + as_a (stmt); + gimple_omp_parallel omp_par_copy = + as_a (copy); + t = unshare_expr (gimple_omp_parallel_clauses (omp_par_stmt)); + gimple_omp_parallel_set_clauses (omp_par_copy, t); + t = unshare_expr (gimple_omp_parallel_child_fn (omp_par_stmt)); + gimple_omp_parallel_set_child_fn (omp_par_copy, t); + t = unshare_expr (gimple_omp_parallel_data_arg (omp_par_stmt)); + gimple_omp_parallel_set_data_arg (omp_par_copy, t); + } goto copy_omp_body; case GIMPLE_OMP_TASK: -- cgit v1.2.1