GCC Middle and Back End API Reference
|
Typedefs | |
typedef char * | char_p |
Functions | |
static void | set_Wstrict_aliasing (struct gcc_options *opts, int onoff) |
void | set_struct_debug_option (struct gcc_options *opts, location_t loc, const char *spec) |
void | strip_off_ending () |
int | base_of_path () |
static void | handle_param (struct gcc_options *opts, struct gcc_options *opts_set, location_t loc, const char *carg) |
static void | set_debug_level (enum debug_info_type type, int extended, const char *arg, struct gcc_options *opts, struct gcc_options *opts_set, location_t loc) |
static void | set_fast_math_flags (struct gcc_options *opts, int set) |
static void | decode_d_option (const char *arg, struct gcc_options *opts, location_t loc, diagnostic_context *dc) |
static void | set_unsafe_math_optimizations_flags (struct gcc_options *opts, int set) |
static void | enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, const struct cl_option_handlers *handlers, struct gcc_options *opts, struct gcc_options *opts_set, location_t loc, diagnostic_context *dc) |
bool | target_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc) |
static void | add_comma_separated_to_vector () |
void | init_options_struct () |
static void | maybe_default_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct default_options *default_opt, int level, bool size, bool fast, bool debug, unsigned int lang_mask, const struct cl_option_handlers *handlers, location_t loc, diagnostic_context *dc) |
static void | maybe_default_options (struct gcc_options *opts, struct gcc_options *opts_set, const struct default_options *default_opts, int level, bool size, bool fast, bool debug, unsigned int lang_mask, const struct cl_option_handlers *handlers, location_t loc, diagnostic_context *dc) |
void | default_options_optimization (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded_options, unsigned int decoded_options_count, location_t loc, unsigned int lang_mask, const struct cl_option_handlers *handlers, diagnostic_context *dc) |
void | finish_options (struct gcc_options *opts, struct gcc_options *opts_set, location_t loc) |
static void | wrap_help (const char *help, const char *item, unsigned int item_width, unsigned int columns) |
static void | print_filtered_help (unsigned int include_flags, unsigned int exclude_flags, unsigned int any_flags, unsigned int columns, struct gcc_options *opts, unsigned int lang_mask) |
static void | print_specific_help (unsigned int include_flags, unsigned int exclude_flags, unsigned int any_flags, struct gcc_options *opts, unsigned int lang_mask) |
bool | common_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc) |
static void | set_Wstrict_aliasing () |
static void | set_fast_math_flags () |
static void | set_unsafe_math_optimizations_flags () |
bool | fast_math_flags_set_p () |
bool | fast_math_flags_struct_set_p () |
static void | setup_core_dumping () |
char * | option_name (diagnostic_context *context, int option_index, diagnostic_t orig_diag_kind, diagnostic_t diag_kind) |
Variables | |
const char *const | debug_type_names [] |
static const char | undocumented_msg [] = N_("This switch lacks documentation") |
static struct default_options | default_options_table [] |
typedef char* char_p |
|
static |
Add comma-separated strings to a char_p vector.
We never free this string.
int base_of_path | ( | ) |
Find the base name of a path, stripping off both directories and a single final extension.
bool common_handle_option | ( | struct gcc_options * | opts, |
struct gcc_options * | opts_set, | ||
const struct cl_decoded_option * | decoded, | ||
unsigned int | lang_mask, | ||
int | kind, | ||
location_t | loc, | ||
const struct cl_option_handlers * | handlers, | ||
diagnostic_context * | dc | ||
) |
Handle target- and language-independent options. Return zero to generate an "unknown option" message. Only options that need extra handling need to be listed here; if you simply want DECODED->value assigned to a variable, it happens automatically.
First display any single language specific options.
Next display any multi language specific options.
Then display any remaining, non-language options.
Note - by default we include undocumented options when listing specific classes. If you only want to see documented options then add ",^undocumented" to the --help= option. E.g.: --help=target,^undocumented
Walk along the argument string, parsing each word in turn. The format is: arg = [^]{word}[,{arg}] word = {optimizers|target|warnings|undocumented| params|common|<language>}
Check to see if the string matches an option class name.
Check to see if the string matches a language name. Note - we rely upon the alpha-sorted nature of the entries in the lang_names array, specifically that shorter names appear before their longer variants. (i.e. C before C++). That way when we are attempting to match --help=c for example we will match with C first and not C++.
The option's argument matches both the start of a language name and the start of an option class name. We have a special case for when the user has specified "--help=c", but otherwise we have to issue a warning.
Check to see if the string matches an option class name.
Handle both -fsanitize and -fno-sanitize cases.
Currently handled in a prescan.
Deferred.
Deferred.
Deferred.
Deferred.
Deferred.
Deferred.
Deferred.
No break here - do -fprofile-use processing.
Indirect call profiling should do all useful transformations speculative devirutalization does.
No break here - do -fprofile-generate processing.
FIXME: Instrumentation we insert makes ipa-reference bitmaps quadratic. Disable the pass until better memory representation is done.
The real switch is -fno-random-seed.
Deferred.
Deferred.
Handled with Var in common.opt.
This is the old stack checking method.
This is the new stack checking method.
The real switch is -fno-stack-limit.
Deferred.
Deferred.
-ftree-vectorizer-verbose is deprecated. It is defined in -terms of fopt-info=N.
Deferred.
FALLTHRU
No-op. Used by the driver and passed to us because it starts with f.
If the flag was handled in a standard way, assume the lack of processing here is intentional.
References lang_names, len, pflags, strlen(), and warning_at().
|
static |
Parse a -d<ARG> command line switch for OPTS, location LOC, diagnostic context DC.
void default_options_optimization | ( | struct gcc_options * | opts, |
struct gcc_options * | opts_set, | ||
struct cl_decoded_option * | decoded_options, | ||
unsigned int | decoded_options_count, | ||
location_t | loc, | ||
unsigned int | lang_mask, | ||
const struct cl_option_handlers * | handlers, | ||
diagnostic_context * | dc | ||
) |
Default the options in OPTS and OPTS_SET based on the optimization settings in DECODED_OPTIONS and DECODED_OPTIONS_COUNT.
Scan to see what optimization level has been specified. That will determine the default value of many flags.
Optimizing for size forces optimize to be 2.
-Ofast only adds flags to -O3.
-Og selects optimization level 1.
Ignore other options in this prescan.
-O2 param settings.
Track fields in field-sensitive alias analysis.
For -O1 only do loop invariant motion for very small loops.
We want to crossjump as much as possible.
Allow default optimizations to be specified on a per-machine basis.
Referenced by set_default_handlers().
|
static |
Enable (or disable if VALUE is 0) a warning option ARG (language mask LANG_MASK, option handlers HANDLERS) as an error for option structures OPTS and OPTS_SET, diagnostic context DC (possibly NULL), location LOC. This is used by -Werror=.
bool fast_math_flags_set_p | ( | ) |
Return true iff flags in OPTS are set as if -ffast-math.
bool fast_math_flags_struct_set_p | ( | ) |
Return true iff flags are set as if -ffast-math but using the flags stored in the struct cl_optimization structure.
void finish_options | ( | struct gcc_options * | opts, |
struct gcc_options * | opts_set, | ||
location_t | loc | ||
) |
After all options at LOC have been read into OPTS and OPTS_SET, finalize settings of those options and diagnose incompatible combinations.
First try to make OPTS->X_DUMP_BASE_NAME relative to the OPTS->X_DUMP_DIR_NAME directory. Then try to make OPTS->X_DUMP_BASE_NAME relative to the OPTS->X_AUX_BASE_NAME directory, typically the directory to contain the object file.
Copy directory component from OPTS->X_AUX_BASE_NAME.
Append existing OPTS->X_DUMP_BASE_NAME.
Handle related options for unit-at-a-time, toplevel-reorder, and section-anchors.
Unless the user has asked for section anchors, we disable toplevel reordering at -O0 to disable transformations that might be surprising to end users and to get -fno-toplevel-reorder tested.
Inlining does not work if not optimizing, so force it not to be done.
The optimization to partition hot and cold basic blocks into separate sections of the .o and executable files does not work (currently) with exception handling. This is because there is no support for generating unwind info. If opts->x_flag_exceptions is turned on we need to turn off the partitioning optimization.
If user requested unwind info, then turn off the partitioning optimization.
If the target requested unwind info, then turn off the partitioning optimization with a different message. Likewise, if the target does not support named sections.
Pipelining of outer loops is only possible when general pipelining capabilities are requested.
When generating IL, do not operate in whole-program mode. Otherwise, symbols will be privatized too early, causing link errors later.
We initialize opts->x_flag_split_stack to -1 so that targets can set a default value if they choose based on other options.
Tune vectorization related parametees according to cost model.
Set PARAM_MAX_STORES_TO_SINK to 0 if either vectorization or if-conversion is disabled.
The -gsplit-dwarf option requires -gpubnames.
|
static |
Handle --param NAME=VALUE.
References DBX_DEBUG, debug_type_names, DWARF2_DEBUG, error_at(), NO_DEBUG, type(), and warning_at().
void init_options_struct | ( | ) |
Initialize OPTS and OPTS_SET before using them in parsing options.
Initialize whether `char' is signed.
Set this to a special "uninitialized" value. The actual default is set after target options have been processed.
Initialize target_flags before default_options_optimization so the latter can modify it.
Some targets have ABI-specified unwind tables.
Some targets have other target-specific initialization.
|
static |
If indicated by the optimization level LEVEL (-Os if SIZE is set, -Ofast if FAST is set, -Og if DEBUG is set), apply the option DEFAULT_OPT to OPTS and OPTS_SET, diagnostic context DC, location LOC, with language mask LANG_MASK and option handlers HANDLERS.
|
static |
As indicated by the optimization level LEVEL (-Os if SIZE is set, -Ofast if FAST is set), apply the options in array DEFAULT_OPTS to OPTS and OPTS_SET, diagnostic context DC, location LOC, with language mask LANG_MASK and option handlers HANDLERS.
char* option_name | ( | diagnostic_context * | context, |
int | option_index, | ||
diagnostic_t | orig_diag_kind, | ||
diagnostic_t | diag_kind | ||
) |
Return malloced memory for the name of the option OPTION_INDEX which enabled a diagnostic (context CONTEXT), originally of type ORIG_DIAG_KIND but possibly converted to DIAG_KIND by options such as -Werror.
A warning classified as an error.
Skip over "-W".
A warning with option.
A warning without option classified as an error.
|
static |
Print help for a specific front-end, etc.
Get the translation.
Skip unwanted switches.
The driver currently prints its own help text.
Skip switches that have already been printed.
Get the translation.
Find the gap between the name of the option and its descriptive text.
With the -Q option enabled we change the descriptive text associated with an option to be an indication of its current setting.
PR 31349: Tell the user how to see all of the options supported by a specific front end.
Print details of enumerated option arguments, if those enumerations have help text headings provided. If no help text is provided, presume that the possible values are listed in the help text for the relevant options.
References undocumented_msg.
|
static |
Display help for a specified type of option. The options must have ALL of the INCLUDE_FLAGS set ANY of the flags in the ANY_FLAGS set and NONE of the EXCLUDE_FLAGS set. The current option state is in OPTS; LANG_MASK is used for interpreting enumerated option state.
Sanity check: Make sure that we do not have more languages than we have bits available to enumerate them.
If we have not done so already, obtain the desired maximum width of the output.
Use a reasonable default.
Decide upon the title for the options that we are going to display.
|
static |
Handle a debug output -g switch for options OPTS (OPTS_SET->x_write_symbols storing whether a debug type was passed explicitly), location LOC. EXTENDED is true or false to support extended output (2 is special and means "-ggdb" was given).
Does it conflict with an already selected type?
A debug flag without a level defaults to level 2.
|
static |
|
static |
The following routines are useful in setting all the flags that -ffast-math and -fno-fast-math imply.
void set_struct_debug_option | ( | struct gcc_options * | opts, |
location_t | loc, | ||
const char * | spec | ||
) |
various labels for comparison
Default is to apply to as much as possible.
What usage?
Generics or not?
What allowable environment?
Effect the specification.
No more -femit-struct-debug-detailed specifications. Do final checks.
|
static |
|
static |
When -funsafe-math-optimizations is set the following flags are set as well.
|
static |
@verbatim
Command line option handling. Copyright (C) 2002-2013 Free Software Foundation, Inc. Contributed by Neil Booth.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.
|
static |
Used to set the level of strict aliasing warnings in OPTS, when no level is specified (i.e., when -Wstrict-aliasing, and not -Wstrict-aliasing=level was given). ONOFF is assumed to take value 1 when -Wstrict-aliasing is specified, and 0 otherwise. After calling this function, wstrict_aliasing will be set to the default value of -Wstrict_aliasing=level, currently 3.
References DINFO_LEVEL_NORMAL.
|
static |
Arrange to dump core on error for diagnostic context DC. (The regular error message is still printed first, except in the case of abort ().)
References cl_options, and diagnostic_context::warning_as_error_requested.
void strip_off_ending | ( | ) |
Strip off a legitimate source ending from the input string NAME of length LEN. Rather than having to know the names used by all of our front ends, we strip off an ending of a period followed by up to five characters. (Java uses ".class".)
bool target_handle_option | ( | struct gcc_options * | opts, |
struct gcc_options * | opts_set, | ||
const struct cl_decoded_option * | decoded, | ||
unsigned int | lang_mask, | ||
int | kind, | ||
location_t | loc, | ||
const struct cl_option_handlers * | handlers, | ||
diagnostic_context * | dc | ||
) |
Handle a back-end option; arguments and return value as for handle_option.
References vec_check_alloc().
|
static |
Output ITEM, of length ITEM_WIDTH, in the left column, followed by word-wrapped HELP in a second column.
References compiler_params, param_info::help, LAST_PARAM, param_info::option, strlen(), and undocumented_msg.
const char* const debug_type_names[] |
Indexed by enum debug_info_type.
Referenced by handle_param().
|
static |
Table of options enabled by default at different levels.
|
static |
What to print when a switch has no documentation.
Referenced by print_filtered_help(), and wrap_help().