OSDN Git Service

2004-10-02 James A. Morrison <phython@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / tree-optimize.c
index b9a2fa5..1d145dc 100644 (file)
@@ -391,7 +391,9 @@ init_tree_optimization_passes (void)
   p = &pass_loop.sub;
   NEXT_PASS (pass_loop_init);
   NEXT_PASS (pass_lim);
+  NEXT_PASS (pass_unswitch);
   NEXT_PASS (pass_iv_canon);
+  NEXT_PASS (pass_record_bounds);
   NEXT_PASS (pass_if_conversion);
   NEXT_PASS (pass_vectorize);
   NEXT_PASS (pass_linear_transform);
@@ -539,13 +541,31 @@ execute_pass_list (struct tree_opt_pass *pass)
     }
   while (pass);
 }
+\f
+
+/* Update recursively all inlined_to pointers of functions
+   inlined into NODE to INLINED_TO.  */
+static void
+update_inlined_to_pointers (struct cgraph_node *node,
+                           struct cgraph_node *inlined_to)
+{
+  struct cgraph_edge *e;
+  for (e = node->callees; e; e = e->next_callee)
+    {
+      if (e->callee->global.inlined_to)
+       {
+         e->callee->global.inlined_to = inlined_to;
+         update_inlined_to_pointers (e->callee, inlined_to);
+       }
+    }
+}
 
 \f
 /* For functions-as-trees languages, this performs all optimization and
    compilation for FNDECL.  */
 
 void
-tree_rest_of_compilation (tree fndecl, bool nested_p)
+tree_rest_of_compilation (tree fndecl)
 {
   location_t saved_loc;
   struct cgraph_node *saved_node = NULL, *node;
@@ -609,11 +629,6 @@ tree_rest_of_compilation (tree fndecl, bool nested_p)
   if (!vars_to_rename)
     vars_to_rename = BITMAP_XMALLOC ();
 
-  /* If this is a nested function, protect the local variables in the stack
-     above us from being collected while we're compiling this function.  */
-  if (nested_p)
-    ggc_push_context ();
-
   /* Perform all tree transforms and optimizations.  */
   execute_pass_list (all_passes);
 
@@ -630,16 +645,14 @@ tree_rest_of_compilation (tree fndecl, bool nested_p)
       if (!flag_unit_at_a_time)
        {
          struct cgraph_edge *e;
+
          while (node->callees)
            cgraph_remove_edge (node->callees);
          node->callees = saved_node->callees;
          saved_node->callees = NULL;
+         update_inlined_to_pointers (node, node);
          for (e = node->callees; e; e = e->next_callee)
-           {
-             if (e->callee->global.inlined_to)
-               e->callee->global.inlined_to = node;
-             e->caller = node;
-           }
+           e->caller = node;
          cgraph_remove_node (saved_node);
        }
     }
@@ -671,7 +684,7 @@ tree_rest_of_compilation (tree fndecl, bool nested_p)
        }
     }
 
-  if (!nested_p && !flag_inline_trees)
+  if (!flag_inline_trees)
     {
       DECL_SAVED_TREE (fndecl) = NULL;
       if (DECL_STRUCT_FUNCTION (fndecl) == 0
@@ -690,9 +703,5 @@ tree_rest_of_compilation (tree fndecl, bool nested_p)
   input_location = saved_loc;
 
   ggc_collect ();
-
-  /* Undo the GC context switch.  */
-  if (nested_p)
-    ggc_pop_context ();
   timevar_pop (TV_EXPAND);
 }