tree-pass.h (pass_O0_always_inline): Declare.
authorJan Hubicka <jh@suse.cz>
Mon, 5 May 2008 05:31:34 +0000 (07:31 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 5 May 2008 05:31:34 +0000 (05:31 +0000)
tree-optimization/36100
* tree-pass.h (pass_O0_always_inline): Declare.
* ipa-inline.c (inline_transform): Remove dead code.
(cgraph_gate_O0_always_inline, cgraph_O0_always_inline,
pass_O0_always_inline): New.
* passes.c (init_optimization_passes): Add pass_O0_always_inline.

From-SVN: r134942

gcc/ChangeLog
gcc/ipa-inline.c
gcc/passes.c
gcc/tree-pass.h

index c29c26fa90cf27c608b3ea733aa20536a78013e2..38ac5f507bd91b7909e5746e7d5140f4c3f15266 100644 (file)
@@ -1,3 +1,12 @@
+2008-06-04  Jan Hubicka  <jh@suse.cz>
+
+       tree-optimization/36100
+       * tree-pass.h (pass_O0_always_inline): Declare.
+       * ipa-inline.c (inline_transform): Remove dead code.
+       (cgraph_gate_O0_always_inline, cgraph_O0_always_inline,
+       pass_O0_always_inline): New.
+       * passes.c (init_optimization_passes): Add pass_O0_always_inline.
+
 2008-05-04  Kai Tietz  <kai.tietz@onevision.com>
 
        * config/i386/i386.c (x86_output_mi_thunk): Use movq alternative
index 81246d8d1a9d4aad14dc1ba57ad56a0206e4e6bd..68a42013bfdb0ab8fbc7356183d7f5fe286dde27 100644 (file)
@@ -1588,14 +1588,6 @@ inline_transform (struct cgraph_node *node)
       todo = optimize_inline_calls (current_function_decl);
       timevar_pop (TV_INTEGRATION);
     }
-  /* In non-unit-at-a-time we must mark all referenced functions as needed.  */
-  if (!flag_unit_at_a_time)
-    {
-      struct cgraph_edge *e;
-      for (e = node->callees; e; e = e->next_callee)
-       if (e->callee->analyzed)
-          cgraph_mark_needed_node (e->callee);
-    }
   return todo | execute_fixup_cfg ();
 }
 
@@ -1628,4 +1620,63 @@ struct ipa_opt_pass pass_ipa_inline =
  NULL,                                 /* variable_transform */
 };
 
+
+/* When inlining shall be performed.  */
+static bool
+cgraph_gate_O0_always_inline (void)
+{
+  return !flag_unit_at_a_time || !flag_inline_trees;
+}
+
+static unsigned int
+cgraph_O0_always_inline (void)
+{
+  struct cgraph_node *node = cgraph_node (current_function_decl);
+  unsigned int todo = 0;
+  bool inlined;
+
+  if (sorrycount || errorcount)
+    return 0;
+  inlined = cgraph_decide_inlining_incrementally (node, INLINE_SPEED, 0);
+  /* We might need the body of this function so that we can expand
+     it inline somewhere else.  */
+  if (cgraph_preserve_function_body_p (current_function_decl))
+    save_inline_function_body (node);
+  if (inlined || warn_inline)
+    {
+      timevar_push (TV_INTEGRATION);
+      todo = optimize_inline_calls (current_function_decl);
+      timevar_pop (TV_INTEGRATION);
+    }
+  /* In non-unit-at-a-time we must mark all referenced functions as needed.  */
+  if (!flag_unit_at_a_time)
+    {
+      struct cgraph_edge *e;
+      for (e = node->callees; e; e = e->next_callee)
+       if (e->callee->analyzed)
+          cgraph_mark_needed_node (e->callee);
+    }
+  return todo | execute_fixup_cfg ();
+}
+
+struct gimple_opt_pass pass_O0_always_inline = 
+{
+ {
+  GIMPLE_PASS,
+  "always_inline",                     /* name */
+  cgraph_gate_O0_always_inline,                /* gate */
+  cgraph_O0_always_inline,             /* execute */
+  NULL,                                        /* sub */
+  NULL,                                        /* next */
+  0,                                   /* static_pass_number */
+  TV_INLINE_HEURISTICS,                        /* tv_id */
+  0,                                   /* properties_required */
+  PROP_cfg,                            /* properties_provided */
+  0,                                   /* properties_destroyed */
+  0,                                   /* todo_flags_start */
+  TODO_dump_func | TODO_verify_flow
+  | TODO_verify_stmts                  /* todo_flags_finish */
+ }
+};
+
 #include "gt-ipa-inline.h"
index 0ca26fe35a0a277fcedc9ab3a0f7919bc2be4784..09585660828e771b81799440b9c1750bdef6cc25 100644 (file)
@@ -553,6 +553,7 @@ init_optimization_passes (void)
   /* These passes are run after IPA passes on every function that is being
      output to the assembler file.  */
   p = &all_passes;
+  NEXT_PASS (pass_O0_always_inline);
   NEXT_PASS (pass_all_optimizations);
     {
       struct opt_pass **p = &pass_all_optimizations.pass.sub;
index 4d16ed697d468b2666348d9a517c6e359564d626..41fd8e5beb4bdbaa6eeb74ef1dc76709f39a8528 100644 (file)
@@ -501,6 +501,7 @@ extern struct rtl_opt_pass pass_final;
 extern struct rtl_opt_pass pass_rtl_seqabstr;
 extern struct gimple_opt_pass pass_release_ssa_names;
 extern struct gimple_opt_pass pass_early_inline;
+extern struct gimple_opt_pass pass_O0_always_inline;
 extern struct gimple_opt_pass pass_inline_parameters;
 extern struct gimple_opt_pass pass_all_early_optimizations;
 extern struct gimple_opt_pass pass_update_address_taken;