Here are run-time target specifications.
This function-like macro expands to a block of code that defines built-in preprocessor macros and assertions for the target CPU, using the functions
builtin_assert. When the front end calls this macro it provides a trailing semicolon, and since it has finished command line option processing your code can use those results freely.
builtin_asserttakes a string in the form you pass to the command-line option -A, such as
cpu=mips, and creates the assertion.
builtin_definetakes a string in the form accepted by option -D and unconditionally defines the macro.
builtin_define_stdtakes a string representing the name of an object-like macro. If it doesn't lie in the user's namespace,
builtin_define_stddefines it unconditionally. Otherwise, it defines a version with two leading underscores, and another version with two leading and trailing underscores, and defines the original only if an ISO standard was not requested on the command line. For example, passing
_mips, and passing
You can also test for the C dialect being compiled. The variable
c_languageis set to one of
clk_objective_c. Note that if we are preprocessing assembler, this variable will be
clk_cbut the function-like macro
preprocessing_asm_p()will return true, so you might want to check for that first. If you need to check for strict ANSI, the variable
flag_isocan be used. The function-like macro
preprocessing_trad_p()can be used to check for traditional preprocessing.
TARGET_CPU_CPP_BUILTINSbut this macro is optional and is used for the target operating system instead.
TARGET_CPU_CPP_BUILTINSbut this macro is optional and is used for the target object format. elfos.h uses this macro to define
__ELF__, so you probably do not need to define it yourself.
This variable is declared in options.h, which is included before any target-specific headers.
This variable specifies the initial value of
target_flags. Its default setting is 0.
This hook is called whenever the user specifies one of the target-specific options described by the .opt definition files (see Options). It has the opportunity to do some option-specific processing and should return true if the option is valid. The default definition does nothing but return true.
code specifies the
OPT_name enumeration value associated with the selected option; name is just a rendering of the option name in which non-alphanumeric characters are replaced by underscores. arg specifies the string argument and is null if no argument was given. If the option is flagged as a
UInteger(see Option properties), value is the numeric value of the argument. Otherwise value is 1 if the positive form of the option was used and 0 if the “no-” form was.
This target hook is called whenever the user specifies one of the target-specific C language family options described by the .opt definition files(see Options). It has the opportunity to do some option-specific processing and should return true if the option is valid. The default definition does nothing but return false.
In general, you should use
TARGET_HANDLE_OPTIONto handle options. However, if processing an option requires routines that are only available in the C (and related language) front ends, then you should use
This macro is a C statement to print on
stderra string describing the particular machine description choice. Every machine description should define
TARGET_VERSION. For example:#ifdef MOTOROLA #define TARGET_VERSION \ fprintf (stderr, " (68k, Motorola syntax)"); #else #define TARGET_VERSION \ fprintf (stderr, " (68k, MIT syntax)"); #endif
Sometimes certain combinations of command options do not make sense on a particular target machine. You can define a macro
OVERRIDE_OPTIONSto take account of this. This macro, if defined, is executed once just after all the command options have been parsed.
Don't use this macro to turn on various extra optimizations for -O. That is what
This is similar to
OVERRIDE_OPTIONSbut is only used in the C language frontends (C, Objective-C, C++, Objective-C++) and so can be used to alter option flag variables which only exist in those frontends.
Some machines may desire to change what optimizations are performed for various optimization levels. This macro, if defined, is executed once just after the optimization level is determined and before the remainder of the command options have been parsed. Values set in this macro are used as the default values for the other command line options.
level is the optimization level specified; 2 if -O2 is specified, 1 if -O is specified, and 0 if neither is specified.
size is nonzero if -Os is specified and zero otherwise.
This macro is run once at program startup and when the optimization options are changed via
#pragma GCC optimizeor by using the
Do not examine
write_symbolsin this macro! The debugging options are not supposed to alter the generated code.
This hook is called in response to the user invoking --target-help on the command line. It gives the target a chance to display extra information on the target specific command line options found in its .opt file.