gccint: Run-time Target

1 
1 18.3 Run-time Target Specification
1 ==================================
1 
1 Here are run-time target specifications.
1 
1  -- Macro: TARGET_CPU_CPP_BUILTINS ()
1      This function-like macro expands to a block of code that defines
1      built-in preprocessor macros and assertions for the target CPU,
1      using the functions 'builtin_define', 'builtin_define_std' and
1      'builtin_assert'.  When the front end calls this macro it provides
1      a trailing semicolon, and since it has finished command line option
1      processing your code can use those results freely.
1 
1      'builtin_assert' takes a string in the form you pass to the
1      command-line option '-A', such as 'cpu=mips', and creates the
1      assertion.  'builtin_define' takes a string in the form accepted by
1      option '-D' and unconditionally defines the macro.
1 
1      'builtin_define_std' takes a string representing the name of an
1      object-like macro.  If it doesn't lie in the user's namespace,
1      'builtin_define_std' defines it unconditionally.  Otherwise, it
1      defines a version with two leading underscores, and another version
1      with two leading and trailing underscores, and defines the original
1      only if an ISO standard was not requested on the command line.  For
1      example, passing 'unix' defines '__unix', '__unix__' and possibly
1      'unix'; passing '_mips' defines '__mips', '__mips__' and possibly
1      '_mips', and passing '_ABI64' defines only '_ABI64'.
1 
1      You can also test for the C dialect being compiled.  The variable
1      'c_language' is set to one of 'clk_c', 'clk_cplusplus' or
1      'clk_objective_c'.  Note that if we are preprocessing assembler,
1      this variable will be 'clk_c' but the function-like macro
1      'preprocessing_asm_p()' will return true, so you might want to
1      check for that first.  If you need to check for strict ANSI, the
1      variable 'flag_iso' can be used.  The function-like macro
1      'preprocessing_trad_p()' can be used to check for traditional
1      preprocessing.
1 
1  -- Macro: TARGET_OS_CPP_BUILTINS ()
1      Similarly to 'TARGET_CPU_CPP_BUILTINS' but this macro is optional
1      and is used for the target operating system instead.
1 
1  -- Macro: TARGET_OBJFMT_CPP_BUILTINS ()
1      Similarly to 'TARGET_CPU_CPP_BUILTINS' but this macro is optional
1      and is used for the target object format.  'elfos.h' uses this
1      macro to define '__ELF__', so you probably do not need to define it
1      yourself.
1 
1  -- Variable: extern int target_flags
1      This variable is declared in 'options.h', which is included before
1      any target-specific headers.
1 
1  -- Common Target Hook: int TARGET_DEFAULT_TARGET_FLAGS
1      This variable specifies the initial value of 'target_flags'.  Its
1      default setting is 0.
1 
1  -- Common Target Hook: bool TARGET_HANDLE_OPTION (struct gcc_options
1           *OPTS, struct gcc_options *OPTS_SET, const struct
1           cl_decoded_option *DECODED, location_t LOC)
1      This hook is called whenever the user specifies one of the
1      target-specific options described by the '.opt' definition files
1      (⇒Options).  It has the opportunity to do some
1      option-specific processing and should return true if the option is
1      valid.  The default definition does nothing but return true.
1 
1      DECODED specifies the option and its arguments.  OPTS and OPTS_SET
1      are the 'gcc_options' structures to be used for storing option
1      state, and LOC is the location at which the option was passed
1      ('UNKNOWN_LOCATION' except for options passed via attributes).
1 
1  -- C Target Hook: bool TARGET_HANDLE_C_OPTION (size_t CODE, const char
1           *ARG, int VALUE)
1      This target hook is called whenever the user specifies one of the
1      target-specific C language family options described by the '.opt'
1      definition files(⇒Options).  It has the opportunity to do
1      some option-specific processing and should return true if the
1      option is valid.  The arguments are like for
1      'TARGET_HANDLE_OPTION'.  The default definition does nothing but
1      return false.
1 
1      In general, you should use 'TARGET_HANDLE_OPTION' to handle
1      options.  However, if processing an option requires routines that
1      are only available in the C (and related language) front ends, then
1      you should use 'TARGET_HANDLE_C_OPTION' instead.
1 
1  -- C Target Hook: tree TARGET_OBJC_CONSTRUCT_STRING_OBJECT (tree
1           STRING)
1      Targets may provide a string object type that can be used within
1      and between C, C++ and their respective Objective-C dialects.  A
1      string object might, for example, embed encoding and length
1      information.  These objects are considered opaque to the compiler
1      and handled as references.  An ideal implementation makes the
1      composition of the string object match that of the Objective-C
1      'NSString' ('NXString' for GNUStep), allowing efficient
1      interworking between C-only and Objective-C code.  If a target
1      implements string objects then this hook should return a reference
1      to such an object constructed from the normal 'C' string
1      representation provided in STRING.  At present, the hook is used by
1      Objective-C only, to obtain a common-format string object when the
1      target provides one.
1 
1  -- C Target Hook: void TARGET_OBJC_DECLARE_UNRESOLVED_CLASS_REFERENCE
1           (const char *CLASSNAME)
1      Declare that Objective C class CLASSNAME is referenced by the
1      current TU.
1 
1  -- C Target Hook: void TARGET_OBJC_DECLARE_CLASS_DEFINITION (const char
1           *CLASSNAME)
1      Declare that Objective C class CLASSNAME is defined by the current
1      TU.
1 
1  -- C Target Hook: bool TARGET_STRING_OBJECT_REF_TYPE_P (const_tree
1           STRINGREF)
1      If a target implements string objects then this hook should return
1      'true' if STRINGREF is a valid reference to such an object.
1 
1  -- C Target Hook: void TARGET_CHECK_STRING_OBJECT_FORMAT_ARG (tree
1           FORMAT_ARG, tree ARGS_LIST)
1      If a target implements string objects then this hook should should
1      provide a facility to check the function arguments in ARGS_LIST
1      against the format specifiers in FORMAT_ARG where the type of
1      FORMAT_ARG is one recognized as a valid string reference type.
1 
1  -- Target Hook: void TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE (void)
1      This target function is similar to the hook
1      'TARGET_OPTION_OVERRIDE' but is called when the optimize level is
1      changed via an attribute or pragma or when it is reset at the end
1      of the code affected by the attribute or pragma.  It is not called
1      at the beginning of compilation when 'TARGET_OPTION_OVERRIDE' is
1      called so if you want to perform these actions then, you should
1      have 'TARGET_OPTION_OVERRIDE' call
1      'TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE'.
1 
1  -- Macro: C_COMMON_OVERRIDE_OPTIONS
1      This is similar to the 'TARGET_OPTION_OVERRIDE' hook but is only
1      used in the C language frontends (C, Objective-C, C++,
1      Objective-C++) and so can be used to alter option flag variables
1      which only exist in those frontends.
1 
1  -- Common Target Hook: const struct default_options *
1           TARGET_OPTION_OPTIMIZATION_TABLE
1      Some machines may desire to change what optimizations are performed
1      for various optimization levels.  This variable, if defined,
1      describes options to enable at particular sets of optimization
1      levels.  These options are processed once just after the
1      optimization level is determined and before the remainder of the
1      command options have been parsed, so may be overridden by other
1      options passed explicitly.
1 
1      This processing is run once at program startup and when the
1      optimization options are changed via '#pragma GCC optimize' or by
1      using the 'optimize' attribute.
1 
1  -- Common Target Hook: void TARGET_OPTION_INIT_STRUCT (struct
1           gcc_options *OPTS)
1      Set target-dependent initial values of fields in OPTS.
1 
1  -- Common Target Hook: void TARGET_OPTION_DEFAULT_PARAMS (void)
1      Set target-dependent default values for '--param' settings, using
1      calls to 'set_default_param_value'.
1 
1  -- Macro: SWITCHABLE_TARGET
1      Some targets need to switch between substantially different
1      subtargets during compilation.  For example, the MIPS target has
1      one subtarget for the traditional MIPS architecture and another for
1      MIPS16.  Source code can switch between these two subarchitectures
1      using the 'mips16' and 'nomips16' attributes.
1 
1      Such subtargets can differ in things like the set of available
1      registers, the set of available instructions, the costs of various
1      operations, and so on.  GCC caches a lot of this type of
1      information in global variables, and recomputing them for each
1      subtarget takes a significant amount of time.  The compiler
1      therefore provides a facility for maintaining several versions of
1      the global variables and quickly switching between them; see
1      'target-globals.h' for details.
1 
1      Define this macro to 1 if your target needs this facility.  The
1      default is 0.
1 
1  -- Target Hook: bool TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
1           (void)
1      Returns true if the target supports IEEE 754 floating-point
1      exceptions and rounding modes, false otherwise.  This is intended
1      to relate to the 'float' and 'double' types, but not necessarily
1      'long double'.  By default, returns true if the 'adddf3'
1      instruction pattern is available and false otherwise, on the
1      assumption that hardware floating point supports exceptions and
1      rounding modes but software floating point does not.
1