diff options
author | Rong Xu <xur@google.com> | 2014-07-21 16:47:22 -0700 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2014-07-29 15:31:03 -0700 |
commit | 38a8aecfb882072900434499696b5c32a2274515 (patch) | |
tree | 2aac97f0ae24b03cd98c1a06e989c031c173f889 /gcc-4.9/gcc/varpool.c | |
parent | c231900e5dcc14d8296bd9f62b45997a49d4d5e7 (diff) | |
download | toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.zip toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.gz toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.bz2 |
[4.9] Switch gcc-4.9 to use google/gcc-4_9 branch.
This source drop uses svn version r212828 of google/gcc-4.9 branch.
We also cherry-picked r213062, r213063 and r213064 to fix windows
build issues.
All gcc-4.9 patches before July 3rd are ported to google/gcc-4.9.
The following prior commits has not been merged to google branch yet.
(They are included in this commit).
e7af147f979e657fe2df00808e5b4319b0e088c6,
baf87df3cb2683649ba7e9872362a7e721117c23, and
c231900e5dcc14d8296bd9f62b45997a49d4d5e7.
Change-Id: I4bea3ea470387ff751c2be4cb0d4a12059b9299b
Diffstat (limited to 'gcc-4.9/gcc/varpool.c')
-rw-r--r-- | gcc-4.9/gcc/varpool.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/gcc-4.9/gcc/varpool.c b/gcc-4.9/gcc/varpool.c index acb5221..d9b9a1a 100644 --- a/gcc-4.9/gcc/varpool.c +++ b/gcc-4.9/gcc/varpool.c @@ -33,7 +33,9 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "output.h" #include "gimple-expr.h" +#include "toplev.h" #include "flags.h" +#include "l-ipo.h" #include "pointer-set.h" /* List of hooks triggered on varpool_node events. */ @@ -150,6 +152,7 @@ varpool_node_for_decl (tree decl) return node; node = varpool_create_empty_node (); + node->module_id = current_module_id; node->decl = decl; symtab_register_node (node); return node; @@ -161,12 +164,15 @@ varpool_remove_node (varpool_node *node) { tree init; varpool_call_node_removal_hooks (node); + varpool_remove_link_node (node); symtab_unregister_node (node); /* Because we remove references from external functions before final compilation, we may end up removing useful constructors. FIXME: We probably want to trace boundaries better. */ - if ((init = ctor_for_folding (node->decl)) == error_mark_node) + if (cgraph_state == CGRAPH_LTO_STREAMING) + ; + else if ((init = ctor_for_folding (node->decl)) == error_mark_node) varpool_remove_initializer (node); else DECL_INITIAL (node->decl) = init; @@ -302,7 +308,18 @@ ctor_for_folding (tree decl) if (DECL_VIRTUAL_P (real_decl)) { gcc_checking_assert (TREE_READONLY (real_decl)); - return DECL_INITIAL (real_decl); + if (DECL_INITIAL (real_decl)) + return DECL_INITIAL (real_decl); + else + { + /* The C++ front end creates VAR_DECLs for vtables of typeinfo + classes not defined in the current TU so that it can refer + to them from typeinfo objects. Avoid returning NULL_TREE. */ + /* In LIPO mode, the DECL_CONTEXT may have been cleared. */ + if (!L_IPO_COMP_MODE) + gcc_checking_assert (!COMPLETE_TYPE_P (DECL_CONTEXT (real_decl))); + return error_mark_node; + } } /* If there is no constructor, we have nothing to do. */ @@ -504,7 +521,7 @@ varpool_remove_unreferenced_decls (void) { enqueue_node (node, &first); if (cgraph_dump_file) - fprintf (cgraph_dump_file, " %s", node->asm_name ()); + fprintf (cgraph_dump_file, " %s/%d", node->asm_name (), node->order); } } while (first != (varpool_node *)(void *)1) @@ -545,7 +562,7 @@ varpool_remove_unreferenced_decls (void) if (!node->aux) { if (cgraph_dump_file) - fprintf (cgraph_dump_file, " %s", node->asm_name ()); + fprintf (cgraph_dump_file, " %s/%d", node->asm_name (), node->order); if (pointer_set_contains (referenced, node)) varpool_remove_initializer (node); else |