> 1to1 partitioning now also partitions toplevel assembly. > Other partitionings keep the old behavior of putting all > toplevel assembly into single partition. > > gcc/ChangeLog: > > * lto-cgraph.cc (compute_ltrans_boundary): Add asm_node. > > gcc/lto/ChangeLog: > > * lto-partition.cc (create_partition_if_empty): New. > (node_into_file_partition): New. If function is mostly broken ou tfrom somewhere else I would write (foo): Break out from ... (bar): ... here So it is clear where the code come from.
> (lto_1_to_1_map): Partition toplevel assembly. > (create_asm_partition): New. > (lto_max_map): Use create_asm_partition. > (lto_balanced_map): Likewise. > +/* If the cgraph is empty, create one cgraph node set so that there is still I guess chgraph->symbol table and "symbol table node set". > + an output file for any variables that need to be exported in a DSO. */ > +static void > +create_partition_if_empty () > +{ > + if (!ltrans_partitions.length ()) > + new_partition ("empty"); > +} > + > /* Free memory used by ltrans partition. > Encoder can be kept to be freed after streaming. */ > static void > @@ -328,6 +337,35 @@ undo_partition (ltrans_partition partition, unsigned int > n_nodes) > } > } > > +/* Insert node into its file partition. */ > +static void > +node_into_file_partition (toplevel_node* node, > + hash_map<lto_file_decl_data *, > + ltrans_partition>& pmap) > +{ > + ltrans_partition partition; > + > + struct lto_file_decl_data *file_data = node->lto_file_data; > + > + if (file_data) > + { > + ltrans_partition *slot = &pmap.get_or_insert (file_data); > + if (*slot) > + partition = *slot; > + else > + { > + partition = new_partition (file_data->file_name); > + *slot = partition; > + } > + } > + else if (!file_data && ltrans_partitions.length ()) > + partition = ltrans_partitions[0]; > + else > + partition = new_partition (""); Since we want to be more careful about tracking partitions, pehraps we want to always create a specific partition for symbols where we do not have clear origin (such as merged constructors) instead of randomly assigning them to partition 0 if they are not first and partition "" otherwise? Honza