OSDN Git Service

* ipa.c (function_and_variable_visibility): Fix my accidentail commit and
[pf3gnuchains/gcc-fork.git] / gcc / ipa-inline.c
index 18e440a..08088dd 100644 (file)
@@ -310,7 +310,7 @@ cgraph_mark_inline_edge (struct cgraph_edge *e, bool update_original,
     overall_size -= orig_size;
   ncalls_inlined++;
 
-  if (flag_indirect_inlining)
+  if (flag_indirect_inlining && !flag_wpa)
     return ipa_propagate_indirect_call_infos (curr, new_edges);
   else
     return false;
@@ -876,7 +876,7 @@ cgraph_decide_inlining_of_small_functions (void)
   int min_size, max_size;
   VEC (cgraph_edge_p, heap) *new_indirect_edges = NULL;
 
-  if (flag_indirect_inlining)
+  if (flag_indirect_inlining && !flag_wpa)
     new_indirect_edges = VEC_alloc (cgraph_edge_p, heap, 8);
 
   if (dump_file)
@@ -1023,10 +1023,10 @@ cgraph_decide_inlining_of_small_functions (void)
          if (where->global.inlined_to)
            where = where->global.inlined_to;
          if (!cgraph_decide_recursive_inlining (where,
-                                                flag_indirect_inlining
+                                                flag_indirect_inlining && !flag_wpa
                                                 ? &new_indirect_edges : NULL))
            continue;
-         if (flag_indirect_inlining)
+         if (flag_indirect_inlining && !flag_wpa)
            add_new_edges_to_heap (heap, new_indirect_edges);
           update_callee_keys (heap, where, updated_nodes);
        }
@@ -1045,7 +1045,7 @@ cgraph_decide_inlining_of_small_functions (void)
            }
          callee = edge->callee;
          cgraph_mark_inline_edge (edge, true, &new_indirect_edges);
-         if (flag_indirect_inlining)
+         if (flag_indirect_inlining && !flag_wpa)
            add_new_edges_to_heap (heap, new_indirect_edges);
 
          update_callee_keys (heap, callee, updated_nodes);
@@ -1113,13 +1113,9 @@ cgraph_decide_inlining (void)
   bool redo_always_inline = true;
   int initial_size = 0;
 
-  /* FIXME lto.  We need to rethink how to coordinate different passes. */
-  if (flag_ltrans)
-    return 0;
-
-  /* FIXME lto.  We need to re-think about how the passes get invoked. */
-  if (!flag_wpa)
-    cgraph_remove_function_insertion_hook (function_insertion_hook_holder);
+  cgraph_remove_function_insertion_hook (function_insertion_hook_holder);
+  if (in_lto_p && flag_indirect_inlining && !flag_wpa)
+    ipa_update_after_lto_read ();
 
   max_count = 0;
   max_benefit = 0;
@@ -1237,6 +1233,7 @@ cgraph_decide_inlining (void)
              && !DECL_EXTERNAL (node->decl)
              && !DECL_COMDAT (node->decl))
            {
+             cgraph_inline_failed_t reason;
              old_size = overall_size;
              if (dump_file)
                {
@@ -1250,7 +1247,7 @@ cgraph_decide_inlining (void)
                }
 
              if (cgraph_check_inline_limits (node->callers->caller, node,
-                                             NULL, false))
+                                             &reason, false))
                {
                  cgraph_mark_inline (node->callers);
                  if (dump_file)
@@ -1265,14 +1262,15 @@ cgraph_decide_inlining (void)
                {
                  if (dump_file)
                    fprintf (dump_file,
-                            " Inline limit reached, not inlined.\n");
+                            " Not inlining: %s.\n",
+                             cgraph_inline_failed_string (reason));
                }
            }
        }
     }
 
   /* Free ipa-prop structures if they are no longer needed.  */
-  if (flag_indirect_inlining)
+  if (flag_indirect_inlining && !flag_wpa)
     free_all_ipa_structures_after_iinln ();
 
   if (dump_file)
@@ -1593,10 +1591,10 @@ cgraph_early_inlining (void)
 
   if (sorrycount || errorcount)
     return 0;
-  while (cgraph_decide_inlining_incrementally (node,
-                                              iterations
-                                              ? INLINE_SIZE_NORECURSIVE : INLINE_SIZE, 0)
-        && iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS))
+  while (iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS)
+         && cgraph_decide_inlining_incrementally (node,
+                                                 iterations
+                                                 ? INLINE_SIZE_NORECURSIVE : INLINE_SIZE, 0))
     {
       timevar_push (TV_INTEGRATION);
       todo |= optimize_inline_calls (current_function_decl);
@@ -1928,10 +1926,6 @@ inline_generate_summary (void)
 {
   struct cgraph_node *node;
 
-  /* FIXME lto.  We should not run any IPA-summary pass in LTRANS mode.  */
-  if (flag_ltrans)
-    return;
-
   function_insertion_hook_holder =
       cgraph_add_function_insertion_hook (&add_new_function, NULL);
 
@@ -1976,6 +1970,34 @@ inline_transform (struct cgraph_node *node)
   return todo | execute_fixup_cfg ();
 }
 
+/* Read inline summary.  Jump functions are shared among ipa-cp
+   and inliner, so when ipa-cp is active, we don't need to write them
+   twice.  */
+
+static void 
+inline_read_summary (void)
+{
+  if (flag_indirect_inlining && !flag_wpa)
+    {
+      ipa_register_cgraph_hooks ();
+      if (!flag_ipa_cp)
+        ipa_prop_read_jump_functions ();
+    }
+  function_insertion_hook_holder =
+      cgraph_add_function_insertion_hook (&add_new_function, NULL);
+}
+
+/* Write inline summary for node in SET.
+   Jump functions are shared among ipa-cp and inliner, so when ipa-cp is
+   active, we don't need to write them twice.  */
+
+static void 
+inline_write_summary (cgraph_node_set set)
+{
+  if (flag_indirect_inlining && !flag_ipa_cp)
+    ipa_prop_write_jump_functions (set);
+}
+
 struct ipa_opt_pass_d pass_ipa_inline =
 {
  {
@@ -1995,9 +2017,10 @@ struct ipa_opt_pass_d pass_ipa_inline =
   | TODO_remove_functions              /* todo_flags_finish */
  },
  inline_generate_summary,              /* generate_summary */
NULL,                                 /* write_summary */
NULL,                                 /* read_summary */
inline_write_summary,                 /* write_summary */
inline_read_summary,                  /* read_summary */
  NULL,                                 /* function_read_summary */
+ NULL,                                 /* stmt_fixup */
  0,                                    /* TODOs */
  inline_transform,                     /* function_transform */
  NULL,                                 /* variable_transform */