aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@gcc.gnu.org>2014-02-07 02:28:33 +0000
committerJan Hubicka <hubicka@gcc.gnu.org>2014-02-07 02:28:33 +0000
commitddb3e20aaecd26afbce0025e1fef1a3144c65ce7 (patch)
tree9636ee869b6ae372017b8dc4b9570c5b950a6be6
parent3c0f1105e1c9ada1cd0e40a510d65a138b3cdaa6 (diff)
downloadgcc-ddb3e20aaecd26afbce0025e1fef1a3144c65ce7.zip
gcc-ddb3e20aaecd26afbce0025e1fef1a3144c65ce7.tar.gz
gcc-ddb3e20aaecd26afbce0025e1fef1a3144c65ce7.tar.bz2
re PR ipa/59469 (LLVM build failure with gcc LTO)
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. From-SVN: r207591
-rw-r--r--gcc/symtab.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc/symtab.c b/gcc/symtab.c
index a7312f5..5d69803 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 <cgraph_node> (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 <varpool_node> (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"