+2008-03-31 Seongbae Park <seongbae.park@gmail.com>
+
+ * Makefile.tpl (.NOTPARALLEL): Serialize stageprofile libiberty.
+ * Makefile.in (.NOTPARALLEL): Regenerate.
+
2008-03-27 Paolo Bonzini <bonzini@gnu.org>
* Makefile.tpl (PICFLAG, PICFLAG_FOR_TARGET): Remove.
# This lives here to allow makefile fragments to contain dependencies.
all:
+.NOTPARALLEL: all-stageprofile-libiberty
+
#### host and target specific makefile fragments come in here.
@target_makefile_frag@
@alphaieee_frag@
# This lives here to allow makefile fragments to contain dependencies.
all:
+.NOTPARALLEL: all-stageprofile-libiberty
+
#### host and target specific makefile fragments come in here.
@target_makefile_frag@
@alphaieee_frag@
+2008-03-31 Seongbae Park <seongbae.park@gmail.com>
+
+ * common.opt (fprofile-dir=, fprofile-use=, fprofile-generate=):
+ New options
+ (fprofile-use): Add var flag_profile_use
+ * coverage.c (coverage_begin_output): Do not open a gcno file for output
+ only if -ftest-coverage is set.
+ Do not add getpwd() to gcda file path.
+ (build_gcov_info): Check the new flag
+ flag_profile_datafile_relative_path.
+ (coverage_init): Use profile_data_prefix.
+ Read profile counter only if flag_profile_use is set.
+ * opts.c (common_handle_option): New option fprofile-use=,
+ fprofile-dir=, fprofile-generate=.
+ * toplev.c (profile_data_prefix): New variable definition.
+ * toplev.h (profile_data_prefix): New declaration.
+ * doc/invoke.tex (Option Summary, Optimization Options):
+ Add new options.
+
2008-03-31 James E. Wilson <wilson@tuliptree.org>
PR target/35695
Common Report Var(profile_arc_flag)
Insert arc-based program profiling code
+fprofile-dir=
+Common Joined RejectNegative
+Set the top-level directory for storing the profile data.
+The default is 'pwd'.
+
fprofile-generate
Common
Enable common options for generating profile info for profile feedback directed optimizations
+fprofile-generate=
+Common Joined RejectNegative
+Enable common options for generating profile info for profile feedback directed optimizations, and set -fprofile-dir=
+
fprofile-use
-Common
+Common Var(flag_profile_use)
Enable common options for performing profile feedback directed optimizations
+fprofile-use=
+Common Joined RejectNegative
+Enable common options for performing profile feedback directed optimizations, and set -fprofile-dir=
+
fprofile-values
Common Report Var(flag_profile_values)
Insert code to profile values of expressions
int
coverage_begin_output (void)
{
- if (no_coverage)
+ /* We don't need to output .gcno file unless we're under -ftest-coverage
+ (e.g. -fprofile-arcs/generate/use don't need .gcno to work). */
+ if (no_coverage || !flag_test_coverage)
return 0;
if (!bbg_function_announced)
tree field, fields = NULL_TREE;
tree value = NULL_TREE;
tree filename_string;
- char *filename;
- int filename_len;
+ int da_file_name_len;
unsigned n_fns;
const struct function_list *fn;
tree string_type;
field = build_decl (FIELD_DECL, NULL_TREE, string_type);
TREE_CHAIN (field) = fields;
fields = field;
- filename = getpwd ();
- filename = (filename && da_file_name[0] != '/'
- ? concat (filename, "/", da_file_name, NULL)
- : da_file_name);
- filename_len = strlen (filename);
- filename_string = build_string (filename_len + 1, filename);
- if (filename != da_file_name)
- free (filename);
+ da_file_name_len = strlen (da_file_name);
+ filename_string = build_string (da_file_name_len + 1, da_file_name);
TREE_TYPE (filename_string) = build_array_type
(char_type_node, build_index_type
- (build_int_cst (NULL_TREE, filename_len)));
+ (build_int_cst (NULL_TREE, da_file_name_len)));
value = tree_cons (field, build1 (ADDR_EXPR, string_type, filename_string),
value);
coverage_init (const char *filename)
{
int len = strlen (filename);
+ /* + 1 for extra '/', in case prefix doesn't end with /. */
+ int prefix_len;
+
+ if (profile_data_prefix == 0 && filename[0] != '/')
+ profile_data_prefix = getpwd ();
+
+ prefix_len = (profile_data_prefix) ? strlen (profile_data_prefix) + 1 : 0;
/* Name of da file. */
- da_file_name = XNEWVEC (char, len + strlen (GCOV_DATA_SUFFIX) + 1);
- strcpy (da_file_name, filename);
+ da_file_name = XNEWVEC (char, len + strlen (GCOV_DATA_SUFFIX)
+ + prefix_len + 1);
+
+ if (profile_data_prefix)
+ {
+ strcpy (da_file_name, profile_data_prefix);
+ da_file_name[prefix_len - 1] = '/';
+ da_file_name[prefix_len] = 0;
+ }
+ else
+ da_file_name[0] = 0;
+ strcat (da_file_name, filename);
strcat (da_file_name, GCOV_DATA_SUFFIX);
/* Name of bbg file. */
strcpy (bbg_file_name, filename);
strcat (bbg_file_name, GCOV_NOTE_SUFFIX);
- read_counts_file ();
+ if (flag_profile_use)
+ read_counts_file ();
}
/* Performs file-level cleanup. Close graph file, generate coverage
-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
-fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
-fpeel-loops -fpredictive-commoning -fprefetch-loop-arrays @gol
--fprofile-generate -fprofile-use -fprofile-values -freciprocal-math @gol
--fregmove -frename-registers -freorder-blocks @gol
+-fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
+-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
+-freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
-freorder-blocks-and-partition -freorder-functions @gol
-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
-frounding-math -frtl-abstract-sequences -fsched2-use-superblocks @gol
Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+@item -fprofile-dir=@var{path}
+@opindex fprofile-dir
+
+Set the directory to search the profile data files in to @var{path}.
+This option affects only the profile data generated by
+@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
+and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
+and its related options.
+By default, GCC will use the current directory as @var{path}
+thus the profile data file will appear in the same directory as the object file.
+
@item -fprofile-generate
+@itemx -fprofile-generate=@var{path}
@opindex fprofile-generate
Enable options usually used for instrumenting application to produce
The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
+If @var{path} is specified, GCC will look at the @var{path} to find
+the profile feeedback data files. See @option{-fprofile-dir}.
+
@item -fprofile-use
+@itemx -fprofile-use=@var{path}
@opindex fprofile-use
Enable profile feedback directed optimizations, and optimizations
generally profitable only with profile feedback available.
match the source code. This error can be turned into a warning by using
@option{-Wcoverage-mismatch}. Note this may result in poorly optimized
code.
+
+If @var{path} is specified, GCC will look at the @var{path} to find
+the profile feedback data files. See @option{-fprofile-dir}.
@end table
The following options control compiler behavior regarding floating
flag_inline_functions_set = true;
break;
+ case OPT_fprofile_dir_:
+ profile_data_prefix = xstrdup (arg);
+ break;
+
+ case OPT_fprofile_use_:
+ profile_data_prefix = xstrdup (arg);
+ flag_profile_use = true;
+ value = true;
+ /* No break here - do -fprofile-use processing. */
case OPT_fprofile_use:
if (!flag_branch_probabilities_set)
flag_branch_probabilities = value;
flag_inline_functions = value;
break;
+ case OPT_fprofile_generate_:
+ profile_data_prefix = xstrdup (arg);
+ value = true;
+ /* No break here - do -fprofile-generate processing. */
case OPT_fprofile_generate:
if (!profile_arc_flag_set)
profile_arc_flag = value;
+2008-03-31 Seongbae Park <seongbae.park@gmail.com>
+
+ * g++.db/bprob/bprob.exp: Do not check gcno files.
+ Use -fprofile-use for profile use.
+ * gcc.misc-tests/bprob.exp: Ditto.
+ * g++.dg/tree-pro/tree-prof.exp: Do not check gcno files.
+ * gcc.dg/matrix/matrix.exp: Ditto.
+ * gcc.dg/struct/struct-reorg.exp: Ditto.
+ * gcc.dg/tree-prof/tree-prof.exp: Ditto.
+ * gcc.dg/profile-dir-1.c: New test.
+ * gcc.dg/profile-dir-2.c: New test.
+ * gcc.dg/profile-dir-3.c: New test.
+
2008-03-31 Volker Reichelt <v.reichelt@netcologne.de>
PR c/35750
# The procedures in profopt.exp need these parameters.
set tool g++
-set prof_ext "gcda gcno"
+set prof_ext "gcda"
if $tracelevel then {
strace $tracelevel
load_lib profopt.exp
set profile_options "-fprofile-arcs"
-set feedback_options "-fbranch-probabilities"
+set feedback_options "-fprofile-use"
# Main loop.
foreach profile_option $profile_options feedback_option $feedback_options {
# The procedures in profopt.exp need these parameters.
set tool g++
-set prof_ext "gcda gcno"
+set prof_ext "gcda"
# Override the list defined in profopt.exp.
set PROFOPT_OPTIONS [list {}]
# The procedures in profopt.exp need these parameters.
set tool gcc
-set prof_ext "gcda gcno"
+set prof_ext "gcda"
# Override the list defined in profopt.exp.
set PROFOPT_OPTIONS [list {}]
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fprofile-generate=." } */
+/* { dg-final { scan-assembler "\"./profile-dir-1.gcda\"" } } */
+
+int
+main(void)
+{
+ return 0;
+}
+
+/* { dg-final { cleanup-coverage-files } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fprofile-generate" } */
+/* { dg-final { scan-assembler "/profile-dir-2.gcda" } } */
+
+int
+main(void)
+{
+ return 0;
+}
+
+/* { dg-final { cleanup-coverage-files } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fprofile-generate -fprofile-dir=." } */
+/* { dg-final { scan-assembler "\"./profile-dir-3.gcda\"" } } */
+
+int
+main(void)
+{
+ return 0;
+}
+
+/* { dg-final { cleanup-coverage-files } } */
# The procedures in profopt.exp need these parameters.
set tool gcc
-set prof_ext "gcda gcno"
+set prof_ext "gcda"
# Override the list defined in profopt.exp.
set PROFOPT_OPTIONS [list {}]
# The procedures in profopt.exp need these parameters.
set tool gcc
-set prof_ext "gcda gcno"
+set prof_ext "gcda"
# Override the list defined in profopt.exp.
set PROFOPT_OPTIONS [list {}]
# The procedures in profopt.exp need these parameters.
set tool gcc
-set prof_ext "gcda gcno"
+set prof_ext "gcda"
set perf_ext tim
# Override the list defined in profopt.exp.
load_lib profopt.exp
set profile_options "-fprofile-arcs"
-set feedback_options "-fbranch-probabilities"
+set feedback_options "-fprofile-use"
foreach profile_option $profile_options feedback_option $feedback_options {
foreach src [lsort [glob -nocomplain $srcdir/$subdir/bprob-*.c]] {
const char *aux_base_name;
+/* Prefix for profile data files */
+const char *profile_data_prefix;
+
/* A mask of target_flags that includes bit X if X was set or cleared
on the command line. */
extern const char *dump_base_name;
extern const char *aux_base_name;
extern const char *aux_info_file_name;
+extern const char *profile_data_prefix;
extern const char *asm_file_name;
extern bool exit_after_options;