OSDN Git Service

don't use TYPE_ARG_TYPES in the Ada frontend
[pf3gnuchains/gcc-fork.git] / gcc / cgraph.c
index 09436c7..91805e3 100644 (file)
@@ -98,6 +98,7 @@ The callgraph:
 #include "rtl.h"
 #include "ipa-utils.h"
 #include "lto-streamer.h"
+#include "ipa-inline.h"
 
 const char * const ld_plugin_symbol_resolution_names[]=
 {
@@ -141,9 +142,6 @@ int cgraph_max_uid;
 /* Maximal uid used in cgraph edges.  */
 int cgraph_edge_max_uid;
 
-/* Maximal pid used for profiling */
-int cgraph_max_pid;
-
 /* Set when whole unit has been analyzed so we can access global info.  */
 bool cgraph_global_info_ready = false;
 
@@ -471,12 +469,10 @@ cgraph_create_node_1 (void)
   struct cgraph_node *node = cgraph_allocate_node ();
 
   node->next = cgraph_nodes;
-  node->pid = -1;
   node->order = cgraph_order++;
   if (cgraph_nodes)
     cgraph_nodes->previous = node;
   node->previous = NULL;
-  node->global.estimated_growth = INT_MIN;
   node->frequency = NODE_FREQUENCY_NORMAL;
   node->count_materialization_scale = REG_BR_PROB_BASE;
   ipa_empty_ref_list (&node->ref_list);
@@ -617,8 +613,9 @@ cgraph_add_thunk (struct cgraph_node *decl_node, tree alias, tree decl,
   node = cgraph_same_body_alias_1 (decl_node, alias, decl);
   gcc_assert (node);
   gcc_checking_assert (!virtual_offset
-                      || tree_int_cst_equal (virtual_offset,
-                                             size_int (virtual_value)));
+                      || double_int_equal_p
+                           (tree_to_double_int (virtual_offset),
+                            shwi_to_double_int (virtual_value)));
   node->thunk.fixed_offset = fixed_offset;
   node->thunk.this_adjusting = this_adjusting;
   node->thunk.virtual_value = virtual_value;
@@ -925,7 +922,7 @@ cgraph_create_edge_including_clones (struct cgraph_node *orig,
                                     struct cgraph_node *callee,
                                     gimple old_stmt,
                                     gimple stmt, gcov_type count,
-                                    int freq, int loop_depth,
+                                    int freq,
                                     cgraph_inline_failed_t reason)
 {
   struct cgraph_node *node;
@@ -933,7 +930,7 @@ cgraph_create_edge_including_clones (struct cgraph_node *orig,
 
   if (!cgraph_edge (orig, stmt))
     {
-      edge = cgraph_create_edge (orig, callee, stmt, count, freq, loop_depth);
+      edge = cgraph_create_edge (orig, callee, stmt, count, freq);
       edge->inline_failed = reason;
     }
 
@@ -952,7 +949,7 @@ cgraph_create_edge_including_clones (struct cgraph_node *orig,
        else if (!cgraph_edge (node, stmt))
          {
            edge = cgraph_create_edge (node, callee, stmt, count,
-                                      freq, loop_depth);
+                                      freq);
            edge->inline_failed = reason;
          }
 
@@ -970,35 +967,13 @@ cgraph_create_edge_including_clones (struct cgraph_node *orig,
       }
 }
 
-/* Give initial reasons why inlining would fail on EDGE.  This gets either
-   nullified or usually overwritten by more precise reasons later.  */
-
-static void
-initialize_inline_failed (struct cgraph_edge *e)
-{
-  struct cgraph_node *callee = e->callee;
-
-  if (e->indirect_unknown_callee)
-    e->inline_failed = CIF_INDIRECT_UNKNOWN_CALL;
-  else if (!callee->analyzed)
-    e->inline_failed = CIF_BODY_NOT_AVAILABLE;
-  else if (callee->local.redefined_extern_inline)
-    e->inline_failed = CIF_REDEFINED_EXTERN_INLINE;
-  else if (!callee->local.inlinable)
-    e->inline_failed = CIF_FUNCTION_NOT_INLINABLE;
-  else if (e->call_stmt && gimple_call_cannot_inline_p (e->call_stmt))
-    e->inline_failed = CIF_MISMATCHED_ARGUMENTS;
-  else
-    e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED;
-}
-
 /* Allocate a cgraph_edge structure and fill it with data according to the
    parameters of which only CALLEE can be NULL (when creating an indirect call
    edge).  */
 
 static struct cgraph_edge *
 cgraph_create_edge_1 (struct cgraph_node *caller, struct cgraph_node *callee,
-                      gimple call_stmt, gcov_type count, int freq, int nest)
+                      gimple call_stmt, gcov_type count, int freq)
 {
   struct cgraph_edge *edge;
 
@@ -1037,11 +1012,8 @@ cgraph_create_edge_1 (struct cgraph_node *caller, struct cgraph_node *callee,
   edge->frequency = freq;
   gcc_assert (freq >= 0);
   gcc_assert (freq <= CGRAPH_FREQ_MAX);
-  edge->loop_nest = nest;
 
   edge->call_stmt = call_stmt;
-  edge->call_stmt_size = 0;
-  edge->call_stmt_time = 0;
   push_cfun (DECL_STRUCT_FUNCTION (caller->decl));
   edge->can_throw_external
     = call_stmt ? stmt_can_throw_external (call_stmt) : false;
@@ -1061,10 +1033,10 @@ cgraph_create_edge_1 (struct cgraph_node *caller, struct cgraph_node *callee,
 
 struct cgraph_edge *
 cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee,
-                   gimple call_stmt, gcov_type count, int freq, int nest)
+                   gimple call_stmt, gcov_type count, int freq)
 {
   struct cgraph_edge *edge = cgraph_create_edge_1 (caller, callee, call_stmt,
-                                                  count, freq, nest);
+                                                  count, freq);
 
   edge->indirect_unknown_callee = 0;
   initialize_inline_failed (edge);
@@ -1100,10 +1072,10 @@ cgraph_allocate_init_indirect_info (void)
 struct cgraph_edge *
 cgraph_create_indirect_edge (struct cgraph_node *caller, gimple call_stmt,
                             int ecf_flags,
-                            gcov_type count, int freq, int nest)
+                            gcov_type count, int freq)
 {
   struct cgraph_edge *edge = cgraph_create_edge_1 (caller, NULL, call_stmt,
-                                                  count, freq, nest);
+                                                  count, freq);
 
   edge->indirect_unknown_callee = 1;
   initialize_inline_failed (edge);
@@ -1270,7 +1242,6 @@ cgraph_update_edges_for_call_stmt_node (struct cgraph_node *node,
       struct cgraph_edge *ne = NULL;
       gcov_type count;
       int frequency;
-      int loop_nest;
 
       if (e)
        {
@@ -1294,7 +1265,6 @@ cgraph_update_edges_for_call_stmt_node (struct cgraph_node *node,
             attached to edge is invalid.  */
          count = e->count;
          frequency = e->frequency;
-         loop_nest = e->loop_nest;
          cgraph_remove_edge (e);
        }
       else
@@ -1304,14 +1274,12 @@ cgraph_update_edges_for_call_stmt_node (struct cgraph_node *node,
          count = bb->count;
          frequency = compute_call_stmt_bb_frequency (current_function_decl,
                                                      bb);
-         loop_nest = bb->loop_depth;
        }
 
       if (new_call)
        {
          ne = cgraph_create_edge (node, cgraph_get_create_node (new_call),
-                                  new_stmt, count, frequency,
-                                  loop_nest);
+                                  new_stmt, count, frequency);
          gcc_assert (ne->inline_failed);
        }
     }
@@ -1849,8 +1817,7 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
   struct cgraph_edge *edge;
   int indirect_calls_count = 0;
 
-  fprintf (f, "%s/%i(%i)", cgraph_node_name (node), node->uid,
-          node->pid);
+  fprintf (f, "%s/%i", cgraph_node_name (node), node->uid);
   dump_addr (f, " @", (void *)node);
   if (DECL_ASSEMBLER_NAME_SET_P (node->decl))
     fprintf (f, " (asm: %s)", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl)));
@@ -1899,12 +1866,6 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
             ld_plugin_symbol_resolution_names[(int)node->resolution]);
   if (node->local.finalized)
     fprintf (f, " finalized");
-  if (node->local.disregard_inline_limits)
-    fprintf (f, " always_inline");
-  else if (node->local.inlinable)
-    fprintf (f, " inlinable");
-  else if (node->local.versionable)
-    fprintf (f, " versionable");
   if (node->local.redefined_extern_inline)
     fprintf (f, " redefined_extern_inline");
   if (TREE_ASM_WRITTEN (node->decl))
@@ -1948,8 +1909,6 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
       if (edge->frequency)
        fprintf (f, "(%.2f per call) ",
                 edge->frequency / (double)CGRAPH_FREQ_BASE);
-      if (edge->loop_nest)
-       fprintf (f, "(nested in %i loops) ", edge->loop_nest);
       if (edge->can_throw_external)
        fprintf(f, "(can throw external) ");
     }
@@ -2097,7 +2056,7 @@ cgraph_function_possibly_inlined_p (tree decl)
 struct cgraph_edge *
 cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n,
                   gimple call_stmt, unsigned stmt_uid, gcov_type count_scale,
-                  int freq_scale, int loop_nest, bool update_original)
+                  int freq_scale, bool update_original)
 {
   struct cgraph_edge *new_edge;
   gcov_type count = e->count * count_scale / REG_BR_PROB_BASE;
@@ -2118,22 +2077,19 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n,
        {
          struct cgraph_node *callee = cgraph_get_node (decl);
          gcc_checking_assert (callee);
-         new_edge = cgraph_create_edge (n, callee, call_stmt, count, freq,
-                                        e->loop_nest + loop_nest);
+         new_edge = cgraph_create_edge (n, callee, call_stmt, count, freq);
        }
       else
        {
          new_edge = cgraph_create_indirect_edge (n, call_stmt,
                                                  e->indirect_info->ecf_flags,
-                                                 count, freq,
-                                                 e->loop_nest + loop_nest);
+                                                 count, freq);
          *new_edge->indirect_info = *e->indirect_info;
        }
     }
   else
     {
-      new_edge = cgraph_create_edge (n, e->callee, call_stmt, count, freq,
-                                    e->loop_nest + loop_nest);
+      new_edge = cgraph_create_edge (n, e->callee, call_stmt, count, freq);
       if (e->indirect_info)
        {
          new_edge->indirect_info
@@ -2142,8 +2098,6 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n,
        }
     }
 
-  new_edge->call_stmt_size = e->call_stmt_size;
-  new_edge->call_stmt_time = e->call_stmt_time;
   new_edge->inline_failed = e->inline_failed;
   new_edge->indirect_inlining_edge = e->indirect_inlining_edge;
   new_edge->lto_stmt_uid = stmt_uid;
@@ -2170,7 +2124,7 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n,
    by node.  */
 struct cgraph_node *
 cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq,
-                  int loop_nest, bool update_original,
+                  bool update_original,
                   VEC(cgraph_edge_p,heap) *redirect_callers)
 {
   struct cgraph_node *new_node = cgraph_create_node_1 ();
@@ -2189,7 +2143,6 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq,
   new_node->local = n->local;
   new_node->local.externally_visible = false;
   new_node->local.local = true;
-  new_node->local.vtable_method = false;
   new_node->global = n->global;
   new_node->rtl = n->rtl;
   new_node->count = count;
@@ -2222,11 +2175,11 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq,
 
   for (e = n->callees;e; e=e->next_callee)
     cgraph_clone_edge (e, new_node, e->call_stmt, e->lto_stmt_uid,
-                      count_scale, freq, loop_nest, update_original);
+                      count_scale, freq, update_original);
 
   for (e = n->indirect_calls; e; e = e->next_callee)
     cgraph_clone_edge (e, new_node, e->call_stmt, e->lto_stmt_uid,
-                      count_scale, freq, loop_nest, update_original);
+                      count_scale, freq, update_original);
   ipa_clone_references (new_node, NULL, &n->ref_list);
 
   new_node->next_sibling_clone = n->clones;
@@ -2319,7 +2272,7 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
   SET_DECL_RTL (new_decl, NULL);
 
   new_node = cgraph_clone_node (old_node, new_decl, old_node->count,
-                               CGRAPH_FREQ_BASE, 0, false,
+                               CGRAPH_FREQ_BASE, false,
                                redirect_callers);
   /* Update the properties.
      Make clone visible only within this translation unit.  Make sure
@@ -2333,6 +2286,8 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
   TREE_PUBLIC (new_node->decl) = 0;
   DECL_COMDAT (new_node->decl) = 0;
   DECL_WEAK (new_node->decl) = 0;
+  DECL_STATIC_CONSTRUCTOR (new_node->decl) = 0;
+  DECL_STATIC_DESTRUCTOR (new_node->decl) = 0;
   new_node->clone.tree_map = tree_map;
   new_node->clone.args_to_skip = args_to_skip;
   FOR_EACH_VEC_ELT (ipa_replace_map_p, tree_map, i, map)
@@ -2734,7 +2689,7 @@ cgraph_propagate_frequency (struct cgraph_node *node)
            fprintf (dump_file, "  Called by %s that is executed once\n",
                     cgraph_node_name (edge->caller));
          maybe_unlikely_executed = false;
-         if (edge->loop_nest)
+         if (inline_edge_summary (edge)->loop_depth)
            {
              maybe_executed_once = false;
              if (dump_file && (dump_flags & TDF_DETAILS))