* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74976
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
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
-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
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
%{!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
/* 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;
break;
case OPT_fbranch_probabilities:
+ flag_branch_probabilities_set = true;
flag_branch_probabilities = value;
break;
break;
case OPT_fpeel_loops:
+ flag_peel_loops_set = true;
flag_peel_loops = value;
break;
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;
break;
case OPT_ftracer:
+ flag_tracer_set = true;
flag_tracer = value;
break;
break;
case OPT_funroll_loops:
+ flag_unroll_loops_set = true;
flag_unroll_loops = value;
break;