diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-07 10:19:26 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-07 10:19:26 +0000 |
commit | 80879cf9009417726906a880af907e2de8683a84 (patch) | |
tree | 5d10fee949bcec7e27a86f73f02f55f09633b3d4 /gcc/varpool.c | |
parent | d42d3fad6998402ea943bc2a3159cad09eb288d5 (diff) | |
download | gcc-80879cf9009417726906a880af907e2de8683a84.tar.gz |
2012-11-07 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 193285 using svnmerge.py
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@193288 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varpool.c')
-rw-r--r-- | gcc/varpool.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/gcc/varpool.c b/gcc/varpool.c index 314c66ee308..b88ec613ff6 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -39,7 +39,7 @@ along with GCC; see the file COPYING3. If not see /* Return varpool node assigned to DECL. Create new one when needed. */ struct varpool_node * -varpool_node (tree decl) +varpool_node_for_decl (tree decl) { struct varpool_node *node = varpool_get_node (decl); gcc_assert (TREE_CODE (decl) == VAR_DECL @@ -114,9 +114,9 @@ debug_varpool (void) struct varpool_node * varpool_node_for_asm (tree asmname) { - symtab_node node = symtab_node_for_asm (asmname); - if (node && symtab_variable_p (node)) - return varpool (node); + if (symtab_node node = symtab_node_for_asm (asmname)) + if (varpool_node *vnode = dyn_cast <varpool_node> (node)) + return vnode; return NULL; } @@ -192,7 +192,7 @@ varpool_add_new_variable (tree decl) { struct varpool_node *node; varpool_finalize_decl (decl); - node = varpool_node (decl); + node = varpool_node_for_decl (decl); if (varpool_externally_visible_p (node, false)) node->symbol.externally_visible = true; } @@ -232,7 +232,7 @@ varpool_analyze_node (struct varpool_node *node) } if (node->alias && node->alias_of) { - struct varpool_node *tgt = varpool_node (node->alias_of); + struct varpool_node *tgt = varpool_node_for_decl (node->alias_of); struct varpool_node *n; for (n = tgt; n && n->alias; @@ -378,16 +378,21 @@ varpool_remove_unreferenced_decls (void) for (next = node->symbol.same_comdat_group; next != (symtab_node)node; next = next->symbol.same_comdat_group) - if (symtab_variable_p (next) - && varpool (next)->analyzed) - enqueue_node (varpool (next), &first); + { + varpool_node *vnext = dyn_cast <varpool_node> (next); + if (vnext && vnext->analyzed) + enqueue_node (vnext, &first); + } } for (i = 0; ipa_ref_list_reference_iterate (&node->symbol.ref_list, i, ref); i++) - if (symtab_variable_p (ref->referred) - && (!DECL_EXTERNAL (ref->referred->symbol.decl) - || varpool (ref->referred)->alias) - && varpool (ref->referred)->analyzed) - enqueue_node (varpool (ref->referred), &first); + { + varpool_node *vnode = dyn_cast <varpool_node> (ref->referred); + if (vnode + && (!DECL_EXTERNAL (ref->referred->symbol.decl) + || vnode->alias) + && vnode->analyzed) + enqueue_node (vnode, &first); + } } if (cgraph_dump_file) fprintf (cgraph_dump_file, "\nRemoving variables:"); @@ -461,7 +466,7 @@ add_new_static_var (tree type) DECL_CONTEXT (new_decl) = NULL_TREE; DECL_ABSTRACT (new_decl) = 0; lang_hooks.dup_lang_specific_decl (new_decl); - new_node = varpool_node (new_decl); + new_node = varpool_node_for_decl (new_decl); varpool_finalize_decl (new_decl); return new_node->symbol.decl; @@ -477,7 +482,7 @@ varpool_create_variable_alias (tree alias, tree decl) gcc_assert (TREE_CODE (decl) == VAR_DECL); gcc_assert (TREE_CODE (alias) == VAR_DECL); - alias_node = varpool_node (alias); + alias_node = varpool_node_for_decl (alias); alias_node->alias = 1; alias_node->finalized = 1; alias_node->alias_of = decl; |