PREV UP NEXT Using and Porting GNU CC

16.2: Run-time Target Specification

CPP_PREDEFINES
Define this to be a string constant containing `-D' options to define the predefined macros that identify this machine and system. These macros will be predefined unless the `-ansi' option is specified.

In addition, a parallel set of macros are predefined, whose names are made by appending `__' at the beginning and at the end. These `__' macros are permitted by the ANSI standard, so they are predefined regardless of whether `-ansi' is specified.

For example, on the Sun, one can use the following value:

"-Dmc68000 -Dsun -Dunix"

The result is to define the macros __mc68000__, __sun__ and __unix__ unconditionally, and the macros mc68000, sun and unix provided `-ansi' is not specified.

STDC_VALUE
Define the value to be assigned to the built-in macro __STDC__. The default is the value `1'.
extern int target_flags;
This declaration should be present.
TARGET_...
This series of macros is to allow compiler command arguments to enable or disable the use of optional features of the target machine. For example, one machine description serves both the 68000 and the 68020; a command argument tells the compiler whether it should use 68020-only instructions or not. This command argument works by means of a macro TARGET_68020 that tests a bit in target_flags.

Define a macro TARGET_featurename for each such option. Its definition should test a bit in target_flags; for example:

#define TARGET_68020 (target_flags & 1)

One place where these macros are used is in the condition-expressions of instruction patterns. Note how TARGET_68020 appears frequently in the 68000 machine description file, `m68k.md'. Another place they are used is in the definitions of the other macros in the `machine.h' file.

TARGET_SWITCHES
This macro defines names of command options to set and clear bits in target_flags. Its definition is an initializer with a subgrouping for each command option.

Each subgrouping contains a string constant, that defines the option name, and a number, which contains the bits to set in target_flags. A negative number says to clear bits instead; the negative of the number is which bits to clear. The actual option name is made by appending `-m' to the specified name.

One of the subgroupings should have a null string. The number in this grouping is the default value for target_flags. Any target options act starting with that value.

Here is an example which defines `-m68000' and `-m68020' with opposite meanings, and picks the latter as the default:

#define TARGET_SWITCHES \
  { { "68020", 1},      \
    { "68000", -1},     \
    { "", 1}}
TARGET_OPTIONS
This macro is similar to TARGET_SWITCHES but defines names of command options that have values. Its definition is an initializer with a subgrouping for each command option.

Each subgrouping contains a string constant, that defines the fixed part of the option name, and the address of a variable. The variable, type char *, is set to the variable part of the given option if the fixed part matches. The actual option name is made by appending `-m' to the specified name.

Here is an example which defines `-mshort-data-number'. If the given option is `-mshort-data-512', the variable m88k_short_data will be set to the string "512".

extern char *m88k_short_data;
#define TARGET_OPTIONS \
 { { "short-data-", &m88k_short_data } }
TARGET_VERSION
This macro is a C statement to print on stderr a 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
OVERRIDE_OPTIONS
Sometimes certain combinations of command options do not make sense on a particular target machine. You can define a macro OVERRIDE_OPTIONS to 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 OPTIMIZATION_OPTIONS is for.

OPTIMIZATION_OPTIONS (level)
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.

You should not use this macro to change options that are not machine-specific. These should uniformly selected by the same optimization level on all supported machines. Use this macro to enable machbine-specific optimizations.

Do not examine write_symbols in this macro! The debugging options are not supposed to alter the generated code.

CAN_DEBUG_WITHOUT_FP
Define this macro if debugging can be performed even without a frame pointer. If this macro is defined, GNU CC will turn on the `-fomit-frame-pointer' option whenever `-O' is specified.