/* Generic dominator tree walker
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
[ Note this walker can also walk the post-dominator tree, which is
- defined in a similar manner. ie, block B1 is said to post-dominate
+ defined in a similar manner. i.e., block B1 is said to post-dominate
block B2 if all paths from B2 to the exit block must pass through
B1. ]
void *bd = NULL;
basic_block dest;
block_stmt_iterator bsi;
+ bool is_interesting;
+
+ /* If block BB is not interesting to the caller, then none of the
+ callbacks that walk the statements in BB are going to be
+ executed. */
+ is_interesting = bb->index < 0
+ || walk_data->interesting_blocks == NULL
+ || TEST_BIT (walk_data->interesting_blocks, bb->index);
/* Callback to initialize the local data structure. */
if (walk_data->initialize_block_local_data)
(*walk_data->before_dom_children_before_stmts) (walk_data, bb);
/* Statement walk before walking dominator children. */
- if (walk_data->before_dom_children_walk_stmts)
+ if (is_interesting && walk_data->before_dom_children_walk_stmts)
{
if (walk_data->walk_stmts_backward)
for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi))
{
/* The destination block may have become unreachable, in
which case there's no point in optimizing it. */
- if (dest->pred)
+ if (EDGE_COUNT (dest->preds) > 0)
walk_dominator_tree (walk_data, dest);
}
(*walk_data->after_dom_children_before_stmts) (walk_data, bb);
/* Statement walk after walking dominator children. */
- if (walk_data->after_dom_children_walk_stmts)
+ if (is_interesting && walk_data->after_dom_children_walk_stmts)
{
if (walk_data->walk_stmts_backward)
for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi))