From 2b7cb1722561ca6e6c7d90d7ae7d99c752f7097c Mon Sep 17 00:00:00 2001 From: hubicka Date: Fri, 7 Feb 2014 02:28:33 +0000 Subject: [PATCH] PR ipa/59469 * lto-cgraph.c (lto_output_node): Use symtab_get_symbol_partitioning_class. (lto_output_varpool_node): likewise. (symtab_get_symbol_partitioning_class): Move here from lto/lto-partition.c * cgraph.h (symbol_partitioning_class): Likewise. (symtab_get_symbol_partitioning_class): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207591 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/symtab.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/gcc/symtab.c b/gcc/symtab.c index a7312f5f9a72..5d698033ca6c 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1267,4 +1267,55 @@ symtab_semantically_equivalent_p (symtab_node *a, bb = b; return bb == ba; } + +/* Classify symbol NODE for partitioning. */ + +enum symbol_partitioning_class +symtab_get_symbol_partitioning_class (symtab_node *node) +{ + /* Inline clones are always duplicated. + This include external delcarations. */ + cgraph_node *cnode = dyn_cast (node); + + if (DECL_ABSTRACT (node->decl)) + return SYMBOL_EXTERNAL; + + if (cnode && cnode->global.inlined_to) + return SYMBOL_DUPLICATE; + + /* Weakref aliases are always duplicated. */ + if (node->weakref) + return SYMBOL_DUPLICATE; + + /* External declarations are external. */ + if (DECL_EXTERNAL (node->decl)) + return SYMBOL_EXTERNAL; + + if (varpool_node *vnode = dyn_cast (node)) + { + /* Constant pool references use local symbol names that can not + be promoted global. We should never put into a constant pool + objects that can not be duplicated across partitions. */ + if (DECL_IN_CONSTANT_POOL (node->decl)) + return SYMBOL_DUPLICATE; + gcc_checking_assert (vnode->definition); + } + /* Functions that are cloned may stay in callgraph even if they are unused. + Handle them as external; compute_ltrans_boundary take care to make + proper things to happen (i.e. to make them appear in the boundary but + with body streamed, so clone can me materialized). */ + else if (!cgraph (node)->definition) + return SYMBOL_EXTERNAL; + + /* Linker discardable symbols are duplicated to every use unless they are + keyed. + Keyed symbols or those. */ + if (DECL_ONE_ONLY (node->decl) + && !node->force_output + && !node->forced_by_abi + && !symtab_used_from_object_file_p (node)) + return SYMBOL_DUPLICATE; + + return SYMBOL_PARTITION; +} #include "gt-symtab.h" -- 2.47.2