aboutsummaryrefslogtreecommitdiff
path: root/gcc/dominance.c
diff options
context:
space:
mode:
authorZdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>2004-09-16 23:29:43 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2004-09-16 21:29:43 +0000
commit42759f1ea05f7893f3bee4adbab74becf1a9f764 (patch)
tree5d0332daba22aa87d85d5e5174a5bd80e35b53fc /gcc/dominance.c
parent2731cf24d22fbc55453b74a5498f72ce5c41a52b (diff)
downloadgcc-42759f1ea05f7893f3bee4adbab74becf1a9f764.zip
gcc-42759f1ea05f7893f3bee4adbab74becf1a9f764.tar.gz
gcc-42759f1ea05f7893f3bee4adbab74becf1a9f764.tar.bz2
Makefile.in (tree-cfg.o): Add CFGLAYOUT_H dependency.
* 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. From-SVN: r87614
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 5d7f824..2782547 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,