OSDN Git Service

* lib/obj-c++.exp (obj-c++_target_compile): Declare global variable,
[pf3gnuchains/gcc-fork.git] / gcc / domwalk.c
index ce0ccd1..2713e04 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
@@ -52,7 +52,7 @@ Boston, MA 02111-1307, USA.  */
 
 
   [ 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.  ]
 
@@ -145,6 +145,14 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
   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)
@@ -179,7 +187,7 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
     (*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))
@@ -201,7 +209,7 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
     {
       /* 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);
     }
 
@@ -211,7 +219,7 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
     (*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))