diff options
Diffstat (limited to 'gcc/lto/lto-partition.c')
-rw-r--r-- | gcc/lto/lto-partition.c | 200 |
1 files changed, 100 insertions, 100 deletions
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index e131d069b76..4abeb117fa0 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -58,18 +58,18 @@ get_symbol_class (symtab_node node) This include external delcarations. */ cgraph_node *cnode = dyn_cast <cgraph_node> (node); - if (DECL_ABSTRACT (node->symbol.decl)) + if (DECL_ABSTRACT (node->decl)) return SYMBOL_EXTERNAL; if (cnode && cnode->global.inlined_to) return SYMBOL_DUPLICATE; /* Weakref aliases are always duplicated. */ - if (node->symbol.weakref) + if (node->weakref) return SYMBOL_DUPLICATE; /* External declarations are external. */ - if (DECL_EXTERNAL (node->symbol.decl)) + if (DECL_EXTERNAL (node->decl)) return SYMBOL_EXTERNAL; if (varpool_node *vnode = dyn_cast <varpool_node> (node)) @@ -77,22 +77,22 @@ get_symbol_class (symtab_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->symbol.decl)) + if (DECL_IN_CONSTANT_POOL (node->decl)) return SYMBOL_DUPLICATE; - gcc_checking_assert (vnode->symbol.definition); + 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)->symbol.definition) + else if (!cgraph (node)->definition) return SYMBOL_EXTERNAL; /* Comdats are duplicated to every use unless they are keyed. Those do not need duplication. */ - if (DECL_COMDAT (node->symbol.decl) - && !node->symbol.force_output - && !symtab_used_from_object_file_p ((symtab_node) node)) + if (DECL_COMDAT (node->decl) + && !node->force_output + && !symtab_used_from_object_file_p (node)) return SYMBOL_DUPLICATE; return SYMBOL_PARTITION; @@ -133,7 +133,7 @@ free_ltrans_partitions (void) static inline bool symbol_partitioned_p (symtab_node node) { - return node->symbol.aux; + return node->aux; } /* Add references into the partition. */ @@ -144,14 +144,14 @@ add_references_to_partition (ltrans_partition part, symtab_node node) struct ipa_ref *ref; /* Add all duplicated references to the partition. */ - for (i = 0; ipa_ref_list_reference_iterate (&node->symbol.ref_list, i, ref); i++) + for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref); i++) if (get_symbol_class (ref->referred) == SYMBOL_DUPLICATE) add_symbol_to_partition (part, ref->referred); /* References to a readonly variable may be constant foled into its value. Recursively look into the initializers of the constant variable and add references, too. */ else if (is_a <varpool_node> (ref->referred) - && ctor_for_folding (ref->referred->symbol.decl) != error_mark_node + && ctor_for_folding (ref->referred->decl) != error_mark_node && !lto_symtab_encoder_in_partition_p (part->encoder, ref->referred)) { if (!part->initializers_visited) @@ -173,7 +173,7 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node node) symtab_node node1; /* If NODE is already there, we have nothing to do. */ - if (lto_symtab_encoder_in_partition_p (part->encoder, (symtab_node) node)) + if (lto_symtab_encoder_in_partition_p (part->encoder, node)) return true; /* non-duplicated aliases or tunks of a duplicated symbol needs to be output @@ -181,7 +181,7 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node node) Be lax about comdats; they may or may not be duplicated and we may end up in need to duplicate keyed comdat because it has unkeyed alias. */ - if (c == SYMBOL_PARTITION && !DECL_COMDAT (node->symbol.decl) + if (c == SYMBOL_PARTITION && !DECL_COMDAT (node->decl) && symbol_partitioned_p (node)) return false; @@ -190,16 +190,16 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node node) gcc_assert (c != SYMBOL_EXTERNAL && (c == SYMBOL_DUPLICATE || !symbol_partitioned_p (node))); - lto_set_symtab_encoder_in_partition (part->encoder, (symtab_node) node); + lto_set_symtab_encoder_in_partition (part->encoder, node); if (symbol_partitioned_p (node)) { - node->symbol.in_other_partition = 1; + node->in_other_partition = 1; if (cgraph_dump_file) fprintf (cgraph_dump_file, "Symbol node %s now used in multiple partitions\n", symtab_node_name (node)); } - node->symbol.aux = (void *)((size_t)node->symbol.aux + 1); + node->aux = (void *)((size_t)node->aux + 1); if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) { @@ -209,27 +209,27 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node node) /* Add all inline clones and callees that are duplicated. */ for (e = cnode->callees; e; e = e->next_callee) if (!e->inline_failed) - add_symbol_to_partition_1 (part, (symtab_node) e->callee); - else if (get_symbol_class ((symtab_node) e->callee) == SYMBOL_DUPLICATE) - add_symbol_to_partition (part, (symtab_node) e->callee); + add_symbol_to_partition_1 (part, e->callee); + else if (get_symbol_class (e->callee) == SYMBOL_DUPLICATE) + add_symbol_to_partition (part, e->callee); /* Add all thunks associated with the function. */ for (e = cnode->callers; e; e = e->next_caller) if (e->caller->thunk.thunk_p) - add_symbol_to_partition_1 (part, (symtab_node) e->caller); + add_symbol_to_partition_1 (part, e->caller); } add_references_to_partition (part, node); /* Add all aliases associated with the symbol. */ - for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, i, ref); i++) - if (ref->use == IPA_REF_ALIAS && !node->symbol.weakref) + for (i = 0; ipa_ref_list_referring_iterate (&node->ref_list, i, ref); i++) + if (ref->use == IPA_REF_ALIAS && !node->weakref) add_symbol_to_partition_1 (part, ref->referring); /* Ensure that SAME_COMDAT_GROUP lists all allways added in a group. */ - if (node->symbol.same_comdat_group) - for (node1 = node->symbol.same_comdat_group; - node1 != node; node1 = node1->symbol.same_comdat_group) + if (node->same_comdat_group) + for (node1 = node->same_comdat_group; + node1 != node; node1 = node1->same_comdat_group) { bool added = add_symbol_to_partition_1 (part, node1); gcc_assert (added); @@ -245,17 +245,17 @@ static symtab_node contained_in_symbol (symtab_node node) { /* Weakrefs are never contained in anything. */ - if (node->symbol.weakref) + if (node->weakref) return node; if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) { cnode = cgraph_function_node (cnode, NULL); if (cnode->global.inlined_to) cnode = cnode->global.inlined_to; - return (symtab_node) cnode; + return cnode; } else if (varpool_node *vnode = dyn_cast <varpool_node> (node)) - return (symtab_node) varpool_variable_node (vnode, NULL); + return varpool_variable_node (vnode, NULL); return node; } @@ -281,7 +281,7 @@ add_symbol_to_partition (ltrans_partition part, symtab_node node) Be lax about comdats; they may or may not be duplicated and we may end up in need to duplicate keyed comdat because it has unkeyed alias. */ gcc_assert (get_symbol_class (node) == SYMBOL_DUPLICATE - || DECL_COMDAT (node->symbol.decl) + || DECL_COMDAT (node->decl) || !symbol_partitioned_p (node)); add_symbol_to_partition_1 (part, node); } @@ -305,7 +305,7 @@ undo_partition (ltrans_partition partition, unsigned int n_nodes) if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) partition->insns -= inline_summary (cnode)->self_size; lto_symtab_encoder_delete_node (partition->encoder, node); - node->symbol.aux = (void *)((size_t)node->symbol.aux - 1); + node->aux = (void *)((size_t)node->aux - 1); } } @@ -330,7 +330,7 @@ lto_1_to_1_map (void) || symbol_partitioned_p (node)) continue; - file_data = node->symbol.lto_file_data; + file_data = node->lto_file_data; if (file_data) { @@ -355,7 +355,7 @@ lto_1_to_1_map (void) npartitions++; } - add_symbol_to_partition (partition, (symtab_node) node); + add_symbol_to_partition (partition, node); } /* If the cgraph is empty, create one cgraph node set so that there is still @@ -382,7 +382,7 @@ lto_max_map (void) || symbol_partitioned_p (node)) continue; partition = new_partition (symtab_node_asm_name (node)); - add_symbol_to_partition (partition, (symtab_node) node); + add_symbol_to_partition (partition, node); npartitions++; } if (!npartitions) @@ -395,7 +395,7 @@ node_cmp (const void *pa, const void *pb) { const struct cgraph_node *a = *(const struct cgraph_node * const *) pa; const struct cgraph_node *b = *(const struct cgraph_node * const *) pb; - return b->symbol.order - a->symbol.order; + return b->order - a->order; } /* Helper function for qsort; sort nodes by order. */ @@ -404,7 +404,7 @@ varpool_node_cmp (const void *pa, const void *pb) { const struct varpool_node *a = *(const struct varpool_node * const *) pa; const struct varpool_node *b = *(const struct varpool_node * const *) pb; - return b->symbol.order - a->symbol.order; + return b->order - a->order; } /* Group cgraph nodes into equally-sized partitions. @@ -466,10 +466,10 @@ lto_balanced_map (void) int current_order = -1; FOR_EACH_VARIABLE (vnode) - gcc_assert (!vnode->symbol.aux); + gcc_assert (!vnode->aux); FOR_EACH_DEFINED_FUNCTION (node) - if (get_symbol_class ((symtab_node) node) == SYMBOL_PARTITION) + if (get_symbol_class (node) == SYMBOL_PARTITION) { order[n_nodes++] = node; total_size += inline_summary (node)->size; @@ -486,13 +486,13 @@ lto_balanced_map (void) qsort (order, n_nodes, sizeof (struct cgraph_node *), node_cmp); FOR_EACH_VARIABLE (vnode) - if (get_symbol_class ((symtab_node) vnode) == SYMBOL_PARTITION) + if (get_symbol_class (vnode) == SYMBOL_PARTITION) n_varpool_nodes++; varpool_order = XNEWVEC (struct varpool_node *, n_varpool_nodes); n_varpool_nodes = 0; FOR_EACH_VARIABLE (vnode) - if (get_symbol_class ((symtab_node) vnode) == SYMBOL_PARTITION) + if (get_symbol_class (vnode) == SYMBOL_PARTITION) varpool_order[n_varpool_nodes++] = vnode; qsort (varpool_order, n_varpool_nodes, sizeof (struct varpool_node *), varpool_node_cmp); @@ -510,21 +510,21 @@ lto_balanced_map (void) for (i = 0; i < n_nodes; i++) { - if (symbol_partitioned_p ((symtab_node) order[i])) + if (symbol_partitioned_p (order[i])) continue; - current_order = order[i]->symbol.order; + current_order = order[i]->order; if (!flag_toplevel_reorder) while (varpool_pos < n_varpool_nodes - && varpool_order[varpool_pos]->symbol.order < current_order) + && varpool_order[varpool_pos]->order < current_order) { - if (!symbol_partitioned_p ((symtab_node) varpool_order[varpool_pos])) - add_symbol_to_partition (partition, (symtab_node) varpool_order[varpool_pos]); + if (!symbol_partitioned_p (varpool_order[varpool_pos])) + add_symbol_to_partition (partition, varpool_order[varpool_pos]); varpool_pos++; } - add_symbol_to_partition (partition, (symtab_node) order[i]); + add_symbol_to_partition (partition, order[i]); total_size -= inline_summary (order[i])->size; @@ -552,15 +552,15 @@ lto_balanced_map (void) { struct cgraph_edge *edge; - refs = &node->symbol.ref_list; + refs = &node->ref_list; last_visited_node++; - gcc_assert (node->symbol.definition || node->symbol.weakref); + gcc_assert (node->definition || node->weakref); /* Compute boundary cost of callgraph edges. */ for (edge = node->callees; edge; edge = edge->next_callee) - if (edge->callee->symbol.definition) + if (edge->callee->definition) { int edge_cost = edge->frequency; int index; @@ -569,7 +569,7 @@ lto_balanced_map (void) edge_cost = 1; gcc_assert (edge_cost > 0); index = lto_symtab_encoder_lookup (partition->encoder, - (symtab_node)edge->callee); + edge->callee); if (index != LCC_NOT_FOUND && index < last_visited_node - 1) cost -= edge_cost, internal += edge_cost; @@ -581,12 +581,12 @@ lto_balanced_map (void) int edge_cost = edge->frequency; int index; - gcc_assert (edge->caller->symbol.definition); + gcc_assert (edge->caller->definition); if (!edge_cost) edge_cost = 1; gcc_assert (edge_cost > 0); index = lto_symtab_encoder_lookup (partition->encoder, - (symtab_node)edge->caller); + edge->caller); if (index != LCC_NOT_FOUND && index < last_visited_node - 1) cost -= edge_cost; @@ -596,7 +596,7 @@ lto_balanced_map (void) } else { - refs = &snode->symbol.ref_list; + refs = &snode->ref_list; last_visited_node++; } @@ -608,13 +608,13 @@ lto_balanced_map (void) int index; vnode = ipa_ref_varpool_node (ref); - if (!vnode->symbol.definition) + if (!vnode->definition) continue; - if (!symbol_partitioned_p ((symtab_node) vnode) && flag_toplevel_reorder - && get_symbol_class ((symtab_node) vnode) == SYMBOL_PARTITION) - add_symbol_to_partition (partition, (symtab_node) vnode); + if (!symbol_partitioned_p (vnode) && flag_toplevel_reorder + && get_symbol_class (vnode) == SYMBOL_PARTITION) + add_symbol_to_partition (partition, vnode); index = lto_symtab_encoder_lookup (partition->encoder, - (symtab_node)vnode); + vnode); if (index != LCC_NOT_FOUND && index < last_visited_node - 1) cost--, internal++; @@ -626,10 +626,10 @@ lto_balanced_map (void) int index; node = ipa_ref_node (ref); - if (!node->symbol.definition) + if (!node->definition) continue; index = lto_symtab_encoder_lookup (partition->encoder, - (symtab_node)node); + node); if (index != LCC_NOT_FOUND && index < last_visited_node - 1) cost--, internal++; @@ -642,12 +642,12 @@ lto_balanced_map (void) int index; vnode = ipa_ref_referring_varpool_node (ref); - gcc_assert (vnode->symbol.definition); - if (!symbol_partitioned_p ((symtab_node) vnode) && flag_toplevel_reorder - && get_symbol_class ((symtab_node) vnode) == SYMBOL_PARTITION) - add_symbol_to_partition (partition, (symtab_node) vnode); + gcc_assert (vnode->definition); + if (!symbol_partitioned_p (vnode) && flag_toplevel_reorder + && get_symbol_class (vnode) == SYMBOL_PARTITION) + add_symbol_to_partition (partition, vnode); index = lto_symtab_encoder_lookup (partition->encoder, - (symtab_node)vnode); + vnode); if (index != LCC_NOT_FOUND && index < last_visited_node - 1) cost--; @@ -659,9 +659,9 @@ lto_balanced_map (void) int index; node = ipa_ref_referring_node (ref); - gcc_assert (node->symbol.definition); + gcc_assert (node->definition); index = lto_symtab_encoder_lookup (partition->encoder, - (symtab_node)node); + node); if (index != LCC_NOT_FOUND && index < last_visited_node - 1) cost--; @@ -688,7 +688,7 @@ lto_balanced_map (void) if (cgraph_dump_file) fprintf (cgraph_dump_file, "Step %i: added %s/%i, size %i, cost %i/%i " "best %i/%i, step %i\n", i, - cgraph_node_name (order[i]), order[i]->symbol.order, + cgraph_node_name (order[i]), order[i]->order, partition->insns, cost, internal, best_cost, best_internal, best_i); /* Partition is too large, unwind into step when best cost was reached and @@ -705,7 +705,7 @@ lto_balanced_map (void) } i = best_i; /* When we are finished, avoid creating empty partition. */ - while (i < n_nodes - 1 && symbol_partitioned_p ((symtab_node) order[i + 1])) + while (i < n_nodes - 1 && symbol_partitioned_p (order[i + 1])) i++; if (i == n_nodes - 1) break; @@ -737,16 +737,16 @@ lto_balanced_map (void) if (flag_toplevel_reorder) { FOR_EACH_VARIABLE (vnode) - if (get_symbol_class ((symtab_node) vnode) == SYMBOL_PARTITION - && !symbol_partitioned_p ((symtab_node) vnode)) - add_symbol_to_partition (partition, (symtab_node) vnode); + if (get_symbol_class (vnode) == SYMBOL_PARTITION + && !symbol_partitioned_p (vnode)) + add_symbol_to_partition (partition, vnode); } else { while (varpool_pos < n_varpool_nodes) { - if (!symbol_partitioned_p ((symtab_node) varpool_order[varpool_pos])) - add_symbol_to_partition (partition, (symtab_node) varpool_order[varpool_pos]); + if (!symbol_partitioned_p (varpool_order[varpool_pos])) + add_symbol_to_partition (partition, varpool_order[varpool_pos]); varpool_pos++; } free (varpool_order); @@ -765,13 +765,13 @@ lto_balanced_map (void) static bool privatize_symbol_name (symtab_node node) { - tree decl = node->symbol.decl; + tree decl = node->decl; const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); /* Our renaming machinery do not handle more than one change of assembler name. We should not need more than one anyway. */ - if (node->symbol.lto_file_data - && lto_get_decl_name_mapping (node->symbol.lto_file_data, name) != name) + if (node->lto_file_data + && lto_get_decl_name_mapping (node->lto_file_data, name) != name) { if (cgraph_dump_file) fprintf (cgraph_dump_file, @@ -783,7 +783,7 @@ privatize_symbol_name (symtab_node node) ??? should have a flag whether a symbol has a 'private' name already, since we produce some symbols like that i.e. for global constructors that are not really clones. */ - if (node->symbol.unique_name) + if (node->unique_name) { if (cgraph_dump_file) fprintf (cgraph_dump_file, @@ -792,8 +792,8 @@ privatize_symbol_name (symtab_node node) return false; } change_decl_assembler_name (decl, clone_function_name (decl, "lto_priv")); - if (node->symbol.lto_file_data) - lto_record_renamed_decl (node->symbol.lto_file_data, name, + if (node->lto_file_data) + lto_record_renamed_decl (node->lto_file_data, name, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); if (cgraph_dump_file) @@ -809,19 +809,19 @@ static void promote_symbol (symtab_node node) { /* We already promoted ... */ - if (DECL_VISIBILITY (node->symbol.decl) == VISIBILITY_HIDDEN - && DECL_VISIBILITY_SPECIFIED (node->symbol.decl) - && TREE_PUBLIC (node->symbol.decl)) + if (DECL_VISIBILITY (node->decl) == VISIBILITY_HIDDEN + && DECL_VISIBILITY_SPECIFIED (node->decl) + && TREE_PUBLIC (node->decl)) return; - gcc_checking_assert (!TREE_PUBLIC (node->symbol.decl) - && !DECL_EXTERNAL (node->symbol.decl)); + gcc_checking_assert (!TREE_PUBLIC (node->decl) + && !DECL_EXTERNAL (node->decl)); /* Be sure that newly public symbol does not conflict with anything already defined by the non-LTO part. */ privatize_symbol_name (node); - TREE_PUBLIC (node->symbol.decl) = 1; - DECL_VISIBILITY (node->symbol.decl) = VISIBILITY_HIDDEN; - DECL_VISIBILITY_SPECIFIED (node->symbol.decl) = true; + TREE_PUBLIC (node->decl) = 1; + DECL_VISIBILITY (node->decl) = VISIBILITY_HIDDEN; + DECL_VISIBILITY_SPECIFIED (node->decl) = true; if (cgraph_dump_file) fprintf (cgraph_dump_file, "Promoting as hidden: %s\n", symtab_node_name (node)); @@ -854,16 +854,16 @@ may_need_named_section_p (lto_symtab_encoder_t encoder, symtab_node node) static void rename_statics (lto_symtab_encoder_t encoder, symtab_node node) { - tree decl = node->symbol.decl; + tree decl = node->decl; symtab_node s; tree name = DECL_ASSEMBLER_NAME (decl); /* See if this is static symbol. */ - if ((node->symbol.externally_visible + if ((node->externally_visible /* FIXME: externally_visible is somewhat illogically not set for external symbols (i.e. those not defined). Remove this test once this is fixed. */ - || DECL_EXTERNAL (node->symbol.decl) + || DECL_EXTERNAL (node->decl) || !symtab_real_symbol_p (node)) && !may_need_named_section_p (encoder, node)) return; @@ -872,9 +872,9 @@ rename_statics (lto_symtab_encoder_t encoder, symtab_node node) (all types of symbols counts here, since we can not have static of the same name as external or public symbol.) */ for (s = symtab_node_for_asm (name); - s; s = s->symbol.next_sharing_asm_name) + s; s = s->next_sharing_asm_name) if ((symtab_real_symbol_p (s) || may_need_named_section_p (encoder, s)) - && s->symbol.decl != node->symbol.decl + && s->decl != node->decl && (!encoder || lto_symtab_encoder_lookup (encoder, s) != LCC_NOT_FOUND)) break; @@ -890,10 +890,10 @@ rename_statics (lto_symtab_encoder_t encoder, symtab_node node) /* Assign every symbol in the set that shares the same ASM name an unique mangled name. */ for (s = symtab_node_for_asm (name); s;) - if (!s->symbol.externally_visible + if (!s->externally_visible && ((symtab_real_symbol_p (s) - && !DECL_EXTERNAL (node->symbol.decl) - && !TREE_PUBLIC (node->symbol.decl)) + && !DECL_EXTERNAL (node->decl) + && !TREE_PUBLIC (node->decl)) || may_need_named_section_p (encoder, s)) && (!encoder || lto_symtab_encoder_lookup (encoder, s) != LCC_NOT_FOUND)) @@ -901,9 +901,9 @@ rename_statics (lto_symtab_encoder_t encoder, symtab_node node) if (privatize_symbol_name (s)) /* Re-start from beginning since we do not know how many symbols changed a name. */ s = symtab_node_for_asm (name); - else s = s->symbol.next_sharing_asm_name; + else s = s->next_sharing_asm_name; } - else s = s->symbol.next_sharing_asm_name; + else s = s->next_sharing_asm_name; } /* Find out all static decls that need to be promoted to global because @@ -942,12 +942,12 @@ lto_promote_cross_file_statics (void) rename_statics (encoder, node); /* No need to promote if symbol already is externally visible ... */ - if (node->symbol.externally_visible + if (node->externally_visible /* ... or if it is part of current partition ... */ || lto_symtab_encoder_in_partition_p (encoder, node) /* ... or if we do not partition it. This mean that it will appear in every partition refernecing it. */ - || get_symbol_class ((symtab_node) node) != SYMBOL_PARTITION) + || get_symbol_class (node) != SYMBOL_PARTITION) continue; promote_symbol (node); |