OSDN Git Service

2011-04-12 Martin Jambor <mjambor@suse.cz>
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Apr 2011 09:27:18 +0000 (09:27 +0000)
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Apr 2011 09:27:18 +0000 (09:27 +0000)
* cgraph.h (cgraph_node): Remove function declaration.
(cgraph_create_node): Declare.
(cgraph_get_create_node): Likewise.
* cgraph.c (cgraph_create_node): Renamed to cgraph_create_node_1.
Updated all callers.
(cgraph_node): Renamed to cgraph_create_node, assert that a node for
the decl does not already exist.  Call cgraph_get_create_node instead
of cgraph_node.
(cgraph_get_create_node): New function.
(cgraph_same_body_alias): Update comment.
(cgraph_set_call_stmt): Call cgraph_get_node instead of cgraph_node,
assert it does not return NULL.
(cgraph_update_edges_for_call_stmt): Likewise.
(cgraph_clone_edge): Likewise.
(cgraph_create_virtual_clone): Likewise.
(cgraph_update_edges_for_call_stmt_node): Call cgraph_get_create_node
instead of cgraph_node.
(cgraph_add_new_function): Call cgraph_create_node or
cgraph_get_create_node instead of cgraph_node.
* cgraphbuild.c (record_reference): Call cgraph_get_create_node
instead of cgraph_node.
(record_eh_tables): Likewise.
(mark_address): Likewise.
(mark_load): Likewise.
(build_cgraph_edges): Call cgraph_get_create_node instead
of cgraph_node.
(rebuild_cgraph_edges): Likewise.
* cgraphunit.c (cgraph_finalize_function): Call cgraph_get_create_node
instead of cgraph_node.
(cgraph_copy_node_for_versioning): Call cgraph_create_node instead of
cgraph_node.
* lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Call
cgraph_create_node instead of cgraph_node.
* c-decl.c (finish_function): Call cgraph_get_create_node instead
of cgraph_node.
* lto-cgraph.c (input_node): Likewise.
* lto-streamer-in.c (input_function): Likewise.
* varasm.c (mark_decl_referenced): Likewise.
(assemble_alias): Likewise.

gcc/c-family/
* c-gimplify.c (c_genericize): Call cgraph_get_create_node instead
of cgraph_node.

gcc/cp/
* cp/class.c (cp_fold_obj_type_ref): Call cgraph_get_create_node
instead of cgraph_node.
* cp/decl2.c (cxx_callgraph_analyze_expr): Likewise.
(cp_write_global_declarations): Likewise.
* cp/optimize.c (maybe_clone_body): Likewise.
* cp/semantics.c (maybe_add_lambda_conv_op): Likewise.
* cp/mangle.c (mangle_decl): Likewise.
* cp/method.c (make_alias_for_thunk): Likewise.
(use_thunk): Likewise.

gcc/ada/
* gcc-interface/utils.c (end_subprog_body): Call
cgraph_get_create_node instead of cgraph_node.

gcc/fortran/
* trans-decl.c (gfc_generate_function_code): Call
cgraph_get_create_node instead of cgraph_node.

gcc/objc/
* objc-act.c (mark_referenced_methods): Call cgraph_get_create_node
instead of cgraph_node.

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

25 files changed:
gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils.c
gcc/c-decl.c
gcc/c-family/ChangeLog
gcc/c-family/c-gimplify.c
gcc/cgraph.c
gcc/cgraph.h
gcc/cgraphbuild.c
gcc/cgraphunit.c
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/decl2.c
gcc/cp/mangle.c
gcc/cp/method.c
gcc/cp/optimize.c
gcc/cp/semantics.c
gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/lto-cgraph.c
gcc/lto-streamer-in.c
gcc/lto-symtab.c
gcc/objc/ChangeLog
gcc/objc/objc-act.c
gcc/varasm.c

index 445317d..c438014 100644 (file)
@@ -1,5 +1,47 @@
 2011-04-12  Martin Jambor  <mjambor@suse.cz>
 
+       * cgraph.h (cgraph_node): Remove function declaration.
+       (cgraph_create_node): Declare.
+       (cgraph_get_create_node): Likewise.
+       * cgraph.c (cgraph_create_node): Renamed to cgraph_create_node_1.
+       Updated all callers.
+       (cgraph_node): Renamed to cgraph_create_node, assert that a node for
+       the decl does not already exist.  Call cgraph_get_create_node instead
+       of cgraph_node.
+       (cgraph_get_create_node): New function.
+       (cgraph_same_body_alias): Update comment.
+       (cgraph_set_call_stmt): Call cgraph_get_node instead of cgraph_node,
+       assert it does not return NULL.
+       (cgraph_update_edges_for_call_stmt): Likewise.
+       (cgraph_clone_edge): Likewise.
+       (cgraph_create_virtual_clone): Likewise.
+       (cgraph_update_edges_for_call_stmt_node): Call cgraph_get_create_node
+       instead of cgraph_node.
+       (cgraph_add_new_function): Call cgraph_create_node or
+       cgraph_get_create_node instead of cgraph_node.
+       * cgraphbuild.c (record_reference): Call cgraph_get_create_node
+       instead of cgraph_node.
+       (record_eh_tables): Likewise.
+       (mark_address): Likewise.
+       (mark_load): Likewise.
+       (build_cgraph_edges): Call cgraph_get_create_node instead
+       of cgraph_node.
+       (rebuild_cgraph_edges): Likewise.
+       * cgraphunit.c (cgraph_finalize_function): Call cgraph_get_create_node
+       instead of cgraph_node.
+       (cgraph_copy_node_for_versioning): Call cgraph_create_node instead of
+       cgraph_node.
+       * lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Call
+       cgraph_create_node instead of cgraph_node.
+       * c-decl.c (finish_function): Call cgraph_get_create_node instead
+       of cgraph_node.
+       * lto-cgraph.c (input_node): Likewise.
+       * lto-streamer-in.c (input_function): Likewise.
+       * varasm.c (mark_decl_referenced): Likewise.
+       (assemble_alias): Likewise.
+
+2011-04-12  Martin Jambor  <mjambor@suse.cz>
+
        * tree-inline.c (tree_function_versioning): Call cgraph_get_node
        instead of cgraph_node and assert it does not return NULL.
        * lto-streamer-in.c (lto_read_body): Likewise.
index e16092f..285d61d 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-12  Martin Jambor  <mjambor@suse.cz>
+
+       * gcc-interface/utils.c (end_subprog_body): Call
+       cgraph_get_create_node instead of cgraph_node.
+
 2011-04-08  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Procedure>: Set minimum
index 8a78789..3ecea18 100644 (file)
@@ -2003,7 +2003,7 @@ end_subprog_body (tree body)
   else
     /* Register this function with cgraph just far enough to get it
        added to our parent's nested function list.  */
-    (void) cgraph_node (fndecl);
+    (void) cgraph_get_create_node (fndecl);
 }
 
 tree
index d54f378..5d32a9a 100644 (file)
@@ -8345,7 +8345,7 @@ finish_function (void)
          /* Register this function with cgraph just far enough to get it
            added to our parent's nested function list.  Handy, since the
            C front end doesn't have such a list.  */
-         (void) cgraph_node (fndecl);
+         (void) cgraph_get_create_node (fndecl);
        }
     }
 
index 780036e..5fd1f20 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-12  Martin Jambor  <mjambor@suse.cz>
+
+       * c-gimplify.c (c_genericize): Call cgraph_get_create_node instead
+       of cgraph_node.
+
 2011-04-11  Richard Guenther  <rguenther@suse.de>
 
        * c-common.c (complete_array_type): Build a range type of
index 769df7c..f45650b 100644 (file)
@@ -98,7 +98,7 @@ c_genericize (tree fndecl)
     }
 
   /* Dump all nested functions now.  */
-  cgn = cgraph_node (fndecl);
+  cgn = cgraph_get_create_node (fndecl);
   for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
     c_genericize (cgn->decl);
 }
index 80f7c7c..22098e5 100644 (file)
@@ -466,7 +466,7 @@ cgraph_allocate_node (void)
 /* Allocate new callgraph node and insert it into basic data structures.  */
 
 static struct cgraph_node *
-cgraph_create_node (void)
+cgraph_create_node_1 (void)
 {
   struct cgraph_node *node = cgraph_allocate_node ();
 
@@ -488,7 +488,7 @@ cgraph_create_node (void)
 /* Return cgraph node assigned to DECL.  Create new one when needed.  */
 
 struct cgraph_node *
-cgraph_node (tree decl)
+cgraph_create_node (tree decl)
 {
   struct cgraph_node key, *node, **slot;
 
@@ -498,23 +498,15 @@ cgraph_node (tree decl)
     cgraph_hash = htab_create_ggc (10, hash_node, eq_node, NULL);
 
   key.decl = decl;
-
   slot = (struct cgraph_node **) htab_find_slot (cgraph_hash, &key, INSERT);
+  gcc_assert (!*slot);
 
-  if (*slot)
-    {
-      node = *slot;
-      if (node->same_body_alias)
-       node = node->same_body;
-      return node;
-    }
-
-  node = cgraph_create_node ();
+  node = cgraph_create_node_1 ();
   node->decl = decl;
   *slot = node;
   if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL)
     {
-      node->origin = cgraph_node (DECL_CONTEXT (decl));
+      node->origin = cgraph_get_create_node (DECL_CONTEXT (decl));
       node->next_nested = node->origin->nested;
       node->origin->nested = node;
     }
@@ -536,6 +528,21 @@ cgraph_node (tree decl)
   return node;
 }
 
+/* Try to find a call graph node for declaration DECL and if it does not exist,
+   create it.  */
+
+struct cgraph_node *
+cgraph_get_create_node (tree decl)
+{
+  struct cgraph_node *node;
+
+  node = cgraph_get_node (decl);
+  if (node)
+    return node;
+
+  return cgraph_create_node (decl);
+}
+
 /* Mark ALIAS as an alias to DECL.  DECL_NODE is cgraph node representing
    the function body is associated with (not neccesarily cgraph_node (DECL).  */
 
@@ -570,9 +577,9 @@ cgraph_same_body_alias_1 (struct cgraph_node *decl_node, tree alias, tree decl)
 }
 
 /* Attempt to mark ALIAS as an alias to DECL.  Return alias node if successful
-   and NULL otherwise. 
+   and NULL otherwise.
    Same body aliases are output whenever the body of DECL is output,
-   and cgraph_node (ALIAS) transparently returns cgraph_node (DECL).   */
+   and cgraph_get_node (ALIAS) transparently returns cgraph_get_node (DECL).  */
 
 struct cgraph_node *
 cgraph_same_body_alias (struct cgraph_node *decl_node, tree alias, tree decl)
@@ -859,8 +866,9 @@ cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt)
     {
       /* Constant propagation (and possibly also inlining?) can turn an
         indirect call into a direct one.  */
-      struct cgraph_node *new_callee = cgraph_node (decl);
+      struct cgraph_node *new_callee = cgraph_get_node (decl);
 
+      gcc_checking_assert (new_callee);
       cgraph_make_edge_direct (e, new_callee, 0);
     }
 
@@ -1301,7 +1309,7 @@ cgraph_update_edges_for_call_stmt_node (struct cgraph_node *node,
 
       if (new_call)
        {
-         ne = cgraph_create_edge (node, cgraph_node (new_call),
+         ne = cgraph_create_edge (node, cgraph_get_create_node (new_call),
                                   new_stmt, count, frequency,
                                   loop_nest);
          gcc_assert (ne->inline_failed);
@@ -1319,9 +1327,10 @@ cgraph_update_edges_for_call_stmt_node (struct cgraph_node *node,
 void
 cgraph_update_edges_for_call_stmt (gimple old_stmt, tree old_decl, gimple new_stmt)
 {
-  struct cgraph_node *orig = cgraph_node (cfun->decl);
+  struct cgraph_node *orig = cgraph_get_node (cfun->decl);
   struct cgraph_node *node;
 
+  gcc_checking_assert (orig);
   cgraph_update_edges_for_call_stmt_node (orig, old_stmt, old_decl, new_stmt);
   if (orig->clones)
     for (node = orig->clones; node != orig;)
@@ -2123,7 +2132,8 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n,
 
       if (call_stmt && (decl = gimple_call_fndecl (call_stmt)))
        {
-         struct cgraph_node *callee = cgraph_node (decl);
+         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);
        }
@@ -2179,7 +2189,7 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq,
                   int loop_nest, bool update_original,
                   VEC(cgraph_edge_p,heap) *redirect_callers)
 {
-  struct cgraph_node *new_node = cgraph_create_node ();
+  struct cgraph_node *new_node = cgraph_create_node_1 ();
   struct cgraph_edge *e;
   gcov_type count_scale;
   unsigned i;
@@ -2355,8 +2365,12 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
       /* Record references of the future statement initializing the constant
         argument.  */
       if (TREE_CODE (var) == FUNCTION_DECL)
-       ipa_record_reference (new_node, NULL, cgraph_node (var),
-                             NULL, IPA_REF_ADDR, NULL);
+       {
+         struct cgraph_node *ref_node = cgraph_get_node (var);
+         gcc_checking_assert (ref_node);
+         ipa_record_reference (new_node, NULL, ref_node, NULL, IPA_REF_ADDR,
+                               NULL);
+       }
       else if (TREE_CODE (var) == VAR_DECL)
        ipa_record_reference (new_node, NULL, NULL, varpool_node (var),
                              IPA_REF_ADDR, NULL);
@@ -2464,7 +2478,7 @@ cgraph_add_new_function (tree fndecl, bool lowered)
     {
       case CGRAPH_STATE_CONSTRUCTION:
        /* Just enqueue function to be processed at nearest occurrence.  */
-       node = cgraph_node (fndecl);
+       node = cgraph_create_node (fndecl);
        node->next_needed = cgraph_new_nodes;
        if (lowered)
          node->lowered = true;
@@ -2476,7 +2490,7 @@ cgraph_add_new_function (tree fndecl, bool lowered)
       case CGRAPH_STATE_EXPANSION:
        /* Bring the function into finalized state and enqueue for later
           analyzing and compilation.  */
-       node = cgraph_node (fndecl);
+       node = cgraph_get_create_node (fndecl);
        node->local.local = false;
        node->local.finalized = true;
        node->reachable = node->needed = true;
@@ -2504,7 +2518,7 @@ cgraph_add_new_function (tree fndecl, bool lowered)
       case CGRAPH_STATE_FINISHED:
        /* At the very end of compilation we have to do all the work up
           to expansion.  */
-       node = cgraph_node (fndecl);
+       node = cgraph_create_node (fndecl);
        if (lowered)
          node->lowered = true;
        cgraph_analyze_function (node);
index 1d3a87b..1351642 100644 (file)
@@ -561,7 +561,8 @@ struct cgraph_edge *cgraph_create_indirect_edge (struct cgraph_node *, gimple,
 struct cgraph_indirect_call_info *cgraph_allocate_init_indirect_info (void);
 struct cgraph_node * cgraph_get_node (const_tree);
 struct cgraph_node * cgraph_get_node_or_alias (const_tree);
-struct cgraph_node * cgraph_node (tree);
+struct cgraph_node * cgraph_create_node (tree);
+struct cgraph_node * cgraph_get_create_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 47199f3..935462e 100644 (file)
@@ -73,10 +73,10 @@ 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_node (decl);
          if (!ctx->only_vars)
-         cgraph_mark_address_taken_node (cgraph_node (decl));
-         ipa_record_reference (NULL, ctx->varpool_node,
-                               cgraph_node (decl), NULL,
+           cgraph_mark_address_taken_node (node);
+         ipa_record_reference (NULL, ctx->varpool_node, node, NULL,
                                IPA_REF_ADDR, NULL);
        }
 
@@ -149,8 +149,8 @@ record_eh_tables (struct cgraph_node *node, struct function *fun)
 
   if (DECL_FUNCTION_PERSONALITY (node->decl))
     ipa_record_reference (node, NULL,
-                         cgraph_node (DECL_FUNCTION_PERSONALITY (node->decl)),
-                         NULL, IPA_REF_ADDR, NULL);
+              cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->decl)),
+              NULL, IPA_REF_ADDR, NULL);
 
   i = fun->eh->region_tree;
   if (!i)
@@ -250,7 +250,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_node (addr);
+      struct cgraph_node *node = cgraph_get_create_node (addr);
       cgraph_mark_address_taken_node (node);
       ipa_record_reference ((struct cgraph_node *)data, NULL,
                            node, NULL,
@@ -285,7 +285,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_node (t);
+      struct cgraph_node *node = cgraph_get_create_node (t);
       cgraph_mark_address_taken_node (node);
       ipa_record_reference ((struct cgraph_node *)data, NULL,
                            node, NULL,
@@ -361,9 +361,8 @@ build_cgraph_edges (void)
                                                         bb);
              decl = gimple_call_fndecl (stmt);
              if (decl)
-               cgraph_create_edge (node, cgraph_node (decl), stmt,
-                                   bb->count, freq,
-                                   bb->loop_depth);
+               cgraph_create_edge (node, cgraph_get_create_node (decl),
+                                   stmt, bb->count, freq, bb->loop_depth);
              else
                cgraph_create_indirect_edge (node, stmt,
                                             gimple_call_flags (stmt),
@@ -376,18 +375,18 @@ build_cgraph_edges (void)
              && gimple_omp_parallel_child_fn (stmt))
            {
              tree fn = gimple_omp_parallel_child_fn (stmt);
-             ipa_record_reference (node, NULL, cgraph_node (fn),
+             ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
                                    NULL, IPA_REF_ADDR, stmt);
            }
          if (gimple_code (stmt) == GIMPLE_OMP_TASK)
            {
              tree fn = gimple_omp_task_child_fn (stmt);
              if (fn)
-               ipa_record_reference (node, NULL, cgraph_node (fn),
+               ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
                                      NULL, IPA_REF_ADDR, stmt);
              fn = gimple_omp_task_copy_fn (stmt);
              if (fn)
-               ipa_record_reference (node, NULL, cgraph_node (fn),
+               ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
                                      NULL, IPA_REF_ADDR, stmt);
            }
        }
@@ -472,9 +471,8 @@ rebuild_cgraph_edges (void)
                                                         bb);
              decl = gimple_call_fndecl (stmt);
              if (decl)
-               cgraph_create_edge (node, cgraph_node (decl), stmt,
-                                   bb->count, freq,
-                                   bb->loop_depth);
+               cgraph_create_edge (node, cgraph_get_create_node (decl), stmt,
+                                   bb->count, freq, bb->loop_depth);
              else
                cgraph_create_indirect_edge (node, stmt,
                                             gimple_call_flags (stmt),
index e0e51dc..539dbf9 100644 (file)
@@ -343,7 +343,7 @@ cgraph_lower_function (struct cgraph_node *node)
 void
 cgraph_finalize_function (tree decl, bool nested)
 {
-  struct cgraph_node *node = cgraph_node (decl);
+  struct cgraph_node *node = cgraph_get_create_node (decl);
 
   if (node->local.finalized)
     cgraph_reset_node (node);
@@ -1990,7 +1990,7 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version,
 
    gcc_assert (old_version);
 
-   new_version = cgraph_node (new_decl);
+   new_version = cgraph_create_node (new_decl);
 
    new_version->analyzed = true;
    new_version->local = old_version->local;
index bf7113f..f9c0fb2 100644 (file)
@@ -1,3 +1,15 @@
+2011-04-12  Martin Jambor  <mjambor@suse.cz>
+
+       * class.c (cp_fold_obj_type_ref): Call cgraph_get_create_node
+       instead of cgraph_node.
+       * decl2.c (cxx_callgraph_analyze_expr): Likewise.
+       (cp_write_global_declarations): Likewise.
+       * optimize.c (maybe_clone_body): Likewise.
+       * semantics.c (maybe_add_lambda_conv_op): Likewise.
+       * mangle.c (mangle_decl): Likewise.
+       * method.c (make_alias_for_thunk): Likewise.
+       (use_thunk): Likewise.
+
 2011-04-11  Jason Merrill  <jason@redhat.com>
 
        PR c++/48535
index 24b8a31..634b2bf 100644 (file)
@@ -8401,7 +8401,7 @@ cp_fold_obj_type_ref (tree ref, tree known_type)
                                  DECL_VINDEX (fndecl)));
 #endif
 
-  cgraph_node (fndecl)->local.vtable_method = true;
+  cgraph_get_create_node (fndecl)->local.vtable_method = true;
 
   return build_address (fndecl);
 }
index f62f913..9e63c87 100644 (file)
@@ -3374,11 +3374,13 @@ cxx_callgraph_analyze_expr (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED)
     {
     case PTRMEM_CST:
       if (TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
-       cgraph_mark_address_taken_node (cgraph_node (PTRMEM_CST_MEMBER (t)));
+       cgraph_mark_address_taken_node (
+                             cgraph_get_create_node (PTRMEM_CST_MEMBER (t)));
       break;
     case BASELINK:
       if (TREE_CODE (BASELINK_FUNCTIONS (t)) == FUNCTION_DECL)
-       cgraph_mark_address_taken_node (cgraph_node (BASELINK_FUNCTIONS (t)));
+       cgraph_mark_address_taken_node (
+                             cgraph_get_create_node (BASELINK_FUNCTIONS (t)));
       break;
     case VAR_DECL:
       if (DECL_CONTEXT (t)
@@ -3891,7 +3893,7 @@ cp_write_global_declarations (void)
          if (!DECL_EXTERNAL (decl)
              && decl_needed_p (decl)
              && !TREE_ASM_WRITTEN (decl)
-             && !cgraph_node (decl)->local.finalized)
+             && !cgraph_get_create_node (decl)->local.finalized)
            {
              /* We will output the function; no longer consider it in this
                 loop.  */
index f063d47..b33f317 100644 (file)
@@ -3170,7 +3170,7 @@ mangle_decl (const tree decl)
       if (vague_linkage_p (decl))
        DECL_WEAK (alias) = 1;
       if (TREE_CODE (decl) == FUNCTION_DECL)
-       cgraph_same_body_alias (cgraph_node (decl), alias, decl);
+       cgraph_same_body_alias (cgraph_get_create_node (decl), alias, decl);
       else
        varpool_extra_name_alias (alias, decl);
 #endif
index b741516..e18143e 100644 (file)
@@ -259,8 +259,9 @@ make_alias_for_thunk (tree function)
 
   if (!flag_syntax_only)
     {
-      struct cgraph_node *aliasn = cgraph_same_body_alias (cgraph_node (function),
-                                                          alias, function);
+      struct cgraph_node *aliasn;
+      aliasn = cgraph_same_body_alias (cgraph_get_create_node (function),
+                                      alias, function);
       DECL_ASSEMBLER_NAME (function);
       gcc_assert (aliasn != NULL);
     }
@@ -378,7 +379,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
   a = nreverse (t);
   DECL_ARGUMENTS (thunk_fndecl) = a;
   TREE_ASM_WRITTEN (thunk_fndecl) = 1;
-  cgraph_add_thunk (cgraph_node (function), thunk_fndecl, function,
+  cgraph_add_thunk (cgraph_get_create_node (function), thunk_fndecl, function,
                    this_adjusting, fixed_offset, virtual_value,
                    virtual_offset, alias);
 
index 2ce9838..2110779 100644 (file)
@@ -309,7 +309,8 @@ maybe_clone_body (tree fn)
          && (!DECL_ONE_ONLY (fns[0])
              || (HAVE_COMDAT_GROUP
                  && DECL_WEAK (fns[0])))
-         && cgraph_same_body_alias (cgraph_node (fns[0]), clone, fns[0]))
+         && cgraph_same_body_alias (cgraph_get_create_node (fns[0]), clone,
+                                    fns[0]))
        {
          alias = true;
          if (DECL_ONE_ONLY (fns[0]))
@@ -423,8 +424,8 @@ maybe_clone_body (tree fn)
          /* If *[CD][12]* dtors go into the *[CD]5* comdat group and dtor is
             virtual, it goes into the same comdat group as well.  */
          DECL_COMDAT_GROUP (fns[2]) = comdat_group;
-         base_dtor_node = cgraph_node (fns[0]);
-         deleting_dtor_node = cgraph_node (fns[2]);
+         base_dtor_node = cgraph_get_create_node (fns[0]);
+         deleting_dtor_node = cgraph_get_create_node (fns[2]);
          gcc_assert (base_dtor_node->same_comdat_group == NULL);
          gcc_assert (deleting_dtor_node->same_comdat_group == NULL);
          base_dtor_node->same_comdat_group = deleting_dtor_node;
index 61d87be..8752f37 100644 (file)
@@ -8458,8 +8458,8 @@ maybe_add_lambda_conv_op (tree type)
       /* Put the thunk in the same comdat group as the call op.  */
       struct cgraph_node *callop_node, *thunk_node;
       DECL_COMDAT_GROUP (statfn) = DECL_COMDAT_GROUP (callop);
-      callop_node = cgraph_node (callop);
-      thunk_node = cgraph_node (statfn);
+      callop_node = cgraph_get_create_node (callop);
+      thunk_node = cgraph_get_create_node (statfn);
       gcc_assert (callop_node->same_comdat_group == NULL);
       gcc_assert (thunk_node->same_comdat_group == NULL);
       callop_node->same_comdat_group = thunk_node;
index 68440f4..3b23770 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-12  Martin Jambor  <mjambor@suse.cz>
+
+       * trans-decl.c (gfc_generate_function_code): Call
+       cgraph_get_create_node instead of cgraph_node.
+
 2011-04-11  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/18918
index acd6c4a..784dfc8 100644 (file)
@@ -5064,7 +5064,7 @@ gfc_generate_function_code (gfc_namespace * ns)
   if (decl_function_context (fndecl))
     /* Register this function with cgraph just far enough to get it
        added to our parent's nested function list.  */
-    (void) cgraph_node (fndecl);
+    (void) cgraph_get_create_node (fndecl);
   else
     cgraph_finalize_function (fndecl, true);
 
index f8de894..63680d3 100644 (file)
@@ -1045,7 +1045,7 @@ input_node (struct lto_file_decl_data *file_data,
                                0, CGRAPH_FREQ_BASE, 0, false, NULL);
     }
   else
-    node = cgraph_node (fn_decl);
+    node = cgraph_get_create_node (fn_decl);
 
   node->count = lto_input_sleb128 (ib);
   node->count_materialization_scale = lto_input_sleb128 (ib);
index c95a8e1..ddc0cae 100644 (file)
@@ -1301,7 +1301,7 @@ input_function (tree fn_decl, struct data_in *data_in,
   DECL_INITIAL (fn_decl) = lto_input_tree (ib, data_in);
   gcc_assert (DECL_INITIAL (fn_decl));
   DECL_SAVED_TREE (fn_decl) = NULL_TREE;
-  node = cgraph_node (fn_decl);
+  node = cgraph_get_create_node (fn_decl);
 
   /* Read all the basic blocks.  */
   tag = input_record_start (ib);
index b02aaba..28a3d8b 100644 (file)
@@ -799,7 +799,7 @@ lto_symtab_merge_cgraph_nodes_1 (void **slot, void *data ATTRIBUTE_UNUSED)
             previously unused.  Create the node.  */
          if (!prevailing->node)
            {
-             prevailing->node = cgraph_node (prevailing->decl);
+             prevailing->node = cgraph_create_node (prevailing->decl);
              prevailing->node->alias = true;
            }
          lto_cgraph_replace_node (e->node, prevailing->node);
index 5e0d5ab..d91ca29 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-12  Martin Jambor  <mjambor@suse.cz>
+
+       * objc-act.c (mark_referenced_methods): Call cgraph_get_create_node
+       instead of cgraph_node.
+
 2011-04-06  Joseph Myers  <joseph@codesourcery.com>
 
        * objc-act.c: Include c-target.h instead of target.h.
index 26a5aa9..513da2f 100644 (file)
@@ -4519,14 +4519,16 @@ mark_referenced_methods (void)
       chain = CLASS_CLS_METHODS (impent->imp_context);
       while (chain)
        {
-         cgraph_mark_needed_node (cgraph_node (METHOD_DEFINITION (chain)));
+         cgraph_mark_needed_node (
+                          cgraph_get_create_node (METHOD_DEFINITION (chain)));
          chain = DECL_CHAIN (chain);
        }
 
       chain = CLASS_NST_METHODS (impent->imp_context);
       while (chain)
        {
-         cgraph_mark_needed_node (cgraph_node (METHOD_DEFINITION (chain)));
+         cgraph_mark_needed_node (
+                          cgraph_get_create_node (METHOD_DEFINITION (chain)));
          chain = DECL_CHAIN (chain);
        }
     }
index 8365612..40a38f5 100644 (file)
@@ -2199,7 +2199,7 @@ mark_decl_referenced (tree decl)
         If we know a method will be emitted in other TU and no new
         functions can be marked reachable, just use the external
         definition.  */
-      struct cgraph_node *node = cgraph_node (decl);
+      struct cgraph_node *node = cgraph_get_create_node (decl);
       if (!DECL_EXTERNAL (decl)
          && (!node->local.vtable_method || !cgraph_global_info_ready
              || !node->local.finalized))
@@ -5807,7 +5807,7 @@ assemble_alias (tree decl, tree target)
 
   /* Allow aliases to aliases.  */
   if (TREE_CODE (decl) == FUNCTION_DECL)
-    cgraph_node (decl)->alias = true;
+    cgraph_get_create_node (decl)->alias = true;
   else
     varpool_node (decl)->alias = true;