GCC Middle and Back End API Reference
|
Go to the source code of this file.
Data Structures | |
struct | cl_option |
struct | cl_option_state |
struct | cl_enum_arg |
struct | cl_enum |
struct | cl_decoded_option |
struct | cl_deferred_option |
struct | cl_option_handler_func |
struct | cl_option_handlers |
Enumerations | |
enum | cl_var_type { CLVC_BOOLEAN, CLVC_EQUAL, CLVC_BIT_CLEAR, CLVC_BIT_SET, CLVC_STRING, CLVC_ENUM, CLVC_DEFER } |
Functions | |
char * | opts_concat (const char *first,...) |
size_t | find_opt (const char *input, unsigned int lang_mask) |
int | integral_argument (const char *arg) |
bool | enum_value_to_arg (const struct cl_enum_arg *enum_args, const char **argp, int value, unsigned int lang_mask) |
void | decode_cmdline_options_to_array (unsigned int argc, const char **argv, unsigned int lang_mask, struct cl_decoded_option **decoded_options, unsigned int *decoded_options_count) |
void | init_options_once (void) |
void | init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set) |
void | decode_cmdline_options_to_array_default_mask (unsigned int argc, const char **argv, struct cl_decoded_option **decoded_options, unsigned int *decoded_options_count) |
void | set_default_handlers (struct cl_option_handlers *handlers) |
void | decode_options (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded_options, unsigned int decoded_options_count, location_t loc, diagnostic_context *dc) |
int | option_enabled (int opt_idx, void *opts) |
bool | get_option_state (struct gcc_options *, int, struct cl_option_state *) |
void | set_option (struct gcc_options *opts, struct gcc_options *opts_set, int opt_index, int value, const char *arg, int kind, location_t loc, diagnostic_context *dc) |
void * | option_flag_var (int opt_index, struct gcc_options *opts) |
bool | handle_generated_option (struct gcc_options *opts, struct gcc_options *opts_set, size_t opt_index, const char *arg, int value, unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc) |
void | generate_option (size_t opt_index, const char *arg, int value, unsigned int lang_mask, struct cl_decoded_option *decoded) |
void | generate_option_input_file (const char *file, struct cl_decoded_option *decoded) |
void | read_cmdline_option (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded, location_t loc, unsigned int lang_mask, const struct cl_option_handlers *handlers, diagnostic_context *dc) |
void | control_warning_option (unsigned int opt_index, int kind, bool imply, location_t loc, unsigned int lang_mask, const struct cl_option_handlers *handlers, struct gcc_options *opts, struct gcc_options *opts_set, diagnostic_context *dc) |
void | print_ignored_options (void) |
void | handle_common_deferred_options (void) |
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) |
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) |
void | finish_options (struct gcc_options *opts, struct gcc_options *opts_set, location_t loc) |
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 | set_struct_debug_option (struct gcc_options *opts, location_t loc, const char *value) |
bool | opt_enum_arg_to_value (size_t opt_index, const char *arg, int *value, unsigned int lang_mask) |
Variables | |
struct cl_option | cl_options [] |
const unsigned int | cl_options_count |
const char *const | lang_names [] |
const unsigned int | cl_lang_count |
struct cl_enum | cl_enums [] |
const unsigned int | cl_enums_count |
const char ** | in_fnames |
unsigned | num_in_fnames |
struct obstack | opts_obstack |
enum cl_var_type |
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.
References add_comma_separated_to_vector(), cl_decoded_option::arg, cl_decoded_option::canonical_option_num_elements, cl_lang_count, colorize_init(), control_warning_option(), DBX_DEBUG, diagnostic_context::dc_inhibit_warnings, diagnostic_context::dc_warn_system_headers, decode_d_option(), diagnostic_set_caret_max_width(), DWARF2_DEBUG, enable_warning_as_error(), error_at(), diagnostic_context::fatal_errors, free(), FULL_BUILTIN_STACK_CHECK, GENERIC_STACK_CHECK, handle_param(), lang_names, len, diagnostic_context::max_errors, NO_DEBUG, NO_STACK_CHECK, cl_decoded_option::opt_index, option_flag_var(), diagnostic_context::pedantic_errors, pflags, pp_set_line_maximum_length(), print_specific_help(), diagnostic_context::printer, SDB_DEBUG, set_debug_level(), set_fast_math_flags(), set_param_value(), set_unsafe_math_optimizations_flags(), set_Wstrict_aliasing(), diagnostic_context::show_caret, diagnostic_context::show_column, diagnostic_context::show_option_requested, STATIC_BUILTIN_STACK_CHECK, strip_off_ending(), strlen(), cl_decoded_option::value, VMS_DEBUG, WARN_STRICT_OVERFLOW_CONDITIONAL, diagnostic_context::warning_as_error_requested, warning_at(), and XCOFF_DEBUG.
Referenced by set_default_handlers(), and set_option_handlers().
void control_warning_option | ( | unsigned int | opt_index, |
int | kind, | ||
bool | imply, | ||
location_t | loc, | ||
unsigned int | lang_mask, | ||
const struct cl_option_handlers * | handlers, | ||
struct gcc_options * | opts, | ||
struct gcc_options * | opts_set, | ||
diagnostic_context * | dc | ||
) |
Set a warning option OPT_INDEX (language mask LANG_MASK, option handlers HANDLERS) to have diagnostic kind KIND for option structures OPTS and OPTS_SET and diagnostic context DC (possibly NULL), at location LOC (UNKNOWN_LOCATION for -Werror=). If IMPLY, the warning option in question is implied at this point. This is used by -Werror= and #pragma GCC diagnostic.
References cl_option::alias_target, cl_options, CLVC_BOOLEAN, diagnostic_classify_diagnostic(), and handle_generated_option().
Referenced by common_handle_option(), and enable_warning_as_error().
void decode_cmdline_options_to_array | ( | unsigned int | argc, |
const char ** | argv, | ||
unsigned int | lang_mask, | ||
struct cl_decoded_option ** | decoded_options, | ||
unsigned int * | decoded_options_count | ||
) |
Decode command-line options (ARGC and ARGV being the arguments of main) into an array, setting *DECODED_OPTIONS to a pointer to that array and *DECODED_OPTIONS_COUNT to the number of entries in the array. The first entry in the array is always one for the program name (OPT_SPECIAL_program_name). LANG_MASK indicates the language flags applicable for decoding (including CL_COMMON and CL_TARGET if those options should be considered applicable). Do not produce any diagnostics or set state outside of these variables.
References cl_decoded_option::arg, cl_decoded_option::canonical_option, cl_decoded_option::canonical_option_num_elements, decode_cmdline_option(), cl_decoded_option::errors, generate_option_input_file(), cl_decoded_option::opt_index, cl_decoded_option::orig_option_with_args_text, prune_options(), cl_decoded_option::value, and cl_decoded_option::warn_message.
Referenced by decode_cmdline_options_to_array_default_mask(), do_self_spec(), get_options_from_collect_gcc_options(), and main().
void decode_cmdline_options_to_array_default_mask | ( | unsigned int | argc, |
const char ** | argv, | ||
struct cl_decoded_option ** | decoded_options, | ||
unsigned int * | decoded_options_count | ||
) |
Decode command-line options to an array, like decode_cmdline_options_to_array and with the same arguments but using the default lang_mask.
References decode_cmdline_options_to_array(), and initial_lang_mask.
Referenced by toplev_main().
void decode_options | ( | struct gcc_options * | opts, |
struct gcc_options * | opts_set, | ||
struct cl_decoded_option * | decoded_options, | ||
unsigned int | decoded_options_count, | ||
location_t | loc, | ||
diagnostic_context * | dc | ||
) |
Parse command line options and set default flag values. Do minimal options processing. The decoded options are in *DECODED_OPTIONS and *DECODED_OPTIONS_COUNT; settings go in OPTS, OPTS_SET and DC; the options are located at LOC.
References default_options_optimization(), finish_options(), initial_lang_mask, read_cmdline_options(), and set_default_handlers().
Referenced by toplev_main().
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.
References cl_decoded_option::arg, default_options_table, default_param_value(), error_at(), integral_argument(), maybe_default_options(), maybe_set_param_value(), and cl_decoded_option::opt_index.
Referenced by decode_options().
bool enum_value_to_arg | ( | const struct cl_enum_arg * | enum_args, |
const char ** | argp, | ||
int | value, | ||
unsigned int | lang_mask | ||
) |
Look of VALUE in ENUM_ARGS for language LANG_MASK and store the corresponding string in *ARGP, returning true if the found string was marked as canonical, false otherwise. If VALUE is not found (which may be the case for uninitialized values if the relevant option has not been passed), set *ARGP to NULL and return false.
References cl_enum_arg::arg, enum_arg_ok_for_language(), and cl_option::flags.
Referenced by decode_cmdline_option(), and print_filtered_help().
size_t find_opt | ( | const char * | input, |
unsigned int | lang_mask | ||
) |
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.
References base_of_path(), error_at(), inform(), maybe_set_param_value(), memcpy(), opts_concat(), opts_obstack, sorry(), strlen(), UI_SJLJ, and UI_TARGET.
Referenced by decode_options().
void generate_option | ( | size_t | opt_index, |
const char * | arg, | ||
int | value, | ||
unsigned int | lang_mask, | ||
struct cl_decoded_option * | decoded | ||
) |
Fill in *DECODED with an option described by OPT_INDEX, ARG and VALUE for a front end using LANG_MASK. This is used when the compiler generates options internally.
References cl_decoded_option::arg, cl_decoded_option::canonical_option, cl_decoded_option::canonical_option_num_elements, cl_options, cl_decoded_option::errors, generate_canonical_option(), cl_decoded_option::opt_index, option(), option_ok_for_language(), opts_concat(), cl_decoded_option::orig_option_with_args_text, cl_decoded_option::value, and cl_decoded_option::warn_message.
Referenced by handle_generated_option().
void generate_option_input_file | ( | const char * | file, |
struct cl_decoded_option * | decoded | ||
) |
Fill in *DECODED with an option for input file FILE.
References cl_decoded_option::arg, cl_decoded_option::canonical_option, cl_decoded_option::canonical_option_num_elements, cl_decoded_option::errors, cl_decoded_option::opt_index, cl_decoded_option::orig_option_with_args_text, cl_decoded_option::value, and cl_decoded_option::warn_message.
Referenced by decode_cmdline_options_to_array().
bool get_option_state | ( | struct gcc_options * | opts, |
int | option, | ||
struct cl_option_state * | state | ||
) |
Fill STATE with the current state of option OPTION in OPTS. Return true if there is some state to store.
References cl_option_state::ch, cl_enums, cl_option::cl_host_wide_int, cl_options, CLVC_BIT_CLEAR, CLVC_BIT_SET, CLVC_BOOLEAN, CLVC_DEFER, CLVC_ENUM, CLVC_EQUAL, CLVC_STRING, cl_option_state::data, HOST_WIDE_INT, option(), option_enabled(), option_flag_var(), cl_option_state::size, strlen(), cl_option::var_enum, and cl_enum::var_size.
Referenced by option_affects_pch_p().
void handle_common_deferred_options | ( | void | ) |
Process common options that have been deferred until after the handlers have been called for all options.
References add_debug_prefix_map(), add_new_plugin(), cl_deferred_option::arg, dbg_cnt_list_all_counters(), dbg_cnt_process_opt(), decode_reg_name(), disable_pass(), dump_remap_tree_vectorizer_verbose(), dump_switch_p(), enable_pass(), enable_rtl_dump_file(), error(), fix_register(), gen_rtx_REG(), cl_deferred_option::opt_index, opt_info_switch_p(), parse_plugin_arg_opt(), set_random_seed(), stack_limit_rtx, cl_deferred_option::value, and vNULL.
Referenced by toplev_main().
bool handle_generated_option | ( | struct gcc_options * | opts, |
struct gcc_options * | opts_set, | ||
size_t | opt_index, | ||
const char * | arg, | ||
int | value, | ||
unsigned int | lang_mask, | ||
int | kind, | ||
location_t | loc, | ||
const struct cl_option_handlers * | handlers, | ||
diagnostic_context * | dc | ||
) |
Like handle_option, but OPT_INDEX, ARG and VALUE describe the option instead of DECODED. This is used for callbacks when one option implies another instead of an option being decoded from the command line.
References generate_option(), and handle_option().
Referenced by control_warning_option(), and maybe_default_option().
void init_options_once | ( | void | ) |
Initialize global options-related settings at start-up.
References global_dc, initial_lang_mask, lang_hooks::initialize_diagnostics, and lang_hooks::option_lang_mask.
Referenced by toplev_main().
void init_options_struct | ( | struct gcc_options * | opts, |
struct gcc_options * | opts_set | ||
) |
int integral_argument | ( | const char * | arg | ) |
bool opt_enum_arg_to_value | ( | size_t | opt_index, |
const char * | arg, | ||
int * | value, | ||
unsigned int | lang_mask | ||
) |
Look up ARG in the enum used by option OPT_INDEX for language LANG_MASK, returning true and storing the value in *VALUE if found, and returning false without modifying *VALUE if not found.
References cl_enums, cl_options, CLVC_ENUM, enum_arg_to_value(), option(), cl_enum::values, cl_option::var_enum, and cl_option::var_type.
int option_enabled | ( | int | opt_idx, |
void * | opts | ||
) |
void* option_flag_var | ( | int | opt_index, |
struct gcc_options * | opts | ||
) |
char* opts_concat | ( | const char * | first, |
... | |||
) |
void print_ignored_options | ( | void | ) |
Produce a warning for each option previously buffered.
References warning_at().
Referenced by toplev_main().
void read_cmdline_option | ( | struct gcc_options * | opts, |
struct gcc_options * | opts_set, | ||
struct cl_decoded_option * | decoded, | ||
location_t | loc, | ||
unsigned int | lang_mask, | ||
const struct cl_option_handlers * | handlers, | ||
diagnostic_context * | dc | ||
) |
Handle the switch DECODED (location LOC) for the language indicated by LANG_MASK, using the handlers in *HANDLERS and setting fields in OPTS and OPTS_SET and using diagnostic context DC (if not NULL) for diagnostic options.
References cl_enum_arg::arg, cl_decoded_option::arg, cl_enums, cl_options, error_at(), cl_decoded_option::errors, handle_option(), inform(), len, memcpy(), cl_option::missing_argument_error, cl_decoded_option::opt_index, cl_option::opt_text, option(), cl_decoded_option::orig_option_with_args_text, strlen(), cl_enum::unknown_error, cl_option_handlers::unknown_option_callback, cl_enum::values, cl_option::var_enum, cl_decoded_option::warn_message, warning_at(), and cl_option_handlers::wrong_lang_callback.
Referenced by do_self_spec(), process_command(), and read_cmdline_options().
void set_default_handlers | ( | struct cl_option_handlers * | handlers | ) |
void set_option | ( | struct gcc_options * | opts, |
struct gcc_options * | opts_set, | ||
int | opt_index, | ||
int | value, | ||
const char * | arg, | ||
int | kind, | ||
location_t | loc, | ||
diagnostic_context * | dc | ||
) |
Set any field in OPTS, and OPTS_SET if not NULL, for option OPT_INDEX according to VALUE and ARG, diagnostic kind KIND, location LOC, using diagnostic context DC if not NULL for diagnostic classification.
References cl_enums, cl_option::cl_host_wide_int, cl_options, CLVC_BIT_CLEAR, CLVC_BIT_SET, CLVC_BOOLEAN, CLVC_DEFER, CLVC_ENUM, CLVC_EQUAL, CLVC_STRING, diagnostic_classify_diagnostic(), HOST_WIDE_INT, option(), option_flag_var(), cl_enum::set, cl_option::var_enum, cl_option::var_type, and cl_option::var_value.
Referenced by handle_option().
void set_struct_debug_option | ( | struct gcc_options * | opts, |
location_t | loc, | ||
const char * | value | ||
) |
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 global_dc.
Referenced by set_default_handlers(), and set_option_handlers().
struct cl_enum cl_enums[] |
const unsigned int cl_enums_count |
Referenced by print_filtered_help().
const unsigned int cl_lang_count |
Referenced by common_handle_option(), complain_wrong_lang(), print_filtered_help(), and print_specific_help().
struct cl_option cl_options[] |
Referenced by cancel_option(), complain_wrong_lang(), control_warning_option(), decode_cmdline_option(), default_pch_valid_p(), driver_wrong_lang_callback(), find_opt(), gen_producer_string(), generate_canonical_option(), generate_option(), get_option_state(), handle_option(), lto_write_options(), maybe_default_option(), merge_and_complain(), opt_enum_arg_to_value(), option_affects_pch_p(), option_enabled(), option_flag_var(), option_name(), print_filtered_help(), print_switch_values(), prune_options(), read_cmdline_option(), run_gcc(), and set_option().
const unsigned int cl_options_count |
Referenced by default_get_pch_validity(), default_pch_valid_p(), find_opt(), print_filtered_help(), print_switch_values(), and prune_options().
const char** in_fnames |
Input file names.
Referenced by add_input_filename().
const char* const lang_names[] |
Referenced by common_handle_option(), print_filtered_help(), print_specific_help(), and write_langs().
unsigned num_in_fnames |
The count of input filenames.
Referenced by add_input_filename().
struct obstack opts_obstack |
Obstack for option strings.
Referenced by decode_cmdline_option(), finish_options(), generate_canonical_option(), init_options_struct(), main(), and opts_concat().