summaryrefslogtreecommitdiff
path: root/gcc/varpool.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-16 21:38:15 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-16 21:38:15 +0000
commit304e5318297980fdbe25c1780578b2a23791c576 (patch)
treee06ba8171841b599b4229f871ff4b5a27a61ccb2 /gcc/varpool.c
parent8878935beee40c3cb6bcfd150b28c66ea7dacf34 (diff)
downloadgcc-304e5318297980fdbe25c1780578b2a23791c576.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137903 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varpool.c')
-rw-r--r--gcc/varpool.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/gcc/varpool.c b/gcc/varpool.c
index 4149c1d1d21..c2410f664f5 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -357,7 +357,13 @@ varpool_assemble_decl (struct varpool_node *node)
&& (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;
@@ -423,12 +429,7 @@ varpool_assemble_pending_decls (void)
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;
}
@@ -438,6 +439,26 @@ varpool_assemble_pending_decls (void)
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)