static void cgraph_mark_functions_to_output (void);
static void cgraph_expand_function (struct cgraph_node *);
static tree record_reference (tree *, int *, void *);
+static void cgraph_output_pending_asms (void);
/* Records tree nodes seen in record_reference. Simply using
walk_tree_without_duplicates doesn't guarantee each node is visited
if (flag_unit_at_a_time)
return false;
+ cgraph_output_pending_asms ();
+
while (cgraph_nodes_queue)
{
struct cgraph_node *n = cgraph_nodes_queue;
}
}
+ /* Process CGRAPH_EXPAND_QUEUE, these are functions created during
+ the expansion process. Note that this queue may grow as its
+ being processed, as the new functions may generate new ones. */
+ while (cgraph_expand_queue)
+ {
+ struct cgraph_node *n = cgraph_expand_queue;
+ cgraph_expand_queue = cgraph_expand_queue->next_needed;
+ n->next_needed = NULL;
+ cgraph_finalize_function (n->decl, false);
+ output = true;
+ }
+
return output;
}
+
+
/* As an GCC extension we allow redefinition of the function. The
semantics when both copies of bodies differ is not well defined.
We replace the old body with new body so in unit at a time mode
node->lowered = true;
}
-static void
-cgraph_finalize_pending_functions (void)
-{
- struct cgraph_node *next, *node = cgraph_analyze_queue;
-
- cgraph_analyze_queue = NULL;
- for (; node ; node = next)
- {
- next = node->next_needed;
- node->next_needed = NULL;
- cgraph_finalize_function (node->decl, true);
- }
-}
-
/* DECL has been parsed. Take it, queue it, compile it at the whim of the
logic in effect. If NESTED is true, then our caller cannot stand to have
the garbage collector run at the moment. We would need to either create
if (!flag_unit_at_a_time)
{
cgraph_analyze_function (node);
- cgraph_finalize_pending_functions ();
cgraph_decide_inlining_incrementally (node, false);
}
/* Rebuild call edges from current function after a passes not aware
of cgraph updating. */
-static void
+static unsigned int
rebuild_cgraph_edges (void)
{
basic_block bb;
}
initialize_inline_failed (node);
gcc_assert (!node->global.inlined_to);
+ return 0;
}
struct tree_opt_pass pass_rebuild_cgraph_edges =
gcc_assert (DECL_SAVED_TREE (decl));
cgraph_analyze_function (node);
- cgraph_finalize_pending_functions ();
for (edge = node->callees; edge; edge = edge->next_callee)
if (!edge->callee->reachable)
cgraph_expand_all_functions (void)
{
struct cgraph_node *node;
- struct cgraph_node **order =
- xcalloc (cgraph_n_nodes, sizeof (struct cgraph_node *));
+ struct cgraph_node **order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
int order_pos = 0, new_order_pos = 0;
int i;
cgraph_expand_function (node);
}
}
+
free (order);
+
+ /* Process CGRAPH_EXPAND_QUEUE, these are functions created during
+ the expansion process. Note that this queue may grow as its
+ being processed, as the new functions may generate new ones. */
+ while (cgraph_expand_queue)
+ {
+ node = cgraph_expand_queue;
+ cgraph_expand_queue = cgraph_expand_queue->next_needed;
+ node->next_needed = NULL;
+ node->output = 0;
+ node->lowered = DECL_STRUCT_FUNCTION (node->decl)->cfg != NULL;
+ cgraph_expand_function (node);
+ }
}
/* This is used to sort the node types by the cgraph order number. */
nodes[i].kind = ORDER_ASM;
nodes[i].u.a = pa;
}
- cgraph_asm_nodes = NULL;
for (i = 0; i < max; ++i)
{
gcc_unreachable ();
}
}
+
+ cgraph_asm_nodes = NULL;
}
/* Mark visibility of all functions.
static struct cgraph_node *
cgraph_copy_node_for_versioning (struct cgraph_node *old_version,
- tree new_decl, varray_type redirect_callers)
+ tree new_decl,
+ VEC(cgraph_edge_p,heap) *redirect_callers)
{
struct cgraph_node *new_version;
struct cgraph_edge *e, *new_e;
if (!next_callee)
break;
}
- if (redirect_callers)
- for (i = 0; i < VARRAY_ACTIVE_SIZE (redirect_callers); i++)
- {
- e = VARRAY_GENERIC_PTR (redirect_callers, i);
- /* Redirect calls to the old version node
- to point to it's new version. */
- cgraph_redirect_edge_callee (e, new_version);
- }
+ for (i = 0; VEC_iterate (cgraph_edge_p, redirect_callers, i, e); i++)
+ {
+ /* Redirect calls to the old version node to point to its new
+ version. */
+ cgraph_redirect_edge_callee (e, new_version);
+ }
return new_version;
}
struct cgraph_node *
cgraph_function_versioning (struct cgraph_node *old_version_node,
- varray_type redirect_callers,
+ VEC(cgraph_edge_p,heap) *redirect_callers,
varray_type tree_map)
{
tree old_decl = old_version_node->decl;
cgraph_lower_function (node);
/* In non-unit-at-a-time we construct full fledged clone we never output to
- assembly file. This clone is pointed out by inline_decl of orginal function
+ assembly file. This clone is pointed out by inline_decl of original function
and inlining infrastructure knows how to deal with this. */
if (!flag_unit_at_a_time)
{