]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2013-11-13 Martin Jambor <mjambor@suse.cz>
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Nov 2013 15:34:47 +0000 (15:34 +0000)
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Nov 2013 15:34:47 +0000 (15:34 +0000)
* cgraph.c (cgraph_get_create_node): Do what
cgraph_get_create_real_symbol_node used to do.
(cgraph_get_create_real_symbol_node): Removed.  Changed all users to
call cgraph_get_create_node.
* cgraph.h (cgraph_get_create_real_symbol_node): Removed.
* lto-streamer-in.c (input_function): Call cgraph_get_node instead of
cgraph_get_create_node.  Assert we get a node.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204748 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cgraph.c
gcc/cgraph.h
gcc/cgraphbuild.c
gcc/gimple-fold.c
gcc/ipa-prop.c
gcc/ipa.c
gcc/lto-streamer-in.c

index 8f989267084daa5dbf3df1d74d5d9100a5cf20ff..77f3ea285b0d7236c9410168ec48e1bb1455d96b 100644 (file)
@@ -1,3 +1,13 @@
+2013-11-13  Martin Jambor  <mjambor@suse.cz>
+
+       * cgraph.c (cgraph_get_create_node): Do what
+       cgraph_get_create_real_symbol_node used to do.
+       (cgraph_get_create_real_symbol_node): Removed.  Changed all users to
+       call cgraph_get_create_node.
+       * cgraph.h (cgraph_get_create_real_symbol_node): Removed.
+       * lto-streamer-in.c (input_function): Call cgraph_get_node instead of
+       cgraph_get_create_node.  Assert we get a node.
+
 2013-11-13  Tejas Belagod  <tejas.belagod@arm.com>
 
        * config/aarch64/aarch64-simd.md (vec_extract): New.
index 385b11da7975a2f7efb697808e5b06d660df8e10..b7ec16655f564764a8071864494b6b7c5edc3bec 100644 (file)
@@ -540,19 +540,34 @@ cgraph_create_node (tree decl)
   return node;
 }
 
-/* Try to find a call graph node for declaration DECL and if it does not exist,
-   create it.  */
+/* Try to find a call graph node for declaration DECL and if it does not exist
+   or if it corresponds to an inline clone, create a new one.  */
 
 struct cgraph_node *
 cgraph_get_create_node (tree decl)
 {
-  struct cgraph_node *node;
+  struct cgraph_node *first_clone = cgraph_get_node (decl);
 
-  node = cgraph_get_node (decl);
-  if (node)
-    return node;
+  if (first_clone && !first_clone->global.inlined_to)
+    return first_clone;
 
-  return cgraph_create_node (decl);
+  struct cgraph_node *node = cgraph_create_node (decl);
+  if (first_clone)
+    {
+      first_clone->clone_of = node;
+      node->clones = first_clone;
+      symtab_prevail_in_asm_name_hash (node);
+      symtab_insert_node_to_hashtable (node);
+      if (dump_file)
+       fprintf (dump_file, "Introduced new external node "
+                "(%s/%i) and turned into root of the clone tree.\n",
+                xstrdup (cgraph_node_name (node)), node->order);
+    }
+  else if (dump_file)
+    fprintf (dump_file, "Introduced new external node "
+            "(%s/%i).\n", xstrdup (cgraph_node_name (node)),
+            node->order);
+  return node;
 }
 
 /* Mark ALIAS as an alias to DECL.  DECL_NODE is cgraph node representing
@@ -2890,51 +2905,6 @@ verify_cgraph (void)
     verify_cgraph_node (node);
 }
 
-/* Create external decl node for DECL.
-   The difference i nbetween cgraph_get_create_node and
-   cgraph_get_create_real_symbol_node is that cgraph_get_create_node
-   may return inline clone, while cgraph_get_create_real_symbol_node
-   will create a new node in this case.
-   FIXME: This function should be removed once clones are put out of decl
-   hash.  */
-
-struct cgraph_node *
-cgraph_get_create_real_symbol_node (tree decl)
-{
-  struct cgraph_node *first_clone = cgraph_get_node (decl);
-  struct cgraph_node *node;
-  /* create symbol table node.  even if inline clone exists, we can not take
-     it as a target of non-inlined call.  */
-  node = cgraph_get_node (decl);
-  if (node && !node->global.inlined_to)
-    return node;
-
-  node = cgraph_create_node (decl);
-
-  /* ok, we previously inlined the function, then removed the offline copy and
-     now we want it back for external call.  this can happen when devirtualizing
-     while inlining function called once that happens after extern inlined and
-     virtuals are already removed.  in this case introduce the external node
-     and make it available for call.  */
-  if (first_clone)
-    {
-      first_clone->clone_of = node;
-      node->clones = first_clone;
-      symtab_prevail_in_asm_name_hash (node);
-      symtab_insert_node_to_hashtable (node);
-      if (dump_file)
-       fprintf (dump_file, "Introduced new external node "
-                "(%s/%i) and turned into root of the clone tree.\n",
-                xstrdup (cgraph_node_name (node)), node->order);
-    }
-  else if (dump_file)
-    fprintf (dump_file, "Introduced new external node "
-            "(%s/%i).\n", xstrdup (cgraph_node_name (node)),
-            node->order);
-  return node;
-}
-
-
 /* Given NODE, walk the alias chain to return the function NODE is alias of.
    Walk through thunk, too.
    When AVAILABILITY is non-NULL, get minimal availability in the chain.  */
index dd99dc830b646286ed1b5335b2cd3496d7e62b74..1ac6dfb9e0de827412ca81d1b2848ddc775d92b5 100644 (file)
@@ -635,7 +635,6 @@ struct cgraph_indirect_call_info *cgraph_allocate_init_indirect_info (void);
 struct cgraph_node * cgraph_create_node (tree);
 struct cgraph_node * cgraph_create_empty_node (void);
 struct cgraph_node * cgraph_get_create_node (tree);
-struct cgraph_node * cgraph_get_create_real_symbol_node (tree);
 struct cgraph_node * cgraph_same_body_alias (struct cgraph_node *, tree, tree);
 struct cgraph_node * cgraph_add_thunk (struct cgraph_node *, tree, tree, bool, HOST_WIDE_INT,
                                       HOST_WIDE_INT, tree, tree);
index 87e06e37cbebb1a6ad1620e5c4f38777592f5146..21ad0ab2ab68e5f44d1764d50f0a5964f0cab616 100644 (file)
@@ -71,7 +71,7 @@ record_reference (tree *tp, int *walk_subtrees, void *data)
       decl = get_base_var (*tp);
       if (TREE_CODE (decl) == FUNCTION_DECL)
        {
-         struct cgraph_node *node = cgraph_get_create_real_symbol_node (decl);
+         struct cgraph_node *node = cgraph_get_create_node (decl);
          if (!ctx->only_vars)
            cgraph_mark_address_taken_node (node);
          ipa_record_reference (ctx->varpool_node,
@@ -139,9 +139,9 @@ record_eh_tables (struct cgraph_node *node, struct function *fun)
 
   if (DECL_FUNCTION_PERSONALITY (node->decl))
     {
-      struct cgraph_node *per_node;
+      tree per_decl = DECL_FUNCTION_PERSONALITY (node->decl);
+      struct cgraph_node *per_node = cgraph_get_create_node (per_decl);
 
-      per_node = cgraph_get_create_real_symbol_node (DECL_FUNCTION_PERSONALITY (node->decl));
       ipa_record_reference (node, per_node, IPA_REF_ADDR, NULL);
       cgraph_mark_address_taken_node (per_node);
     }
@@ -221,7 +221,7 @@ mark_address (gimple stmt, tree addr, void *data)
   addr = get_base_address (addr);
   if (TREE_CODE (addr) == FUNCTION_DECL)
     {
-      struct cgraph_node *node = cgraph_get_create_real_symbol_node (addr);
+      struct cgraph_node *node = cgraph_get_create_node (addr);
       cgraph_mark_address_taken_node (node);
       ipa_record_reference ((symtab_node *)data,
                            node,
@@ -250,7 +250,7 @@ mark_load (gimple stmt, tree t, void *data)
     {
       /* ??? This can happen on platforms with descriptors when these are
         directly manipulated in the code.  Pretend that it's an address.  */
-      struct cgraph_node *node = cgraph_get_create_real_symbol_node (t);
+      struct cgraph_node *node = cgraph_get_create_node (t);
       cgraph_mark_address_taken_node (node);
       ipa_record_reference ((symtab_node *)data,
                            node,
@@ -338,7 +338,7 @@ build_cgraph_edges (void)
            {
              tree fn = gimple_omp_parallel_child_fn (stmt);
              ipa_record_reference (node,
-                                   cgraph_get_create_real_symbol_node (fn),
+                                   cgraph_get_create_node (fn),
                                    IPA_REF_ADDR, stmt);
            }
          if (gimple_code (stmt) == GIMPLE_OMP_TASK)
@@ -346,12 +346,12 @@ build_cgraph_edges (void)
              tree fn = gimple_omp_task_child_fn (stmt);
              if (fn)
                ipa_record_reference (node,
-                                     cgraph_get_create_real_symbol_node (fn),
+                                     cgraph_get_create_node (fn),
                                      IPA_REF_ADDR, stmt);
              fn = gimple_omp_task_copy_fn (stmt);
              if (fn)
                ipa_record_reference (node,
-                                     cgraph_get_create_real_symbol_node (fn),
+                                     cgraph_get_create_node (fn),
                                      IPA_REF_ADDR, stmt);
            }
        }
index 122d1932b94ba2b2a0811c80963bc233d0bc681c..1cf8965b7f2d5bc5c16f0ce4655a01da4c4a46ff 100644 (file)
@@ -196,7 +196,7 @@ canonicalize_constructor_val (tree cval, tree from_decl)
          /* Make sure we create a cgraph node for functions we'll reference.
             They can be non-existent if the reference comes from an entry
             of an external vtable for example.  */
-         cgraph_get_create_real_symbol_node (base);
+         cgraph_get_create_node (base);
        }
       /* Fixup types in global initializers.  */
       if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0)))
index 9b38e4b38626c83a9c6dfc09253908e2689d1c9e..d1d3d71c0afd0e727ade90b78648511ff57fc7e3 100644 (file)
@@ -2454,7 +2454,7 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target)
                     ie->callee->order);
          return NULL;
        }
-      callee = cgraph_get_create_real_symbol_node (target);
+      callee = cgraph_get_create_node (target);
     }
   ipa_check_create_node_params ();
 
index 5e81fccbe0a802de32463a25508ef1e75d14e064..a11b1c753043efdbb337c903c30d9428bd698a9e 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -355,7 +355,7 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
          if (DECL_ABSTRACT_ORIGIN (node->decl))
            {
              struct cgraph_node *origin_node
-             = cgraph_get_create_real_symbol_node (DECL_ABSTRACT_ORIGIN (node->decl));
+             = cgraph_get_create_node (DECL_ABSTRACT_ORIGIN (node->decl));
              origin_node->used_as_abstract_origin = true;
              enqueue_node (origin_node, &first, reachable);
            }
index d4a52a766712456eac71064ad30da65729f09201..ebff04f5cdc6c7dc7b7cfc63015895e2d7cd6a25 100644 (file)
@@ -915,7 +915,8 @@ input_function (tree fn_decl, struct data_in *data_in,
 
   gimple_register_cfg_hooks ();
 
-  node = cgraph_get_create_node (fn_decl);
+  node = cgraph_get_node (fn_decl);
+  gcc_checking_assert (node);
   input_struct_function_base (fn, data_in, ib);
   input_cfg (ib_cfg, fn, node->count_materialization_scale);