Commit a8a5f53a by Jan Hubicka Committed by Jan Hubicka

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
parent 57702a80
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> 2003-12-23 Mark Mitchell <mark@codesourcery.com>
* c-common.c (flag_abi_version): Default to 2. * c-common.c (flag_abi_version): Default to 2.
......
...@@ -513,6 +513,14 @@ fprofile-arcs ...@@ -513,6 +513,14 @@ fprofile-arcs
Common Common
Insert arc-based program profiling code 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 fprofile-values
Common Common
Insert code to profile values of expressions Insert code to profile values of expressions
......
...@@ -281,6 +281,7 @@ in the following sections. ...@@ -281,6 +281,7 @@ in the following sections.
-fno-trapping-math -fno-zero-initialized-in-bss @gol -fno-trapping-math -fno-zero-initialized-in-bss @gol
-fomit-frame-pointer -foptimize-register-move @gol -fomit-frame-pointer -foptimize-register-move @gol
-foptimize-sibling-calls -fprefetch-loop-arrays @gol -foptimize-sibling-calls -fprefetch-loop-arrays @gol
-fprofile-generate -fprofile-use @gol
-freduce-all-givs -fregmove -frename-registers @gol -freduce-all-givs -fregmove -frename-registers @gol
-freorder-blocks -freorder-functions @gol -freorder-blocks -freorder-functions @gol
-frerun-cse-after-loop -frerun-loop-opt @gol -frerun-cse-after-loop -frerun-loop-opt @gol
...@@ -4377,6 +4378,21 @@ and occasionally eliminate the copy. ...@@ -4377,6 +4378,21 @@ and occasionally eliminate the copy.
Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 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 @end table
The following options control compiler behavior regarding floating The following options control compiler behavior regarding floating
......
...@@ -677,7 +677,7 @@ proper position among the other output files. */ ...@@ -677,7 +677,7 @@ proper position among the other output files. */
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ %{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)}}\ %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}" %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
#endif #endif
......
...@@ -148,6 +148,13 @@ static unsigned int columns = 80; ...@@ -148,6 +148,13 @@ static unsigned int columns = 80;
/* What to print when a switch has no documentation. */ /* What to print when a switch has no documentation. */
static const char undocumented_msg[] = N_("This switch lacks 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. */ /* Input file names. */
const char **in_fnames; const char **in_fnames;
unsigned num_in_fnames; unsigned num_in_fnames;
...@@ -882,6 +889,7 @@ common_handle_option (size_t scode, const char *arg, ...@@ -882,6 +889,7 @@ common_handle_option (size_t scode, const char *arg,
break; break;
case OPT_fbranch_probabilities: case OPT_fbranch_probabilities:
flag_branch_probabilities_set = true;
flag_branch_probabilities = value; flag_branch_probabilities = value;
break; break;
...@@ -1135,6 +1143,7 @@ common_handle_option (size_t scode, const char *arg, ...@@ -1135,6 +1143,7 @@ common_handle_option (size_t scode, const char *arg,
break; break;
case OPT_fpeel_loops: case OPT_fpeel_loops:
flag_peel_loops_set = true;
flag_peel_loops = value; flag_peel_loops = value;
break; break;
...@@ -1167,14 +1176,41 @@ common_handle_option (size_t scode, const char *arg, ...@@ -1167,14 +1176,41 @@ common_handle_option (size_t scode, const char *arg,
break; break;
case OPT_fprofile_arcs: case OPT_fprofile_arcs:
profile_arc_flag_set = true;
profile_arc_flag = value; profile_arc_flag = value;
break; 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: case OPT_fprofile_values:
flag_profile_values_set = true;
flag_profile_values = value; flag_profile_values = value;
break; break;
case OPT_fvpt: case OPT_fvpt:
flag_value_profile_transformations_set = value;
flag_value_profile_transformations = value; flag_value_profile_transformations = value;
break; break;
...@@ -1358,6 +1394,7 @@ common_handle_option (size_t scode, const char *arg, ...@@ -1358,6 +1394,7 @@ common_handle_option (size_t scode, const char *arg,
break; break;
case OPT_ftracer: case OPT_ftracer:
flag_tracer_set = true;
flag_tracer = value; flag_tracer = value;
break; break;
...@@ -1378,6 +1415,7 @@ common_handle_option (size_t scode, const char *arg, ...@@ -1378,6 +1415,7 @@ common_handle_option (size_t scode, const char *arg,
break; break;
case OPT_funroll_loops: case OPT_funroll_loops:
flag_unroll_loops_set = true;
flag_unroll_loops = value; flag_unroll_loops = value;
break; break;
......
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