diff options
author | Tom de Vries <tom@codesourcery.com> | 2014-11-13 10:51:58 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2014-11-13 10:51:58 +0000 |
commit | 187518942c654f1d144a76a262ba8a7b904f7b9d (patch) | |
tree | 3873e81fede18285707d2a798b557f5b571b0ea0 /gcc/omp-low.c | |
parent | d82f1e13053446d0b0fd8e8e3b26f5d7e579bfd7 (diff) | |
download | gcc-187518942c654f1d144a76a262ba8a7b904f7b9d.zip gcc-187518942c654f1d144a76a262ba8a7b904f7b9d.tar.gz gcc-187518942c654f1d144a76a262ba8a7b904f7b9d.tar.bz2 |
Run pass_expand_omp_ssa after pass_paralellize_loops
2014-11-13 Tom de Vries <tom@codesourcery.com>
* omp-low.c (pass_data_expand_omp): Set properties_provided to
PROP_gimple_eomp.
(pass_expand_omp::gate): Remove function. Move gate expression to ...
(pass_expand_omp::execute): ... here, as new variable gate. Add early
exit if gate is false.
(pass_data pass_data_expand_omp_ssa): New pass_data.
(class pass_expand_omp_ssa): New pass.
(make_pass_expand_omp_ssa): New function.
* passes.def (pass_parallelize_loops): Use PUSH_INSERT_PASSES_WITHIN
instead of NEXT_PASS.
(pass_expand_omp_ssa): Add after pass_parallelize_loops.
* tree-parloops.c (gen_parallel_loop): Remove call to omp_expand_local.
(pass_parallelize_loops::execute): Don't do cleanups TODO_cleanup_cfg
and TODO_rebuild_alias yet. Add TODO_update_ssa. Set
cfun->omp_expand_needed.
* tree-pass.h: Add define PROP_gimple_eomp.
(make_pass_expand_omp_ssa): Declare.
From-SVN: r217474
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index b59d069..e7d8a7e 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -8801,7 +8801,7 @@ const pass_data pass_data_expand_omp = OPTGROUP_NONE, /* optinfo_flags */ TV_NONE, /* tv_id */ PROP_gimple_any, /* properties_required */ - 0, /* properties_provided */ + PROP_gimple_eomp, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ 0, /* todo_flags_finish */ @@ -8815,13 +8815,18 @@ public: {} /* opt_pass methods: */ - virtual bool gate (function *) + virtual unsigned int execute (function *) { - return ((flag_openmp != 0 || flag_openmp_simd != 0 - || flag_cilkplus != 0) && !seen_error ()); - } + bool gate = ((flag_openmp != 0 || flag_openmp_simd != 0 + || flag_cilkplus != 0) && !seen_error ()); - virtual unsigned int execute (function *) { return execute_expand_omp (); } + /* This pass always runs, to provide PROP_gimple_eomp. + But there is nothing to do unless -fopenmp is given. */ + if (!gate) + return 0; + + return execute_expand_omp (); + } }; // class pass_expand_omp @@ -8832,6 +8837,45 @@ make_pass_expand_omp (gcc::context *ctxt) { return new pass_expand_omp (ctxt); } + +namespace { + +const pass_data pass_data_expand_omp_ssa = +{ + GIMPLE_PASS, /* type */ + "ompexpssa", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + TV_NONE, /* tv_id */ + PROP_cfg | PROP_ssa, /* properties_required */ + PROP_gimple_eomp, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_cleanup_cfg | TODO_rebuild_alias, /* todo_flags_finish */ +}; + +class pass_expand_omp_ssa : public gimple_opt_pass +{ +public: + pass_expand_omp_ssa (gcc::context *ctxt) + : gimple_opt_pass (pass_data_expand_omp_ssa, ctxt) + {} + + /* opt_pass methods: */ + virtual bool gate (function *fun) + { + return !(fun->curr_properties & PROP_gimple_eomp); + } + virtual unsigned int execute (function *) { return execute_expand_omp (); } + +}; // class pass_expand_omp_ssa + +} // anon namespace + +gimple_opt_pass * +make_pass_expand_omp_ssa (gcc::context *ctxt) +{ + return new pass_expand_omp_ssa (ctxt); +} /* Routines to lower OpenMP directives into OMP-GIMPLE. */ |