OSDN Git Service

* lib/gcc-simulate-thread.exp (simulate-thread): Improve error message.
[pf3gnuchains/gcc-fork.git] / gcc / cgraph.c
index dfa5439..44a950c 100644 (file)
@@ -110,7 +110,8 @@ const char * const ld_plugin_symbol_resolution_names[]=
   "preempted_ir",
   "resolved_ir",
   "resolved_exec",
-  "resolved_dyn"
+  "resolved_dyn",
+  "prevailing_def_ironly_exp"
 };
 
 static void cgraph_node_remove_callers (struct cgraph_node *node);
@@ -642,29 +643,6 @@ cgraph_add_thunk (struct cgraph_node *decl_node ATTRIBUTE_UNUSED,
    is assigned.  */
 
 struct cgraph_node *
-cgraph_get_node_or_alias (const_tree decl)
-{
-  struct cgraph_node key, *node = NULL, **slot;
-
-  gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
-
-  if (!cgraph_hash)
-    return NULL;
-
-  key.decl = CONST_CAST2 (tree, const_tree, decl);
-
-  slot = (struct cgraph_node **) htab_find_slot (cgraph_hash, &key,
-                                                NO_INSERT);
-
-  if (slot && *slot)
-    node = *slot;
-  return node;
-}
-
-/* Returns the cgraph node assigned to DECL or NULL if no cgraph node
-   is assigned.  */
-
-struct cgraph_node *
 cgraph_get_node (const_tree decl)
 {
   struct cgraph_node key, *node = NULL, **slot;
@@ -858,7 +836,7 @@ cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt)
       struct cgraph_node *new_callee = cgraph_get_node (decl);
 
       gcc_checking_assert (new_callee);
-      cgraph_make_edge_direct (e, new_callee, 0);
+      cgraph_make_edge_direct (e, new_callee);
     }
 
   push_cfun (DECL_STRUCT_FUNCTION (e->caller->decl));
@@ -1184,11 +1162,9 @@ cgraph_redirect_edge_callee (struct cgraph_edge *e, struct cgraph_node *n)
    pointer (first parameter) to compensate for skipping a thunk adjustment.  */
 
 void
-cgraph_make_edge_direct (struct cgraph_edge *edge, struct cgraph_node *callee,
-                        HOST_WIDE_INT delta)
+cgraph_make_edge_direct (struct cgraph_edge *edge, struct cgraph_node *callee)
 {
   edge->indirect_unknown_callee = 0;
-  edge->indirect_info->thunk_delta = delta;
 
   /* Get the edge out of the indirect edge list. */
   if (edge->prev_callee)
@@ -1208,6 +1184,13 @@ cgraph_make_edge_direct (struct cgraph_edge *edge, struct cgraph_node *callee,
   /* Insert to callers list of the new callee.  */
   cgraph_set_edge_callee (edge, callee);
 
+  if (edge->call_stmt
+      && !gimple_check_call_matching_types (edge->call_stmt, callee->decl))
+    {
+      gimple_call_set_cannot_inline (edge->call_stmt, true);
+      edge->call_stmt_cannot_inline_p = true;
+    }
+
   /* We need to re-determine the inlining status of the edge.  */
   initialize_inline_failed (edge);
 }
@@ -1630,6 +1613,31 @@ cgraph_remove_node (struct cgraph_node *node)
   free_nodes = node;
 }
 
+/* Add NEW_ to the same comdat group that OLD is in.  */
+
+void
+cgraph_add_to_same_comdat_group (struct cgraph_node *new_,
+                                struct cgraph_node *old)
+{
+  gcc_assert (DECL_ONE_ONLY (old->decl));
+  gcc_assert (!new_->same_comdat_group);
+  gcc_assert (new_ != old);
+
+  DECL_COMDAT_GROUP (new_->decl) = DECL_COMDAT_GROUP (old->decl);
+  new_->same_comdat_group = old;
+  if (!old->same_comdat_group)
+    old->same_comdat_group = new_;
+  else
+    {
+      struct cgraph_node *n;
+      for (n = old->same_comdat_group;
+          n->same_comdat_group != old;
+          n = n->same_comdat_group)
+       ;
+      n->same_comdat_group = new_;
+    }
+}
+
 /* Remove the node from cgraph.  */
 
 void
@@ -1837,6 +1845,10 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
     fprintf (f, " only_called_at_startup");
   if (node->only_called_at_exit)
     fprintf (f, " only_called_at_exit");
+  else if (node->alias)
+    fprintf (f, " alias");
+  if (node->tm_clone)
+    fprintf (f, " tm_clone");
 
   fprintf (f, "\n");
 
@@ -1959,7 +1971,7 @@ change_decl_assembler_name (tree decl, tree name)
 
       if (assembler_name_hash
          && TREE_CODE (decl) == FUNCTION_DECL
-         && (node = cgraph_get_node_or_alias (decl)) != NULL)
+         && (node = cgraph_get_node (decl)) != NULL)
        {
          tree old_name = DECL_ASSEMBLER_NAME (decl);
          slot = htab_find_slot_with_hash (assembler_name_hash, old_name,
@@ -1977,7 +1989,7 @@ change_decl_assembler_name (tree decl, tree name)
     }
   if (assembler_name_hash
       && TREE_CODE (decl) == FUNCTION_DECL
-      && (node = cgraph_get_node_or_alias (decl)) != NULL)
+      && (node = cgraph_get_node (decl)) != NULL)
     {
       slot = htab_find_slot_with_hash (assembler_name_hash, name,
                                       decl_assembler_name_hash (name),
@@ -2487,7 +2499,7 @@ cgraph_make_decl_local (tree decl)
     DECL_COMMON (decl) = 0;
   else gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
 
-  if (DECL_COMDAT (decl))
+  if (DECL_ONE_ONLY (decl) || DECL_COMDAT (decl))
     {
       /* It is possible that we are linking against library defining same COMDAT
         function.  To avoid conflict we need to rename our local name of the
@@ -2500,7 +2512,7 @@ cgraph_make_decl_local (tree decl)
          old_name  = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
          if (TREE_CODE (decl) == FUNCTION_DECL)
            {
-             struct cgraph_node *node = cgraph_get_node_or_alias (decl);
+             struct cgraph_node *node = cgraph_get_node (decl);
              change_decl_assembler_name (decl,
                                          clone_function_name (decl, "local"));
              if (node->local.lto_file_data)
@@ -2566,7 +2578,7 @@ cgraph_for_node_thunks_and_aliases (struct cgraph_node *node,
   for (e = node->callers; e; e = e->next_caller)
     if (e->caller->thunk.thunk_p
        && (include_overwritable
-           || cgraph_function_body_availability (e->caller)))
+           || cgraph_function_body_availability (e->caller) > AVAIL_OVERWRITABLE))
       if (cgraph_for_node_thunks_and_aliases (e->caller, callback, data,
                                              include_overwritable))
        return true;