+void
+cgraph_varpool_finalize_decl (tree decl)
+{
+ struct cgraph_varpool_node *node = cgraph_varpool_node (decl);
+
+ /* The first declaration of a variable that comes through this function
+ decides whether it is global (in C, has external linkage)
+ or local (in C, has internal linkage). So do nothing more
+ if this function has already run. */
+ if (node->finalized)
+ return;
+ if (node->needed)
+ {
+ node->next_needed = cgraph_varpool_nodes_queue;
+ cgraph_varpool_nodes_queue = node;
+ notice_global_symbol (decl);
+ }
+ node->finalized = true;
+
+ if (/* Externally visible variables must be output. The exception are
+ COMDAT functions that must be output only when they are needed. */
+ (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
+ /* Function whose name is output to the assembler file must be produced.
+ It is possible to assemble the name later after finalizing the function
+ and the fact is noticed in assemble_name then. */
+ || (DECL_ASSEMBLER_NAME_SET_P (decl)
+ && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
+ {
+ cgraph_varpool_mark_needed_node (node);
+ }
+}
+
+bool
+cgraph_varpool_assemble_pending_decls (void)
+{
+ bool changed = false;
+
+ while (cgraph_varpool_nodes_queue)
+ {
+ tree decl = cgraph_varpool_nodes_queue->decl;
+ struct cgraph_varpool_node *node = cgraph_varpool_nodes_queue;
+
+ cgraph_varpool_nodes_queue = cgraph_varpool_nodes_queue->next_needed;
+ if (!TREE_ASM_WRITTEN (decl))
+ {
+ assemble_variable (decl, 0, 1, 0);
+ changed = true;
+ }
+ node->next_needed = NULL;
+ }
+ return changed;
+}
+
+/* Return true when the DECL can possibly be inlined. */
+bool
+cgraph_function_possibly_inlined_p (tree decl)
+{
+ if (!cgraph_global_info_ready)
+ return (DECL_INLINE (decl) && !flag_really_no_inline);
+ return DECL_POSSIBLY_INLINED (decl);
+}
+
+/* Create clone of E in the node N represented by CALL_EXPR the callgraph. */
+struct cgraph_edge *
+cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, tree call_expr)
+{
+ struct cgraph_edge *new = cgraph_create_edge (n, e->callee, call_expr);
+
+ new->inline_failed = e->inline_failed;
+ return new;
+}
+
+/* Create node representing clone of N. */
+struct cgraph_node *
+cgraph_clone_node (struct cgraph_node *n)
+{
+ struct cgraph_node *new = cgraph_create_node ();
+ struct cgraph_edge *e;
+
+ new->decl = n->decl;
+ new->origin = n->origin;
+ if (new->origin)
+ {
+ new->next_nested = new->origin->nested;
+ new->origin->nested = new;
+ }
+ new->analyzed = n->analyzed;
+ new->local = n->local;
+ new->global = n->global;
+ new->rtl = n->rtl;
+
+ for (e = n->callees;e; e=e->next_callee)
+ cgraph_clone_edge (e, new, e->call_expr);
+
+ new->next_clone = n->next_clone;
+ n->next_clone = new;
+
+ return new;
+}
+
+/* NODE is no longer nested function; update cgraph accordingly. */
+void
+cgraph_unnest_node (struct cgraph_node *node)
+{
+ struct cgraph_node **node2 = &node->origin->nested;
+ gcc_assert (node->origin);
+
+ while (*node2 != node)
+ node2 = &(*node2)->next_nested;
+ *node2 = node->next_nested;
+ node->origin = NULL;
+}