aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorZdenek Dvorak <ook@ucw.cz>2007-08-01 13:50:39 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2007-08-01 11:50:39 +0000
commite5c95afe1e18581b060601f70b1a6888835028ce (patch)
treeff781d81e1c759d85b9e39299b57bf35bf7747a4 /gcc/tree-cfg.c
parent203bb67ec4596d07169474c03d36f7726e796120 (diff)
downloadgcc-e5c95afe1e18581b060601f70b1a6888835028ce.zip
gcc-e5c95afe1e18581b060601f70b1a6888835028ce.tar.gz
gcc-e5c95afe1e18581b060601f70b1a6888835028ce.tar.bz2
tree-pretty-print.c (dump_generic_node): Dump OMP_SECTIONS_SWITCH.
* tree-pretty-print.c (dump_generic_node): Dump OMP_SECTIONS_SWITCH. Display new operands of OMP_SECTIONS and OMP_CONTINUE. * tree.h (OMP_SECTIONS_CONTROL): New macro. (OMP_DIRECTIVE_P): Add OMP_SECTIONS_SWITCH. * omp-low.c (get_ws_args_for, determine_parallel_type, expand_omp_for_generic, expand_omp_for_static_nochunk, expand_omp_for_static_chunk, expand_omp_for, expand_omp_sections): Work with more precise CFG. (build_omp_regions_1): Handle OMP_SECTIONS_SWITCH. (lower_omp_sections): Emit OMP_SECTIONS_SWITCH. Add arguments to OMP_CONTINUE. * tree-gimple.c (is_gimple_stmt): Handle OMP_SECTIONS_SWITCH. * gimple-low.c (lower_stmt): Ditto. * tree-inline.c (estimate_num_insns_1): Ditto. * tree.def (OMP_SECTIONS, OMP_CONTINUE): Added new operands. (OMP_SECTIONS_SWITCH): New. * tree-cfgcleanup.c (cleanup_omp_return): New. (cleanup_tree_cfg_bb): Call cleanup_omp_return. * tree-cfg.c (make_edges): Create back edges for OMP_CONTINUE and exit edge for OMP_FOR. Handle OMP_SECTIONS_SWITCH. (tree_redirect_edge_and_branch): Handle omp constructs. * fortran/trans-openmp.c (gfc_trans_omp_sections): Build OMP_SECTIONS with three arguments. From-SVN: r127121
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index c24b1c6..f124c9a 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -517,6 +517,10 @@ make_edges (void)
case OMP_SECTIONS:
cur_region = new_omp_region (bb, code, cur_region);
+ fallthru = true;
+ break;
+
+ case OMP_SECTIONS_SWITCH:
fallthru = false;
break;
@@ -533,31 +537,42 @@ make_edges (void)
switch (cur_region->type)
{
case OMP_FOR:
- /* ??? Technically there should be a some sort of loopback
- edge here, but it goes to a block that doesn't exist yet,
- and without it, updating the ssa form would be a real
- bear. Fortunately, we don't yet do ssa before expanding
- these nodes. */
+ /* Make the loopback edge. */
+ make_edge (bb, single_succ (cur_region->entry), 0);
+
+ /* Create an edge from OMP_FOR to exit, which corresponds to
+ the case that the body of the loop is not executed at
+ all. */
+ make_edge (cur_region->entry, bb->next_bb, 0);
+ fallthru = true;
break;
case OMP_SECTIONS:
/* Wire up the edges into and out of the nested sections. */
- /* ??? Similarly wrt loopback. */
{
+ basic_block switch_bb = single_succ (cur_region->entry);
+
struct omp_region *i;
for (i = cur_region->inner; i ; i = i->next)
{
gcc_assert (i->type == OMP_SECTION);
- make_edge (cur_region->entry, i->entry, 0);
+ make_edge (switch_bb, i->entry, 0);
make_edge (i->exit, bb, EDGE_FALLTHRU);
}
+
+ /* Make the loopback edge to the block with
+ OMP_SECTIONS_SWITCH. */
+ make_edge (bb, switch_bb, 0);
+
+ /* Make the edge from the switch to exit. */
+ make_edge (switch_bb, bb->next_bb, 0);
+ fallthru = false;
}
break;
default:
gcc_unreachable ();
}
- fallthru = true;
break;
default:
@@ -4807,6 +4822,13 @@ tree_redirect_edge_and_branch (edge e, basic_block dest)
e->flags |= EDGE_FALLTHRU;
break;
+ case OMP_RETURN:
+ case OMP_CONTINUE:
+ case OMP_SECTIONS_SWITCH:
+ case OMP_FOR:
+ /* The edges from OMP constructs can be simply redirected. */
+ break;
+
default:
/* Otherwise it must be a fallthru edge, and we don't need to
do anything besides redirecting it. */