common.opt (fprofile-generate,fprofile-use): Add.

* common.opt (fprofile-generate,fprofile-use): Add.
	* gcc.c (LINK_COMMAND_SPEC): Arrange -fprofile-generate to imply -lgcov
	* opts.c (profile_arc_flag_set, flag_profile_values_set,
	flag_unroll_loops_set, flag_tracer_set,
	flag_value_profile_transformations_set,
	flag_peel_loops_set): New static variables.
	(common_handle_option): Deal with -fprofile-generate/-fprofile-use
	* invoke.texi (-fprofile-generate, -fprofile-use): Describe.

From-SVN: r74976
This commit is contained in:
Jan Hubicka 2003-12-23 18:55:33 +01:00 committed by Jan Hubicka
parent 57702a80e8
commit a8a5f53add
5 changed files with 74 additions and 1 deletions

View File

@ -1,3 +1,14 @@
2003-12-23 Jan Hubicka <jh@suse.cz>
* common.opt (fprofile-generate,fprofile-use): Add.
* gcc.c (LINK_COMMAND_SPEC): Arrange -fprofile-generate to imply -lgcov
* opts.c (profile_arc_flag_set, flag_profile_values_set,
flag_unroll_loops_set, flag_tracer_set,
flag_value_profile_transformations_set,
flag_peel_loops_set): New static variables.
(common_handle_option): Deal with -fprofile-generate/-fprofile-use
* invoke.texi (-fprofile-generate, -fprofile-use): Describe.
2003-12-23 Mark Mitchell <mark@codesourcery.com>
* c-common.c (flag_abi_version): Default to 2.

View File

@ -513,6 +513,14 @@ fprofile-arcs
Common
Insert arc-based program profiling code
fprofile-generate
Common
Enable common options for generating profile info for profile feedback directed optimizations
fprofile-use
Common
Enable common options for performing profile feedback directed optimizations
fprofile-values
Common
Insert code to profile values of expressions

View File

@ -281,6 +281,7 @@ in the following sections.
-fno-trapping-math -fno-zero-initialized-in-bss @gol
-fomit-frame-pointer -foptimize-register-move @gol
-foptimize-sibling-calls -fprefetch-loop-arrays @gol
-fprofile-generate -fprofile-use @gol
-freduce-all-givs -fregmove -frename-registers @gol
-freorder-blocks -freorder-functions @gol
-frerun-cse-after-loop -frerun-loop-opt @gol
@ -4377,6 +4378,21 @@ and occasionally eliminate the copy.
Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
@item -fprofile-generate
@opindex fprofile-generate
Enable options usually used for instrumenting application to produce profile usefull
for later recompilation profile feedback based optimization.
The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}
@item -fprofile-use
@opindex fprofile-use
Enable profile feedback directed optimizations, and optimizations
generally profitable only with profile feedback available.
The following options are enabled: @code{-fbranch-probabilities},
@code{-fvpt}, @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}.
@end table
The following options control compiler behavior regarding floating

View File

@ -677,7 +677,7 @@ proper position among the other output files. */
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
%{static:} %{L*} %(link_libgcc) %o %{fprofile-arcs:-lgcov}\
%{static:} %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate:-lgcov}\
%{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
#endif

View File

@ -148,6 +148,13 @@ static unsigned int columns = 80;
/* What to print when a switch has no documentation. */
static const char undocumented_msg[] = N_("This switch lacks documentation");
/* Used for bookkeeping on whether user set these flags so
-fprofile-use/-fprofile-generate does not use them. */
static bool profile_arc_flag_set, flag_profile_values_set;
static bool flag_unroll_loops_set, flag_tracer_set;
static bool flag_value_profile_transformations_set;
static bool flag_peel_loops_set, flag_branch_probabilities_set;
/* Input file names. */
const char **in_fnames;
unsigned num_in_fnames;
@ -882,6 +889,7 @@ common_handle_option (size_t scode, const char *arg,
break;
case OPT_fbranch_probabilities:
flag_branch_probabilities_set = true;
flag_branch_probabilities = value;
break;
@ -1135,6 +1143,7 @@ common_handle_option (size_t scode, const char *arg,
break;
case OPT_fpeel_loops:
flag_peel_loops_set = true;
flag_peel_loops = value;
break;
@ -1167,14 +1176,41 @@ common_handle_option (size_t scode, const char *arg,
break;
case OPT_fprofile_arcs:
profile_arc_flag_set = true;
profile_arc_flag = value;
break;
case OPT_fprofile_use:
if (!flag_branch_probabilities_set)
flag_branch_probabilities = value;
if (!flag_profile_values_set)
flag_profile_values = value;
if (!flag_unroll_loops_set)
flag_unroll_loops = value;
if (!flag_peel_loops_set)
flag_peel_loops = value;
if (!flag_tracer_set)
flag_tracer = value;
if (!flag_value_profile_transformations_set)
flag_value_profile_transformations = value;
break;
case OPT_fprofile_generate:
if (!profile_arc_flag_set)
profile_arc_flag = value;
if (!flag_profile_values_set)
flag_profile_values = value;
if (!flag_value_profile_transformations_set)
flag_value_profile_transformations = value;
break;
case OPT_fprofile_values:
flag_profile_values_set = true;
flag_profile_values = value;
break;
case OPT_fvpt:
flag_value_profile_transformations_set = value;
flag_value_profile_transformations = value;
break;
@ -1358,6 +1394,7 @@ common_handle_option (size_t scode, const char *arg,
break;
case OPT_ftracer:
flag_tracer_set = true;
flag_tracer = value;
break;
@ -1378,6 +1415,7 @@ common_handle_option (size_t scode, const char *arg,
break;
case OPT_funroll_loops:
flag_unroll_loops_set = true;
flag_unroll_loops = value;
break;