diff options
author | Rong Xu <xur@google.com> | 2014-07-21 16:47:22 -0700 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2014-07-29 15:31:03 -0700 |
commit | 38a8aecfb882072900434499696b5c32a2274515 (patch) | |
tree | 2aac97f0ae24b03cd98c1a06e989c031c173f889 /gcc-4.9/gcc/opts-global.c | |
parent | c231900e5dcc14d8296bd9f62b45997a49d4d5e7 (diff) | |
download | toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.zip toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.gz toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.bz2 |
[4.9] Switch gcc-4.9 to use google/gcc-4_9 branch.
This source drop uses svn version r212828 of google/gcc-4.9 branch.
We also cherry-picked r213062, r213063 and r213064 to fix windows
build issues.
All gcc-4.9 patches before July 3rd are ported to google/gcc-4.9.
The following prior commits has not been merged to google branch yet.
(They are included in this commit).
e7af147f979e657fe2df00808e5b4319b0e088c6,
baf87df3cb2683649ba7e9872362a7e721117c23, and
c231900e5dcc14d8296bd9f62b45997a49d4d5e7.
Change-Id: I4bea3ea470387ff751c2be4cb0d4a12059b9299b
Diffstat (limited to 'gcc-4.9/gcc/opts-global.c')
-rw-r--r-- | gcc-4.9/gcc/opts-global.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/gcc-4.9/gcc/opts-global.c b/gcc-4.9/gcc/opts-global.c index 111884b..e115c9b 100644 --- a/gcc-4.9/gcc/opts-global.c +++ b/gcc-4.9/gcc/opts-global.c @@ -41,6 +41,8 @@ along with GCC; see the file COPYING3. If not see #include "plugin.h" #include "toplev.h" #include "tree-pass.h" +#include "params.h" +#include "l-ipo.h" #include "context.h" typedef const char *const_char_p; /* For DEF_VEC_P. */ @@ -185,7 +187,7 @@ lang_handle_option (struct gcc_options *opts, /* Handle FILENAME from the command line. */ -static void +void add_input_filename (const char *filename) { num_in_fnames++; @@ -193,6 +195,40 @@ add_input_filename (const char *filename) in_fnames[num_in_fnames - 1] = filename; } +/* GCC command-line options saved to the LIPO profile data file. + See detailed comment in opts.h. */ +const char **lipo_cl_args; +unsigned num_lipo_cl_args; + +/* Inspect the given GCC command-line arguments, which are part of one GCC + switch, and decide whether or not to store these to the LIPO profile data + file. */ +static void +lipo_save_cl_args (struct cl_decoded_option *decoded) +{ + const char *opt = decoded->orig_option_with_args_text; + /* Store the following command-line flags to the lipo profile data file: + (1) -f... (except -frandom-seed...) + (2) -m... + (3) -W... + (4) -O... + (5) --param... + (6) -std=... (-std=c99 for restrict keyword) + */ + if (opt[0] == '-' + && (opt[1] == 'f' || opt[1] == 'm' || opt[1] == 'W' || opt[1] == 'O' + || (strstr (opt, "--param") == opt) + || (strstr (opt, "-std="))) + && !strstr(opt, "-frandom-seed") + && !strstr(opt, "-fripa-disallow-opt-mismatch") + && !strstr(opt, "-Wripa-opt-mismatch")) + { + num_lipo_cl_args++; + lipo_cl_args = XRESIZEVEC (const char *, lipo_cl_args, num_lipo_cl_args); + lipo_cl_args[num_lipo_cl_args - 1] = opt; + } +} + /* Handle the vector of command line options (located at LOC), storing the results of processing DECODED_OPTIONS and DECODED_OPTIONS_COUNT in OPTS and OPTS_SET and using DC for diagnostic state. LANG_MASK @@ -209,6 +245,10 @@ read_cmdline_options (struct gcc_options *opts, struct gcc_options *opts_set, diagnostic_context *dc) { unsigned int i; + int force_multi_module = 0; + static int cur_mod_id = 0; + + force_multi_module = PARAM_VALUE (PARAM_FORCE_LIPO_MODE); for (i = 1; i < decoded_options_count; i++) { @@ -227,12 +267,15 @@ read_cmdline_options (struct gcc_options *opts, struct gcc_options *opts_set, &opts->x_main_input_basename); } add_input_filename (decoded_options[i].arg); + if (force_multi_module) + add_module_info (++cur_mod_id, (num_in_fnames == 1), num_in_fnames - 1); continue; } read_cmdline_option (opts, opts_set, decoded_options + i, loc, lang_mask, handlers, dc); + lipo_save_cl_args (decoded_options + i); } } |