summaryrefslogtreecommitdiff
path: root/gcc/dominance.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-16 21:29:43 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-16 21:29:43 +0000
commitd8b5b4fe9870aed9c10f607b488bb9b20428b8e9 (patch)
tree5d0332daba22aa87d85d5e5174a5bd80e35b53fc /gcc/dominance.c
parent1e6c89721706a05df1f92e3829a50bd74cfa9096 (diff)
downloadgcc-d8b5b4fe9870aed9c10f607b488bb9b20428b8e9.tar.gz
* Makefile.in (tree-cfg.o): Add CFGLAYOUT_H dependency.
* basic-block.h (get_dominated_by_region): Declare. * dominance.c (get_dominated_by_region): New function. * tree-cfg.c: Include cfglayout.h. (tree_duplicate_bb): Duplicate also phi nodes. (struct ssa_name_map_entry): New type. (add_phi_args_after_copy_bb, add_phi_args_after_copy, ssa_name_map_entry_hash, ssa_name_map_entry_eq, allocate_ssa_names, rewrite_to_new_ssa_names_def, rewrite_to_new_ssa_names_use, rewrite_to_new_ssa_names_bb, rewrite_to_new_ssa_names, tree_duplicate_sese_region): New functions. * tree-flow.h (tree_duplicate_sese_region, add_phi_args_after_copy_bb, add_phi_args_after_copy, rewrite_to_new_ssa_names_bb, rewrite_to_new_ssa_names, allocate_ssa_names, rewrite_into_loop_closed_ssa, verify_loop_closed_ssa): Declare. * tree-ssa-loop-ch.c (duplicate_blocks): Removed. (copy_loop_headers): Use tree_duplicate_sese_region. * gcc.dg/tree-ssa/copy-headers.c: Update outcome. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87614 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dominance.c')
-rw-r--r--gcc/dominance.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 5d7f824d1d6..278254719af 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -738,6 +738,32 @@ get_dominated_by (enum cdi_direction dir, basic_block bb, basic_block **bbs)
return n;
}
+/* Find all basic blocks that are immediately dominated (in direction DIR)
+ by some block between N_REGION ones stored in REGION, except for blocks
+ in the REGION itself. The found blocks are stored to DOMS and their number
+ is returned. */
+
+unsigned
+get_dominated_by_region (enum cdi_direction dir, basic_block *region,
+ unsigned n_region, basic_block *doms)
+{
+ unsigned n_doms = 0, i;
+ basic_block dom;
+
+ for (i = 0; i < n_region; i++)
+ region[i]->rbi->duplicated = 1;
+ for (i = 0; i < n_region; i++)
+ for (dom = first_dom_son (dir, region[i]);
+ dom;
+ dom = next_dom_son (dir, dom))
+ if (!dom->rbi->duplicated)
+ doms[n_doms++] = dom;
+ for (i = 0; i < n_region; i++)
+ region[i]->rbi->duplicated = 0;
+
+ return n_doms;
+}
+
/* Redirect all edges pointing to BB to TO. */
void
redirect_immediate_dominators (enum cdi_direction dir, basic_block bb,