summaryrefslogtreecommitdiff
path: root/gcc/dominance.c
diff options
context:
space:
mode:
authormkuvyrkov <mkuvyrkov@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-27 19:48:15 +0000
committermkuvyrkov <mkuvyrkov@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-27 19:48:15 +0000
commitc09391309a2fe002f8e1424a8fef2923bf9ca7c5 (patch)
treeef6e287dda7baf7be12f1fb62bf64d66c6a8211d /gcc/dominance.c
parent654d23578eb8fef8c9c6e6f41211b9318b9f96e5 (diff)
downloadgcc-c09391309a2fe002f8e1424a8fef2923bf9ca7c5.tar.gz
PR target/42495
PR middle-end/42574 * basic-block.h (get_dominated_to_depth): Declare. * dominance.c (get_dominated_to_depth): New function, use get_all_dominated_blocks as a base. (get_all_dominated_blocks): Use get_dominated_to_depth. * gcse.c (occr_t, VEC (occr_t, heap)): Define. (hoist_exprs): Remove. (alloc_code_hoist_mem, free_code_hoist_mem): Update. (compute_code_hoist_vbeinout): Add debug print outs. (hoist_code): Partially rewrite, simplify. Use get_dominated_to_depth. * params.def (PARAM_MAX_HOIST_DEPTH): New parameter to avoid quadratic behavior. * params.h (MAX_HOIST_DEPTH): New macro. * doc/invoke.texi (max-hoist-depth): Document. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162597 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dominance.c')
-rw-r--r--gcc/dominance.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 2e5f3ee26a2..688c87bff43 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -784,16 +784,20 @@ get_dominated_by_region (enum cdi_direction dir, basic_block *region,
}
/* Returns the list of basic blocks including BB dominated by BB, in the
- direction DIR. The vector will be sorted in preorder. */
+ direction DIR up to DEPTH in the dominator tree. The DEPTH of zero will
+ produce a vector containing all dominated blocks. The vector will be sorted
+ in preorder. */
VEC (basic_block, heap) *
-get_all_dominated_blocks (enum cdi_direction dir, basic_block bb)
+get_dominated_to_depth (enum cdi_direction dir, basic_block bb, int depth)
{
VEC(basic_block, heap) *bbs = NULL;
unsigned i;
+ unsigned next_level_start;
i = 0;
VEC_safe_push (basic_block, heap, bbs, bb);
+ next_level_start = 1; /* = VEC_length (basic_block, bbs); */
do
{
@@ -804,12 +808,24 @@ get_all_dominated_blocks (enum cdi_direction dir, basic_block bb)
son;
son = next_dom_son (dir, son))
VEC_safe_push (basic_block, heap, bbs, son);
+
+ if (i == next_level_start && --depth)
+ next_level_start = VEC_length (basic_block, bbs);
}
- while (i < VEC_length (basic_block, bbs));
+ while (i < next_level_start);
return bbs;
}
+/* 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)
+{
+ return get_dominated_to_depth (dir, bb, 0);
+}
+
/* Redirect all edges pointing to BB to TO. */
void
redirect_immediate_dominators (enum cdi_direction dir, basic_block bb,