summaryrefslogtreecommitdiff
path: root/gcc/dominance.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-20 14:01:52 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-20 14:01:52 +0000
commit59f3ea59d3c5c480e0ea7958da7a4ef6e317b91f (patch)
tree1f17a313bc30e85d418e64815f036e5b5545b849 /gcc/dominance.c
parentd2bf053d7a80f067d92121a8e72d935785fc76b8 (diff)
downloadgcc-59f3ea59d3c5c480e0ea7958da7a4ef6e317b91f.tar.gz
2009-04-20 Richard Guenther <rguenther@suse.de>
* basic-block.h (get_all_dominated_blocks): Declare. * dominance.c (get_all_dominated_blocks): New function. * tree-cfg.c (get_all_dominated_blocks): Remove. (remove_edge_and_dominated_blocks): Adjust. * tree-ssa-phiprop.c (tree_ssa_phiprop_1): Fold in ... (tree_ssa_phiprop): ... here. Use get_all_dominated_blocks instead of recursing. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146425 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dominance.c')
-rw-r--r--gcc/dominance.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/dominance.c b/gcc/dominance.c
index b4dff4c6c16..2cc14145848 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -782,6 +782,33 @@ get_dominated_by_region (enum cdi_direction dir, basic_block *region,
return doms;
}
+/* Returns the list of basic blocks including BB dominated by BB, in the
+ direction DIR. The vector will be sorted in preorder. */
+
+VEC (basic_block, heap) *
+get_all_dominated_blocks (enum cdi_direction dir, basic_block bb)
+{
+ VEC(basic_block, heap) *bbs = NULL;
+ unsigned i;
+
+ i = 0;
+ VEC_safe_push (basic_block, heap, bbs, bb);
+
+ do
+ {
+ basic_block son;
+
+ bb = VEC_index (basic_block, bbs, i++);
+ for (son = first_dom_son (dir, bb);
+ son;
+ son = next_dom_son (dir, son))
+ VEC_safe_push (basic_block, heap, bbs, son);
+ }
+ while (i < VEC_length (basic_block, bbs));
+
+ return bbs;
+}
+
/* Redirect all edges pointing to BB to TO. */
void
redirect_immediate_dominators (enum cdi_direction dir, basic_block bb,