+2008-07-16 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.h (varpool_empty_needed_queue): Declare.
+ * cgraphunit.c (output_in_order): Mark all variables as needed;
+ empty the queue.
+ * varpool.c (varpool_assemble_node): Update debug queue.
+ (varpool_assemble_pending_decls): Don't do it here.
+ (varpool_empty_needed_queue): New function.
+
2008-07-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* recog.c (peephole2_optimize): Fix formatting.
bool varpool_analyze_pending_decls (void);
void varpool_output_debug_info (void);
void varpool_remove_unreferenced_decls (void);
+void varpool_empty_needed_queue (void);
/* Walk all reachable static variables. */
#define FOR_EACH_STATIC_VARIABLE(node) \
nodes[i].u.a = pa;
}
+ /* In toplevel reorder mode we output all statics; mark them as needed. */
+ for (i = 0; i < max; ++i)
+ {
+ if (nodes[i].kind == ORDER_VAR)
+ {
+ varpool_mark_needed_node (nodes[i].u.v);
+ }
+ }
+ varpool_empty_needed_queue ();
+
for (i = 0; i < max; ++i)
{
switch (nodes[i].kind)
&& (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl)))
{
assemble_variable (decl, 0, 1, 0);
- return TREE_ASM_WRITTEN (decl);
+ if (TREE_ASM_WRITTEN (decl))
+ {
+ node->next_needed = varpool_assembled_nodes_queue;
+ varpool_assembled_nodes_queue = node;
+ node->finalized = 1;
+ return true;
+ }
}
return false;
varpool_nodes_queue = varpool_nodes_queue->next_needed;
if (varpool_assemble_decl (node))
- {
- changed = true;
- node->next_needed = varpool_assembled_nodes_queue;
- varpool_assembled_nodes_queue = node;
- node->finalized = 1;
- }
+ changed = true;
else
node->next_needed = NULL;
}
return changed;
}
+/* Remove all elements from the queue so we can re-use it for debug output. */
+void
+varpool_empty_needed_queue (void)
+{
+ /* EH might mark decls as needed during expansion. This should be safe since
+ we don't create references to new function, but it should not be used
+ elsewhere. */
+ varpool_analyze_pending_decls ();
+
+ while (varpool_nodes_queue)
+ {
+ struct varpool_node *node = varpool_nodes_queue;
+ varpool_nodes_queue = varpool_nodes_queue->next_needed;
+ node->next_needed = NULL;
+ }
+ /* varpool_nodes_queue is now empty, clear the pointer to the last element
+ in the queue. */
+ varpool_last_needed_node = NULL;
+}
+
/* Output all variables enqueued to be assembled. */
void
varpool_output_debug_info (void)