Commit 783dab6b by Richard Biener Committed by Richard Biener

common.opt (lto_partition_model): New enum.

2014-04-15  Richard Biener  <rguenther@suse.de>

	* common.opt (lto_partition_model): New enum.
	(flto-partition=): Merge separate options with a single with argument,
	add -flto-partition=one support.
	* flag-types.h (enum lto_partition_model): Declare.
	* opts.c (finish_options): Remove duplicate -flto-partition=
	option check.
	* lto-wrapper.c (run_gcc): Adjust.

	lto/
	* lto.c: Include params.h.
	(do_whole_program_analysis): Switch on flag_lto_partition value,
	add support for LTO_PARTITION_ONE.
	* lto-partition.h (lto_balanced_map): Adjust.
	* lto-partition.c (lto_balanced_map): Get number of desired
	partitions as argument to support -flto-partition=one.

From-SVN: r209416
parent f51b8572
2014-04-15 Richard Biener <rguenther@suse.de> 2014-04-15 Richard Biener <rguenther@suse.de>
* common.opt (lto_partition_model): New enum.
(flto-partition=): Merge separate options with a single with argument,
add -flto-partition=one support.
* flag-types.h (enum lto_partition_model): Declare.
* opts.c (finish_options): Remove duplicate -flto-partition=
option check.
* lto-wrapper.c (run_gcc): Adjust.
2014-04-15 Richard Biener <rguenther@suse.de>
* alias.c (ncr_compar): New function. * alias.c (ncr_compar): New function.
(nonoverlapping_component_refs_p): Re-implement in O (n log n). (nonoverlapping_component_refs_p): Re-implement in O (n log n).
......
...@@ -1495,21 +1495,27 @@ flto= ...@@ -1495,21 +1495,27 @@ flto=
Common RejectNegative Joined Var(flag_lto) Common RejectNegative Joined Var(flag_lto)
Link-time optimization with number of parallel jobs or jobserver. Link-time optimization with number of parallel jobs or jobserver.
flto-partition=1to1 Enum
Common Var(flag_lto_partition_1to1) Name(lto_partition_model) Type(enum lto_partition_model) UnknownError(unknown LTO partitioning model %qs)
Partition symbols and vars at linktime based on object files they originate from
flto-partition=balanced EnumValue
Common Var(flag_lto_partition_balanced) Enum(lto_partition_model) String(none) Value(LTO_PARTITION_NONE)
Partition functions and vars at linktime into approximately same sized buckets
flto-partition=max EnumValue
Common Var(flag_lto_partition_max) Enum(lto_partition_model) String(one) Value(LTO_PARTITION_ONE)
Put every symbol into separate partition
EnumValue
Enum(lto_partition_model) String(balanced) Value(LTO_PARTITION_BALANCED)
EnumValue
Enum(lto_partition_model) String(1to1) Value(LTO_PARTITION_1TO1)
EnumValue
Enum(lto_partition_model) String(max) Value(LTO_PARTITION_MAX)
flto-partition=none flto-partition=
Common Var(flag_lto_partition_none) Common Joined RejectNegative Enum(lto_partition_model) Var(flag_lto_partition) Init(LTO_PARTITION_BALANCED)
Disable partioning and streaming Specify the algorithm to partition symbols and vars at linktime
; The initial value of -1 comes from Z_DEFAULT_COMPRESSION in zlib.h. ; The initial value of -1 comes from Z_DEFAULT_COMPRESSION in zlib.h.
flto-compression-level= flto-compression-level=
......
...@@ -229,4 +229,14 @@ enum vtv_priority { ...@@ -229,4 +229,14 @@ enum vtv_priority {
VTV_STANDARD_PRIORITY = 1, VTV_STANDARD_PRIORITY = 1,
VTV_PREINIT_PRIORITY = 2 VTV_PREINIT_PRIORITY = 2
}; };
/* flag_lto_partition initialization values. */
enum lto_partition_model {
LTO_PARTITION_NONE = 0,
LTO_PARTITION_ONE = 1,
LTO_PARTITION_BALANCED = 2,
LTO_PARTITION_1TO1 = 3,
LTO_PARTITION_MAX = 4
};
#endif /* ! GCC_FLAG_TYPES_H */ #endif /* ! GCC_FLAG_TYPES_H */
...@@ -657,9 +657,7 @@ run_gcc (unsigned argc, char *argv[]) ...@@ -657,9 +657,7 @@ run_gcc (unsigned argc, char *argv[])
/* Drop arguments that we want to take from the link line. */ /* Drop arguments that we want to take from the link line. */
case OPT_flto_: case OPT_flto_:
case OPT_flto: case OPT_flto:
case OPT_flto_partition_none: case OPT_flto_partition_:
case OPT_flto_partition_1to1:
case OPT_flto_partition_balanced:
continue; continue;
default: default:
...@@ -727,8 +725,9 @@ run_gcc (unsigned argc, char *argv[]) ...@@ -727,8 +725,9 @@ run_gcc (unsigned argc, char *argv[])
verbose = 1; verbose = 1;
break; break;
case OPT_flto_partition_none: case OPT_flto_partition_:
no_partition = true; if (strcmp (option->arg, "none") == 0)
no_partition = true;
break; break;
case OPT_flto_: case OPT_flto_:
......
2014-04-15 Richard Biener <rguenther@suse.de>
* lto.c: Include params.h.
(do_whole_program_analysis): Switch on flag_lto_partition value,
add support for LTO_PARTITION_ONE.
* lto-partition.h (lto_balanced_map): Adjust.
* lto-partition.c (lto_balanced_map): Get number of desired
partitions as argument to support -flto-partition=one.
2014-04-14 Jan Hubicka <hubicka@ucw.cz> 2014-04-14 Jan Hubicka <hubicka@ucw.cz>
* lto/lto-symtab.c (lto_cgraph_replace_node): Don't re-merge * lto/lto-symtab.c (lto_cgraph_replace_node): Don't re-merge
......
...@@ -415,7 +415,7 @@ varpool_node_cmp (const void *pa, const void *pb) ...@@ -415,7 +415,7 @@ varpool_node_cmp (const void *pa, const void *pb)
and in-partition calls was reached. */ and in-partition calls was reached. */
void void
lto_balanced_map (void) lto_balanced_map (int n_lto_partitions)
{ {
int n_nodes = 0; int n_nodes = 0;
int n_varpool_nodes = 0, varpool_pos = 0, best_varpool_pos = 0; int n_varpool_nodes = 0, varpool_pos = 0, best_varpool_pos = 0;
...@@ -472,7 +472,7 @@ lto_balanced_map (void) ...@@ -472,7 +472,7 @@ lto_balanced_map (void)
} }
/* Compute partition size and create the first partition. */ /* Compute partition size and create the first partition. */
partition_size = total_size / PARAM_VALUE (PARAM_LTO_PARTITIONS); partition_size = total_size / n_lto_partitions;
if (partition_size < PARAM_VALUE (MIN_PARTITION_SIZE)) if (partition_size < PARAM_VALUE (MIN_PARTITION_SIZE))
partition_size = PARAM_VALUE (MIN_PARTITION_SIZE); partition_size = PARAM_VALUE (MIN_PARTITION_SIZE);
npartitions = 1; npartitions = 1;
...@@ -699,9 +699,8 @@ lto_balanced_map (void) ...@@ -699,9 +699,8 @@ lto_balanced_map (void)
/* Since the size of partitions is just approximate, update the size after /* Since the size of partitions is just approximate, update the size after
we finished current one. */ we finished current one. */
if (npartitions < PARAM_VALUE (PARAM_LTO_PARTITIONS)) if (npartitions < n_lto_partitions)
partition_size = total_size partition_size = total_size / (n_lto_partitions - npartitions);
/ (PARAM_VALUE (PARAM_LTO_PARTITIONS) - npartitions);
else else
partition_size = INT_MAX; partition_size = INT_MAX;
......
...@@ -34,7 +34,7 @@ extern vec<ltrans_partition> ltrans_partitions; ...@@ -34,7 +34,7 @@ extern vec<ltrans_partition> ltrans_partitions;
void lto_1_to_1_map (void); void lto_1_to_1_map (void);
void lto_max_map (void); void lto_max_map (void);
void lto_balanced_map (void); void lto_balanced_map (int);
void lto_promote_cross_file_statics (void); void lto_promote_cross_file_statics (void);
void free_ltrans_partitions (void); void free_ltrans_partitions (void);
void lto_promote_statics_nonwpa (void); void lto_promote_statics_nonwpa (void);
...@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "context.h" #include "context.h"
#include "pass_manager.h" #include "pass_manager.h"
#include "ipa-inline.h" #include "ipa-inline.h"
#include "params.h"
/* Number of parallel tasks to run, -1 if we want to use GNU Make jobserver. */ /* Number of parallel tasks to run, -1 if we want to use GNU Make jobserver. */
...@@ -3267,12 +3268,16 @@ do_whole_program_analysis (void) ...@@ -3267,12 +3268,16 @@ do_whole_program_analysis (void)
timevar_pop (TV_WHOPR_WPA); timevar_pop (TV_WHOPR_WPA);
timevar_push (TV_WHOPR_PARTITIONING); timevar_push (TV_WHOPR_PARTITIONING);
if (flag_lto_partition_1to1) if (flag_lto_partition == LTO_PARTITION_1TO1)
lto_1_to_1_map (); lto_1_to_1_map ();
else if (flag_lto_partition_max) else if (flag_lto_partition == LTO_PARTITION_MAX)
lto_max_map (); lto_max_map ();
else if (flag_lto_partition == LTO_PARTITION_ONE)
lto_balanced_map (1);
else if (flag_lto_partition == LTO_PARTITION_BALANCED)
lto_balanced_map (PARAM_VALUE (PARAM_LTO_PARTITIONS));
else else
lto_balanced_map (); gcc_unreachable ();
/* Inline summaries are needed for balanced partitioning. Free them now so /* Inline summaries are needed for balanced partitioning. Free them now so
the memory can be used for streamer caches. */ the memory can be used for streamer caches. */
......
...@@ -824,14 +824,6 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, ...@@ -824,14 +824,6 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
opts->x_flag_fat_lto_objects = 1; opts->x_flag_fat_lto_objects = 1;
} }
} }
if ((opts->x_flag_lto_partition_balanced != 0) + (opts->x_flag_lto_partition_1to1 != 0)
+ (opts->x_flag_lto_partition_none != 0) >= 1)
{
if ((opts->x_flag_lto_partition_balanced != 0)
+ (opts->x_flag_lto_partition_1to1 != 0)
+ (opts->x_flag_lto_partition_none != 0) > 1)
error_at (loc, "only one -flto-partition value can be specified");
}
/* We initialize opts->x_flag_split_stack to -1 so that targets can set a /* We initialize opts->x_flag_split_stack to -1 so that targets can set a
default value if they choose based on other options. */ default value if they choose based on other options. */
......
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