Commit c3c445e1 by Jan Hubicka Committed by Jan Hubicka

common.opt (flto-partition): Add "max".

	* common.opt (flto-partition): Add "max".
	* invoke.texi (flto-partition): Document "max"

	* lto.c (do_whole_program_analysis): Care timevars, statistics and
	AUX pointer cleaning. Add max partitioning.
	* lto-partition.c (enum symbol_class): New.
	(get_symbol_class): New function.
	(symbol_partitioned_p): New function.
	(add_references_to_partition): Remove.
	(add_aliases_to_partition): Remove.
	(add_cgraph_node_to_partition_1): Remove.
	(add_cgraph_node_to_partition): Remove.
	(add_symbol_to_partition): New function.
	(add_symbol_to_partition_1): New function.
	(contained_in_symbol): New function.
	(partition_cgraph_node_p): Remove.
	(partition_varpool_node_p): Remove.
	(partition_symbol_p): Remove.
	(lto_1_to_1_map): Cleanup.
	(lto_max_map): New.
	(lto_balanced_map): Update.
	(lto_promote_cross_file_statics): Update.
	* lto-partition.h (lto_max_map): Declare.
	* timevar.def (TV_WHOPR_PARTITIONING): New timevar.

From-SVN: r191229
parent b5c7cdfb
2012-09-12 Jan Hubicka <jh@suse.cz>
* common.opt (flto-partition): Add "max".
* invoke.texi (flto-partition): Document "max"
2012-09-12 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com>
* config/i386/i386.md : Comments on fma4 instruction
......
......@@ -1439,12 +1439,16 @@ Link-time optimization with number of parallel jobs or jobserver.
flto-partition=1to1
Common Var(flag_lto_partition_1to1)
Partition functions and vars at linktime based on object files they originate from
Partition symbols and vars at linktime based on object files they originate from
flto-partition=balanced
Common Var(flag_lto_partition_balanced)
Partition functions and vars at linktime into approximately same sized buckets
flto-partition=max
Common Var(flag_lto_partition_max)
Put every symbol into separate partition
flto-partition=none
Common Var(flag_lto_partition_none)
Disable partioning and streaming
......
......@@ -8093,9 +8093,12 @@ This option is disabled by default.
Specify the partitioning algorithm used by the link-time optimizer.
The value is either @code{1to1} to specify a partitioning mirroring
the original source files or @code{balanced} to specify partitioning
into equally sized chunks (whenever possible). Specifying @code{none}
as an algorithm disables partitioning and streaming completely. The
default value is @code{balanced}.
into equally sized chunks (whenever possible) or @code{max} to create
new partition for every symbol where possible. Specifying @code{none}
as an algorithm disables partitioning and streaming completely.
The default value is @code{balanced}. While @code{1to1} can be used
as an workaround for various code ordering issues, the @code{max}
partitioning is intended for internal testing only.
@item -flto-compression-level=@var{n}
This option specifies the level of compression used for intermediate
......
2012-09-12 Jan Hubicka <jh@suse.cz>
* lto.c (do_whole_program_analysis): Care timevars, statistics and
AUX pointer cleaning. Add max partitioning.
* lto-partition.c (enum symbol_class): New.
(get_symbol_class): New function.
(symbol_partitioned_p): New function.
(add_references_to_partition): Remove.
(add_aliases_to_partition): Remove.
(add_cgraph_node_to_partition_1): Remove.
(add_cgraph_node_to_partition): Remove.
(add_symbol_to_partition): New function.
(add_symbol_to_partition_1): New function.
(contained_in_symbol): New function.
(partition_cgraph_node_p): Remove.
(partition_varpool_node_p): Remove.
(partition_symbol_p): Remove.
(lto_1_to_1_map): Cleanup.
(lto_max_map): New.
(lto_balanced_map): Update.
(lto_promote_cross_file_statics): Update.
* lto-partition.h (lto_max_map): Declare.
* timevar.def (TV_WHOPR_PARTITIONING): New timevar.
2012-09-11 Jan Hubicka <jh@suse.cz>
PR lto/54312
......
......@@ -25,6 +25,7 @@ struct ltrans_partition_def
lto_symtab_encoder_t encoder;
const char * name;
int insns;
pointer_set_t *initializers_visited;
};
typedef struct ltrans_partition_def *ltrans_partition;
......@@ -34,6 +35,7 @@ DEF_VEC_ALLOC_P(ltrans_partition,heap);
extern VEC(ltrans_partition, heap) *ltrans_partitions;
void lto_1_to_1_map (void);
void lto_max_map (void);
void lto_balanced_map (void);
void lto_promote_cross_file_statics (void);
void free_ltrans_partitions (void);
......@@ -2604,11 +2604,28 @@ lto_wpa_write_files (void)
fprintf (cgraph_dump_file, "Writing partition %s to file %s, %i insns\n",
part->name, temp_filename, part->insns);
fprintf (cgraph_dump_file, " Symbols in partition: ");
for (lsei = lsei_start_in_partition (part->encoder); !lsei_end_p (lsei);
lsei_next_in_partition (&lsei))
{
symtab_node node = lsei_node (lsei);
fprintf (cgraph_dump_file, "%s ", symtab_node_name (node));
fprintf (cgraph_dump_file, "%s ", symtab_node_asm_name (node));
}
fprintf (cgraph_dump_file, "\n Symbols in boundary: ");
for (lsei = lsei_start (part->encoder); !lsei_end_p (lsei);
lsei_next (&lsei))
{
symtab_node node = lsei_node (lsei);
if (!lto_symtab_encoder_in_partition_p (part->encoder, node))
{
fprintf (cgraph_dump_file, "%s ", symtab_node_asm_name (node));
if (symtab_function_p (node)
&& lto_symtab_encoder_encode_body_p (part->encoder, cgraph (node)))
fprintf (cgraph_dump_file, "(body included)");
else if (symtab_variable_p (node)
&& lto_symtab_encoder_encode_initializer_p (part->encoder, varpool (node)))
fprintf (cgraph_dump_file, "(initializer included)");
}
}
fprintf (cgraph_dump_file, "\n");
}
......@@ -3093,6 +3110,8 @@ print_lto_report_1 (void)
static void
do_whole_program_analysis (void)
{
symtab_node node;
timevar_start (TV_PHASE_OPT_GEN);
/* Note that since we are in WPA mode, materialize_cgraph will not
......@@ -3127,17 +3146,31 @@ do_whole_program_analysis (void)
dump_cgraph (cgraph_dump_file);
dump_varpool (cgraph_dump_file);
}
#ifdef ENABLE_CHECKING
verify_cgraph ();
#endif
bitmap_obstack_release (NULL);
/* We are about to launch the final LTRANS phase, stop the WPA timer. */
timevar_pop (TV_WHOPR_WPA);
timevar_push (TV_WHOPR_PARTITIONING);
if (flag_lto_partition_1to1)
lto_1_to_1_map ();
else if (flag_lto_partition_max)
lto_max_map ();
else
lto_balanced_map ();
/* AUX pointers are used by partitioning code to bookkeep number of
partitions symbol is in. This is no longer needed. */
FOR_EACH_SYMBOL (node)
node->symbol.aux = NULL;
lto_stats.num_cgraph_partitions += VEC_length (ltrans_partition,
ltrans_partitions);
timevar_pop (TV_WHOPR_PARTITIONING);
timevar_stop (TV_PHASE_OPT_GEN);
timevar_start (TV_PHASE_STREAM_OUT);
......
......@@ -81,6 +81,7 @@ DEFTIMEVAR (TV_IPA_LTO_CGRAPH_MERGE , "ipa lto cgraph merge")
DEFTIMEVAR (TV_LTO , "lto")
DEFTIMEVAR (TV_WHOPR_WPA , "whopr wpa")
DEFTIMEVAR (TV_WHOPR_WPA_IO , "whopr wpa I/O")
DEFTIMEVAR (TV_WHOPR_PARTITIONING , "whopr partitioning")
DEFTIMEVAR (TV_WHOPR_LTRANS , "whopr ltrans")
DEFTIMEVAR (TV_IPA_REFERENCE , "ipa reference")
DEFTIMEVAR (TV_IPA_PROFILE , "ipa profile")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment