diff options
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 33 | ||||
-rw-r--r-- | gcc/final.c | 1 | ||||
-rw-r--r-- | gcc/gcc.c | 1 | ||||
-rw-r--r-- | gcc/profile.c | 3 | ||||
-rw-r--r-- | gcc/toplev.c | 51 | ||||
-rw-r--r-- | gcc/toplev.h | 2 |
7 files changed, 87 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ff96478..135fac4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,21 @@ 2002-08-04 Nathan Sidwell <nathan@codesourcery.com> + * gcc.c (cc1_options): Pass output file as auxbase when + appropriate. + * profile.c (init_branch_prob): FILENAME has already had ending + stripped. + * final.c (end_final): Likewise. + * toplev.c (aux_base_name): New global. + (compile_file): Pass aux_base_name to init init_branch_prob and + end_final. + (independent_decode_option, case 'a'): New auxinfo options. + (case 'd'): Protect against mising basename. + (do_compile): Initialize aux_base_name. + * toplev.h (aux_base_name): New global. + * doc/invoke.texi: Adjust documentation. + +2002-08-04 Nathan Sidwell <nathan@codesourcery.com> + * config/i386/i386.c (x86_field_alignment): Remove duplicate test of TARGET_ALIGN_DOUBLE. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a29f5e3..2bd6450 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2818,11 +2818,16 @@ allocation when it finishes. @item -fprofile-arcs @opindex fprofile-arcs -Instrument @dfn{arcs} during compilation to generate coverage data -or for profile-directed block ordering. During execution the program +Instrument @dfn{arcs} during compilation to generate coverage data or +for profile-directed block ordering. During execution the program records how many times each branch is executed and how many times it is taken. When the compiled program exits it saves this data to a file -called @file{@var{sourcename}.da} for each source file. +called @file{@var{auxname}.da} for each source file. @var{auxname} is +generated from the name of the output file, if explicitly specified and +it is not the final executable, otherwise it is the basename of the +source file. In both cases any suffix is removed (e.g. @file{foo.da} +for input file @file{dir/foo.c}, or @file{dir/foo.da} for output file +specified as @option{-o dir/foo.o}). For profile-directed block ordering, compile the program with @option{-fprofile-arcs} plus optimization and code generation options, @@ -2863,19 +2868,19 @@ information to estimate all branch probabilities. @item -ftest-coverage @opindex ftest-coverage Create data files for the @code{gcov} code-coverage utility -(@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}). -The data file names begin with the name of your source file: +(@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}). See +@option{-fprofile-arcs} option above for a description of @var{auxname}. @table @gcctabopt -@item @var{sourcename}.bb +@item @var{auxname}.bb A mapping from basic blocks to line numbers, which @code{gcov} uses to associate basic block execution counts with line numbers. -@item @var{sourcename}.bbg +@item @var{auxname}.bbg A list of all arcs in the program flow graph. This allows @code{gcov} to reconstruct the program flow graph, so that it can compute all basic block and arc execution counts from the information in the -@code{@var{sourcename}.da} file. +@file{@var{auxname}.da} file. @end table Use @option{-ftest-coverage} with @option{-fprofile-arcs}; the latter @@ -2883,9 +2888,9 @@ option adds instrumentation to the program, which then writes execution counts to another data file: @table @gcctabopt -@item @var{sourcename}.da +@item @var{auxname}.da Runtime arc execution counts, used in conjunction with the arc -information in the file @code{@var{sourcename}.bbg}. +information in the file @file{@var{auxname}.bbg}. @end table Coverage data will map better to the source files if @@ -2896,8 +2901,12 @@ Coverage data will map better to the source files if Says to make debugging dumps during compilation at times specified by @var{letters}. This is used for debugging the compiler. The file names for most of the dumps are made by appending a pass number and a word to -the source file name (e.g. @file{foo.c.00.rtl} or @file{foo.c.01.sibling}). -Here are the possible letters for use in @var{letters}, and their meanings: +the @var{dumpname}. @var{dumpname} is generated from the name of the +output file, if explicitly specified and it is not an executable, +otherwise it is the basename of the source file. In both cases any +suffix is removed (e.g. @file{foo.00.rtl} or @file{foo.01.sibling}). +Here are the possible letters for use in @var{letters}, and their +meanings: @table @samp @item A diff --git a/gcc/final.c b/gcc/final.c index 7d817ae..1b009c6 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -311,7 +311,6 @@ end_final (filename) strcpy (da_filename, cwd); strcat (da_filename, "/"); strcat (da_filename, filename); - strip_off_ending (da_filename, da_filename_len - 3); strcat (da_filename, ".da"); da_filename_len = strlen (da_filename); string_cst = build_string (da_filename_len + 1, da_filename); @@ -697,6 +697,7 @@ static const char *cpp_debug_options = "%{d*}"; static const char *cc1_options = "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\ + -auxbase%{c|S:%{o*:-strip%*}%{!o*: %b}}%{!c:%{!S: %b}}\ %{g*} %{O*} %{W*&pedantic*} %{w} %{std*} %{ansi}\ %{v:-version} %{pg:-p} %{p} %{f*} %{undef}\ %{Qn:-fno-ident} %{--help:--help}\ diff --git a/gcc/profile.c b/gcc/profile.c index 489e377..36ce8a3 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -1196,7 +1196,6 @@ init_branch_prob (filename) /* Open an output file for the basic block/line number map. */ data_file = (char *) alloca (len + 4); strcpy (data_file, filename); - strip_off_ending (data_file, len); strcat (data_file, ".bb"); if ((bb_file = fopen (data_file, "wb")) == 0) fatal_io_error ("can't open %s", data_file); @@ -1204,7 +1203,6 @@ init_branch_prob (filename) /* Open an output file for the program flow graph. */ bbg_file_name = (char *) alloca (len + 5); strcpy (bbg_file_name, filename); - strip_off_ending (bbg_file_name, len); strcat (bbg_file_name, ".bbg"); if ((bbg_file = fopen (bbg_file_name, "wb")) == 0) fatal_io_error ("can't open %s", bbg_file_name); @@ -1221,7 +1219,6 @@ init_branch_prob (filename) len = strlen (filename); da_file_name = (char *) alloca (len + 4); strcpy (da_file_name, filename); - strip_off_ending (da_file_name, len); strcat (da_file_name, ".da"); if ((da_file = fopen (da_file_name, "rb")) == 0) warning ("file %s not found, execution counts assumed to be zero", diff --git a/gcc/toplev.c b/gcc/toplev.c index 25d3cd2..719b48d 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -168,6 +168,10 @@ int input_file_stack_tick; const char *dump_base_name; +/* Name to use as a base for auxiliary output files. */ + +const char *aux_base_name; + /* Format to use to print dumpfile index value */ #ifndef DUMPFILE_FORMAT #define DUMPFILE_FORMAT ".%02d." @@ -2117,7 +2121,7 @@ compile_file () /* Initialize yet another pass. */ init_final (main_input_filename); - init_branch_prob (dump_base_name); + init_branch_prob (aux_base_name); timevar_push (TV_PARSE); @@ -2190,7 +2194,7 @@ compile_file () dw2_output_indirect_constants (); - end_final (dump_base_name); + end_final (aux_base_name); if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) { @@ -4297,7 +4301,9 @@ independent_decode_option (argc, argv) if (argc == 1) return 0; - dump_base_name = argv[1]; + if (argv[1][0]) + dump_base_name = argv[1]; + return 2; } else @@ -4370,6 +4376,30 @@ independent_decode_option (argc, argv) else return 0; } + else if (!strcmp (arg, "auxbase")) + { + if (argc == 1) + return 0; + + if (argv[1][0]) + aux_base_name = argv[1]; + + return 2; + } + else if (!strcmp (arg, "auxbase-strip")) + { + if (argc == 1) + return 0; + + if (argv[1][0]) + { + strip_off_ending (argv[1], strlen (argv[1])); + if (argv[1][0]) + aux_base_name = argv[1]; + } + + return 2; + } else return 0; break; @@ -5170,7 +5200,7 @@ lang_dependent_init (name) { if (dump_base_name == 0) dump_base_name = name ? name : "gccdump"; - + /* Front-end initialization. This hook can assume that GC, identifier hashes etc. are set up, but debug initialization is not done yet. This routine must return the original filename @@ -5281,6 +5311,19 @@ do_compile (no_backend) /* The bulk of command line switch processing. */ process_options (); + if (aux_base_name) + /*NOP*/; + else if (filename) + { + char *name = xstrdup (lbasename (filename)); + + aux_base_name = name; + strip_off_ending (name, strlen (name)); + } + + else + aux_base_name = "gccaux"; + /* We cannot start timing until after options are processed since that says if we run timers or not. */ init_timevar (); diff --git a/gcc/toplev.h b/gcc/toplev.h index aa7345b..2dab244 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -108,6 +108,8 @@ extern void check_global_declarations PARAMS ((union tree_node **, int)); extern const char *progname; extern const char *dump_base_name; +extern const char *aux_base_name; + extern int target_flags_explicit; /* The hashtable, so that the C front ends can pass it to cpplib. */ |