@c Copyright (C) 1988-2022 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @node Target Macros @chapter Target Description Macros and Functions @cindex machine description macros @cindex target description macros @cindex macros, target description @cindex @file{tm.h} macros In addition to the file @file{@var{machine}.md}, a machine description includes a C header file conventionally given the name @file{@var{machine}.h} and a C source file named @file{@var{machine}.c}. The header file defines numerous macros that convey the information about the target machine that does not fit into the scheme of the @file{.md} file. The file @file{tm.h} should be a link to @file{@var{machine}.h}. The header file @file{config.h} includes @file{tm.h} and most compiler source files include @file{config.h}. The source file defines a variable @code{targetm}, which is a structure containing pointers to functions and data relating to the target machine. @file{@var{machine}.c} should also contain their definitions, if they are not defined elsewhere in GCC, and other functions called through the macros defined in the @file{.h} file. @menu * Target Structure:: The @code{targetm} variable. * Driver:: Controlling how the driver runs the compilation passes. * Run-time Target:: Defining @samp{-m} options like @option{-m68000} and @option{-m68020}. * Per-Function Data:: Defining data structures for per-function information. * Storage Layout:: Defining sizes and alignments of data. * Type Layout:: Defining sizes and properties of basic user data types. * Registers:: Naming and describing the hardware registers. * Register Classes:: Defining the classes of hardware registers. * Stack and Calling:: Defining which way the stack grows and by how much. * Varargs:: Defining the varargs macros. * Trampolines:: Code set up at run time to enter a nested function. * Library Calls:: Controlling how library routines are implicitly called. * Addressing Modes:: Defining addressing modes valid for memory operands. * Anchored Addresses:: Defining how @option{-fsection-anchors} should work. * Condition Code:: Defining how insns update the condition code. * Costs:: Defining relative costs of different operations. * Scheduling:: Adjusting the behavior of the instruction scheduler. * Sections:: Dividing storage into text, data, and other sections. * PIC:: Macros for position independent code. * Assembler Format:: Defining how to write insns and pseudo-ops to output. * Debugging Info:: Defining the format of debugging output. * Floating Point:: Handling floating point for cross-compilers. * Mode Switching:: Insertion of mode-switching instructions. * Target Attributes:: Defining target-specific uses of @code{__attribute__}. * Emulated TLS:: Emulated TLS support. * MIPS Coprocessors:: MIPS coprocessor support and how to customize it. * PCH Target:: Validity checking for precompiled headers. * C++ ABI:: Controlling C++ ABI changes. * D Language and ABI:: Controlling D ABI changes. * Named Address Spaces:: Adding support for named address spaces * Misc:: Everything else. @end menu @node Target Structure @section The Global @code{targetm} Variable @cindex target hooks @cindex target functions @deftypevar {struct gcc_target} targetm The target @file{.c} file must define the global @code{targetm} variable which contains pointers to functions and data relating to the target machine. The variable is declared in @file{target.h}; @file{target-def.h} defines the macro @code{TARGET_INITIALIZER} which is used to initialize the variable, and macros for the default initializers for elements of the structure. The @file{.c} file should override those macros for which the default definition is inappropriate. For example: @smallexample #include "target.h" #include "target-def.h" /* @r{Initialize the GCC target structure.} */ #undef TARGET_COMP_TYPE_ATTRIBUTES #define TARGET_COMP_TYPE_ATTRIBUTES @var{machine}_comp_type_attributes struct gcc_target targetm = TARGET_INITIALIZER; @end smallexample @end deftypevar Where a macro should be defined in the @file{.c} file in this manner to form part of the @code{targetm} structure, it is documented below as a ``Target Hook'' with a prototype. Many macros will change in future from being defined in the @file{.h} file to being part of the @code{targetm} structure. Similarly, there is a @code{targetcm} variable for hooks that are specific to front ends for C-family languages, documented as ``C Target Hook''. This is declared in @file{c-family/c-target.h}, the initializer @code{TARGETCM_INITIALIZER} in @file{c-family/c-target-def.h}. If targets initialize @code{targetcm} themselves, they should set @code{target_has_targetcm=yes} in @file{config.gcc}; otherwise a default definition is used. Similarly, there is a @code{targetm_common} variable for hooks that are shared between the compiler driver and the compilers proper, documented as ``Common Target Hook''. This is declared in @file{common/common-target.h}, the initializer @code{TARGETM_COMMON_INITIALIZER} in @file{common/common-target-def.h}. If targets initialize @code{targetm_common} themselves, they should set @code{target_has_targetm_common=yes} in @file{config.gcc}; otherwise a default definition is used. Similarly, there is a @code{targetdm} variable for hooks that are specific to the D language front end, documented as ``D Target Hook''. This is declared in @file{d/d-target.h}, the initializer @code{TARGETDM_INITIALIZER} in @file{d/d-target-def.h}. If targets initialize @code{targetdm} themselves, they should set @code{target_has_targetdm=yes} in @file{config.gcc}; otherwise a default definition is used. @node Driver @section Controlling the Compilation Driver, @file{gcc} @cindex driver @cindex controlling the compilation driver @c prevent bad page break with this line You can control the compilation driver. @defmac DRIVER_SELF_SPECS A list of specs for the driver itself. It should be a suitable initializer for an array of strings, with no surrounding braces. The driver applies these specs to its own command line between loading default @file{specs} files (but not command-line specified ones) and choosing the multilib directory or running any subcommands. It applies them in the order given, so each spec can depend on the options added by earlier ones. It is also possible to remove options using @samp{%<@var{option}} in the usual way. This macro can be useful when a port has several interdependent target options. It provides a way of standardizing the command line so that the other specs are easier to write. Do not define this macro if it does not need to do anything. @end defmac @defmac OPTION_DEFAULT_SPECS A list of specs used to support configure-time default options (i.e.@: @option{--with} options) in the driver. It should be a suitable initializer for an array of structures, each containing two strings, without the outermost pair of surrounding braces. The first item in the pair is the name of the default. This must match the code in @file{config.gcc} for the target. The second item is a spec to apply if a default with this name was specified. The string @samp{%(VALUE)} in the spec will be replaced by the value of the default everywhere it occurs. The driver will apply these specs to its own command line between loading default @file{specs} files and processing @code{DRIVER_SELF_SPECS}, using the same mechanism as @code{DRIVER_SELF_SPECS}. Do not define this macro if it does not need to do anything. @end defmac @defmac CPP_SPEC A C string constant that tells the GCC driver program options to pass to CPP@. It can also specify how to translate options you give to GCC into options for GCC to pass to the CPP@. Do not define this macro if it does not need to do anything. @end defmac @defmac CPLUSPLUS_CPP_SPEC This macro is just like @code{CPP_SPEC}, but is used for C++, rather than C@. If you do not define this macro, then the value of @code{CPP_SPEC} (if any) will be used instead. @end defmac @defmac CC1_SPEC A C string constant that tells the GCC driver program options to pass to @code{cc1}, @code{cc1plus}, @code{f771}, and the other language front ends. It can also specify how to translate options you give to GCC into options for GCC to pass to front ends. Do not define this macro if it does not need to do anything. @end defmac @defmac CC1PLUS_SPEC A C string constant that tells the GCC driver program options to pass to @code{cc1plus}. It can also specify how to translate options you give to GCC into options for GCC to pass to the @code{cc1plus}. Do not define this macro if it does not need to do anything. Note that everything defined in CC1_SPEC is already passed to @code{cc1plus} so there is no need to duplicate the contents of CC1_SPEC in CC1PLUS_SPEC@. @end defmac @defmac ASM_SPEC A C string constant that tells the GCC driver program options to pass to the assembler. It can also specify how to translate options you give to GCC into options for GCC to pass to the assembler. See the file @file{sun3.h} for an example of this. Do not define this macro if it does not need to do anything. @end defmac @defmac ASM_FINAL_SPEC A C string constant that tells the GCC driver program how to run any programs which cleanup after the normal assembler. Normally, this is not needed. See the file @file{mips.h} for an example of this. Do not define this macro if it does not need to do anything. @end defmac @defmac AS_NEEDS_DASH_FOR_PIPED_INPUT Define this macro, with no value, if the driver should give the assembler an argument consisting of a single dash, @option{-}, to instruct it to read from its standard input (which will be a pipe connected to the output of the compiler proper). This argument is given after any @option{-o} option specifying the name of the output file. If you do not define this macro, the assembler is assumed to read its standard input if given no non-option arguments. If your assembler cannot read standard input at all, use a @samp{%@{pipe:%e@}} construct; see @file{mips.h} for instance. @end defmac @defmac LINK_SPEC A C string constant that tells the GCC driver program options to pass to the linker. It can also specify how to translate options you give to GCC into options for GCC to pass to the linker. Do not define this macro if it does not need to do anything. @end defmac @defmac LIB_SPEC Another C string constant used much like @code{LINK_SPEC}. The difference between the two is that @code{LIB_SPEC} is used at the end of the command given to the linker. If this macro is not defined, a default is provided that loads the standard C library from the usual place. See @file{gcc.cc}. @end defmac @defmac LIBGCC_SPEC Another C string constant that tells the GCC driver program how and when to place a reference to @file{libgcc.a} into the linker command line. This constant is placed both before and after the value of @code{LIB_SPEC}. If this macro is not defined, the GCC driver provides a default that passes the string @option{-lgcc} to the linker. @end defmac @defmac REAL_LIBGCC_SPEC By default, if @code{ENABLE_SHARED_LIBGCC} is defined, the @code{LIBGCC_SPEC} is not directly used by the driver program but is instead modified to refer to different versions of @file{libgcc.a} depending on the values of the command line flags @option{-static}, @option{-shared}, @option{-static-libgcc}, and @option{-shared-libgcc}. On targets where these modifications are inappropriate, define @code{REAL_LIBGCC_SPEC} instead. @code{REAL_LIBGCC_SPEC} tells the driver how to place a reference to @file{libgcc} on the link command line, but, unlike @code{LIBGCC_SPEC}, it is used unmodified. @end defmac @defmac USE_LD_AS_NEEDED A macro that controls the modifications to @code{LIBGCC_SPEC} mentioned in @code{REAL_LIBGCC_SPEC}. If nonzero, a spec will be generated that uses @option{--as-needed} or equivalent options and the shared @file{libgcc} in place of the static exception handler library, when linking without any of @code{-static}, @code{-static-libgcc}, or @code{-shared-libgcc}. @end defmac @defmac LINK_EH_SPEC If defined, this C string constant is added to @code{LINK_SPEC}. When @code{USE_LD_AS_NEEDED} is zero or undefined, it also affects the modifications to @code{LIBGCC_SPEC} mentioned in @code{REAL_LIBGCC_SPEC}. @end defmac @defmac STARTFILE_SPEC Another C string constant used much like @code{LINK_SPEC}. The difference between the two is that @code{STARTFILE_SPEC} is used at the very beginning of the command given to the linker. If this macro is not defined, a default is provided that loads the standard C startup file from the usual place. See @file{gcc.cc}. @end defmac @defmac ENDFILE_SPEC Another C string constant used much like @code{LINK_SPEC}. The difference between the two is that @code{ENDFILE_SPEC} is used at the very end of the command given to the linker. Do not define this macro if it does not need to do anything. @end defmac @defmac THREAD_MODEL_SPEC GCC @code{-v} will print the thread model GCC was configured to use. However, this doesn't work on platforms that are multilibbed on thread models, such as AIX 4.3. On such platforms, define @code{THREAD_MODEL_SPEC} such that it evaluates to a string without blanks that names one of the recognized thread models. @code{%*}, the default value of this macro, will expand to the value of @code{thread_file} set in @file{config.gcc}. @end defmac @defmac SYSROOT_SUFFIX_SPEC Define this macro to add a suffix to the target sysroot when GCC is configured with a sysroot. This will cause GCC to search for usr/lib, et al, within sysroot+suffix. @end defmac @defmac SYSROOT_HEADERS_SUFFIX_SPEC Define this macro to add a headers_suffix to the target sysroot when GCC is configured with a sysroot. This will cause GCC to pass the updated sysroot+headers_suffix to CPP, causing it to search for usr/include, et al, within sysroot+headers_suffix. @end defmac @defmac EXTRA_SPECS Define this macro to provide additional specifications to put in the @file{specs} file that can be used in various specifications like @code{CC1_SPEC}. The definition should be an initializer for an array of structures, containing a string constant, that defines the specification name, and a string constant that provides the specification. Do not define this macro if it does not need to do anything. @code{EXTRA_SPECS} is useful when an architecture contains several related targets, which have various @code{@dots{}_SPECS} which are similar to each other, and the maintainer would like one central place to keep these definitions. For example, the PowerPC System V.4 targets use @code{EXTRA_SPECS} to define either @code{_CALL_SYSV} when the System V calling sequence is used or @code{_CALL_AIX} when the older AIX-based calling sequence is used. The @file{config/rs6000/rs6000.h} target file defines: @smallexample #define EXTRA_SPECS \ @{ "cpp_sysv_default", CPP_SYSV_DEFAULT @}, #define CPP_SYS_DEFAULT "" @end smallexample The @file{config/rs6000/sysv.h} target file defines: @smallexample #undef CPP_SPEC #define CPP_SPEC \ "%@{posix: -D_POSIX_SOURCE @} \ %@{mcall-sysv: -D_CALL_SYSV @} \ %@{!mcall-sysv: %(cpp_sysv_default) @} \ %@{msoft-float: -D_SOFT_FLOAT@} %@{mcpu=403: -D_SOFT_FLOAT@}" #undef CPP_SYSV_DEFAULT #define CPP_SYSV_DEFAULT "-D_CALL_SYSV" @end smallexample while the @file{config/rs6000/eabiaix.h} target file defines @code{CPP_SYSV_DEFAULT} as: @smallexample #undef CPP_SYSV_DEFAULT #define CPP_SYSV_DEFAULT "-D_CALL_AIX" @end smallexample @end defmac @defmac LINK_LIBGCC_SPECIAL_1 Define this macro if the driver program should find the library @file{libgcc.a}. If you do not define this macro, the driver program will pass the argument @option{-lgcc} to tell the linker to do the search. @end defmac @defmac LINK_GCC_C_SEQUENCE_SPEC The sequence in which libgcc and libc are specified to the linker. By default this is @code{%G %L %G}. @end defmac @defmac POST_LINK_SPEC Define this macro to add additional steps to be executed after linker. The default value of this macro is empty string. @end defmac @defmac LINK_COMMAND_SPEC A C string constant giving the complete command line need to execute the linker. When you do this, you will need to update your port each time a change is made to the link command line within @file{gcc.cc}. Therefore, define this macro only if you need to completely redefine the command line for invoking the linker and there is no other way to accomplish the effect you need. Overriding this macro may be avoidable by overriding @code{LINK_GCC_C_SEQUENCE_SPEC} instead. @end defmac @hook TARGET_ALWAYS_STRIP_DOTDOT @defmac MULTILIB_DEFAULTS Define this macro as a C expression for the initializer of an array of string to tell the driver program which options are defaults for this target and thus do not need to be handled specially when using @code{MULTILIB_OPTIONS}. Do not define this macro if @code{MULTILIB_OPTIONS} is not defined in the target makefile fragment or if none of the options listed in @code{MULTILIB_OPTIONS} are set by default. @xref{Target Fragment}. @end defmac @defmac RELATIVE_PREFIX_NOT_LINKDIR Define this macro to tell @command{gcc} that it should only translate a @option{-B} prefix into a @option{-L} linker option if the prefix indicates an absolute file name. @end defmac @defmac MD_EXEC_PREFIX If defined, this macro is an additional prefix to try after @code{STANDARD_EXEC_PREFIX}. @code{MD_EXEC_PREFIX} is not searched when the compiler is built as a cross compiler. If you define @code{MD_EXEC_PREFIX}, then be sure to add it to the list of directories used to find the assembler in @file{configure.ac}. @end defmac @defmac STANDARD_STARTFILE_PREFIX Define this macro as a C string constant if you wish to override the standard choice of @code{libdir} as the default prefix to try when searching for startup files such as @file{crt0.o}. @code{STANDARD_STARTFILE_PREFIX} is not searched when the compiler is built as a cross compiler. @end defmac @defmac STANDARD_STARTFILE_PREFIX_1 Define this macro as a C string constant if you wish to override the standard choice of @code{/lib} as a prefix to try after the default prefix when searching for startup files such as @file{crt0.o}. @code{STANDARD_STARTFILE_PREFIX_1} is not searched when the compiler is built as a cross compiler. @end defmac @defmac STANDARD_STARTFILE_PREFIX_2 Define this macro as a C string constant if you wish to override the standard choice of @code{/lib} as yet another prefix to try after the default prefix when searching for startup files such as @file{crt0.o}. @code{STANDARD_STARTFILE_PREFIX_2} is not searched when the compiler is built as a cross compiler. @end defmac @defmac MD_STARTFILE_PREFIX If defined, this macro supplies an additional prefix to try after the standard prefixes. @code{MD_EXEC_PREFIX} is not searched when the compiler is built as a cross compiler. @end defmac @defmac MD_STARTFILE_PREFIX_1 If defined, this macro supplies yet another prefix to try after the standard prefixes. It is not searched when the compiler is built as a cross compiler. @end defmac @defmac INIT_ENVIRONMENT Define this macro as a C string constant if you wish to set environment variables for programs called by the driver, such as the assembler and loader. The driver passes the value of this macro to @code{putenv} to initialize the necessary environment variables. @end defmac @defmac LOCAL_INCLUDE_DIR Define this macro as a C string constant if you wish to override the standard choice of @file{/usr/local/include} as the default prefix to try when searching for local header files. @code{LOCAL_INCLUDE_DIR} comes before @code{NATIVE_SYSTEM_HEADER_DIR} (set in @file{config.gcc}, normally @file{/usr/include}) in the search order. Cross compilers do not search either @file{/usr/local/include} or its replacement. @end defmac @defmac NATIVE_SYSTEM_HEADER_COMPONENT The ``component'' corresponding to @code{NATIVE_SYSTEM_HEADER_DIR}. See @code{INCLUDE_DEFAULTS}, below, for the description of components. If you do not define this macro, no component is used. @end defmac @defmac INCLUDE_DEFAULTS Define this macro if you wish to override the entire default search path for include files. For a native compiler, the default search path usually consists of @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR}, @code{GPLUSPLUS_INCLUDE_DIR}, and @code{NATIVE_SYSTEM_HEADER_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR} and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile}, and specify private search areas for GCC@. The directory @code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs. The definition should be an initializer for an array of structures. Each array element should have four elements: the directory name (a string constant), the component name (also a string constant), a flag for C++-only directories, and a flag showing that the includes in the directory don't need to be wrapped in @code{extern @samp{C}} when compiling C++. Mark the end of the array with a null element. The component name denotes what GNU package the include file is part of, if any, in all uppercase letters. For example, it might be @samp{GCC} or @samp{BINUTILS}. If the package is part of a vendor-supplied operating system, code the component name as @samp{0}. For example, here is the definition used for VAX/VMS: @smallexample #define INCLUDE_DEFAULTS \ @{ \ @{ "GNU_GXX_INCLUDE:", "G++", 1, 1@}, \ @{ "GNU_CC_INCLUDE:", "GCC", 0, 0@}, \ @{ "SYS$SYSROOT:[SYSLIB.]", 0, 0, 0@}, \ @{ ".", 0, 0, 0@}, \ @{ 0, 0, 0, 0@} \ @} @end smallexample @end defmac Here is the order of prefixes tried for exec files: @enumerate @item Any prefixes specified by the user with @option{-B}. @item The environment variable @code{GCC_EXEC_PREFIX} or, if @code{GCC_EXEC_PREFIX} is not set and the compiler has not been installed in the configure-time @var{prefix}, the location in which the compiler has actually been installed. @item The directories specified by the environment variable @code{COMPILER_PATH}. @item The macro @code{STANDARD_EXEC_PREFIX}, if the compiler has been installed in the configured-time @var{prefix}. @item The location @file{/usr/libexec/gcc/}, but only if this is a native compiler. @item The location @file{/usr/lib/gcc/}, but only if this is a native compiler. @item The macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a native compiler. @end enumerate Here is the order of prefixes tried for startfiles: @enumerate @item Any prefixes specified by the user with @option{-B}. @item The environment variable @code{GCC_EXEC_PREFIX} or its automatically determined value based on the installed toolchain location. @item The directories specified by the environment variable @code{LIBRARY_PATH} (or port-specific name; native only, cross compilers do not use this). @item The macro @code{STANDARD_EXEC_PREFIX}, but only if the toolchain is installed in the configured @var{prefix} or this is a native compiler. @item The location @file{/usr/lib/gcc/}, but only if this is a native compiler. @item The macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a native compiler. @item The macro @code{MD_STARTFILE_PREFIX}, if defined, but only if this is a native compiler, or we have a target system root. @item The macro @code{MD_STARTFILE_PREFIX_1}, if defined, but only if this is a native compiler, or we have a target system root. @item The macro @code{STANDARD_STARTFILE_PREFIX}, with any sysroot modifications. If this path is relative it will be prefixed by @code{GCC_EXEC_PREFIX} and the machine suffix or @code{STANDARD_EXEC_PREFIX} and the machine suffix. @item The macro @code{STANDARD_STARTFILE_PREFIX_1}, but only if this is a native compiler, or we have a target system root. The default for this macro is @file{/lib/}. @item The macro @code{STANDARD_STARTFILE_PREFIX_2}, but only if this is a native compiler, or we have a target system root. The default for this macro is @file{/usr/lib/}. @end enumerate @node Run-time Target @section Run-time Target Specification @cindex run-time target specification @cindex predefined macros @cindex target specifications @c prevent bad page break with this line Here are run-time target specifications. @defmac TARGET_CPU_CPP_BUILTINS () 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 @code{builtin_define}, @code{builtin_define_std} and @code{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. @code{builtin_assert} takes a string in the form you pass to the command-line option @option{-A}, such as @code{cpu=mips}, and creates the assertion. @code{builtin_define} takes a string in the form accepted by option @option{-D} and unconditionally defines the macro. @code{builtin_define_std} takes a string representing the name of an object-like macro. If it doesn't lie in the user's namespace, @code{builtin_define_std} defines 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 @code{unix} defines @code{__unix}, @code{__unix__} and possibly @code{unix}; passing @code{_mips} defines @code{__mips}, @code{__mips__} and possibly @code{_mips}, and passing @code{_ABI64} defines only @code{_ABI64}. You can also test for the C dialect being compiled. The variable @code{c_language} is set to one of @code{clk_c}, @code{clk_cplusplus} or @code{clk_objective_c}. Note that if we are preprocessing assembler, this variable will be @code{clk_c} but the function-like macro @code{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 @code{flag_iso} can be used. The function-like macro @code{preprocessing_trad_p()} can be used to check for traditional preprocessing. @end defmac @defmac TARGET_OS_CPP_BUILTINS () Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional and is used for the target operating system instead. @end defmac @defmac TARGET_OBJFMT_CPP_BUILTINS () Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional and is used for the target object format. @file{elfos.h} uses this macro to define @code{__ELF__}, so you probably do not need to define it yourself. @end defmac @deftypevar {extern int} target_flags This variable is declared in @file{options.h}, which is included before any target-specific headers. @end deftypevar @hook TARGET_DEFAULT_TARGET_FLAGS This variable specifies the initial value of @code{target_flags}. Its default setting is 0. @end deftypevr @cindex optional hardware or system features @cindex features, optional, in system conventions @hook TARGET_HANDLE_OPTION This hook is called whenever the user specifies one of the target-specific options described by the @file{.opt} definition files (@pxref{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. @var{decoded} specifies the option and its arguments. @var{opts} and @var{opts_set} are the @code{gcc_options} structures to be used for storing option state, and @var{loc} is the location at which the option was passed (@code{UNKNOWN_LOCATION} except for options passed via attributes). @end deftypefn @hook TARGET_HANDLE_C_OPTION This target hook is called whenever the user specifies one of the target-specific C language family options described by the @file{.opt} definition files(@pxref{Options}). It has the opportunity to do some option-specific processing and should return true if the option is valid. The arguments are like for @code{TARGET_HANDLE_OPTION}. The default definition does nothing but return false. In general, you should use @code{TARGET_HANDLE_OPTION} to 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 @code{TARGET_HANDLE_C_OPTION} instead. @end deftypefn @hook TARGET_OBJC_CONSTRUCT_STRING_OBJECT @hook TARGET_OBJC_DECLARE_UNRESOLVED_CLASS_REFERENCE @hook TARGET_OBJC_DECLARE_CLASS_DEFINITION @hook TARGET_STRING_OBJECT_REF_TYPE_P @hook TARGET_CHECK_STRING_OBJECT_FORMAT_ARG @hook TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE @defmac C_COMMON_OVERRIDE_OPTIONS This is similar to the @code{TARGET_OPTION_OVERRIDE} hook but 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. @end defmac @hook TARGET_OPTION_OPTIMIZATION_TABLE Some machines may desire to change what optimizations are performed for various optimization levels. This variable, if defined, describes options to enable at particular sets of optimization levels. These options are processed once just after the optimization level is determined and before the remainder of the command options have been parsed, so may be overridden by other options passed explicitly. This processing is run once at program startup and when the optimization options are changed via @code{#pragma GCC optimize} or by using the @code{optimize} attribute. @end deftypevr @hook TARGET_OPTION_INIT_STRUCT @defmac SWITCHABLE_TARGET Some targets need to switch between substantially different subtargets during compilation. For example, the MIPS target has one subtarget for the traditional MIPS architecture and another for MIPS16. Source code can switch between these two subarchitectures using the @code{mips16} and @code{nomips16} attributes. Such subtargets can differ in things like the set of available registers, the set of available instructions, the costs of various operations, and so on. GCC caches a lot of this type of information in global variables, and recomputing them for each subtarget takes a significant amount of time. The compiler therefore provides a facility for maintaining several versions of the global variables and quickly switching between them; see @file{target-globals.h} for details. Define this macro to 1 if your target needs this facility. The default is 0. @end defmac @hook TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P @node Per-Function Data @section Defining data structures for per-function information. @cindex per-function data @cindex data structures If the target needs to store information on a per-function basis, GCC provides a macro and a couple of variables to allow this. Note, just using statics to store the information is a bad idea, since GCC supports nested functions, so you can be halfway through encoding one function when another one comes along. GCC defines a data structure called @code{struct function} which contains all of the data specific to an individual function. This structure contains a field called @code{machine} whose type is @code{struct machine_function *}, which can be used by targets to point to their own specific data. If a target needs per-function specific data it should define the type @code{struct machine_function} and also the macro @code{INIT_EXPANDERS}. This macro should be used to initialize the function pointer @code{init_machine_status}. This pointer is explained below. One typical use of per-function, target specific data is to create an RTX to hold the register containing the function's return address. This RTX can then be used to implement the @code{__builtin_return_address} function, for level 0. Note---earlier implementations of GCC used a single data area to hold all of the per-function information. Thus when processing of a nested function began the old per-function data had to be pushed onto a stack, and when the processing was finished, it had to be popped off the stack. GCC used to provide function pointers called @code{save_machine_status} and @code{restore_machine_status} to handle the saving and restoring of the target specific information. Since the single data area approach is no longer used, these pointers are no longer supported. @defmac INIT_EXPANDERS Macro called to initialize any target specific information. This macro is called once per function, before generation of any RTL has begun. The intention of this macro is to allow the initialization of the function pointer @code{init_machine_status}. @end defmac @deftypevar {void (*)(struct function *)} init_machine_status If this function pointer is non-@code{NULL} it will be called once per function, before function compilation starts, in order to allow the target to perform any target specific initialization of the @code{struct function} structure. It is intended that this would be used to initialize the @code{machine} of that structure. @code{struct machine_function} structures are expected to be freed by GC@. Generally, any memory that they reference must be allocated by using GC allocation, including the structure itself. @end deftypevar @node Storage Layout @section Storage Layout @cindex storage layout Note that the definitions of the macros in this table which are sizes or alignments measured in bits do not need to be constant. They can be C expressions that refer to static variables, such as the @code{target_flags}. @xref{Run-time Target}. @defmac BITS_BIG_ENDIAN Define this macro to have the value 1 if the most significant bit in a byte has the lowest number; otherwise define it to have the value zero. This means that bit-field instructions count from the most significant bit. If the machine has no bit-field instructions, then this must still be defined, but it doesn't matter which value it is defined to. This macro need not be a constant. This macro does not affect the way structure fields are packed into bytes or words; that is controlled by @code{BYTES_BIG_ENDIAN}. @end defmac @defmac BYTES_BIG_ENDIAN Define this macro to have the value 1 if the most significant byte in a word has the lowest number. This macro need not be a constant. @end defmac @defmac WORDS_BIG_ENDIAN Define this macro to have the value 1 if, in a multiword object, the most significant word has the lowest number. This applies to both memory locations and registers; see @code{REG_WORDS_BIG_ENDIAN} if the order of words in memory is not the same as the order in registers. This macro need not be a constant. @end defmac @defmac REG_WORDS_BIG_ENDIAN On some machines, the order of words in a multiword object differs between registers in memory. In such a situation, define this macro to describe the order of words in a register. The macro @code{WORDS_BIG_ENDIAN} controls the order of words in memory. @end defmac @defmac FLOAT_WORDS_BIG_ENDIAN Define this macro to have the value 1 if @code{DFmode}, @code{XFmode} or @code{TFmode} floating point numbers are stored in memory with the word containing the sign bit at the lowest address; otherwise define it to have the value 0. This macro need not be a constant. You need not define this macro if the ordering is the same as for multi-word integers. @end defmac @defmac BITS_PER_WORD Number of bits in a word. If you do not define this macro, the default is @code{BITS_PER_UNIT * UNITS_PER_WORD}. @end defmac @defmac MAX_BITS_PER_WORD Maximum number of bits in a word. If this is undefined, the default is @code{BITS_PER_WORD}. Otherwise, it is the constant value that is the largest value that @code{BITS_PER_WORD} can have at run-time. @end defmac @defmac UNITS_PER_WORD Number of storage units in a word; normally the size of a general-purpose register, a power of two from 1 or 8. @end defmac @defmac MIN_UNITS_PER_WORD Minimum number of units in a word. If this is undefined, the default is @code{UNITS_PER_WORD}. Otherwise, it is the constant value that is the smallest value that @code{UNITS_PER_WORD} can have at run-time. @end defmac @defmac POINTER_SIZE Width of a pointer, in bits. You must specify a value no wider than the width of @code{Pmode}. If it is not equal to the width of @code{Pmode}, you must define @code{POINTERS_EXTEND_UNSIGNED}. If you do not specify a value the default is @code{BITS_PER_WORD}. @end defmac @defmac POINTERS_EXTEND_UNSIGNED A C expression that determines how pointers should be extended from @code{ptr_mode} to either @code{Pmode} or @code{word_mode}. It is greater than zero if pointers should be zero-extended, zero if they should be sign-extended, and negative if some other sort of conversion is needed. In the last case, the extension is done by the target's @code{ptr_extend} instruction. You need not define this macro if the @code{ptr_mode}, @code{Pmode} and @code{word_mode} are all the same width. @end defmac @defmac PROMOTE_MODE (@var{m}, @var{unsignedp}, @var{type}) A macro to update @var{m} and @var{unsignedp} when an object whose type is @var{type} and which has the specified mode and signedness is to be stored in a register. This macro is only called when @var{type} is a scalar type. On most RISC machines, which only have operations that operate on a full register, define this macro to set @var{m} to @code{word_mode} if @var{m} is an integer mode narrower than @code{BITS_PER_WORD}. In most cases, only integer modes should be widened because wider-precision floating-point operations are usually more expensive than their narrower counterparts. For most machines, the macro definition does not change @var{unsignedp}. However, some machines, have instructions that preferentially handle either signed or unsigned quantities of certain modes. For example, on the DEC Alpha, 32-bit loads from memory and 32-bit add instructions sign-extend the result to 64 bits. On such machines, set @var{unsignedp} according to which kind of extension is more efficient. Do not define this macro if it would never modify @var{m}. @end defmac @hook TARGET_C_EXCESS_PRECISION Return a value, with the same meaning as the C99 macro @code{FLT_EVAL_METHOD} that describes which excess precision should be applied. @hook TARGET_PROMOTE_FUNCTION_MODE @defmac PARM_BOUNDARY Normal alignment required for function parameters on the stack, in bits. All stack parameters receive at least this much alignment regardless of data type. On most machines, this is the same as the size of an integer. @end defmac @defmac STACK_BOUNDARY Define this macro to the minimum alignment enforced by hardware for the stack pointer on this machine. The definition is a C expression for the desired alignment (measured in bits). This value is used as a default if @code{PREFERRED_STACK_BOUNDARY} is not defined. On most machines, this should be the same as @code{PARM_BOUNDARY}. @end defmac @defmac PREFERRED_STACK_BOUNDARY Define this macro if you wish to preserve a certain alignment for the stack pointer, greater than what the hardware enforces. The definition is a C expression for the desired alignment (measured in bits). This macro must evaluate to a value equal to or larger than @code{STACK_BOUNDARY}. @end defmac @defmac INCOMING_STACK_BOUNDARY Define this macro if the incoming stack boundary may be different from @code{PREFERRED_STACK_BOUNDARY}. This macro must evaluate to a value equal to or larger than @code{STACK_BOUNDARY}. @end defmac @defmac FUNCTION_BOUNDARY Alignment required for a function entry point, in bits. @end defmac @defmac BIGGEST_ALIGNMENT Biggest alignment that any data type can require on this machine, in bits. Note that this is not the biggest alignment that is supported, just the biggest alignment that, when violated, may cause a fault. @end defmac @hook TARGET_ABSOLUTE_BIGGEST_ALIGNMENT @defmac MALLOC_ABI_ALIGNMENT Alignment, in bits, a C conformant malloc implementation has to provide. If not defined, the default value is @code{BITS_PER_WORD}. @end defmac @defmac ATTRIBUTE_ALIGNED_VALUE Alignment used by the @code{__attribute__ ((aligned))} construct. If not defined, the default value is @code{BIGGEST_ALIGNMENT}. @end defmac @defmac MINIMUM_ATOMIC_ALIGNMENT If defined, the smallest alignment, in bits, that can be given to an object that can be referenced in one operation, without disturbing any nearby object. Normally, this is @code{BITS_PER_UNIT}, but may be larger on machines that don't have byte or half-word store operations. @end defmac @defmac BIGGEST_FIELD_ALIGNMENT Biggest alignment that any structure or union field can require on this machine, in bits. If defined, this overrides @code{BIGGEST_ALIGNMENT} for structure and union fields only, unless the field alignment has been set by the @code{__attribute__ ((aligned (@var{n})))} construct. @end defmac @defmac ADJUST_FIELD_ALIGN (@var{field}, @var{type}, @var{computed}) An expression for the alignment of a structure field @var{field} of type @var{type} if the alignment computed in the usual way (including applying of @code{BIGGEST_ALIGNMENT} and @code{BIGGEST_FIELD_ALIGNMENT} to the alignment) is @var{computed}. It overrides alignment only if the field alignment has not been set by the @code{__attribute__ ((aligned (@var{n})))} construct. Note that @var{field} may be @code{NULL_TREE} in case we just query for the minimum alignment of a field of type @var{type} in structure context. @end defmac @defmac MAX_STACK_ALIGNMENT Biggest stack alignment guaranteed by the backend. Use this macro to specify the maximum alignment of a variable on stack. If not defined, the default value is @code{STACK_BOUNDARY}. @c FIXME: The default should be @code{PREFERRED_STACK_BOUNDARY}. @c But the fix for PR 32893 indicates that we can only guarantee @c maximum stack alignment on stack up to @code{STACK_BOUNDARY}, not @c @code{PREFERRED_STACK_BOUNDARY}, if stack alignment isn't supported. @end defmac @defmac MAX_OFILE_ALIGNMENT Biggest alignment supported by the object file format of this machine. Use this macro to limit the alignment which can be specified using the @code{__attribute__ ((aligned (@var{n})))} construct for functions and objects with static storage duration. The alignment of automatic objects may exceed the object file format maximum up to the maximum supported by GCC. If not defined, the default value is @code{BIGGEST_ALIGNMENT}. On systems that use ELF, the default (in @file{config/elfos.h}) is the largest supported 32-bit ELF section alignment representable on a 32-bit host e.g.@: @samp{(((uint64_t) 1 << 28) * 8)}. On 32-bit ELF the largest supported section alignment in bits is @samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts. @end defmac @hook TARGET_LOWER_LOCAL_DECL_ALIGNMENT @hook TARGET_STATIC_RTX_ALIGNMENT @defmac DATA_ALIGNMENT (@var{type}, @var{basic-align}) If defined, a C expression to compute the alignment for a variable in the static store. @var{type} is the data type, and @var{basic-align} is the alignment that the object would ordinarily have. The value of this macro is used instead of that alignment to align the object. If this macro is not defined, then @var{basic-align} is used. @findex strcpy One use of this macro is to increase alignment of medium-size data to make it all fit in fewer cache lines. Another is to cause character arrays to be word-aligned so that @code{strcpy} calls that copy constants to character arrays can be done inline. @end defmac @defmac DATA_ABI_ALIGNMENT (@var{type}, @var{basic-align}) Similar to @code{DATA_ALIGNMENT}, but for the cases where the ABI mandates some alignment increase, instead of optimization only purposes. E.g.@ AMD x86-64 psABI says that variables with array type larger than 15 bytes must be aligned to 16 byte boundaries. If this macro is not defined, then @var{basic-align} is used. @end defmac @hook TARGET_CONSTANT_ALIGNMENT @defmac LOCAL_ALIGNMENT (@var{type}, @var{basic-align}) If defined, a C expression to compute the alignment for a variable in the local store. @var{type} is the data type, and @var{basic-align} is the alignment that the object would ordinarily have. The value of this macro is used instead of that alignment to align the object. If this macro is not defined, then @var{basic-align} is used. One use of this macro is to increase alignment of medium-size data to make it all fit in fewer cache lines. If the value of this macro has a type, it should be an unsigned type. @end defmac @hook TARGET_VECTOR_ALIGNMENT @defmac STACK_SLOT_ALIGNMENT (@var{type}, @var{mode}, @var{basic-align}) If defined, a C expression to compute the alignment for stack slot. @var{type} is the data type, @var{mode} is the widest mode available, and @var{basic-align} is the alignment that the slot would ordinarily have. The value of this macro is used instead of that alignment to align the slot. If this macro is not defined, then @var{basic-align} is used when @var{type} is @code{NULL}. Otherwise, @code{LOCAL_ALIGNMENT} will be used. This macro is to set alignment of stack slot to the maximum alignment of all possible modes which the slot may have. If the value of this macro has a type, it should be an unsigned type. @end defmac @defmac LOCAL_DECL_ALIGNMENT (@var{decl}) If defined, a C expression to compute the alignment for a local variable @var{decl}. If this macro is not defined, then @code{LOCAL_ALIGNMENT (TREE_TYPE (@var{decl}), DECL_ALIGN (@var{decl}))} is used. One use of this macro is to increase alignment of medium-size data to make it all fit in fewer cache lines. If the value of this macro has a type, it should be an unsigned type. @end defmac @defmac MINIMUM_ALIGNMENT (@var{exp}, @var{mode}, @var{align}) If defined, a C expression to compute the minimum required alignment for dynamic stack realignment purposes for @var{exp} (a type or decl), @var{mode}, assuming normal alignment @var{align}. If this macro is not defined, then @var{align} will be used. @end defmac @defmac EMPTY_FIELD_BOUNDARY Alignment in bits to be given to a structure bit-field that follows an empty field such as @code{int : 0;}. If @code{PCC_BITFIELD_TYPE_MATTERS} is true, it overrides this macro. @end defmac @defmac STRUCTURE_SIZE_BOUNDARY Number of bits which any structure or union's size must be a multiple of. Each structure or union's size is rounded up to a multiple of this. If you do not define this macro, the default is the same as @code{BITS_PER_UNIT}. @end defmac @defmac STRICT_ALIGNMENT Define this macro to be the value 1 if instructions will fail to work if given data not on the nominal alignment. If instructions will merely go slower in that case, define this macro as 0. @end defmac @defmac PCC_BITFIELD_TYPE_MATTERS Define this if you wish to imitate the way many other C compilers handle alignment of bit-fields and the structures that contain them. The behavior is that the type written for a named bit-field (@code{int}, @code{short}, or other integer type) imposes an alignment for the entire structure, as if the structure really did contain an ordinary field of that type. In addition, the bit-field is placed within the structure so that it would fit within such a field, not crossing a boundary for it. Thus, on most machines, a named bit-field whose type is written as @code{int} would not cross a four-byte boundary, and would force four-byte alignment for the whole structure. (The alignment used may not be four bytes; it is controlled by the other alignment parameters.) An unnamed bit-field will not affect the alignment of the containing structure. If the macro is defined, its definition should be a C expression; a nonzero value for the expression enables this behavior. Note that if this macro is not defined, or its value is zero, some bit-fields may cross more than one alignment boundary. The compiler can support such references if there are @samp{insv}, @samp{extv}, and @samp{extzv} insns that can directly reference memory. The other known way of making bit-fields work is to define @code{STRUCTURE_SIZE_BOUNDARY} as large as @code{BIGGEST_ALIGNMENT}. Then every structure can be accessed with fullwords. Unless the machine has bit-field instructions or you define @code{STRUCTURE_SIZE_BOUNDARY} that way, you must define @code{PCC_BITFIELD_TYPE_MATTERS} to have a nonzero value. If your aim is to make GCC use the same conventions for laying out bit-fields as are used by another compiler, here is how to investigate what the other compiler does. Compile and run this program: @smallexample struct foo1 @{ char x; char :0; char y; @}; struct foo2 @{ char x; int :0; char y; @}; main () @{ printf ("Size of foo1 is %d\n", sizeof (struct foo1)); printf ("Size of foo2 is %d\n", sizeof (struct foo2)); exit (0); @} @end smallexample If this prints 2 and 5, then the compiler's behavior is what you would get from @code{PCC_BITFIELD_TYPE_MATTERS}. @end defmac @defmac BITFIELD_NBYTES_LIMITED Like @code{PCC_BITFIELD_TYPE_MATTERS} except that its effect is limited to aligning a bit-field within the structure. @end defmac @hook TARGET_ALIGN_ANON_BITFIELD @hook TARGET_NARROW_VOLATILE_BITFIELD @hook TARGET_MEMBER_TYPE_FORCES_BLK @defmac ROUND_TYPE_ALIGN (@var{type}, @var{computed}, @var{specified}) Define this macro as an expression for the alignment of a type (given by @var{type} as a tree node) if the alignment computed in the usual way is @var{computed} and the alignment explicitly specified was @var{specified}. The default is to use @var{specified} if it is larger; otherwise, use the smaller of @var{computed} and @code{BIGGEST_ALIGNMENT} @end defmac @defmac MAX_FIXED_MODE_SIZE An integer expression for the size in bits of the largest integer machine mode that should actually be used. All integer machine modes of this size or smaller can be used for structures and unions with the appropriate sizes. If this macro is undefined, @code{GET_MODE_BITSIZE (DImode)} is assumed. @end defmac @defmac STACK_SAVEAREA_MODE (@var{save_level}) If defined, an expression of type @code{machine_mode} that specifies the mode of the save area operand of a @code{save_stack_@var{level}} named pattern (@pxref{Standard Names}). @var{save_level} is one of @code{SAVE_BLOCK}, @code{SAVE_FUNCTION}, or @code{SAVE_NONLOCAL} and selects which of the three named patterns is having its mode specified. You need not define this macro if it always returns @code{Pmode}. You would most commonly define this macro if the @code{save_stack_@var{level}} patterns need to support both a 32- and a 64-bit mode. @end defmac @defmac STACK_SIZE_MODE If defined, an expression of type @code{machine_mode} that specifies the mode of the size increment operand of an @code{allocate_stack} named pattern (@pxref{Standard Names}). You need not define this macro if it always returns @code{word_mode}. You would most commonly define this macro if the @code{allocate_stack} pattern needs to support both a 32- and a 64-bit mode. @end defmac @hook TARGET_LIBGCC_CMP_RETURN_MODE @hook TARGET_LIBGCC_SHIFT_COUNT_MODE @hook TARGET_UNWIND_WORD_MODE @hook TARGET_MS_BITFIELD_LAYOUT_P @hook TARGET_DECIMAL_FLOAT_SUPPORTED_P @hook TARGET_FIXED_POINT_SUPPORTED_P @hook TARGET_EXPAND_TO_RTL_HOOK @hook TARGET_INSTANTIATE_DECLS @hook TARGET_MANGLE_TYPE @node Type Layout @section Layout of Source Language Data Types These macros define the sizes and other characteristics of the standard basic data types used in programs being compiled. Unlike the macros in the previous section, these apply to specific features of C and related languages, rather than to fundamental aspects of storage layout. @defmac INT_TYPE_SIZE A C expression for the size in bits of the type @code{int} on the target machine. If you don't define this, the default is one word. @end defmac @defmac SHORT_TYPE_SIZE A C expression for the size in bits of the type @code{short} on the target machine. If you don't define this, the default is half a word. (If this would be less than one storage unit, it is rounded up to one unit.) @end defmac @defmac LONG_TYPE_SIZE A C expression for the size in bits of the type @code{long} on the target machine. If you don't define this, the default is one word. @end defmac @defmac ADA_LONG_TYPE_SIZE On some machines, the size used for the Ada equivalent of the type @code{long} by a native Ada compiler differs from that used by C@. In that situation, define this macro to be a C expression to be used for the size of that type. If you don't define this, the default is the value of @code{LONG_TYPE_SIZE}. @end defmac @defmac LONG_LONG_TYPE_SIZE A C expression for the size in bits of the type @code{long long} on the target machine. If you don't define this, the default is two words. If you want to support GNU Ada on your machine, the value of this macro must be at least 64. @end defmac @defmac CHAR_TYPE_SIZE A C expression for the size in bits of the type @code{char} on the target machine. If you don't define this, the default is @code{BITS_PER_UNIT}. @end defmac @defmac BOOL_TYPE_SIZE A C expression for the size in bits of the C++ type @code{bool} and C99 type @code{_Bool} on the target machine. If you don't define this, and you probably shouldn't, the default is @code{CHAR_TYPE_SIZE}. @end defmac @defmac FLOAT_TYPE_SIZE A C expression for the size in bits of the type @code{float} on the target machine. If you don't define this, the default is one word. @end defmac @defmac DOUBLE_TYPE_SIZE A C expression for the size in bits of the type @code{double} on the target machine. If you don't define this, the default is two words. @end defmac @defmac LONG_DOUBLE_TYPE_SIZE A C expression for the size in bits of the type @code{long double} on the target machine. If you don't define this, the default is two words. @end defmac @defmac SHORT_FRACT_TYPE_SIZE A C expression for the size in bits of the type @code{short _Fract} on the target machine. If you don't define this, the default is @code{BITS_PER_UNIT}. @end defmac @defmac FRACT_TYPE_SIZE A C expression for the size in bits of the type @code{_Fract} on the target machine. If you don't define this, the default is @code{BITS_PER_UNIT * 2}. @end defmac @defmac LONG_FRACT_TYPE_SIZE A C expression for the size in bits of the type @code{long _Fract} on the target machine. If you don't define this, the default is @code{BITS_PER_UNIT * 4}. @end defmac @defmac LONG_LONG_FRACT_TYPE_SIZE A C expression for the size in bits of the type @code{long long _Fract} on the target machine. If you don't define this, the default is @code{BITS_PER_UNIT * 8}. @end defmac @defmac SHORT_ACCUM_TYPE_SIZE A C expression for the size in bits of the type @code{short _Accum} on the target machine. If you don't define this, the default is @code{BITS_PER_UNIT * 2}. @end defmac @defmac ACCUM_TYPE_SIZE A C expression for the size in bits of the type @code{_Accum} on the target machine. If you don't define this, the default is @code{BITS_PER_UNIT * 4}. @end defmac @defmac LONG_ACCUM_TYPE_SIZE A C expression for the size in bits of the type @code{long _Accum} on the target machine. If you don't define this, the default is @code{BITS_PER_UNIT * 8}. @end defmac @defmac LONG_LONG_ACCUM_TYPE_SIZE A C expression for the size in bits of the type @code{long long _Accum} on the target machine. If you don't define this, the default is @code{BITS_PER_UNIT * 16}. @end defmac @defmac LIBGCC2_GNU_PREFIX This macro corresponds to the @code{TARGET_LIBFUNC_GNU_PREFIX} target hook and should be defined if that hook is overriden to be true. It causes function names in libgcc to be changed to use a @code{__gnu_} prefix for their name rather than the default @code{__}. A port which uses this macro should also arrange to use @file{t-gnu-prefix} in the libgcc @file{config.host}. @end defmac @defmac WIDEST_HARDWARE_FP_SIZE A C expression for the size in bits of the widest floating-point format supported by the hardware. If you define this macro, you must specify a value less than or equal to the value of @code{LONG_DOUBLE_TYPE_SIZE}. If you do not define this macro, the value of @code{LONG_DOUBLE_TYPE_SIZE} is the default. @end defmac @defmac DEFAULT_SIGNED_CHAR An expression whose value is 1 or 0, according to whether the type @code{char} should be signed or unsigned by default. The user can always override this default with the options @option{-fsigned-char} and @option{-funsigned-char}. @end defmac @hook TARGET_DEFAULT_SHORT_ENUMS @defmac SIZE_TYPE A C expression for a string describing the name of the data type to use for size values. The typedef name @code{size_t} is defined using the contents of the string. The string can contain more than one keyword. If so, separate them with spaces, and write first any length keyword, then @code{unsigned} if appropriate, and finally @code{int}. The string must exactly match one of the data type names defined in the function @code{c_common_nodes_and_builtins} in the file @file{c-family/c-common.cc}. You may not omit @code{int} or change the order---that would cause the compiler to crash on startup. If you don't define this macro, the default is @code{"long unsigned int"}. @end defmac @defmac SIZETYPE GCC defines internal types (@code{sizetype}, @code{ssizetype}, @code{bitsizetype} and @code{sbitsizetype}) for expressions dealing with size. This macro is a C expression for a string describing the name of the data type from which the precision of @code{sizetype} is extracted. The string has the same restrictions as @code{SIZE_TYPE} string. If you don't define this macro, the default is @code{SIZE_TYPE}. @end defmac @defmac PTRDIFF_TYPE A C expression for a string describing the name of the data type to use for the result of subtracting two pointers. The typedef name @code{ptrdiff_t} is defined using the contents of the string. See @code{SIZE_TYPE} above for more information. If you don't define this macro, the default is @code{"long int"}. @end defmac @defmac WCHAR_TYPE A C expression for a string describing the name of the data type to use for wide characters. The typedef name @code{wchar_t} is defined using the contents of the string. See @code{SIZE_TYPE} above for more information. If you don't define this macro, the default is @code{"int"}. @end defmac @defmac WCHAR_TYPE_SIZE A C expression for the size in bits of the data type for wide characters. This is used in @code{cpp}, which cannot make use of @code{WCHAR_TYPE}. @end defmac @defmac WINT_TYPE A C expression for a string describing the name of the data type to use for wide characters passed to @code{printf} and returned from @code{getwc}. The typedef name @code{wint_t} is defined using the contents of the string. See @code{SIZE_TYPE} above for more information. If you don't define this macro, the default is @code{"unsigned int"}. @end defmac @defmac INTMAX_TYPE A C expression for a string describing the name of the data type that can represent any value of any standard or extended signed integer type. The typedef name @code{intmax_t} is defined using the contents of the string. See @code{SIZE_TYPE} above for more information. If you don't define this macro, the default is the first of @code{"int"}, @code{"long int"}, or @code{"long long int"} that has as much precision as @code{long long int}. @end defmac @defmac UINTMAX_TYPE A C expression for a string describing the name of the data type that can represent any value of any standard or extended unsigned integer type. The typedef name @code{uintmax_t} is defined using the contents of the string. See @code{SIZE_TYPE} above for more information. If you don't define this macro, the default is the first of @code{"unsigned int"}, @code{"long unsigned int"}, or @code{"long long unsigned int"} that has as much precision as @code{long long unsigned int}. @end defmac @defmac SIG_ATOMIC_TYPE @defmacx INT8_TYPE @defmacx INT16_TYPE @defmacx INT32_TYPE @defmacx INT64_TYPE @defmacx UINT8_TYPE @defmacx UINT16_TYPE @defmacx UINT32_TYPE @defmacx UINT64_TYPE @defmacx INT_LEAST8_TYPE @defmacx INT_LEAST16_TYPE @defmacx INT_LEAST32_TYPE @defmacx INT_LEAST64_TYPE @defmacx UINT_LEAST8_TYPE @defmacx UINT_LEAST16_TYPE @defmacx UINT_LEAST32_TYPE @defmacx UINT_LEAST64_TYPE @defmacx INT_FAST8_TYPE @defmacx INT_FAST16_TYPE @defmacx INT_FAST32_TYPE @defmacx INT_FAST64_TYPE @defmacx UINT_FAST8_TYPE @defmacx UINT_FAST16_TYPE @defmacx UINT_FAST32_TYPE @defmacx UINT_FAST64_TYPE @defmacx INTPTR_TYPE @defmacx UINTPTR_TYPE C expressions for the standard types @code{sig_atomic_t}, @code{int8_t}, @code{int16_t}, @code{int32_t}, @code{int64_t}, @code{uint8_t}, @code{uint16_t}, @code{uint32_t}, @code{uint64_t}, @code{int_least8_t}, @code{int_least16_t}, @code{int_least32_t}, @code{int_least64_t}, @code{uint_least8_t}, @code{uint_least16_t}, @code{uint_least32_t}, @code{uint_least64_t}, @code{int_fast8_t}, @code{int_fast16_t}, @code{int_fast32_t}, @code{int_fast64_t}, @code{uint_fast8_t}, @code{uint_fast16_t}, @code{uint_fast32_t}, @code{uint_fast64_t}, @code{intptr_t}, and @code{uintptr_t}. See @code{SIZE_TYPE} above for more information. If any of these macros evaluates to a null pointer, the corresponding type is not supported; if GCC is configured to provide @code{} in such a case, the header provided may not conform to C99, depending on the type in question. The defaults for all of these macros are null pointers. @end defmac @defmac TARGET_PTRMEMFUNC_VBIT_LOCATION The C++ compiler represents a pointer-to-member-function with a struct that looks like: @smallexample struct @{ union @{ void (*fn)(); ptrdiff_t vtable_index; @}; ptrdiff_t delta; @}; @end smallexample @noindent The C++ compiler must use one bit to indicate whether the function that will be called through a pointer-to-member-function is virtual. Normally, we assume that the low-order bit of a function pointer must always be zero. Then, by ensuring that the vtable_index is odd, we can distinguish which variant of the union is in use. But, on some platforms function pointers can be odd, and so this doesn't work. In that case, we use the low-order bit of the @code{delta} field, and shift the remainder of the @code{delta} field to the left. GCC will automatically make the right selection about where to store this bit using the @code{FUNCTION_BOUNDARY} setting for your platform. However, some platforms such as ARM/Thumb have @code{FUNCTION_BOUNDARY} set such that functions always start at even addresses, but the lowest bit of pointers to functions indicate whether the function at that address is in ARM or Thumb mode. If this is the case of your architecture, you should define this macro to @code{ptrmemfunc_vbit_in_delta}. In general, you should not have to define this macro. On architectures in which function addresses are always even, according to @code{FUNCTION_BOUNDARY}, GCC will automatically define this macro to @code{ptrmemfunc_vbit_in_pfn}. @end defmac @defmac TARGET_VTABLE_USES_DESCRIPTORS Normally, the C++ compiler uses function pointers in vtables. This macro allows the target to change to use ``function descriptors'' instead. Function descriptors are found on targets for whom a function pointer is actually a small data structure. Normally the data structure consists of the actual code address plus a data pointer to which the function's data is relative. If vtables are used, the value of this macro should be the number of words that the function descriptor occupies. @end defmac @defmac TARGET_VTABLE_ENTRY_ALIGN By default, the vtable entries are void pointers, the so the alignment is the same as pointer alignment. The value of this macro specifies the alignment of the vtable entry in bits. It should be defined only when special alignment is necessary. */ @end defmac @defmac TARGET_VTABLE_DATA_ENTRY_DISTANCE There are a few non-descriptor entries in the vtable at offsets below zero. If these entries must be padded (say, to preserve the alignment specified by @code{TARGET_VTABLE_ENTRY_ALIGN}), set this to the number of words in each data entry. @end defmac @node Registers @section Register Usage @cindex register usage This section explains how to describe what registers the target machine has, and how (in general) they can be used. The description of which registers a specific instruction can use is done with register classes; see @ref{Register Classes}. For information on using registers to access a stack frame, see @ref{Frame Registers}. For passing values in registers, see @ref{Register Arguments}. For returning values in registers, see @ref{Scalar Return}. @menu * Register Basics:: Number and kinds of registers. * Allocation Order:: Order in which registers are allocated. * Values in Registers:: What kinds of values each reg can hold. * Leaf Functions:: Renumbering registers for leaf functions. * Stack Registers:: Handling a register stack such as 80387. @end menu @node Register Basics @subsection Basic Characteristics of Registers @c prevent bad page break with this line Registers have various characteristics. @defmac FIRST_PSEUDO_REGISTER Number of hardware registers known to the compiler. They receive numbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the first pseudo register's number really is assigned the number @code{FIRST_PSEUDO_REGISTER}. @end defmac @defmac FIXED_REGISTERS @cindex fixed register An initializer that says which registers are used for fixed purposes all throughout the compiled code and are therefore not available for general allocation. These would include the stack pointer, the frame pointer (except on machines where that can be used as a general register when no frame pointer is needed), the program counter on machines where that is considered one of the addressable registers, and any other numbered register with a standard use. This information is expressed as a sequence of numbers, separated by commas and surrounded by braces. The @var{n}th number is 1 if register @var{n} is fixed, 0 otherwise. The table initialized from this macro, and the table initialized by the following one, may be overridden at run time either automatically, by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or by the user with the command options @option{-ffixed-@var{reg}}, @option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}}. @end defmac @defmac CALL_USED_REGISTERS @cindex call-used register @cindex call-clobbered register @cindex call-saved register Like @code{FIXED_REGISTERS} but has 1 for each register that is clobbered (in general) by function calls as well as for fixed registers. This macro therefore identifies the registers that are not available for general allocation of values that must live across function calls. If a register has 0 in @code{CALL_USED_REGISTERS}, the compiler automatically saves it on function entry and restores it on function exit, if the register is used within the function. Exactly one of @code{CALL_USED_REGISTERS} and @code{CALL_REALLY_USED_REGISTERS} must be defined. Modern ports should define @code{CALL_REALLY_USED_REGISTERS}. @end defmac @defmac CALL_REALLY_USED_REGISTERS @cindex call-used register @cindex call-clobbered register @cindex call-saved register Like @code{CALL_USED_REGISTERS} except this macro doesn't require that the entire set of @code{FIXED_REGISTERS} be included. (@code{CALL_USED_REGISTERS} must be a superset of @code{FIXED_REGISTERS}). Exactly one of @code{CALL_USED_REGISTERS} and @code{CALL_REALLY_USED_REGISTERS} must be defined. Modern ports should define @code{CALL_REALLY_USED_REGISTERS}. @end defmac @cindex call-used register @cindex call-clobbered register @cindex call-saved register @hook TARGET_FNTYPE_ABI @hook TARGET_INSN_CALLEE_ABI @cindex call-used register @cindex call-clobbered register @cindex call-saved register @hook TARGET_HARD_REGNO_CALL_PART_CLOBBERED @hook TARGET_GET_MULTILIB_ABI_NAME @findex fixed_regs @findex call_used_regs @findex global_regs @findex reg_names @findex reg_class_contents @hook TARGET_CONDITIONAL_REGISTER_USAGE @defmac INCOMING_REGNO (@var{out}) Define this macro if the target machine has register windows. This C expression returns the register number as seen by the called function corresponding to the register number @var{out} as seen by the calling function. Return @var{out} if register number @var{out} is not an outbound register. @end defmac @defmac OUTGOING_REGNO (@var{in}) Define this macro if the target machine has register windows. This C expression returns the register number as seen by the calling function corresponding to the register number @var{in} as seen by the called function. Return @var{in} if register number @var{in} is not an inbound register. @end defmac @defmac LOCAL_REGNO (@var{regno}) Define this macro if the target machine has register windows. This C expression returns true if the register is call-saved but is in the register window. Unlike most call-saved registers, such registers need not be explicitly restored on function exit or during non-local gotos. @end defmac @defmac PC_REGNUM If the program counter has a register number, define this as that register number. Otherwise, do not define it. @end defmac @node Allocation Order @subsection Order of Allocation of Registers @cindex order of register allocation @cindex register allocation order @c prevent bad page break with this line Registers are allocated in order. @defmac REG_ALLOC_ORDER If defined, an initializer for a vector of integers, containing the numbers of hard registers in the order in which GCC should prefer to use them (from most preferred to least). If this macro is not defined, registers are used lowest numbered first (all else being equal). One use of this macro is on machines where the highest numbered registers must always be saved and the save-multiple-registers instruction supports only sequences of consecutive registers. On such machines, define @code{REG_ALLOC_ORDER} to be an initializer that lists the highest numbered allocable register first. @end defmac @defmac ADJUST_REG_ALLOC_ORDER A C statement (sans semicolon) to choose the order in which to allocate hard registers for pseudo-registers local to a basic block. Store the desired register order in the array @code{reg_alloc_order}. Element 0 should be the register to allocate first; element 1, the next register; and so on. The macro body should not assume anything about the contents of @code{reg_alloc_order} before execution of the macro. On most machines, it is not necessary to define this macro. @end defmac @defmac HONOR_REG_ALLOC_ORDER Normally, IRA tries to estimate the costs for saving a register in the prologue and restoring it in the epilogue. This discourages it from using call-saved registers. If a machine wants to ensure that IRA allocates registers in the order given by REG_ALLOC_ORDER even if some call-saved registers appear earlier than call-used ones, then define this macro as a C expression to nonzero. Default is 0. @end defmac @defmac IRA_HARD_REGNO_ADD_COST_MULTIPLIER (@var{regno}) In some case register allocation order is not enough for the Integrated Register Allocator (@acronym{IRA}) to generate a good code. If this macro is defined, it should return a floating point value based on @var{regno}. The cost of using @var{regno} for a pseudo will be increased by approximately the pseudo's usage frequency times the value returned by this macro. Not defining this macro is equivalent to having it always return @code{0.0}. On most machines, it is not necessary to define this macro. @end defmac @node Values in Registers @subsection How Values Fit in Registers This section discusses the macros that describe which kinds of values (specifically, which machine modes) each register can hold, and how many consecutive registers are needed for a given mode. @hook TARGET_HARD_REGNO_NREGS @defmac HARD_REGNO_NREGS_HAS_PADDING (@var{regno}, @var{mode}) A C expression that is nonzero if a value of mode @var{mode}, stored in memory, ends with padding that causes it to take up more space than in registers starting at register number @var{regno} (as determined by multiplying GCC's notion of the size of the register when containing this mode by the number of registers returned by @code{TARGET_HARD_REGNO_NREGS}). By default this is zero. For example, if a floating-point value is stored in three 32-bit registers but takes up 128 bits in memory, then this would be nonzero. This macros only needs to be defined if there are cases where @code{subreg_get_info} would otherwise wrongly determine that a @code{subreg} can be represented by an offset to the register number, when in fact such a @code{subreg} would contain some of the padding not stored in registers and so not be representable. @end defmac @defmac HARD_REGNO_NREGS_WITH_PADDING (@var{regno}, @var{mode}) For values of @var{regno} and @var{mode} for which @code{HARD_REGNO_NREGS_HAS_PADDING} returns nonzero, a C expression returning the greater number of registers required to hold the value including any padding. In the example above, the value would be four. @end defmac @defmac REGMODE_NATURAL_SIZE (@var{mode}) Define this macro if the natural size of registers that hold values of mode @var{mode} is not the word size. It is a C expression that should give the natural size in bytes for the specified mode. It is used by the register allocator to try to optimize its results. This happens for example on SPARC 64-bit where the natural size of floating-point registers is still 32-bit. @end defmac @hook TARGET_HARD_REGNO_MODE_OK @defmac HARD_REGNO_RENAME_OK (@var{from}, @var{to}) A C expression that is nonzero if it is OK to rename a hard register @var{from} to another hard register @var{to}. One common use of this macro is to prevent renaming of a register to another register that is not saved by a prologue in an interrupt handler. The default is always nonzero. @end defmac @hook TARGET_MODES_TIEABLE_P @hook TARGET_HARD_REGNO_SCRATCH_OK @defmac AVOID_CCMODE_COPIES Define this macro if the compiler should avoid copies to/from @code{CCmode} registers. You should only define this macro if support for copying to/from @code{CCmode} is incomplete. @end defmac @node Leaf Functions @subsection Handling Leaf Functions @cindex leaf functions @cindex functions, leaf On some machines, a leaf function (i.e., one which makes no calls) can run more efficiently if it does not make its own register window. Often this means it is required to receive its arguments in the registers where they are passed by the caller, instead of the registers where they would normally arrive. The special treatment for leaf functions generally applies only when other conditions are met; for example, often they may use only those registers for its own variables and temporaries. We use the term ``leaf function'' to mean a function that is suitable for this special handling, so that functions with no calls are not necessarily ``leaf functions''. GCC assigns register numbers before it knows whether the function is suitable for leaf function treatment. So it needs to renumber the registers in order to output a leaf function. The following macros accomplish this. @defmac LEAF_REGISTERS Name of a char vector, indexed by hard register number, which contains 1 for a register that is allowable in a candidate for leaf function treatment. If leaf function treatment involves renumbering the registers, then the registers marked here should be the ones before renumbering---those that GCC would ordinarily allocate. The registers which will actually be used in the assembler code, after renumbering, should not be marked with 1 in this vector. Define this macro only if the target machine offers a way to optimize the treatment of leaf functions. @end defmac @defmac LEAF_REG_REMAP (@var{regno}) A C expression whose value is the register number to which @var{regno} should be renumbered, when a function is treated as a leaf function. If @var{regno} is a register number which should not appear in a leaf function before renumbering, then the expression should yield @minus{}1, which will cause the compiler to abort. Define this macro only if the target machine offers a way to optimize the treatment of leaf functions, and registers need to be renumbered to do this. @end defmac @findex current_function_is_leaf @findex current_function_uses_only_leaf_regs @code{TARGET_ASM_FUNCTION_PROLOGUE} and @code{TARGET_ASM_FUNCTION_EPILOGUE} must usually treat leaf functions specially. They can test the C variable @code{current_function_is_leaf} which is nonzero for leaf functions. @code{current_function_is_leaf} is set prior to local register allocation and is valid for the remaining compiler passes. They can also test the C variable @code{current_function_uses_only_leaf_regs} which is nonzero for leaf functions which only use leaf registers. @code{current_function_uses_only_leaf_regs} is valid after all passes that modify the instructions have been run and is only useful if @code{LEAF_REGISTERS} is defined. @c changed this to fix overfull. ALSO: why the "it" at the beginning @c of the next paragraph?! --mew 2feb93 @node Stack Registers @subsection Registers That Form a Stack There are special features to handle computers where some of the ``registers'' form a stack. Stack registers are normally written by pushing onto the stack, and are numbered relative to the top of the stack. Currently, GCC can only handle one group of stack-like registers, and they must be consecutively numbered. Furthermore, the existing support for stack-like registers is specific to the 80387 floating point coprocessor. If you have a new architecture that uses stack-like registers, you will need to do substantial work on @file{reg-stack.cc} and write your machine description to cooperate with it, as well as defining these macros. @defmac STACK_REGS Define this if the machine has any stack-like registers. @end defmac @defmac STACK_REG_COVER_CLASS This is a cover class containing the stack registers. Define this if the machine has any stack-like registers. @end defmac @defmac FIRST_STACK_REG The number of the first stack-like register. This one is the top of the stack. @end defmac @defmac LAST_STACK_REG The number of the last stack-like register. This one is the bottom of the stack. @end defmac @node Register Classes @section Register Classes @cindex register class definitions @cindex class definitions, register On many machines, the numbered registers are not all equivalent. For example, certain registers may not be allowed for indexed addressing; certain registers may not be allowed in some instructions. These machine restrictions are described to the compiler using @dfn{register classes}. You define a number of register classes, giving each one a name and saying which of the registers belong to it. Then you can specify register classes that are allowed as operands to particular instruction patterns. @findex ALL_REGS @findex NO_REGS In general, each register will belong to several classes. In fact, one class must be named @code{ALL_REGS} and contain all the registers. Another class must be named @code{NO_REGS} and contain no registers. Often the union of two classes will be another class; however, this is not required. @findex GENERAL_REGS One of the classes must be named @code{GENERAL_REGS}. There is nothing terribly special about the name, but the operand constraint letters @samp{r} and @samp{g} specify this class. If @code{GENERAL_REGS} is the same as @code{ALL_REGS}, just define it as a macro which expands to @code{ALL_REGS}. Order the classes so that if class @var{x} is contained in class @var{y} then @var{x} has a lower class number than @var{y}. The way classes other than @code{GENERAL_REGS} are specified in operand constraints is through machine-dependent operand constraint letters. You can define such letters to correspond to various classes, then use them in operand constraints. You must define the narrowest register classes for allocatable registers, so that each class either has no subclasses, or that for some mode, the move cost between registers within the class is cheaper than moving a register in the class to or from memory (@pxref{Costs}). You should define a class for the union of two classes whenever some instruction allows both classes. For example, if an instruction allows either a floating point (coprocessor) register or a general register for a certain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS} which includes both of them. Otherwise you will get suboptimal code, or even internal compiler errors when reload cannot find a register in the class computed via @code{reg_class_subunion}. You must also specify certain redundant information about the register classes: for each class, which classes contain it and which ones are contained in it; for each pair of classes, the largest class contained in their union. When a value occupying several consecutive registers is expected in a certain class, all the registers used must belong to that class. Therefore, register classes cannot be used to enforce a requirement for a register pair to start with an even-numbered register. The way to specify this requirement is with @code{TARGET_HARD_REGNO_MODE_OK}. Register classes used for input-operands of bitwise-and or shift instructions have a special requirement: each such class must have, for each fixed-point machine mode, a subclass whose registers can transfer that mode to or from memory. For example, on some machines, the operations for single-byte values (@code{QImode}) are limited to certain registers. When this is so, each register class that is used in a bitwise-and or shift instruction must have a subclass consisting of registers from which single-byte values can be loaded or stored. This is so that @code{PREFERRED_RELOAD_CLASS} can always have a possible value to return. @deftp {Data type} {enum reg_class} An enumerated type that must be defined with all the register class names as enumerated values. @code{NO_REGS} must be first. @code{ALL_REGS} must be the last register class, followed by one more enumerated value, @code{LIM_REG_CLASSES}, which is not a register class but rather tells how many classes there are. Each register class has a number, which is the value of casting the class name to type @code{int}. The number serves as an index in many of the tables described below. @end deftp @defmac N_REG_CLASSES The number of distinct register classes, defined as follows: @smallexample #define N_REG_CLASSES (int) LIM_REG_CLASSES @end smallexample @end defmac @defmac REG_CLASS_NAMES An initializer containing the names of the register classes as C string constants. These names are used in writing some of the debugging dumps. @end defmac @defmac REG_CLASS_CONTENTS An initializer containing the contents of the register classes, as integers which are bit masks. The @var{n}th integer specifies the contents of class @var{n}. The way the integer @var{mask} is interpreted is that register @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1. When the machine has more than 32 registers, an integer does not suffice. Then the integers are replaced by sub-initializers, braced groupings containing several integers. Each sub-initializer must be suitable as an initializer for the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}. In this situation, the first integer in each sub-initializer corresponds to registers 0 through 31, the second integer to registers 32 through 63, and so on. @end defmac @defmac REGNO_REG_CLASS (@var{regno}) A C expression whose value is a register class containing hard register @var{regno}. In general there is more than one such class; choose a class which is @dfn{minimal}, meaning that no smaller class also contains the register. @end defmac @defmac BASE_REG_CLASS A macro whose definition is the name of the class to which a valid base register must belong. A base register is one used in an address which is the register value plus a displacement. @end defmac @defmac MODE_BASE_REG_CLASS (@var{mode}) This is a variation of the @code{BASE_REG_CLASS} macro which allows the selection of a base register in a mode dependent manner. If @var{mode} is VOIDmode then it should return the same value as @code{BASE_REG_CLASS}. @end defmac @defmac MODE_BASE_REG_REG_CLASS (@var{mode}) A C expression whose value is the register class to which a valid base register must belong in order to be used in a base plus index register address. You should define this macro if base plus index addresses have different requirements than other base register uses. @end defmac @defmac MODE_CODE_BASE_REG_CLASS (@var{mode}, @var{address_space}, @var{outer_code}, @var{index_code}) A C expression whose value is the register class to which a valid base register for a memory reference in mode @var{mode} to address space @var{address_space} must belong. @var{outer_code} and @var{index_code} define the context in which the base register occurs. @var{outer_code} is the code of the immediately enclosing expression (@code{MEM} for the top level of an address, @code{ADDRESS} for something that occurs in an @code{address_operand}). @var{index_code} is the code of the corresponding index expression if @var{outer_code} is @code{PLUS}; @code{SCRATCH} otherwise. @end defmac @defmac INDEX_REG_CLASS A macro whose definition is the name of the class to which a valid index register must belong. An index register is one used in an address where its value is either multiplied by a scale factor or added to another register (as well as added to a displacement). @end defmac @defmac REGNO_OK_FOR_BASE_P (@var{num}) A C expression which is nonzero if register number @var{num} is suitable for use as a base register in operand addresses. @end defmac @defmac REGNO_MODE_OK_FOR_BASE_P (@var{num}, @var{mode}) A C expression that is just like @code{REGNO_OK_FOR_BASE_P}, except that that expression may examine the mode of the memory reference in @var{mode}. You should define this macro if the mode of the memory reference affects whether a register may be used as a base register. If you define this macro, the compiler will use it instead of @code{REGNO_OK_FOR_BASE_P}. The mode may be @code{VOIDmode} for addresses that appear outside a @code{MEM}, i.e., as an @code{address_operand}. @end defmac @defmac REGNO_MODE_OK_FOR_REG_BASE_P (@var{num}, @var{mode}) A C expression which is nonzero if register number @var{num} is suitable for use as a base register in base plus index operand addresses, accessing memory in mode @var{mode}. It may be either a suitable hard register or a pseudo register that has been allocated such a hard register. You should define this macro if base plus index addresses have different requirements than other base register uses. Use of this macro is deprecated; please use the more general @code{REGNO_MODE_CODE_OK_FOR_BASE_P}. @end defmac @defmac REGNO_MODE_CODE_OK_FOR_BASE_P (@var{num}, @var{mode}, @var{address_space}, @var{outer_code}, @var{index_code}) A C expression which is nonzero if register number @var{num} is suitable for use as a base register in operand addresses, accessing memory in mode @var{mode} in address space @var{address_space}. This is similar to @code{REGNO_MODE_OK_FOR_BASE_P}, except that that expression may examine the context in which the register appears in the memory reference. @var{outer_code} is the code of the immediately enclosing expression (@code{MEM} if at the top level of the address, @code{ADDRESS} for something that occurs in an @code{address_operand}). @var{index_code} is the code of the corresponding index expression if @var{outer_code} is @code{PLUS}; @code{SCRATCH} otherwise. The mode may be @code{VOIDmode} for addresses that appear outside a @code{MEM}, i.e., as an @code{address_operand}. @end defmac @defmac REGNO_OK_FOR_INDEX_P (@var{num}) A C expression which is nonzero if register number @var{num} is suitable for use as an index register in operand addresses. It may be either a suitable hard register or a pseudo register that has been allocated such a hard register. The difference between an index register and a base register is that the index register may be scaled. If an address involves the sum of two registers, neither one of them scaled, then either one may be labeled the ``base'' and the other the ``index''; but whichever labeling is used must fit the machine's constraints of which registers may serve in each capacity. The compiler will try both labelings, looking for one that is valid, and will reload one or both registers only if neither labeling works. @end defmac @hook TARGET_PREFERRED_RENAME_CLASS @hook TARGET_PREFERRED_RELOAD_CLASS @defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class}) A C expression that places additional restrictions on the register class to use when it is necessary to copy value @var{x} into a register in class @var{class}. The value is a register class; perhaps @var{class}, or perhaps another, smaller class. On many machines, the following definition is safe: @smallexample #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS @end smallexample Sometimes returning a more restrictive class makes better code. For example, on the 68000, when @var{x} is an integer constant that is in range for a @samp{moveq} instruction, the value of this macro is always @code{DATA_REGS} as long as @var{class} includes the data registers. Requiring a data register guarantees that a @samp{moveq} will be used. One case where @code{PREFERRED_RELOAD_CLASS} must not return @var{class} is if @var{x} is a legitimate constant which cannot be loaded into some register class. By returning @code{NO_REGS} you can force @var{x} into a memory location. For example, rs6000 can load immediate values into general-purpose registers, but does not have an instruction for loading an immediate value into a floating-point register, so @code{PREFERRED_RELOAD_CLASS} returns @code{NO_REGS} when @var{x} is a floating-point constant. If the constant cannot be loaded into any kind of register, code generation will be better if @code{TARGET_LEGITIMATE_CONSTANT_P} makes the constant illegitimate instead of using @code{TARGET_PREFERRED_RELOAD_CLASS}. If an insn has pseudos in it after register allocation, reload will go through the alternatives and call repeatedly @code{PREFERRED_RELOAD_CLASS} to find the best one. Returning @code{NO_REGS}, in this case, makes reload add a @code{!} in front of the constraint: the x86 back-end uses this feature to discourage usage of 387 registers when math is done in the SSE registers (and vice versa). @end defmac @hook TARGET_PREFERRED_OUTPUT_RELOAD_CLASS @defmac LIMIT_RELOAD_CLASS (@var{mode}, @var{class}) A C expression that places additional restrictions on the register class to use when it is necessary to be able to hold a value of mode @var{mode} in a reload register for which class @var{class} would ordinarily be used. Unlike @code{PREFERRED_RELOAD_CLASS}, this macro should be used when there are certain modes that simply cannot go in certain reload classes. The value is a register class; perhaps @var{class}, or perhaps another, smaller class. Don't define this macro unless the target machine has limitations which require the macro to do something nontrivial. @end defmac @hook TARGET_SECONDARY_RELOAD @defmac SECONDARY_RELOAD_CLASS (@var{class}, @var{mode}, @var{x}) @defmacx SECONDARY_INPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x}) @defmacx SECONDARY_OUTPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x}) These macros are obsolete, new ports should use the target hook @code{TARGET_SECONDARY_RELOAD} instead. These are obsolete macros, replaced by the @code{TARGET_SECONDARY_RELOAD} target hook. Older ports still define these macros to indicate to the reload phase that it may need to allocate at least one register for a reload in addition to the register to contain the data. Specifically, if copying @var{x} to a register @var{class} in @var{mode} requires an intermediate register, you were supposed to define @code{SECONDARY_INPUT_RELOAD_CLASS} to return the largest register class all of whose registers can be used as intermediate registers or scratch registers. If copying a register @var{class} in @var{mode} to @var{x} requires an intermediate or scratch register, @code{SECONDARY_OUTPUT_RELOAD_CLASS} was supposed to be defined be defined to return the largest register class required. If the requirements for input and output reloads were the same, the macro @code{SECONDARY_RELOAD_CLASS} should have been used instead of defining both macros identically. The values returned by these macros are often @code{GENERAL_REGS}. Return @code{NO_REGS} if no spare register is needed; i.e., if @var{x} can be directly copied to or from a register of @var{class} in @var{mode} without requiring a scratch register. Do not define this macro if it would always return @code{NO_REGS}. If a scratch register is required (either with or without an intermediate register), you were supposed to define patterns for @samp{reload_in@var{m}} or @samp{reload_out@var{m}}, as required (@pxref{Standard Names}. These patterns, which were normally implemented with a @code{define_expand}, should be similar to the @samp{mov@var{m}} patterns, except that operand 2 is the scratch register. These patterns need constraints for the reload register and scratch register that contain a single register class. If the original reload register (whose class is @var{class}) can meet the constraint given in the pattern, the value returned by these macros is used for the class of the scratch register. Otherwise, two additional reload registers are required. Their classes are obtained from the constraints in the insn pattern. @var{x} might be a pseudo-register or a @code{subreg} of a pseudo-register, which could either be in a hard register or in memory. Use @code{true_regnum} to find out; it will return @minus{}1 if the pseudo is in memory and the hard register number if it is in a register. These macros should not be used in the case where a particular class of registers can only be copied to memory and not to another class of registers. In that case, secondary reload registers are not needed and would not be helpful. Instead, a stack location must be used to perform the copy and the @code{mov@var{m}} pattern should use memory as an intermediate storage. This case often occurs between floating-point and general registers. @end defmac @hook TARGET_SECONDARY_MEMORY_NEEDED @defmac SECONDARY_MEMORY_NEEDED_RTX (@var{mode}) Normally when @code{TARGET_SECONDARY_MEMORY_NEEDED} is defined, the compiler allocates a stack slot for a memory location needed for register copies. If this macro is defined, the compiler instead uses the memory location defined by this macro. Do not define this macro if you do not define @code{TARGET_SECONDARY_MEMORY_NEEDED}. @end defmac @hook TARGET_SECONDARY_MEMORY_NEEDED_MODE @hook TARGET_SELECT_EARLY_REMAT_MODES @hook TARGET_CLASS_LIKELY_SPILLED_P @hook TARGET_CLASS_MAX_NREGS @defmac CLASS_MAX_NREGS (@var{class}, @var{mode}) A C expression for the maximum number of consecutive registers of class @var{class} needed to hold a value of mode @var{mode}. This is closely related to the macro @code{TARGET_HARD_REGNO_NREGS}. In fact, the value of the macro @code{CLASS_MAX_NREGS (@var{class}, @var{mode})} should be the maximum value of @code{TARGET_HARD_REGNO_NREGS (@var{regno}, @var{mode})} for all @var{regno} values in the class @var{class}. This macro helps control the handling of multiple-word values in the reload pass. @end defmac @hook TARGET_CAN_CHANGE_MODE_CLASS @hook TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS @hook TARGET_LRA_P @hook TARGET_REGISTER_PRIORITY @hook TARGET_REGISTER_USAGE_LEVELING_P @hook TARGET_DIFFERENT_ADDR_DISPLACEMENT_P @hook TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P @hook TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT @hook TARGET_SPILL_CLASS @hook TARGET_ADDITIONAL_ALLOCNO_CLASS_P @hook TARGET_CSTORE_MODE @hook TARGET_COMPUTE_PRESSURE_CLASSES @node Stack and Calling @section Stack Layout and Calling Conventions @cindex calling conventions @c prevent bad page break with this line This describes the stack layout and calling conventions. @menu * Frame Layout:: * Exception Handling:: * Stack Checking:: * Frame Registers:: * Elimination:: * Stack Arguments:: * Register Arguments:: * Scalar Return:: * Aggregate Return:: * Caller Saves:: * Function Entry:: * Profiling:: * Tail Calls:: * Shrink-wrapping separate components:: * Stack Smashing Protection:: * Miscellaneous Register Hooks:: @end menu @node Frame Layout @subsection Basic Stack Layout @cindex stack frame layout @cindex frame layout @c prevent bad page break with this line Here is the basic stack layout. @defmac STACK_GROWS_DOWNWARD Define this macro to be true if pushing a word onto the stack moves the stack pointer to a smaller address, and false otherwise. @end defmac @defmac STACK_PUSH_CODE This macro defines the operation used when something is pushed on the stack. In RTL, a push operation will be @code{(set (mem (STACK_PUSH_CODE (reg sp))) @dots{})} The choices are @code{PRE_DEC}, @code{POST_DEC}, @code{PRE_INC}, and @code{POST_INC}. Which of these is correct depends on the stack direction and on whether the stack pointer points to the last item on the stack or whether it points to the space for the next item on the stack. The default is @code{PRE_DEC} when @code{STACK_GROWS_DOWNWARD} is true, which is almost always right, and @code{PRE_INC} otherwise, which is often wrong. @end defmac @defmac FRAME_GROWS_DOWNWARD Define this macro to nonzero value if the addresses of local variable slots are at negative offsets from the frame pointer. @end defmac @defmac ARGS_GROW_DOWNWARD Define this macro if successive arguments to a function occupy decreasing addresses on the stack. @end defmac @hook TARGET_STARTING_FRAME_OFFSET @defmac STACK_ALIGNMENT_NEEDED Define to zero to disable final alignment of the stack during reload. The nonzero default for this macro is suitable for most ports. On ports where @code{TARGET_STARTING_FRAME_OFFSET} is nonzero or where there is a register save block following the local block that doesn't require alignment to @code{STACK_BOUNDARY}, it may be beneficial to disable stack alignment and do it in the backend. @end defmac @defmac STACK_POINTER_OFFSET Offset from the stack pointer register to the first location at which outgoing arguments are placed. If not specified, the default value of zero is used. This is the proper value for most machines. If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above the first location at which outgoing arguments are placed. @end defmac @defmac FIRST_PARM_OFFSET (@var{fundecl}) Offset from the argument pointer register to the first argument's address. On some machines it may depend on the data type of the function. If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above the first argument's address. @end defmac @defmac STACK_DYNAMIC_OFFSET (@var{fundecl}) Offset from the stack pointer register to an item dynamically allocated on the stack, e.g., by @code{alloca}. The default value for this macro is @code{STACK_POINTER_OFFSET} plus the length of the outgoing arguments. The default is correct for most machines. See @file{function.cc} for details. @end defmac @defmac INITIAL_FRAME_ADDRESS_RTX A C expression whose value is RTL representing the address of the initial stack frame. This address is passed to @code{RETURN_ADDR_RTX} and @code{DYNAMIC_CHAIN_ADDRESS}. If you don't define this macro, a reasonable default value will be used. Define this macro in order to make frame pointer elimination work in the presence of @code{__builtin_frame_address (count)} and @code{__builtin_return_address (count)} for @code{count} not equal to zero. @end defmac @defmac DYNAMIC_CHAIN_ADDRESS (@var{frameaddr}) A C expression whose value is RTL representing the address in a stack frame where the pointer to the caller's frame is stored. Assume that @var{frameaddr} is an RTL expression for the address of the stack frame itself. If you don't define this macro, the default is to return the value of @var{frameaddr}---that is, the stack frame address is also the address of the stack word that points to the previous frame. @end defmac @defmac SETUP_FRAME_ADDRESSES A C expression that produces the machine-specific code to setup the stack so that arbitrary frames can be accessed. For example, on the SPARC, we must flush all of the register windows to the stack before we can access arbitrary stack frames. You will seldom need to define this macro. The default is to do nothing. @end defmac @hook TARGET_BUILTIN_SETJMP_FRAME_VALUE @defmac FRAME_ADDR_RTX (@var{frameaddr}) A C expression whose value is RTL representing the value of the frame address for the current frame. @var{frameaddr} is the frame pointer of the current frame. This is used for __builtin_frame_address. You need only define this macro if the frame address is not the same as the frame pointer. Most machines do not need to define it. @end defmac @defmac RETURN_ADDR_RTX (@var{count}, @var{frameaddr}) A C expression whose value is RTL representing the value of the return address for the frame @var{count} steps up from the current frame, after the prologue. @var{frameaddr} is the frame pointer of the @var{count} frame, or the frame pointer of the @var{count} @minus{} 1 frame if @code{RETURN_ADDR_IN_PREVIOUS_FRAME} is nonzero. The value of the expression must always be the correct address when @var{count} is zero, but may be @code{NULL_RTX} if there is no way to determine the return address of other frames. @end defmac @defmac RETURN_ADDR_IN_PREVIOUS_FRAME Define this macro to nonzero value if the return address of a particular stack frame is accessed from the frame pointer of the previous stack frame. The zero default for this macro is suitable for most ports. @end defmac @defmac INCOMING_RETURN_ADDR_RTX A C expression whose value is RTL representing the location of the incoming return address at the beginning of any function, before the prologue. This RTL is either a @code{REG}, indicating that the return value is saved in @samp{REG}, or a @code{MEM} representing a location in the stack. You only need to define this macro if you want to support call frame debugging information like that provided by DWARF 2. If this RTL is a @code{REG}, you should also define @code{DWARF_FRAME_RETURN_COLUMN} to @code{DWARF_FRAME_REGNUM (REGNO)}. @end defmac @defmac DWARF_ALT_FRAME_RETURN_COLUMN A C expression whose value is an integer giving a DWARF 2 column number that may be used as an alternative return column. The column must not correspond to any gcc hard register (that is, it must not be in the range of @code{DWARF_FRAME_REGNUM}). This macro can be useful if @code{DWARF_FRAME_RETURN_COLUMN} is set to a general register, but an alternative column needs to be used for signal frames. Some targets have also used different frame return columns over time. @end defmac @defmac DWARF_ZERO_REG A C expression whose value is an integer giving a DWARF 2 register number that is considered to always have the value zero. This should only be defined if the target has an architected zero register, and someone decided it was a good idea to use that register number to terminate the stack backtrace. New ports should avoid this. @end defmac @hook TARGET_DWARF_HANDLE_FRAME_UNSPEC @hook TARGET_DWARF_POLY_INDETERMINATE_VALUE @defmac INCOMING_FRAME_SP_OFFSET A C expression whose value is an integer giving the offset, in bytes, from the value of the stack pointer register to the top of the stack frame at the beginning of any function, before the prologue. The top of the frame is defined to be the value of the stack pointer in the previous frame, just before the call instruction. You only need to define this macro if you want to support call frame debugging information like that provided by DWARF 2. @end defmac @defmac DEFAULT_INCOMING_FRAME_SP_OFFSET Like @code{INCOMING_FRAME_SP_OFFSET}, but must be the same for all functions of the same ABI, and when using GAS @code{.cfi_*} directives must also agree with the default CFI GAS emits. Define this macro only if @code{INCOMING_FRAME_SP_OFFSET} can have different values between different functions of the same ABI or when @code{INCOMING_FRAME_SP_OFFSET} does not agree with GAS default CFI. @end defmac @defmac ARG_POINTER_CFA_OFFSET (@var{fundecl}) A C expression whose value is an integer giving the offset, in bytes, from the argument pointer to the canonical frame address (cfa). The final value should coincide with that calculated by @code{INCOMING_FRAME_SP_OFFSET}. Which is unfortunately not usable during virtual register instantiation. The default value for this macro is @code{FIRST_PARM_OFFSET (fundecl) + crtl->args.pretend_args_size}, which is correct for most machines; in general, the arguments are found immediately before the stack frame. Note that this is not the case on some targets that save registers into the caller's frame, such as SPARC and rs6000, and so such targets need to define this macro. You only need to define this macro if the default is incorrect, and you want to support call frame debugging information like that provided by DWARF 2. @end defmac @defmac FRAME_POINTER_CFA_OFFSET (@var{fundecl}) If defined, a C expression whose value is an integer giving the offset in bytes from the frame pointer to the canonical frame address (cfa). The final value should coincide with that calculated by @code{INCOMING_FRAME_SP_OFFSET}. Normally the CFA is calculated as an offset from the argument pointer, via @code{ARG_POINTER_CFA_OFFSET}, but if the argument pointer is variable due to the ABI, this may not be possible. If this macro is defined, it implies that the virtual register instantiation should be based on the frame pointer instead of the argument pointer. Only one of @code{FRAME_POINTER_CFA_OFFSET} and @code{ARG_POINTER_CFA_OFFSET} should be defined. @end defmac @defmac CFA_FRAME_BASE_OFFSET (@var{fundecl}) If defined, a C expression whose value is an integer giving the offset in bytes from the canonical frame address (cfa) to the frame base used in DWARF 2 debug information. The default is zero. A different value may reduce the size of debug information on some ports. @end defmac @node Exception Handling @subsection Exception Handling Support @cindex exception handling @defmac EH_RETURN_DATA_REGNO (@var{N}) A C expression whose value is the @var{N}th register number used for data by exception handlers, or @code{INVALID_REGNUM} if fewer than @var{N} registers are usable. The exception handling library routines communicate with the exception handlers via a set of agreed upon registers. Ideally these registers should be call-clobbered; it is possible to use call-saved registers, but may negatively impact code size. The target must support at least 2 data registers, but should define 4 if there are enough free registers. You must define this macro if you want to support call frame exception handling like that provided by DWARF 2. @end defmac @defmac EH_RETURN_STACKADJ_RTX A C expression whose value is RTL representing a location in which to store a stack adjustment to be applied before function return. This is used to unwind the stack to an exception handler's call frame. It will be assigned zero on code paths that return normally. Typically this is a call-clobbered hard register that is otherwise untouched by the epilogue, but could also be a stack slot. Do not define this macro if the stack pointer is saved and restored by the regular prolog and epilog code in the call frame itself; in this case, the exception handling library routines will update the stack location to be restored in place. Otherwise, you must define this macro if you want to support call frame exception handling like that provided by DWARF 2. @end defmac @defmac EH_RETURN_HANDLER_RTX A C expression whose value is RTL representing a location in which to store the address of an exception handler to which we should return. It will not be assigned on code paths that return normally. Typically this is the location in the call frame at which the normal return address is stored. For targets that return by popping an address off the stack, this might be a memory address just below the @emph{target} call frame rather than inside the current call frame. If defined, @code{EH_RETURN_STACKADJ_RTX} will have already been assigned, so it may be used to calculate the location of the target call frame. Some targets have more complex requirements than storing to an address calculable during initial code generation. In that case the @code{eh_return} instruction pattern should be used instead. If you want to support call frame exception handling, you must define either this macro or the @code{eh_return} instruction pattern. @end defmac @defmac RETURN_ADDR_OFFSET If defined, an integer-valued C expression for which rtl will be generated to add it to the exception handler address before it is searched in the exception handling tables, and to subtract it again from the address before using it to return to the exception handler. @end defmac @defmac ASM_PREFERRED_EH_DATA_FORMAT (@var{code}, @var{global}) This macro chooses the encoding of pointers embedded in the exception handling sections. If at all possible, this should be defined such that the exception handling section will not require dynamic relocations, and so may be read-only. @var{code} is 0 for data, 1 for code labels, 2 for function pointers. @var{global} is true if the symbol may be affected by dynamic relocations. The macro should return a combination of the @code{DW_EH_PE_*} defines as found in @file{dwarf2.h}. If this macro is not defined, pointers will not be encoded but represented directly. @end defmac @defmac ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX (@var{file}, @var{encoding}, @var{size}, @var{addr}, @var{done}) This macro allows the target to emit whatever special magic is required to represent the encoding chosen by @code{ASM_PREFERRED_EH_DATA_FORMAT}. Generic code takes care of pc-relative and indirect encodings; this must be defined if the target uses text-relative or data-relative encodings. This is a C statement that branches to @var{done} if the format was handled. @var{encoding} is the format chosen, @var{size} is the number of bytes that the format occupies, @var{addr} is the @code{SYMBOL_REF} to be emitted. @end defmac @defmac MD_FALLBACK_FRAME_STATE_FOR (@var{context}, @var{fs}) This macro allows the target to add CPU and operating system specific code to the call-frame unwinder for use when there is no unwind data available. The most common reason to implement this macro is to unwind through signal frames. This macro is called from @code{uw_frame_state_for} in @file{unwind-dw2.c}, @file{unwind-dw2-xtensa.c} and @file{unwind-ia64.c}. @var{context} is an @code{_Unwind_Context}; @var{fs} is an @code{_Unwind_FrameState}. Examine @code{context->ra} for the address of the code being executed and @code{context->cfa} for the stack pointer value. If the frame can be decoded, the register save addresses should be updated in @var{fs} and the macro should evaluate to @code{_URC_NO_REASON}. If the frame cannot be decoded, the macro should evaluate to @code{_URC_END_OF_STACK}. For proper signal handling in Java this macro is accompanied by @code{MAKE_THROW_FRAME}, defined in @file{libjava/include/*-signal.h} headers. @end defmac @defmac MD_HANDLE_UNWABI (@var{context}, @var{fs}) This macro allows the target to add operating system specific code to the call-frame unwinder to handle the IA-64 @code{.unwabi} unwinding directive, usually used for signal or interrupt frames. This macro is called from @code{uw_update_context} in libgcc's @file{unwind-ia64.c}. @var{context} is an @code{_Unwind_Context}; @var{fs} is an @code{_Unwind_FrameState}. Examine @code{fs->unwabi} for the abi and context in the @code{.unwabi} directive. If the @code{.unwabi} directive can be handled, the register save addresses should be updated in @var{fs}. @end defmac @defmac TARGET_USES_WEAK_UNWIND_INFO A C expression that evaluates to true if the target requires unwind info to be given comdat linkage. Define it to be @code{1} if comdat linkage is necessary. The default is @code{0}. @end defmac @node Stack Checking @subsection Specifying How Stack Checking is Done GCC will check that stack references are within the boundaries of the stack, if the option @option{-fstack-check} is specified, in one of three ways: @enumerate @item If the value of the @code{STACK_CHECK_BUILTIN} macro is nonzero, GCC will assume that you have arranged for full stack checking to be done at appropriate places in the configuration files. GCC will not do other special processing. @item If @code{STACK_CHECK_BUILTIN} is zero and the value of the @code{STACK_CHECK_STATIC_BUILTIN} macro is nonzero, GCC will assume that you have arranged for static stack checking (checking of the static stack frame of functions) to be done at appropriate places in the configuration files. GCC will only emit code to do dynamic stack checking (checking on dynamic stack allocations) using the third approach below. @item If neither of the above are true, GCC will generate code to periodically ``probe'' the stack pointer using the values of the macros defined below. @end enumerate If neither STACK_CHECK_BUILTIN nor STACK_CHECK_STATIC_BUILTIN is defined, GCC will change its allocation strategy for large objects if the option @option{-fstack-check} is specified: they will always be allocated dynamically if their size exceeds @code{STACK_CHECK_MAX_VAR_SIZE} bytes. @defmac STACK_CHECK_BUILTIN A nonzero value if stack checking is done by the configuration files in a machine-dependent manner. You should define this macro if stack checking is required by the ABI of your machine or if you would like to do stack checking in some more efficient way than the generic approach. The default value of this macro is zero. @end defmac @defmac STACK_CHECK_STATIC_BUILTIN A nonzero value if static stack checking is done by the configuration files in a machine-dependent manner. You should define this macro if you would like to do static stack checking in some more efficient way than the generic approach. The default value of this macro is zero. @end defmac @defmac STACK_CHECK_PROBE_INTERVAL_EXP An integer specifying the interval at which GCC must generate stack probe instructions, defined as 2 raised to this integer. You will normally define this macro so that the interval be no larger than the size of the ``guard pages'' at the end of a stack area. The default value of 12 (4096-byte interval) is suitable for most systems. @end defmac @defmac STACK_CHECK_MOVING_SP An integer which is nonzero if GCC should move the stack pointer page by page when doing probes. This can be necessary on systems where the stack pointer contains the bottom address of the memory area accessible to the executing thread at any point in time. In this situation an alternate signal stack is required in order to be able to recover from a stack overflow. The default value of this macro is zero. @end defmac @defmac STACK_CHECK_PROTECT The number of bytes of stack needed to recover from a stack overflow, for languages where such a recovery is supported. The default value of 4KB/8KB with the @code{setjmp}/@code{longjmp}-based exception handling mechanism and 8KB/12KB with other exception handling mechanisms should be adequate for most architectures and operating systems. @end defmac The following macros are relevant only if neither STACK_CHECK_BUILTIN nor STACK_CHECK_STATIC_BUILTIN is defined; you can omit them altogether in the opposite case. @defmac STACK_CHECK_MAX_FRAME_SIZE The maximum size of a stack frame, in bytes. GCC will generate probe instructions in non-leaf functions to ensure at least this many bytes of stack are available. If a stack frame is larger than this size, stack checking will not be reliable and GCC will issue a warning. The default is chosen so that GCC only generates one instruction on most systems. You should normally not change the default value of this macro. @end defmac @defmac STACK_CHECK_FIXED_FRAME_SIZE GCC uses this value to generate the above warning message. It represents the amount of fixed frame used by a function, not including space for any callee-saved registers, temporaries and user variables. You need only specify an upper bound for this amount and will normally use the default of four words. @end defmac @defmac STACK_CHECK_MAX_VAR_SIZE The maximum size, in bytes, of an object that GCC will place in the fixed area of the stack frame when the user specifies @option{-fstack-check}. GCC computed the default from the values of the above macros and you will normally not need to override that default. @end defmac @hook TARGET_STACK_CLASH_PROTECTION_ALLOCA_PROBE_RANGE @need 2000 @node Frame Registers @subsection Registers That Address the Stack Frame @c prevent bad page break with this line This discusses registers that address the stack frame. @defmac STACK_POINTER_REGNUM The register number of the stack pointer register, which must also be a fixed register according to @code{FIXED_REGISTERS}. On most machines, the hardware determines which register this is. @end defmac @defmac FRAME_POINTER_REGNUM The register number of the frame pointer register, which is used to access automatic variables in the stack frame. On some machines, the hardware determines which register this is. On other machines, you can choose any register you wish for this purpose. @end defmac @defmac HARD_FRAME_POINTER_REGNUM On some machines the offset between the frame pointer and starting offset of the automatic variables is not known until after register allocation has been done (for example, because the saved registers are between these two locations). On those machines, define @code{FRAME_POINTER_REGNUM} the number of a special, fixed register to be used internally until the offset is known, and define @code{HARD_FRAME_POINTER_REGNUM} to be the actual hard register number used for the frame pointer. You should define this macro only in the very rare circumstances when it is not possible to calculate the offset between the frame pointer and the automatic variables until after register allocation has been completed. When this macro is defined, you must also indicate in your definition of @code{ELIMINABLE_REGS} how to eliminate @code{FRAME_POINTER_REGNUM} into either @code{HARD_FRAME_POINTER_REGNUM} or @code{STACK_POINTER_REGNUM}. Do not define this macro if it would be the same as @code{FRAME_POINTER_REGNUM}. @end defmac @defmac ARG_POINTER_REGNUM The register number of the arg pointer register, which is used to access the function's argument list. On some machines, this is the same as the frame pointer register. On some machines, the hardware determines which register this is. On other machines, you can choose any register you wish for this purpose. If this is not the same register as the frame pointer register, then you must mark it as a fixed register according to @code{FIXED_REGISTERS}, or arrange to be able to eliminate it (@pxref{Elimination}). @end defmac @defmac HARD_FRAME_POINTER_IS_FRAME_POINTER Define this to a preprocessor constant that is nonzero if @code{hard_frame_pointer_rtx} and @code{frame_pointer_rtx} should be the same. The default definition is @samp{(HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM)}; you only need to define this macro if that definition is not suitable for use in preprocessor conditionals. @end defmac @defmac HARD_FRAME_POINTER_IS_ARG_POINTER Define this to a preprocessor constant that is nonzero if @code{hard_frame_pointer_rtx} and @code{arg_pointer_rtx} should be the same. The default definition is @samp{(HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)}; you only need to define this macro if that definition is not suitable for use in preprocessor conditionals. @end defmac @defmac RETURN_ADDRESS_POINTER_REGNUM The register number of the return address pointer register, which is used to access the current function's return address from the stack. On some machines, the return address is not at a fixed offset from the frame pointer or stack pointer or argument pointer. This register can be defined to point to the return address on the stack, and then be converted by @code{ELIMINABLE_REGS} into either the frame pointer or stack pointer. Do not define this macro unless there is no other way to get the return address from the stack. @end defmac @defmac STATIC_CHAIN_REGNUM @defmacx STATIC_CHAIN_INCOMING_REGNUM Register numbers used for passing a function's static chain pointer. If register windows are used, the register number as seen by the called function is @code{STATIC_CHAIN_INCOMING_REGNUM}, while the register number as seen by the calling function is @code{STATIC_CHAIN_REGNUM}. If these registers are the same, @code{STATIC_CHAIN_INCOMING_REGNUM} need not be defined. The static chain register need not be a fixed register. If the static chain is passed in memory, these macros should not be defined; instead, the @code{TARGET_STATIC_CHAIN} hook should be used. @end defmac @hook TARGET_STATIC_CHAIN @defmac DWARF_FRAME_REGISTERS This macro specifies the maximum number of hard registers that can be saved in a call frame. This is used to size data structures used in DWARF2 exception handling. Prior to GCC 3.0, this macro was needed in order to establish a stable exception handling ABI in the face of adding new hard registers for ISA extensions. In GCC 3.0 and later, the EH ABI is insulated from changes in the number of hard registers. Nevertheless, this macro can still be used to reduce the runtime memory requirements of the exception handling routines, which can be substantial if the ISA contains a lot of registers that are not call-saved. If this macro is not defined, it defaults to @code{FIRST_PSEUDO_REGISTER}. @end defmac @defmac PRE_GCC3_DWARF_FRAME_REGISTERS This macro is similar to @code{DWARF_FRAME_REGISTERS}, but is provided for backward compatibility in pre GCC 3.0 compiled code. If this macro is not defined, it defaults to @code{DWARF_FRAME_REGISTERS}. @end defmac @defmac DWARF_REG_TO_UNWIND_COLUMN (@var{regno}) Define this macro if the target's representation for dwarf registers is different than the internal representation for unwind column. Given a dwarf register, this macro should return the internal unwind column number to use instead. @end defmac @defmac DWARF_FRAME_REGNUM (@var{regno}) Define this macro if the target's representation for dwarf registers used in .eh_frame or .debug_frame is different from that used in other debug info sections. Given a GCC hard register number, this macro should return the .eh_frame register number. The default is @code{DBX_REGISTER_NUMBER (@var{regno})}. @end defmac @defmac DWARF2_FRAME_REG_OUT (@var{regno}, @var{for_eh}) Define this macro to map register numbers held in the call frame info that GCC has collected using @code{DWARF_FRAME_REGNUM} to those that should be output in .debug_frame (@code{@var{for_eh}} is zero) and .eh_frame (@code{@var{for_eh}} is nonzero). The default is to return @code{@var{regno}}. @end defmac @defmac REG_VALUE_IN_UNWIND_CONTEXT Define this macro if the target stores register values as @code{_Unwind_Word} type in unwind context. It should be defined if target register size is larger than the size of @code{void *}. The default is to store register values as @code{void *} type. @end defmac @defmac ASSUME_EXTENDED_UNWIND_CONTEXT Define this macro to be 1 if the target always uses extended unwind context with version, args_size and by_value fields. If it is undefined, it will be defined to 1 when @code{REG_VALUE_IN_UNWIND_CONTEXT} is defined and 0 otherwise. @end defmac @defmac DWARF_LAZY_REGISTER_VALUE (@var{regno}, @var{value}) Define this macro if the target has pseudo DWARF registers whose values need to be computed lazily on demand by the unwinder (such as when referenced in a CFA expression). The macro returns true if @var{regno} is such a register and stores its value in @samp{*@var{value}} if so. @end defmac @node Elimination @subsection Eliminating Frame Pointer and Arg Pointer @c prevent bad page break with this line This is about eliminating the frame pointer and arg pointer. @hook TARGET_FRAME_POINTER_REQUIRED @defmac ELIMINABLE_REGS This macro specifies a table of register pairs used to eliminate unneeded registers that point into the stack frame. The definition of this macro is a list of structure initializations, each of which specifies an original and replacement register. On some machines, the position of the argument pointer is not known until the compilation is completed. In such a case, a separate hard register must be used for the argument pointer. This register can be eliminated by replacing it with either the frame pointer or the argument pointer, depending on whether or not the frame pointer has been eliminated. In this case, you might specify: @smallexample #define ELIMINABLE_REGS \ @{@{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM@}, \ @{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM@}, \ @{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM@}@} @end smallexample Note that the elimination of the argument pointer with the stack pointer is specified first since that is the preferred elimination. @end defmac @hook TARGET_CAN_ELIMINATE @defmac INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var}) This macro returns the initial difference between the specified pair of registers. The value would be computed from information such as the result of @code{get_frame_size ()} and the tables of registers @code{df_regs_ever_live_p} and @code{call_used_regs}. @end defmac @hook TARGET_COMPUTE_FRAME_LAYOUT @node Stack Arguments @subsection Passing Function Arguments on the Stack @cindex arguments on stack @cindex stack arguments The macros in this section control how arguments are passed on the stack. See the following section for other macros that control passing certain arguments in registers. @hook TARGET_PROMOTE_PROTOTYPES @hook TARGET_PUSH_ARGUMENT @defmac PUSH_ARGS_REVERSED A C expression. If nonzero, function arguments will be evaluated from last to first, rather than from first to last. If this macro is not defined, it defaults to @code{PUSH_ARGS} on targets where the stack and args grow in opposite directions, and 0 otherwise. @end defmac @defmac PUSH_ROUNDING (@var{npushed}) A C expression that is the number of bytes actually pushed onto the stack when an instruction attempts to push @var{npushed} bytes. On some machines, the definition @smallexample #define PUSH_ROUNDING(BYTES) (BYTES) @end smallexample @noindent will suffice. But on other machines, instructions that appear to push one byte actually push two bytes in an attempt to maintain alignment. Then the definition should be @smallexample #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1) @end smallexample If the value of this macro has a type, it should be an unsigned type. @end defmac @findex outgoing_args_size @findex crtl->outgoing_args_size @defmac ACCUMULATE_OUTGOING_ARGS A C expression. If nonzero, the maximum amount of space required for outgoing arguments will be computed and placed into @code{crtl->outgoing_args_size}. No space will be pushed onto the stack for each call; instead, the function prologue should increase the stack frame size by this amount. Setting both @code{PUSH_ARGS} and @code{ACCUMULATE_OUTGOING_ARGS} is not proper. @end defmac @defmac REG_PARM_STACK_SPACE (@var{fndecl}) Define this macro if functions should assume that stack space has been allocated for arguments even when their values are passed in registers. The value of this macro is the size, in bytes, of the area reserved for arguments passed in registers for the function represented by @var{fndecl}, which can be zero if GCC is calling a library function. The argument @var{fndecl} can be the FUNCTION_DECL, or the type itself of the function. This space can be allocated by the caller, or be a part of the machine-dependent stack frame: @code{OUTGOING_REG_PARM_STACK_SPACE} says which. @end defmac @c above is overfull. not sure what to do. --mew 5feb93 did @c something, not sure if it looks good. --mew 10feb93 @defmac INCOMING_REG_PARM_STACK_SPACE (@var{fndecl}) Like @code{REG_PARM_STACK_SPACE}, but for incoming register arguments. Define this macro if space guaranteed when compiling a function body is different to space required when making a call, a situation that can arise with K&R style function definitions. @end defmac @defmac OUTGOING_REG_PARM_STACK_SPACE (@var{fntype}) Define this to a nonzero value if it is the responsibility of the caller to allocate the area reserved for arguments passed in registers when calling a function of @var{fntype}. @var{fntype} may be NULL if the function called is a library function. If @code{ACCUMULATE_OUTGOING_ARGS} is defined, this macro controls whether the space for these arguments counts in the value of @code{crtl->outgoing_args_size}. @end defmac @defmac STACK_PARMS_IN_REG_PARM_AREA Define this macro if @code{REG_PARM_STACK_SPACE} is defined, but the stack parameters don't skip the area specified by it. @c i changed this, makes more sens and it should have taken care of the @c overfull.. not as specific, tho. --mew 5feb93 Normally, when a parameter is not passed in registers, it is placed on the stack beyond the @code{REG_PARM_STACK_SPACE} area. Defining this macro suppresses this behavior and causes the parameter to be passed on the stack in its natural location. @end defmac @hook TARGET_RETURN_POPS_ARGS @defmac CALL_POPS_ARGS (@var{cum}) A C expression that should indicate the number of bytes a call sequence pops off the stack. It is added to the value of @code{RETURN_POPS_ARGS} when compiling a function call. @var{cum} is the variable in which all arguments to the called function have been accumulated. On certain architectures, such as the SH5, a call trampoline is used that pops certain registers off the stack, depending on the arguments that have been passed to the function. Since this is a property of the call site, not of the called function, @code{RETURN_POPS_ARGS} is not appropriate. @end defmac @node Register Arguments @subsection Passing Arguments in Registers @cindex arguments in registers @cindex registers arguments This section describes the macros which let you control how various types of arguments are passed in registers or how they are arranged in the stack. @hook TARGET_FUNCTION_ARG @hook TARGET_MUST_PASS_IN_STACK @hook TARGET_FUNCTION_INCOMING_ARG @hook TARGET_USE_PSEUDO_PIC_REG @hook TARGET_INIT_PIC_REG @hook TARGET_ARG_PARTIAL_BYTES @hook TARGET_PASS_BY_REFERENCE @hook TARGET_CALLEE_COPIES @defmac CUMULATIVE_ARGS A C type for declaring a variable that is used as the first argument of @code{TARGET_FUNCTION_ARG} and other related values. For some target machines, the type @code{int} suffices and can hold the number of bytes of argument so far. There is no need to record in @code{CUMULATIVE_ARGS} anything about the arguments that have been passed on the stack. The compiler has other variables to keep track of that. For target machines on which all arguments are passed on the stack, there is no need to store anything in @code{CUMULATIVE_ARGS}; however, the data structure must exist and should not be empty, so use @code{int}. @end defmac @defmac OVERRIDE_ABI_FORMAT (@var{fndecl}) If defined, this macro is called before generating any code for a function, but after the @var{cfun} descriptor for the function has been created. The back end may use this macro to update @var{cfun} to reflect an ABI other than that which would normally be used by default. If the compiler is generating code for a compiler-generated function, @var{fndecl} may be @code{NULL}. @end defmac @defmac INIT_CUMULATIVE_ARGS (@var{cum}, @var{fntype}, @var{libname}, @var{fndecl}, @var{n_named_args}) A C statement (sans semicolon) for initializing the variable @var{cum} for the state at the beginning of the argument list. The variable has type @code{CUMULATIVE_ARGS}. The value of @var{fntype} is the tree node for the data type of the function which will receive the args, or 0 if the args are to a compiler support library function. For direct calls that are not libcalls, @var{fndecl} contain the declaration node of the function. @var{fndecl} is also set when @code{INIT_CUMULATIVE_ARGS} is used to find arguments for the function being compiled. @var{n_named_args} is set to the number of named arguments, including a structure return address if it is passed as a parameter, when making a call. When processing incoming arguments, @var{n_named_args} is set to @minus{}1. When processing a call to a compiler support library function, @var{libname} identifies which one. It is a @code{symbol_ref} rtx which contains the name of the function, as a string. @var{libname} is 0 when an ordinary C function call is being processed. Thus, each time this macro is called, either @var{libname} or @var{fntype} is nonzero, but never both of them at once. @end defmac @defmac INIT_CUMULATIVE_LIBCALL_ARGS (@var{cum}, @var{mode}, @var{libname}) Like @code{INIT_CUMULATIVE_ARGS} but only used for outgoing libcalls, it gets a @code{MODE} argument instead of @var{fntype}, that would be @code{NULL}. @var{indirect} would always be zero, too. If this macro is not defined, @code{INIT_CUMULATIVE_ARGS (cum, NULL_RTX, libname, 0)} is used instead. @end defmac @defmac INIT_CUMULATIVE_INCOMING_ARGS (@var{cum}, @var{fntype}, @var{libname}) Like @code{INIT_CUMULATIVE_ARGS} but overrides it for the purposes of finding the arguments for the function being compiled. If this macro is undefined, @code{INIT_CUMULATIVE_ARGS} is used instead. The value passed for @var{libname} is always 0, since library routines with special calling conventions are never compiled with GCC@. The argument @var{libname} exists for symmetry with @code{INIT_CUMULATIVE_ARGS}. @c could use "this macro" in place of @code{INIT_CUMULATIVE_ARGS}, maybe. @c --mew 5feb93 i switched the order of the sentences. --mew 10feb93 @end defmac @hook TARGET_FUNCTION_ARG_ADVANCE @hook TARGET_FUNCTION_ARG_OFFSET @hook TARGET_FUNCTION_ARG_PADDING @defmac PAD_VARARGS_DOWN If defined, a C expression which determines whether the default implementation of va_arg will attempt to pad down before reading the next argument, if that argument is smaller than its aligned space as controlled by @code{PARM_BOUNDARY}. If this macro is not defined, all such arguments are padded down if @code{BYTES_BIG_ENDIAN} is true. @end defmac @defmac BLOCK_REG_PADDING (@var{mode}, @var{type}, @var{first}) Specify padding for the last element of a block move between registers and memory. @var{first} is nonzero if this is the only element. Defining this macro allows better control of register function parameters on big-endian machines, without using @code{PARALLEL} rtl. In particular, @code{MUST_PASS_IN_STACK} need not test padding and mode of types in registers, as there is no longer a "wrong" part of a register; For example, a three byte aggregate may be passed in the high part of a register if so required. @end defmac @hook TARGET_FUNCTION_ARG_BOUNDARY @hook TARGET_FUNCTION_ARG_ROUND_BOUNDARY @defmac FUNCTION_ARG_REGNO_P (@var{regno}) A C expression that is nonzero if @var{regno} is the number of a hard register in which function arguments are sometimes passed. This does @emph{not} include implicit arguments such as the static chain and the structure-value address. On many machines, no registers can be used for this purpose since all function arguments are pushed on the stack. @end defmac @hook TARGET_SPLIT_COMPLEX_ARG @hook TARGET_BUILD_BUILTIN_VA_LIST @hook TARGET_ENUM_VA_LIST_P @hook TARGET_FN_ABI_VA_LIST @hook TARGET_CANONICAL_VA_LIST_TYPE @hook TARGET_GIMPLIFY_VA_ARG_EXPR @hook TARGET_VALID_POINTER_MODE @hook TARGET_REF_MAY_ALIAS_ERRNO @hook TARGET_TRANSLATE_MODE_ATTRIBUTE @hook TARGET_SCALAR_MODE_SUPPORTED_P @hook TARGET_VECTOR_MODE_SUPPORTED_P @hook TARGET_COMPATIBLE_VECTOR_TYPES_P @hook TARGET_ARRAY_MODE @hook TARGET_ARRAY_MODE_SUPPORTED_P @hook TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P @hook TARGET_FLOATN_MODE @hook TARGET_FLOATN_BUILTIN_P @hook TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P @node Scalar Return @subsection How Scalar Function Values Are Returned @cindex return values in registers @cindex values, returned by functions @cindex scalars, returned as values This section discusses the macros that control returning scalars as values---values that can fit in registers. @hook TARGET_FUNCTION_VALUE @defmac FUNCTION_VALUE (@var{valtype}, @var{func}) This macro has been deprecated. Use @code{TARGET_FUNCTION_VALUE} for a new target instead. @end defmac @defmac LIBCALL_VALUE (@var{mode}) A C expression to create an RTX representing the place where a library function returns a value of mode @var{mode}. Note that ``library function'' in this context means a compiler support routine, used to perform arithmetic, whose name is known specially by the compiler and was not mentioned in the C code being compiled. @end defmac @hook TARGET_LIBCALL_VALUE @defmac FUNCTION_VALUE_REGNO_P (@var{regno}) A C expression that is nonzero if @var{regno} is the number of a hard register in which the values of called function may come back. A register whose use for returning values is limited to serving as the second of a pair (for a value of type @code{double}, say) need not be recognized by this macro. So for most machines, this definition suffices: @smallexample #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0) @end smallexample If the machine has register windows, so that the caller and the called function use different registers for the return value, this macro should recognize only the caller's register numbers. This macro has been deprecated. Use @code{TARGET_FUNCTION_VALUE_REGNO_P} for a new target instead. @end defmac @hook TARGET_FUNCTION_VALUE_REGNO_P @defmac APPLY_RESULT_SIZE Define this macro if @samp{untyped_call} and @samp{untyped_return} need more space than is implied by @code{FUNCTION_VALUE_REGNO_P} for saving and restoring an arbitrary return value. @end defmac @hook TARGET_OMIT_STRUCT_RETURN_REG @hook TARGET_RETURN_IN_MSB @node Aggregate Return @subsection How Large Values Are Returned @cindex aggregates as return values @cindex large return values @cindex returning aggregate values @cindex structure value address When a function value's mode is @code{BLKmode} (and in some other cases), the value is not returned according to @code{TARGET_FUNCTION_VALUE} (@pxref{Scalar Return}). Instead, the caller passes the address of a block of memory in which the value should be stored. This address is called the @dfn{structure value address}. This section describes how to control returning structure values in memory. @hook TARGET_RETURN_IN_MEMORY @defmac DEFAULT_PCC_STRUCT_RETURN Define this macro to be 1 if all structure and union return values must be in memory. Since this results in slower code, this should be defined only if needed for compatibility with other compilers or with an ABI@. If you define this macro to be 0, then the conventions used for structure and union return values are decided by the @code{TARGET_RETURN_IN_MEMORY} target hook. If not defined, this defaults to the value 1. @end defmac @hook TARGET_STRUCT_VALUE_RTX @defmac PCC_STATIC_STRUCT_RETURN Define this macro if the usual system convention on the target machine for returning structures and unions is for the called function to return the address of a static variable containing the value. Do not define this if the usual system convention is for the caller to pass an address to the subroutine. This macro has effect in @option{-fpcc-struct-return} mode, but it does nothing when you use @option{-freg-struct-return} mode. @end defmac @hook TARGET_GET_RAW_RESULT_MODE @hook TARGET_GET_RAW_ARG_MODE @hook TARGET_EMPTY_RECORD_P @hook TARGET_WARN_PARAMETER_PASSING_ABI @node Caller Saves @subsection Caller-Saves Register Allocation If you enable it, GCC can save registers around function calls. This makes it possible to use call-clobbered registers to hold variables that must live across calls. @defmac HARD_REGNO_CALLER_SAVE_MODE (@var{regno}, @var{nregs}) A C expression specifying which mode is required for saving @var{nregs} of a pseudo-register in call-clobbered hard register @var{regno}. If @var{regno} is unsuitable for caller save, @code{VOIDmode} should be returned. For most machines this macro need not be defined since GCC will select the smallest suitable mode. @end defmac @node Function Entry @subsection Function Entry and Exit @cindex function entry and exit @cindex prologue @cindex epilogue This section describes the macros that output function entry (@dfn{prologue}) and exit (@dfn{epilogue}) code. @hook TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY @hook TARGET_ASM_FUNCTION_PROLOGUE @hook TARGET_ASM_FUNCTION_END_PROLOGUE @hook TARGET_ASM_FUNCTION_BEGIN_EPILOGUE @hook TARGET_ASM_FUNCTION_EPILOGUE @itemize @bullet @item @findex pretend_args_size @findex crtl->args.pretend_args_size A region of @code{crtl->args.pretend_args_size} bytes of uninitialized space just underneath the first argument arriving on the stack. (This may not be at the very start of the allocated stack region if the calling sequence has pushed anything else since pushing the stack arguments. But usually, on such machines, nothing else has been pushed yet, because the function prologue itself does all the pushing.) This region is used on machines where an argument may be passed partly in registers and partly in memory, and, in some cases to support the features in @code{}. @item An area of memory used to save certain registers used by the function. The size of this area, which may also include space for such things as the return address and pointers to previous stack frames, is machine-specific and usually depends on which registers have been used in the function. Machines with register windows often do not require a save area. @item A region of at least @var{size} bytes, possibly rounded up to an allocation boundary, to contain the local variables of the function. On some machines, this region and the save area may occur in the opposite order, with the save area closer to the top of the stack. @item @cindex @code{ACCUMULATE_OUTGOING_ARGS} and stack frames Optionally, when @code{ACCUMULATE_OUTGOING_ARGS} is defined, a region of @code{crtl->outgoing_args_size} bytes to be used for outgoing argument lists of the function. @xref{Stack Arguments}. @end itemize @defmac EXIT_IGNORE_STACK Define this macro as a C expression that is nonzero if the return instruction or the function epilogue ignores the value of the stack pointer; in other words, if it is safe to delete an instruction to adjust the stack pointer before a return from the function. The default is 0. Note that this macro's value is relevant only for functions for which frame pointers are maintained. It is never safe to delete a final stack adjustment in a function that has no frame pointer, and the compiler knows this regardless of @code{EXIT_IGNORE_STACK}. @end defmac @defmac EPILOGUE_USES (@var{regno}) Define this macro as a C expression that is nonzero for registers that are used by the epilogue or the @samp{return} pattern. The stack and frame pointer registers are already assumed to be used as needed. @end defmac @defmac EH_USES (@var{regno}) Define this macro as a C expression that is nonzero for registers that are used by the exception handling mechanism, and so should be considered live on entry to an exception edge. @end defmac @hook TARGET_ASM_OUTPUT_MI_THUNK @hook TARGET_ASM_CAN_OUTPUT_MI_THUNK @node Profiling @subsection Generating Code for Profiling @cindex profiling, code generation These macros will help you generate code for profiling. @defmac FUNCTION_PROFILER (@var{file}, @var{labelno}) A C statement or compound statement to output to @var{file} some assembler code to call the profiling subroutine @code{mcount}. @findex mcount The details of how @code{mcount} expects to be called are determined by your operating system environment, not by GCC@. To figure them out, compile a small program for profiling using the system's installed C compiler and look at the assembler code that results. Older implementations of @code{mcount} expect the address of a counter variable to be loaded into some register. The name of this variable is @samp{LP} followed by the number @var{labelno}, so you would generate the name using @samp{LP%d} in a @code{fprintf}. @end defmac @defmac PROFILE_HOOK A C statement or compound statement to output to @var{file} some assembly code to call the profiling subroutine @code{mcount} even the target does not support profiling. @end defmac @defmac NO_PROFILE_COUNTERS Define this macro to be an expression with a nonzero value if the @code{mcount} subroutine on your system does not need a counter variable allocated for each function. This is true for almost all modern implementations. If you define this macro, you must not use the @var{labelno} argument to @code{FUNCTION_PROFILER}. @end defmac @defmac PROFILE_BEFORE_PROLOGUE Define this macro if the code for function profiling should come before the function prologue. Normally, the profiling code comes after. @end defmac @hook TARGET_KEEP_LEAF_WHEN_PROFILED @node Tail Calls @subsection Permitting tail calls @cindex tail calls @hook TARGET_FUNCTION_OK_FOR_SIBCALL @hook TARGET_EXTRA_LIVE_ON_ENTRY @hook TARGET_SET_UP_BY_PROLOGUE @hook TARGET_WARN_FUNC_RETURN @node Shrink-wrapping separate components @subsection Shrink-wrapping separate components @cindex shrink-wrapping separate components The prologue may perform a variety of target dependent tasks such as saving callee-saved registers, saving the return address, aligning the stack, creating a stack frame, initializing the PIC register, setting up the static chain, etc. On some targets some of these tasks may be independent of others and thus may be shrink-wrapped separately. These independent tasks are referred to as components and are handled generically by the target independent parts of GCC. Using the following hooks those prologue or epilogue components can be shrink-wrapped separately, so that the initialization (and possibly teardown) those components do is not done as frequently on execution paths where this would unnecessary. What exactly those components are is up to the target code; the generic code treats them abstractly, as a bit in an @code{sbitmap}. These @code{sbitmap}s are allocated by the @code{shrink_wrap.get_separate_components} and @code{shrink_wrap.components_for_bb} hooks, and deallocated by the generic code. @hook TARGET_SHRINK_WRAP_GET_SEPARATE_COMPONENTS @hook TARGET_SHRINK_WRAP_COMPONENTS_FOR_BB @hook TARGET_SHRINK_WRAP_DISQUALIFY_COMPONENTS @hook TARGET_SHRINK_WRAP_EMIT_PROLOGUE_COMPONENTS @hook TARGET_SHRINK_WRAP_EMIT_EPILOGUE_COMPONENTS @hook TARGET_SHRINK_WRAP_SET_HANDLED_COMPONENTS @node Stack Smashing Protection @subsection Stack smashing protection @cindex stack smashing protection @hook TARGET_STACK_PROTECT_GUARD @hook TARGET_STACK_PROTECT_FAIL @hook TARGET_STACK_PROTECT_RUNTIME_ENABLED_P @hook TARGET_SUPPORTS_SPLIT_STACK @hook TARGET_GET_VALID_OPTION_VALUES @node Miscellaneous Register Hooks @subsection Miscellaneous register hooks @cindex miscellaneous register hooks @hook TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS @node Varargs @section Implementing the Varargs Macros @cindex varargs implementation GCC comes with an implementation of @code{} and @code{} that work without change on machines that pass arguments on the stack. Other machines require their own implementations of varargs, and the two machine independent header files must have conditionals to include it. ISO @code{} differs from traditional @code{} mainly in the calling convention for @code{va_start}. The traditional implementation takes just one argument, which is the variable in which to store the argument pointer. The ISO implementation of @code{va_start} takes an additional second argument. The user is supposed to write the last named argument of the function here. However, @code{va_start} should not use this argument. The way to find the end of the named arguments is with the built-in functions described below. @defmac __builtin_saveregs () Use this built-in function to save the argument registers in memory so that the varargs mechanism can access them. Both ISO and traditional versions of @code{va_start} must use @code{__builtin_saveregs}, unless you use @code{TARGET_SETUP_INCOMING_VARARGS} (see below) instead. On some machines, @code{__builtin_saveregs} is open-coded under the control of the target hook @code{TARGET_EXPAND_BUILTIN_SAVEREGS}. On other machines, it calls a routine written in assembler language, found in @file{libgcc2.c}. Code generated for the call to @code{__builtin_saveregs} appears at the beginning of the function, as opposed to where the call to @code{__builtin_saveregs} is written, regardless of what the code is. This is because the registers must be saved before the function starts to use them for its own purposes. @c i rewrote the first sentence above to fix an overfull hbox. --mew @c 10feb93 @end defmac @defmac __builtin_next_arg (@var{lastarg}) This builtin returns the address of the first anonymous stack argument, as type @code{void *}. If @code{ARGS_GROW_DOWNWARD}, it returns the address of the location above the first anonymous stack argument. Use it in @code{va_start} to initialize the pointer for fetching arguments from the stack. Also use it in @code{va_start} to verify that the second parameter @var{lastarg} is the last named argument of the current function. @end defmac @defmac __builtin_classify_type (@var{object}) Since each machine has its own conventions for which data types are passed in which kind of register, your implementation of @code{va_arg} has to embody these conventions. The easiest way to categorize the specified data type is to use @code{__builtin_classify_type} together with @code{sizeof} and @code{__alignof__}. @code{__builtin_classify_type} ignores the value of @var{object}, considering only its data type. It returns an integer describing what kind of type that is---integer, floating, pointer, structure, and so on. The file @file{typeclass.h} defines an enumeration that you can use to interpret the values of @code{__builtin_classify_type}. @end defmac These machine description macros help implement varargs: @hook TARGET_EXPAND_BUILTIN_SAVEREGS @hook TARGET_SETUP_INCOMING_VARARGS @hook TARGET_STRICT_ARGUMENT_NAMING @hook TARGET_CALL_ARGS @hook TARGET_END_CALL_ARGS @hook TARGET_PRETEND_OUTGOING_VARARGS_NAMED @node Trampolines @section Support for Nested Functions @cindex support for nested functions @cindex trampolines for nested functions @cindex descriptors for nested functions @cindex nested functions, support for Taking the address of a nested function requires special compiler handling to ensure that the static chain register is loaded when the function is invoked via an indirect call. GCC has traditionally supported nested functions by creating an executable @dfn{trampoline} at run time when the address of a nested function is taken. This is a small piece of code which normally resides on the stack, in the stack frame of the containing function. The trampoline loads the static chain register and then jumps to the real address of the nested function. The use of trampolines requires an executable stack, which is a security risk. To avoid this problem, GCC also supports another strategy: using descriptors for nested functions. Under this model, taking the address of a nested function results in a pointer to a non-executable function descriptor object. Initializing the static chain from the descriptor is handled at indirect call sites. On some targets, including HPPA and IA-64, function descriptors may be mandated by the ABI or be otherwise handled in a target-specific way by the back end in its code generation strategy for indirect calls. GCC also provides its own generic descriptor implementation to support the @option{-fno-trampolines} option. In this case runtime detection of function descriptors at indirect call sites relies on descriptor pointers being tagged with a bit that is never set in bare function addresses. Since GCC's generic function descriptors are not ABI-compliant, this option is typically used only on a per-language basis (notably by Ada) or when it can otherwise be applied to the whole program. For languages other than Ada, the @code{-ftrampolines} and @code{-fno-trampolines} options currently have no effect, and trampolines are always generated on platforms that need them for nested functions. Define the following hook if your backend either implements ABI-specified descriptor support, or can use GCC's generic descriptor implementation for nested functions. @hook TARGET_CUSTOM_FUNCTION_DESCRIPTORS The following macros tell GCC how to generate code to allocate and initialize an executable trampoline. You can also use this interface if your back end needs to create ABI-specified non-executable descriptors; in this case the "trampoline" created is the descriptor containing data only. The instructions in an executable trampoline must do two things: load a constant address into the static chain register, and jump to the real address of the nested function. On CISC machines such as the m68k, this requires two instructions, a move immediate and a jump. Then the two addresses exist in the trampoline as word-long immediate operands. On RISC machines, it is often necessary to load each address into a register in two parts. Then pieces of each address form separate immediate operands. The code generated to initialize the trampoline must store the variable parts---the static chain value and the function address---into the immediate operands of the instructions. On a CISC machine, this is simply a matter of copying each address to a memory reference at the proper offset from the start of the trampoline. On a RISC machine, it may be necessary to take out pieces of the address and store them separately. @hook TARGET_ASM_TRAMPOLINE_TEMPLATE @defmac TRAMPOLINE_SECTION Return the section into which the trampoline template is to be placed (@pxref{Sections}). The default value is @code{readonly_data_section}. @end defmac @defmac TRAMPOLINE_SIZE A C expression for the size in bytes of the trampoline, as an integer. @end defmac @defmac TRAMPOLINE_ALIGNMENT Alignment required for trampolines, in bits. If you don't define this macro, the value of @code{FUNCTION_ALIGNMENT} is used for aligning trampolines. @end defmac @hook TARGET_TRAMPOLINE_INIT @hook TARGET_EMIT_CALL_BUILTIN___CLEAR_CACHE @hook TARGET_TRAMPOLINE_ADJUST_ADDRESS Implementing trampolines is difficult on many machines because they have separate instruction and data caches. Writing into a stack location fails to clear the memory in the instruction cache, so when the program jumps to that location, it executes the old contents. Here are two possible solutions. One is to clear the relevant parts of the instruction cache whenever a trampoline is set up. The other is to make all trampolines identical, by having them jump to a standard subroutine. The former technique makes trampoline execution faster; the latter makes initialization faster. To clear the instruction cache when a trampoline is initialized, define the following macro. @defmac CLEAR_INSN_CACHE (@var{beg}, @var{end}) If defined, expands to a C expression clearing the @emph{instruction cache} in the specified interval. The definition of this macro would typically be a series of @code{asm} statements. Both @var{beg} and @var{end} are pointer expressions. @end defmac To use a standard subroutine, define the following macro. In addition, you must make sure that the instructions in a trampoline fill an entire cache line with identical instructions, or else ensure that the beginning of the trampoline code is always aligned at the same point in its cache line. Look in @file{m68k.h} as a guide. @defmac TRANSFER_FROM_TRAMPOLINE Define this macro if trampolines need a special subroutine to do their work. The macro should expand to a series of @code{asm} statements which will be compiled with GCC@. They go in a library function named @code{__transfer_from_trampoline}. If you need to avoid executing the ordinary prologue code of a compiled C function when you jump to the subroutine, you can do so by placing a special label of your own in the assembler code. Use one @code{asm} statement to generate an assembler label, and another to make the label global. Then trampolines can use that label to jump directly to your special assembler code. @end defmac @node Library Calls @section Implicit Calls to Library Routines @cindex library subroutine names @cindex @file{libgcc.a} @c prevent bad page break with this line Here is an explanation of implicit calls to library routines. @defmac DECLARE_LIBRARY_RENAMES This macro, if defined, should expand to a piece of C code that will get expanded when compiling functions for libgcc.a. It can be used to provide alternate names for GCC's internal library functions if there are ABI-mandated names that the compiler should provide. @end defmac @findex set_optab_libfunc @findex init_one_libfunc @hook TARGET_INIT_LIBFUNCS @hook TARGET_LIBFUNC_GNU_PREFIX @defmac FLOAT_LIB_COMPARE_RETURNS_BOOL (@var{mode}, @var{comparison}) This macro should return @code{true} if the library routine that implements the floating point comparison operator @var{comparison} in mode @var{mode} will return a boolean, and @var{false} if it will return a tristate. GCC's own floating point libraries return tristates from the comparison operators, so the default returns false always. Most ports don't need to define this macro. @end defmac @defmac TARGET_LIB_INT_CMP_BIASED This macro should evaluate to @code{true} if the integer comparison functions (like @code{__cmpdi2}) return 0 to indicate that the first operand is smaller than the second, 1 to indicate that they are equal, and 2 to indicate that the first operand is greater than the second. If this macro evaluates to @code{false} the comparison functions return @minus{}1, 0, and 1 instead of 0, 1, and 2. If the target uses the routines in @file{libgcc.a}, you do not need to define this macro. @end defmac @defmac TARGET_HAS_NO_HW_DIVIDE This macro should be defined if the target has no hardware divide instructions. If this macro is defined, GCC will use an algorithm which make use of simple logical and arithmetic operations for 64-bit division. If the macro is not defined, GCC will use an algorithm which make use of a 64-bit by 32-bit divide primitive. @end defmac @cindex @code{EDOM}, implicit usage @findex matherr @defmac TARGET_EDOM The value of @code{EDOM} on the target machine, as a C integer constant expression. If you don't define this macro, GCC does not attempt to deposit the value of @code{EDOM} into @code{errno} directly. Look in @file{/usr/include/errno.h} to find the value of @code{EDOM} on your system. If you do not define @code{TARGET_EDOM}, then compiled code reports domain errors by calling the library function and letting it report the error. If mathematical functions on your system use @code{matherr} when there is an error, then you should leave @code{TARGET_EDOM} undefined so that @code{matherr} is used normally. @end defmac @cindex @code{errno}, implicit usage @defmac GEN_ERRNO_RTX Define this macro as a C expression to create an rtl expression that refers to the global ``variable'' @code{errno}. (On certain systems, @code{errno} may not actually be a variable.) If you don't define this macro, a reasonable default is used. @end defmac @hook TARGET_LIBC_HAS_FUNCTION @hook TARGET_LIBC_HAS_FAST_FUNCTION @defmac NEXT_OBJC_RUNTIME Set this macro to 1 to use the "NeXT" Objective-C message sending conventions by default. This calling convention involves passing the object, the selector and the method arguments all at once to the method-lookup library function. This is the usual setting when targeting Darwin/Mac OS X systems, which have the NeXT runtime installed. If the macro is set to 0, the "GNU" Objective-C message sending convention will be used by default. This convention passes just the object and the selector to the method-lookup function, which returns a pointer to the method. In either case, it remains possible to select code-generation for the alternate scheme, by means of compiler command line switches. @end defmac @node Addressing Modes @section Addressing Modes @cindex addressing modes @c prevent bad page break with this line This is about addressing modes. @defmac HAVE_PRE_INCREMENT @defmacx HAVE_PRE_DECREMENT @defmacx HAVE_POST_INCREMENT @defmacx HAVE_POST_DECREMENT A C expression that is nonzero if the machine supports pre-increment, pre-decrement, post-increment, or post-decrement addressing respectively. @end defmac @defmac HAVE_PRE_MODIFY_DISP @defmacx HAVE_POST_MODIFY_DISP A C expression that is nonzero if the machine supports pre- or post-address side-effect generation involving constants other than the size of the memory operand. @end defmac @defmac HAVE_PRE_MODIFY_REG @defmacx HAVE_POST_MODIFY_REG A C expression that is nonzero if the machine supports pre- or post-address side-effect generation involving a register displacement. @end defmac @defmac CONSTANT_ADDRESS_P (@var{x}) A C expression that is 1 if the RTX @var{x} is a constant which is a valid address. On most machines the default definition of @code{(CONSTANT_P (@var{x}) && GET_CODE (@var{x}) != CONST_DOUBLE)} is acceptable, but a few machines are more restrictive as to which constant addresses are supported. @end defmac @defmac CONSTANT_P (@var{x}) @code{CONSTANT_P}, which is defined by target-independent code, accepts integer-values expressions whose values are not explicitly known, such as @code{symbol_ref}, @code{label_ref}, and @code{high} expressions and @code{const} arithmetic expressions, in addition to @code{const_int} and @code{const_double} expressions. @end defmac @defmac MAX_REGS_PER_ADDRESS A number, the maximum number of registers that can appear in a valid memory address. Note that it is up to you to specify a value equal to the maximum number that @code{TARGET_LEGITIMATE_ADDRESS_P} would ever accept. @end defmac @hook TARGET_LEGITIMATE_ADDRESS_P @defmac TARGET_MEM_CONSTRAINT A single character to be used instead of the default @code{'m'} character for general memory addresses. This defines the constraint letter which matches the memory addresses accepted by @code{TARGET_LEGITIMATE_ADDRESS_P}. Define this macro if you want to support new address formats in your back end without changing the semantics of the @code{'m'} constraint. This is necessary in order to preserve functionality of inline assembly constructs using the @code{'m'} constraint. @end defmac @defmac FIND_BASE_TERM (@var{x}) A C expression to determine the base term of address @var{x}, or to provide a simplified version of @var{x} from which @file{alias.cc} can easily find the base term. This macro is used in only two places: @code{find_base_value} and @code{find_base_term} in @file{alias.cc}. It is always safe for this macro to not be defined. It exists so that alias analysis can understand machine-dependent addresses. The typical use of this macro is to handle addresses containing a label_ref or symbol_ref within an UNSPEC@. @end defmac @hook TARGET_LEGITIMIZE_ADDRESS @defmac LEGITIMIZE_RELOAD_ADDRESS (@var{x}, @var{mode}, @var{opnum}, @var{type}, @var{ind_levels}, @var{win}) A C compound statement that attempts to replace @var{x}, which is an address that needs reloading, with a valid memory address for an operand of mode @var{mode}. @var{win} will be a C statement label elsewhere in the code. It is not necessary to define this macro, but it might be useful for performance reasons. For example, on the i386, it is sometimes possible to use a single reload register instead of two by reloading a sum of two pseudo registers into a register. On the other hand, for number of RISC processors offsets are limited so that often an intermediate address needs to be generated in order to address a stack slot. By defining @code{LEGITIMIZE_RELOAD_ADDRESS} appropriately, the intermediate addresses generated for adjacent some stack slots can be made identical, and thus be shared. @emph{Note}: This macro should be used with caution. It is necessary to know something of how reload works in order to effectively use this, and it is quite easy to produce macros that build in too much knowledge of reload internals. @emph{Note}: This macro must be able to reload an address created by a previous invocation of this macro. If it fails to handle such addresses then the compiler may generate incorrect code or abort. @findex push_reload The macro definition should use @code{push_reload} to indicate parts that need reloading; @var{opnum}, @var{type} and @var{ind_levels} are usually suitable to be passed unaltered to @code{push_reload}. The code generated by this macro must not alter the substructure of @var{x}. If it transforms @var{x} into a more legitimate form, it should assign @var{x} (which will always be a C variable) a new value. This also applies to parts that you change indirectly by calling @code{push_reload}. @findex strict_memory_address_p The macro definition may use @code{strict_memory_address_p} to test if the address has become legitimate. @findex copy_rtx If you want to change only a part of @var{x}, one standard way of doing this is to use @code{copy_rtx}. Note, however, that it unshares only a single level of rtl. Thus, if the part to be changed is not at the top level, you'll need to replace first the top level. It is not necessary for this macro to come up with a legitimate address; but often a machine-dependent strategy can generate better code. @end defmac @hook TARGET_MODE_DEPENDENT_ADDRESS_P @hook TARGET_LEGITIMATE_CONSTANT_P @hook TARGET_PRECOMPUTE_TLS_P @hook TARGET_DELEGITIMIZE_ADDRESS @hook TARGET_CONST_NOT_OK_FOR_DEBUG_P @hook TARGET_CANNOT_FORCE_CONST_MEM @hook TARGET_USE_BLOCKS_FOR_CONSTANT_P @hook TARGET_USE_BLOCKS_FOR_DECL_P @hook TARGET_BUILTIN_RECIPROCAL @hook TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD @hook TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST @hook TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT @hook TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE @hook TARGET_VECTORIZE_VEC_PERM_CONST @hook TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION @hook TARGET_VECTORIZE_BUILTIN_MD_VECTORIZED_FUNCTION @hook TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT @hook TARGET_VECTORIZE_PREFERRED_SIMD_MODE @hook TARGET_VECTORIZE_SPLIT_REDUCTION @hook TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES @hook TARGET_VECTORIZE_RELATED_MODE @hook TARGET_VECTORIZE_GET_MASK_MODE @hook TARGET_VECTORIZE_EMPTY_MASK_IS_EXPENSIVE @hook TARGET_VECTORIZE_CREATE_COSTS @hook TARGET_VECTORIZE_BUILTIN_GATHER @hook TARGET_VECTORIZE_BUILTIN_SCATTER @hook TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN @hook TARGET_SIMD_CLONE_ADJUST @hook TARGET_SIMD_CLONE_USABLE @hook TARGET_SIMT_VF @hook TARGET_OMP_DEVICE_KIND_ARCH_ISA @hook TARGET_GOACC_VALIDATE_DIMS @hook TARGET_GOACC_DIM_LIMIT @hook TARGET_GOACC_FORK_JOIN @hook TARGET_GOACC_REDUCTION @hook TARGET_PREFERRED_ELSE_VALUE @hook TARGET_GOACC_ADJUST_PRIVATE_DECL @hook TARGET_GOACC_EXPAND_VAR_DECL @hook TARGET_GOACC_CREATE_WORKER_BROADCAST_RECORD @hook TARGET_GOACC_SHARED_MEM_LAYOUT @node Anchored Addresses @section Anchored Addresses @cindex anchored addresses @cindex @option{-fsection-anchors} GCC usually addresses every static object as a separate entity. For example, if we have: @smallexample static int a, b, c; int foo (void) @{ return a + b + c; @} @end smallexample the code for @code{foo} will usually calculate three separate symbolic addresses: those of @code{a}, @code{b} and @code{c}. On some targets, it would be better to calculate just one symbolic address and access the three variables relative to it. The equivalent pseudocode would be something like: @smallexample int foo (void) @{ register int *xr = &x; return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; @} @end smallexample (which isn't valid C). We refer to shared addresses like @code{x} as ``section anchors''. Their use is controlled by @option{-fsection-anchors}. The hooks below describe the target properties that GCC needs to know in order to make effective use of section anchors. It won't use section anchors at all unless either @code{TARGET_MIN_ANCHOR_OFFSET} or @code{TARGET_MAX_ANCHOR_OFFSET} is set to a nonzero value. @hook TARGET_MIN_ANCHOR_OFFSET @hook TARGET_MAX_ANCHOR_OFFSET @hook TARGET_ASM_OUTPUT_ANCHOR @hook TARGET_USE_ANCHORS_FOR_SYMBOL_P @node Condition Code @section Condition Code Status @cindex condition code status Condition codes in GCC are represented as registers, which provides better schedulability for architectures that do have a condition code register, but on which most instructions do not affect it. The latter category includes most RISC machines. Implicit clobbering would pose a strong restriction on the placement of the definition and use of the condition code. In the past the definition and use were always adjacent. However, recent changes to support trapping arithmetic may result in the definition and user being in different blocks. Thus, there may be a @code{NOTE_INSN_BASIC_BLOCK} between them. Additionally, the definition may be the source of exception handling edges. These restrictions can prevent important optimizations on some machines. For example, on the IBM RS/6000, there is a delay for taken branches unless the condition code register is set three instructions earlier than the conditional branch. The instruction scheduler cannot perform this optimization if it is not permitted to separate the definition and use of the condition code register. If there is a specific condition code register in the machine, use a hard register. If the condition code or comparison result can be placed in any general register, or if there are multiple condition registers, use a pseudo register. Registers used to store the condition code value will usually have a mode that is in class @code{MODE_CC}. Alternatively, you can use @code{BImode} if the comparison operator is specified already in the compare instruction. In this case, you are not interested in most macros in this section. @menu * MODE_CC Condition Codes:: Modern representation of condition codes. @end menu @node MODE_CC Condition Codes @subsection Representation of condition codes using registers @findex CCmode @findex MODE_CC @defmac SELECT_CC_MODE (@var{op}, @var{x}, @var{y}) On many machines, the condition code may be produced by other instructions than compares, for example the branch can use directly the condition code set by a subtract instruction. However, on some machines when the condition code is set this way some bits (such as the overflow bit) are not set in the same way as a test instruction, so that a different branch instruction must be used for some conditional branches. When this happens, use the machine mode of the condition code register to record different formats of the condition code register. Modes can also be used to record which compare instruction (e.g.@: a signed or an unsigned comparison) produced the condition codes. If other modes than @code{CCmode} are required, add them to @file{@var{machine}-modes.def} and define @code{SELECT_CC_MODE} to choose a mode given an operand of a compare. This is needed because the modes have to be chosen not only during RTL generation but also, for example, by instruction combination. The result of @code{SELECT_CC_MODE} should be consistent with the mode used in the patterns; for example to support the case of the add on the SPARC discussed above, we have the pattern @smallexample (define_insn "" [(set (reg:CCNZ 0) (compare:CCNZ (plus:SI (match_operand:SI 0 "register_operand" "%r") (match_operand:SI 1 "arith_operand" "rI")) (const_int 0)))] "" "@dots{}") @end smallexample @noindent together with a @code{SELECT_CC_MODE} that returns @code{CCNZmode} for comparisons whose argument is a @code{plus}: @smallexample #define SELECT_CC_MODE(OP,X,Y) \ (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ ? ((OP == LT || OP == LE || OP == GT || OP == GE) \ ? CCFPEmode : CCFPmode) \ : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \ || GET_CODE (X) == NEG || GET_CODE (x) == ASHIFT) \ ? CCNZmode : CCmode)) @end smallexample Another reason to use modes is to retain information on which operands were used by the comparison; see @code{REVERSIBLE_CC_MODE} later in this section. You should define this macro if and only if you define extra CC modes in @file{@var{machine}-modes.def}. @end defmac @hook TARGET_CANONICALIZE_COMPARISON @defmac REVERSIBLE_CC_MODE (@var{mode}) A C expression whose value is one if it is always safe to reverse a comparison whose mode is @var{mode}. If @code{SELECT_CC_MODE} can ever return @var{mode} for a floating-point inequality comparison, then @code{REVERSIBLE_CC_MODE (@var{mode})} must be zero. You need not define this macro if it would always returns zero or if the floating-point format is anything other than @code{IEEE_FLOAT_FORMAT}. For example, here is the definition used on the SPARC, where floating-point inequality comparisons are given either @code{CCFPEmode} or @code{CCFPmode}: @smallexample #define REVERSIBLE_CC_MODE(MODE) \ ((MODE) != CCFPEmode && (MODE) != CCFPmode) @end smallexample @end defmac @defmac REVERSE_CONDITION (@var{code}, @var{mode}) A C expression whose value is reversed condition code of the @var{code} for comparison done in CC_MODE @var{mode}. The macro is used only in case @code{REVERSIBLE_CC_MODE (@var{mode})} is nonzero. Define this macro in case machine has some non-standard way how to reverse certain conditionals. For instance in case all floating point conditions are non-trapping, compiler may freely convert unordered compares to ordered ones. Then definition may look like: @smallexample #define REVERSE_CONDITION(CODE, MODE) \ ((MODE) != CCFPmode ? reverse_condition (CODE) \ : reverse_condition_maybe_unordered (CODE)) @end smallexample @end defmac @hook TARGET_FIXED_CONDITION_CODE_REGS @hook TARGET_CC_MODES_COMPATIBLE @hook TARGET_FLAGS_REGNUM @node Costs @section Describing Relative Costs of Operations @cindex costs of instructions @cindex relative costs @cindex speed of instructions These macros let you describe the relative speed of various operations on the target machine. @defmac REGISTER_MOVE_COST (@var{mode}, @var{from}, @var{to}) A C expression for the cost of moving data of mode @var{mode} from a register in class @var{from} to one in class @var{to}. The classes are expressed using the enumeration values such as @code{GENERAL_REGS}. A value of 2 is the default; other values are interpreted relative to that. It is not required that the cost always equal 2 when @var{from} is the same as @var{to}; on some machines it is expensive to move between registers if they are not general registers. If reload sees an insn consisting of a single @code{set} between two hard registers, and if @code{REGISTER_MOVE_COST} applied to their classes returns a value of 2, reload does not check to ensure that the constraints of the insn are met. Setting a cost of other than 2 will allow reload to verify that the constraints are met. You should do this if the @samp{mov@var{m}} pattern's constraints do not allow such copying. These macros are obsolete, new ports should use the target hook @code{TARGET_REGISTER_MOVE_COST} instead. @end defmac @hook TARGET_REGISTER_MOVE_COST @defmac MEMORY_MOVE_COST (@var{mode}, @var{class}, @var{in}) A C expression for the cost of moving data of mode @var{mode} between a register of class @var{class} and memory; @var{in} is zero if the value is to be written to memory, nonzero if it is to be read in. This cost is relative to those in @code{REGISTER_MOVE_COST}. If moving between registers and memory is more expensive than between two registers, you should define this macro to express the relative cost. If you do not define this macro, GCC uses a default cost of 4 plus the cost of copying via a secondary reload register, if one is needed. If your machine requires a secondary reload register to copy between memory and a register of @var{class} but the reload mechanism is more complex than copying via an intermediate, define this macro to reflect the actual cost of the move. GCC defines the function @code{memory_move_secondary_cost} if secondary reloads are needed. It computes the costs due to copying via a secondary register. If your machine copies from memory using a secondary register in the conventional way but the default base value of 4 is not correct for your machine, define this macro to add some other value to the result of that function. The arguments to that function are the same as to this macro. These macros are obsolete, new ports should use the target hook @code{TARGET_MEMORY_MOVE_COST} instead. @end defmac @hook TARGET_MEMORY_MOVE_COST @defmac BRANCH_COST (@var{speed_p}, @var{predictable_p}) A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. Parameter @var{speed_p} is true when the branch in question should be optimized for speed. When it is false, @code{BRANCH_COST} should return a value optimal for code size rather than performance. @var{predictable_p} is true for well-predicted branches. On many architectures the @code{BRANCH_COST} can be reduced then. @end defmac Here are additional macros which do not specify precise relative costs, but only that certain actions are more expensive than GCC would ordinarily expect. @defmac SLOW_BYTE_ACCESS Define this macro as a C expression which is nonzero if accessing less than a word of memory (i.e.@: a @code{char} or a @code{short}) is no faster than accessing a word of memory, i.e., if such access require more than one instruction or if there is no difference in cost between byte and (aligned) word loads. When this macro is not defined, the compiler will access a field by finding the smallest containing object; when it is defined, a fullword load will be used if alignment permits. Unless bytes accesses are faster than word accesses, using word accesses is preferable since it may eliminate subsequent memory access if subsequent accesses occur to other fields in the same word of the structure, but to different bytes. @end defmac @hook TARGET_SLOW_UNALIGNED_ACCESS @defmac MOVE_RATIO (@var{speed}) The threshold of number of scalar memory-to-memory move insns, @emph{below} which a sequence of insns should be generated instead of a string move insn or a library call. Increasing the value will always make code faster, but eventually incurs high cost in increased code size. Note that on machines where the corresponding move insn is a @code{define_expand} that emits a sequence of insns, this macro counts the number of such sequences. The parameter @var{speed} is true if the code is currently being optimized for speed rather than size. If you don't define this, a reasonable default is used. @end defmac @hook TARGET_USE_BY_PIECES_INFRASTRUCTURE_P @hook TARGET_OVERLAP_OP_BY_PIECES_P @hook TARGET_COMPARE_BY_PIECES_BRANCH_RATIO @defmac MOVE_MAX_PIECES A C expression used by @code{move_by_pieces} to determine the largest unit a load or store used to copy memory is. Defaults to @code{MOVE_MAX}. @end defmac @defmac STORE_MAX_PIECES A C expression used by @code{store_by_pieces} to determine the largest unit a store used to memory is. Defaults to @code{MOVE_MAX_PIECES}, or two times the size of @code{HOST_WIDE_INT}, whichever is smaller. @end defmac @defmac COMPARE_MAX_PIECES A C expression used by @code{compare_by_pieces} to determine the largest unit a load or store used to compare memory is. Defaults to @code{MOVE_MAX_PIECES}. @end defmac @defmac CLEAR_RATIO (@var{speed}) The threshold of number of scalar move insns, @emph{below} which a sequence of insns should be generated to clear memory instead of a string clear insn or a library call. Increasing the value will always make code faster, but eventually incurs high cost in increased code size. The parameter @var{speed} is true if the code is currently being optimized for speed rather than size. If you don't define this, a reasonable default is used. @end defmac @defmac SET_RATIO (@var{speed}) The threshold of number of scalar move insns, @emph{below} which a sequence of insns should be generated to set memory to a constant value, instead of a block set insn or a library call. Increasing the value will always make code faster, but eventually incurs high cost in increased code size. The parameter @var{speed} is true if the code is currently being optimized for speed rather than size. If you don't define this, it defaults to the value of @code{MOVE_RATIO}. @end defmac @defmac USE_LOAD_POST_INCREMENT (@var{mode}) A C expression used to determine whether a load postincrement is a good thing to use for a given mode. Defaults to the value of @code{HAVE_POST_INCREMENT}. @end defmac @defmac USE_LOAD_POST_DECREMENT (@var{mode}) A C expression used to determine whether a load postdecrement is a good thing to use for a given mode. Defaults to the value of @code{HAVE_POST_DECREMENT}. @end defmac @defmac USE_LOAD_PRE_INCREMENT (@var{mode}) A C expression used to determine whether a load preincrement is a good thing to use for a given mode. Defaults to the value of @code{HAVE_PRE_INCREMENT}. @end defmac @defmac USE_LOAD_PRE_DECREMENT (@var{mode}) A C expression used to determine whether a load predecrement is a good thing to use for a given mode. Defaults to the value of @code{HAVE_PRE_DECREMENT}. @end defmac @defmac USE_STORE_POST_INCREMENT (@var{mode}) A C expression used to determine whether a store postincrement is a good thing to use for a given mode. Defaults to the value of @code{HAVE_POST_INCREMENT}. @end defmac @defmac USE_STORE_POST_DECREMENT (@var{mode}) A C expression used to determine whether a store postdecrement is a good thing to use for a given mode. Defaults to the value of @code{HAVE_POST_DECREMENT}. @end defmac @defmac USE_STORE_PRE_INCREMENT (@var{mode}) This macro is used to determine whether a store preincrement is a good thing to use for a given mode. Defaults to the value of @code{HAVE_PRE_INCREMENT}. @end defmac @defmac USE_STORE_PRE_DECREMENT (@var{mode}) This macro is used to determine whether a store predecrement is a good thing to use for a given mode. Defaults to the value of @code{HAVE_PRE_DECREMENT}. @end defmac @defmac NO_FUNCTION_CSE Define this macro to be true if it is as good or better to call a constant function address than to call an address kept in a register. @end defmac @defmac LOGICAL_OP_NON_SHORT_CIRCUIT Define this macro if a non-short-circuit operation produced by @samp{fold_range_test ()} is optimal. This macro defaults to true if @code{BRANCH_COST} is greater than or equal to the value 2. @end defmac @hook TARGET_OPTAB_SUPPORTED_P @hook TARGET_RTX_COSTS @hook TARGET_ADDRESS_COST @hook TARGET_INSN_COST @hook TARGET_MAX_NOCE_IFCVT_SEQ_COST @hook TARGET_NOCE_CONVERSION_PROFITABLE_P @hook TARGET_NEW_ADDRESS_PROFITABLE_P @hook TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P @hook TARGET_ESTIMATED_POLY_VALUE @node Scheduling @section Adjusting the Instruction Scheduler The instruction scheduler may need a fair amount of machine-specific adjustment in order to produce good code. GCC provides several target hooks for this purpose. It is usually enough to define just a few of them: try the first ones in this list first. @hook TARGET_SCHED_ISSUE_RATE @hook TARGET_SCHED_VARIABLE_ISSUE @hook TARGET_SCHED_ADJUST_COST @hook TARGET_SCHED_ADJUST_PRIORITY @hook TARGET_SCHED_REORDER @hook TARGET_SCHED_REORDER2 @hook TARGET_SCHED_MACRO_FUSION_P @hook TARGET_SCHED_MACRO_FUSION_PAIR_P @hook TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK @hook TARGET_SCHED_INIT @hook TARGET_SCHED_FINISH @hook TARGET_SCHED_INIT_GLOBAL @hook TARGET_SCHED_FINISH_GLOBAL @hook TARGET_SCHED_DFA_PRE_CYCLE_INSN @hook TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN @hook TARGET_SCHED_DFA_POST_CYCLE_INSN @hook TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN @hook TARGET_SCHED_DFA_PRE_ADVANCE_CYCLE @hook TARGET_SCHED_DFA_POST_ADVANCE_CYCLE @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_BEGIN @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_ISSUE @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_BACKTRACK @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_END @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_INIT @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_FINI @hook TARGET_SCHED_DFA_NEW_CYCLE @hook TARGET_SCHED_IS_COSTLY_DEPENDENCE @hook TARGET_SCHED_H_I_D_EXTENDED @hook TARGET_SCHED_ALLOC_SCHED_CONTEXT @hook TARGET_SCHED_INIT_SCHED_CONTEXT @hook TARGET_SCHED_SET_SCHED_CONTEXT @hook TARGET_SCHED_CLEAR_SCHED_CONTEXT @hook TARGET_SCHED_FREE_SCHED_CONTEXT @hook TARGET_SCHED_SPECULATE_INSN @hook TARGET_SCHED_NEEDS_BLOCK_P @hook TARGET_SCHED_GEN_SPEC_CHECK @hook TARGET_SCHED_SET_SCHED_FLAGS @hook TARGET_SCHED_CAN_SPECULATE_INSN @hook TARGET_SCHED_SMS_RES_MII @hook TARGET_SCHED_DISPATCH @hook TARGET_SCHED_DISPATCH_DO @hook TARGET_SCHED_EXPOSED_PIPELINE @hook TARGET_SCHED_REASSOCIATION_WIDTH @hook TARGET_SCHED_FUSION_PRIORITY @hook TARGET_EXPAND_DIVMOD_LIBFUNC @node Sections @section Dividing the Output into Sections (Texts, Data, @dots{}) @c the above section title is WAY too long. maybe cut the part between @c the (...)? --mew 10feb93 An object file is divided into sections containing different types of data. In the most common case, there are three sections: the @dfn{text section}, which holds instructions and read-only data; the @dfn{data section}, which holds initialized writable data; and the @dfn{bss section}, which holds uninitialized data. Some systems have other kinds of sections. @file{varasm.cc} provides several well-known sections, such as @code{text_section}, @code{data_section} and @code{bss_section}. The normal way of controlling a @code{@var{foo}_section} variable is to define the associated @code{@var{FOO}_SECTION_ASM_OP} macro, as described below. The macros are only read once, when @file{varasm.cc} initializes itself, so their values must be run-time constants. They may however depend on command-line flags. @emph{Note:} Some run-time files, such @file{crtstuff.c}, also make use of the @code{@var{FOO}_SECTION_ASM_OP} macros, and expect them to be string literals. Some assemblers require a different string to be written every time a section is selected. If your assembler falls into this category, you should define the @code{TARGET_ASM_INIT_SECTIONS} hook and use @code{get_unnamed_section} to set up the sections. You must always create a @code{text_section}, either by defining @code{TEXT_SECTION_ASM_OP} or by initializing @code{text_section} in @code{TARGET_ASM_INIT_SECTIONS}. The same is true of @code{data_section} and @code{DATA_SECTION_ASM_OP}. If you do not create a distinct @code{readonly_data_section}, the default is to reuse @code{text_section}. All the other @file{varasm.cc} sections are optional, and are null if the target does not provide them. @defmac TEXT_SECTION_ASM_OP A C expression whose value is a string, including spacing, containing the assembler operation that should precede instructions and read-only data. Normally @code{"\t.text"} is right. @end defmac @defmac HOT_TEXT_SECTION_NAME If defined, a C string constant for the name of the section containing most frequently executed functions of the program. If not defined, GCC will provide a default definition if the target supports named sections. @end defmac @defmac UNLIKELY_EXECUTED_TEXT_SECTION_NAME If defined, a C string constant for the name of the section containing unlikely executed functions in the program. @end defmac @defmac DATA_SECTION_ASM_OP A C expression whose value is a string, including spacing, containing the assembler operation to identify the following data as writable initialized data. Normally @code{"\t.data"} is right. @end defmac @defmac SDATA_SECTION_ASM_OP If defined, a C expression whose value is a string, including spacing, containing the assembler operation to identify the following data as initialized, writable small data. @end defmac @defmac READONLY_DATA_SECTION_ASM_OP A C expression whose value is a string, including spacing, containing the assembler operation to identify the following data as read-only initialized data. @end defmac @defmac BSS_SECTION_ASM_OP If defined, a C expression whose value is a string, including spacing, containing the assembler operation to identify the following data as uninitialized global data. If not defined, and @code{ASM_OUTPUT_ALIGNED_BSS} not defined, uninitialized global data will be output in the data section if @option{-fno-common} is passed, otherwise @code{ASM_OUTPUT_COMMON} will be used. @end defmac @defmac SBSS_SECTION_ASM_OP If defined, a C expression whose value is a string, including spacing, containing the assembler operation to identify the following data as uninitialized, writable small data. @end defmac @defmac TLS_COMMON_ASM_OP If defined, a C expression whose value is a string containing the assembler operation to identify the following data as thread-local common data. The default is @code{".tls_common"}. @end defmac @defmac TLS_SECTION_ASM_FLAG If defined, a C expression whose value is a character constant containing the flag used to mark a section as a TLS section. The default is @code{'T'}. @end defmac @defmac INIT_SECTION_ASM_OP If defined, a C expression whose value is a string, including spacing, containing the assembler operation to identify the following data as initialization code. If not defined, GCC will assume such a section does not exist. This section has no corresponding @code{init_section} variable; it is used entirely in runtime code. @end defmac @defmac FINI_SECTION_ASM_OP If defined, a C expression whose value is a string, including spacing, containing the assembler operation to identify the following data as finalization code. If not defined, GCC will assume such a section does not exist. This section has no corresponding @code{fini_section} variable; it is used entirely in runtime code. @end defmac @defmac INIT_ARRAY_SECTION_ASM_OP If defined, a C expression whose value is a string, including spacing, containing the assembler operation to identify the following data as part of the @code{.init_array} (or equivalent) section. If not defined, GCC will assume such a section does not exist. Do not define both this macro and @code{INIT_SECTION_ASM_OP}. @end defmac @defmac FINI_ARRAY_SECTION_ASM_OP If defined, a C expression whose value is a string, including spacing, containing the assembler operation to identify the following data as part of the @code{.fini_array} (or equivalent) section. If not defined, GCC will assume such a section does not exist. Do not define both this macro and @code{FINI_SECTION_ASM_OP}. @end defmac @defmac MACH_DEP_SECTION_ASM_FLAG If defined, a C expression whose value is a character constant containing the flag used to mark a machine-dependent section. This corresponds to the @code{SECTION_MACH_DEP} section flag. @end defmac @defmac CRT_CALL_STATIC_FUNCTION (@var{section_op}, @var{function}) If defined, an ASM statement that switches to a different section via @var{section_op}, calls @var{function}, and switches back to the text section. This is used in @file{crtstuff.c} if @code{INIT_SECTION_ASM_OP} or @code{FINI_SECTION_ASM_OP} to calls to initialization and finalization functions from the init and fini sections. By default, this macro uses a simple function call. Some ports need hand-crafted assembly code to avoid dependencies on registers initialized in the function prologue or to ensure that constant pools don't end up too far way in the text section. @end defmac @defmac TARGET_LIBGCC_SDATA_SECTION If defined, a string which names the section into which small variables defined in crtstuff and libgcc should go. This is useful when the target has options for optimizing access to small data, and you want the crtstuff and libgcc routines to be conservative in what they expect of your application yet liberal in what your application expects. For example, for targets with a @code{.sdata} section (like MIPS), you could compile crtstuff with @code{-G 0} so that it doesn't require small data support from your application, but use this macro to put small data into @code{.sdata} so that your application can access these variables whether it uses small data or not. @end defmac @defmac FORCE_CODE_SECTION_ALIGN If defined, an ASM statement that aligns a code section to some arbitrary boundary. This is used to force all fragments of the @code{.init} and @code{.fini} sections to have to same alignment and thus prevent the linker from having to add any padding. @end defmac @defmac JUMP_TABLES_IN_TEXT_SECTION Define this macro to be an expression with a nonzero value if jump tables (for @code{tablejump} insns) should be output in the text section, along with the assembler instructions. Otherwise, the readonly data section is used. This macro is irrelevant if there is no separate readonly data section. @end defmac @hook TARGET_ASM_INIT_SECTIONS @hook TARGET_ASM_RELOC_RW_MASK @hook TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC @hook TARGET_ASM_SELECT_SECTION @defmac USE_SELECT_SECTION_FOR_FUNCTIONS Define this macro if you wish TARGET_ASM_SELECT_SECTION to be called for @code{FUNCTION_DECL}s as well as for variables and constants. In the case of a @code{FUNCTION_DECL}, @var{reloc} will be zero if the function has been determined to be likely to be called, and nonzero if it is unlikely to be called. @end defmac @hook TARGET_ASM_UNIQUE_SECTION @hook TARGET_ASM_FUNCTION_RODATA_SECTION @hook TARGET_ASM_MERGEABLE_RODATA_PREFIX @hook TARGET_ASM_TM_CLONE_TABLE_SECTION @hook TARGET_ASM_SELECT_RTX_SECTION @hook TARGET_MANGLE_DECL_ASSEMBLER_NAME @hook TARGET_ENCODE_SECTION_INFO @hook TARGET_STRIP_NAME_ENCODING @hook TARGET_IN_SMALL_DATA_P @hook TARGET_HAVE_SRODATA_SECTION @hook TARGET_PROFILE_BEFORE_PROLOGUE @hook TARGET_BINDS_LOCAL_P @hook TARGET_HAVE_TLS @node PIC @section Position Independent Code @cindex position independent code @cindex PIC This section describes macros that help implement generation of position independent code. Simply defining these macros is not enough to generate valid PIC; you must also add support to the hook @code{TARGET_LEGITIMATE_ADDRESS_P} and to the macro @code{PRINT_OPERAND_ADDRESS}, as well as @code{LEGITIMIZE_ADDRESS}. You must modify the definition of @samp{movsi} to do something appropriate when the source operand contains a symbolic address. You may also need to alter the handling of switch statements so that they use relative addresses. @c i rearranged the order of the macros above to try to force one of @c them to the next line, to eliminate an overfull hbox. --mew 10feb93 @defmac PIC_OFFSET_TABLE_REGNUM The register number of the register used to address a table of static data addresses in memory. In some cases this register is defined by a processor's ``application binary interface'' (ABI)@. When this macro is defined, RTL is generated for this register once, as with the stack pointer and frame pointer registers. If this macro is not defined, it is up to the machine-dependent files to allocate such a register (if necessary). Note that this register must be fixed when in use (e.g.@: when @code{flag_pic} is true). @end defmac @defmac PIC_OFFSET_TABLE_REG_CALL_CLOBBERED A C expression that is nonzero if the register defined by @code{PIC_OFFSET_TABLE_REGNUM} is clobbered by calls. If not defined, the default is zero. Do not define this macro if @code{PIC_OFFSET_TABLE_REGNUM} is not defined. @end defmac @defmac LEGITIMATE_PIC_OPERAND_P (@var{x}) A C expression that is nonzero if @var{x} is a legitimate immediate operand on the target machine when generating position independent code. You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need not check this. You can also assume @var{flag_pic} is true, so you need not check it either. You need not define this macro if all constants (including @code{SYMBOL_REF}) can be immediate operands when generating position independent code. @end defmac @node Assembler Format @section Defining the Output Assembler Language This section describes macros whose principal purpose is to describe how to write instructions in assembler language---rather than what the instructions do. @menu * File Framework:: Structural information for the assembler file. * Data Output:: Output of constants (numbers, strings, addresses). * Uninitialized Data:: Output of uninitialized variables. * Label Output:: Output and generation of labels. * Initialization:: General principles of initialization and termination routines. * Macros for Initialization:: Specific macros that control the handling of initialization and termination routines. * Instruction Output:: Output of actual instructions. * Dispatch Tables:: Output of jump tables. * Exception Region Output:: Output of exception region code. * Alignment Output:: Pseudo ops for alignment and skipping data. @end menu @node File Framework @subsection The Overall Framework of an Assembler File @cindex assembler format @cindex output of assembler code @c prevent bad page break with this line This describes the overall framework of an assembly file. @findex default_file_start @hook TARGET_ASM_FILE_START @hook TARGET_ASM_FILE_START_APP_OFF @hook TARGET_ASM_FILE_START_FILE_DIRECTIVE @hook TARGET_ASM_FILE_END @deftypefun void file_end_indicate_exec_stack () Some systems use a common convention, the @samp{.note.GNU-stack} special section, to indicate whether or not an object file relies on the stack being executable. If your system uses this convention, you should define @code{TARGET_ASM_FILE_END} to this function. If you need to do other things in that hook, have your hook function call this function. @end deftypefun @hook TARGET_ASM_LTO_START @hook TARGET_ASM_LTO_END @hook TARGET_ASM_CODE_END @defmac ASM_COMMENT_START A C string constant describing how to begin a comment in the target assembler language. The compiler assumes that the comment will end at the end of the line. @end defmac @defmac ASM_APP_ON A C string constant for text to be output before each @code{asm} statement or group of consecutive ones. Normally this is @code{"#APP"}, which is a comment that has no effect on most assemblers but tells the GNU assembler that it must check the lines that follow for all valid assembler constructs. @end defmac @defmac ASM_APP_OFF A C string constant for text to be output after each @code{asm} statement or group of consecutive ones. Normally this is @code{"#NO_APP"}, which tells the GNU assembler to resume making the time-saving assumptions that are valid for ordinary compiler output. @end defmac @defmac ASM_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name}) A C statement to output COFF information or DWARF debugging information which indicates that filename @var{name} is the current source file to the stdio stream @var{stream}. This macro need not be defined if the standard form of output for the file format in use is appropriate. @end defmac @hook TARGET_ASM_OUTPUT_SOURCE_FILENAME @hook TARGET_ASM_OUTPUT_IDENT @defmac OUTPUT_QUOTED_STRING (@var{stream}, @var{string}) A C statement to output the string @var{string} to the stdio stream @var{stream}. If you do not call the function @code{output_quoted_string} in your config files, GCC will only call it to output filenames to the assembler source. So you can use it to canonicalize the format of the filename using this macro. @end defmac @hook TARGET_ASM_NAMED_SECTION @hook TARGET_ASM_ELF_FLAGS_NUMERIC @hook TARGET_ASM_FUNCTION_SECTION @hook TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS @hook TARGET_HAVE_NAMED_SECTIONS This flag is true if the target supports @code{TARGET_ASM_NAMED_SECTION}. It must not be modified by command-line option processing. @end deftypevr @anchor{TARGET_HAVE_SWITCHABLE_BSS_SECTIONS} @hook TARGET_HAVE_SWITCHABLE_BSS_SECTIONS @hook TARGET_SECTION_TYPE_FLAGS @hook TARGET_ASM_RECORD_GCC_SWITCHES @hook TARGET_ASM_RECORD_GCC_SWITCHES_SECTION @need 2000 @node Data Output @subsection Output of Data @hook TARGET_ASM_BYTE_OP @hook TARGET_ASM_INTEGER @hook TARGET_ASM_DECL_END @hook TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA @defmac ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len}) A C statement to output to the stdio stream @var{stream} an assembler instruction to assemble a string constant containing the @var{len} bytes at @var{ptr}. @var{ptr} will be a C expression of type @code{char *} and @var{len} a C expression of type @code{int}. If the assembler has a @code{.ascii} pseudo-op as found in the Berkeley Unix assembler, do not define the macro @code{ASM_OUTPUT_ASCII}. @end defmac @defmac ASM_OUTPUT_FDESC (@var{stream}, @var{decl}, @var{n}) A C statement to output word @var{n} of a function descriptor for @var{decl}. This must be defined if @code{TARGET_VTABLE_USES_DESCRIPTORS} is defined, and is otherwise unused. @end defmac @defmac CONSTANT_POOL_BEFORE_FUNCTION You may define this macro as a C expression. You should define the expression to have a nonzero value if GCC should output the constant pool for a function before the code for the function, or a zero value if GCC should output the constant pool after the function. If you do not define this macro, the usual case, GCC will output the constant pool before the function. @end defmac @defmac ASM_OUTPUT_POOL_PROLOGUE (@var{file}, @var{funname}, @var{fundecl}, @var{size}) A C statement to output assembler commands to define the start of the constant pool for a function. @var{funname} is a string giving the name of the function. Should the return type of the function be required, it can be obtained via @var{fundecl}. @var{size} is the size, in bytes, of the constant pool that will be written immediately after this call. If no constant-pool prefix is required, the usual case, this macro need not be defined. @end defmac @defmac ASM_OUTPUT_SPECIAL_POOL_ENTRY (@var{file}, @var{x}, @var{mode}, @var{align}, @var{labelno}, @var{jumpto}) A C statement (with or without semicolon) to output a constant in the constant pool, if it needs special treatment. (This macro need not do anything for RTL expressions that can be output normally.) The argument @var{file} is the standard I/O stream to output the assembler code on. @var{x} is the RTL expression for the constant to output, and @var{mode} is the machine mode (in case @var{x} is a @samp{const_int}). @var{align} is the required alignment for the value @var{x}; you should output an assembler directive to force this much alignment. The argument @var{labelno} is a number to use in an internal label for the address of this pool entry. The definition of this macro is responsible for outputting the label definition at the proper place. Here is how to do this: @smallexample @code{(*targetm.asm_out.internal_label)} (@var{file}, "LC", @var{labelno}); @end smallexample When you output a pool entry specially, you should end with a @code{goto} to the label @var{jumpto}. This will prevent the same pool entry from being output a second time in the usual manner. You need not define this macro if it would do nothing. @end defmac @defmac ASM_OUTPUT_POOL_EPILOGUE (@var{file} @var{funname} @var{fundecl} @var{size}) A C statement to output assembler commands to at the end of the constant pool for a function. @var{funname} is a string giving the name of the function. Should the return type of the function be required, you can obtain it via @var{fundecl}. @var{size} is the size, in bytes, of the constant pool that GCC wrote immediately before this call. If no constant-pool epilogue is required, the usual case, you need not define this macro. @end defmac @defmac IS_ASM_LOGICAL_LINE_SEPARATOR (@var{C}, @var{STR}) Define this macro as a C expression which is nonzero if @var{C} is used as a logical line separator by the assembler. @var{STR} points to the position in the string where @var{C} was found; this can be used if a line separator uses multiple characters. If you do not define this macro, the default is that only the character @samp{;} is treated as a logical line separator. @end defmac @hook TARGET_ASM_OPEN_PAREN These macros are provided by @file{real.h} for writing the definitions of @code{ASM_OUTPUT_DOUBLE} and the like: @defmac REAL_VALUE_TO_TARGET_SINGLE (@var{x}, @var{l}) @defmacx REAL_VALUE_TO_TARGET_DOUBLE (@var{x}, @var{l}) @defmacx REAL_VALUE_TO_TARGET_LONG_DOUBLE (@var{x}, @var{l}) @defmacx REAL_VALUE_TO_TARGET_DECIMAL32 (@var{x}, @var{l}) @defmacx REAL_VALUE_TO_TARGET_DECIMAL64 (@var{x}, @var{l}) @defmacx REAL_VALUE_TO_TARGET_DECIMAL128 (@var{x}, @var{l}) These translate @var{x}, of type @code{REAL_VALUE_TYPE}, to the target's floating point representation, and store its bit pattern in the variable @var{l}. For @code{REAL_VALUE_TO_TARGET_SINGLE} and @code{REAL_VALUE_TO_TARGET_DECIMAL32}, this variable should be a simple @code{long int}. For the others, it should be an array of @code{long int}. The number of elements in this array is determined by the size of the desired target floating point data type: 32 bits of it go in each @code{long int} array element. Each array element holds 32 bits of the result, even if @code{long int} is wider than 32 bits on the host machine. The array element values are designed so that you can print them out using @code{fprintf} in the order they should appear in the target machine's memory. @end defmac @node Uninitialized Data @subsection Output of Uninitialized Variables Each of the macros in this section is used to do the whole job of outputting a single uninitialized variable. @defmac ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded}) A C statement (sans semicolon) to output to the stdio stream @var{stream} the assembler definition of a common-label named @var{name} whose size is @var{size} bytes. The variable @var{rounded} is the size rounded up to whatever alignment the caller wants. It is possible that @var{size} may be zero, for instance if a struct with no other member than a zero-length array is defined. In this case, the backend must output a symbol definition that allocates at least one byte, both so that the address of the resulting object does not compare equal to any other, and because some object formats cannot even express the concept of a zero-sized common symbol, as that is how they represent an ordinary undefined external. Use the expression @code{assemble_name (@var{stream}, @var{name})} to output the name itself; before and after that, output the additional assembler syntax for defining the name, and a newline. This macro controls how the assembler definitions of uninitialized common global variables are output. @end defmac @defmac ASM_OUTPUT_ALIGNED_COMMON (@var{stream}, @var{name}, @var{size}, @var{alignment}) Like @code{ASM_OUTPUT_COMMON} except takes the required alignment as a separate, explicit argument. If you define this macro, it is used in place of @code{ASM_OUTPUT_COMMON}, and gives you more flexibility in handling the required alignment of the variable. The alignment is specified as the number of bits. @end defmac @defmac ASM_OUTPUT_ALIGNED_DECL_COMMON (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment}) Like @code{ASM_OUTPUT_ALIGNED_COMMON} except that @var{decl} of the variable to be output, if there is one, or @code{NULL_TREE} if there is no corresponding variable. If you define this macro, GCC will use it in place of both @code{ASM_OUTPUT_COMMON} and @code{ASM_OUTPUT_ALIGNED_COMMON}. Define this macro when you need to see the variable's decl in order to chose what to output. @end defmac @defmac ASM_OUTPUT_ALIGNED_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment}) A C statement (sans semicolon) to output to the stdio stream @var{stream} the assembler definition of uninitialized global @var{decl} named @var{name} whose size is @var{size} bytes. The variable @var{alignment} is the alignment specified as the number of bits. Try to use function @code{asm_output_aligned_bss} defined in file @file{varasm.cc} when defining this macro. If unable, use the expression @code{assemble_name (@var{stream}, @var{name})} to output the name itself; before and after that, output the additional assembler syntax for defining the name, and a newline. There are two ways of handling global BSS@. One is to define this macro. The other is to have @code{TARGET_ASM_SELECT_SECTION} return a switchable BSS section (@pxref{TARGET_HAVE_SWITCHABLE_BSS_SECTIONS}). You do not need to do both. Some languages do not have @code{common} data, and require a non-common form of global BSS in order to handle uninitialized globals efficiently. C++ is one example of this. However, if the target does not support global BSS, the front end may choose to make globals common in order to save space in the object file. @end defmac @defmac ASM_OUTPUT_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded}) A C statement (sans semicolon) to output to the stdio stream @var{stream} the assembler definition of a local-common-label named @var{name} whose size is @var{size} bytes. The variable @var{rounded} is the size rounded up to whatever alignment the caller wants. Use the expression @code{assemble_name (@var{stream}, @var{name})} to output the name itself; before and after that, output the additional assembler syntax for defining the name, and a newline. This macro controls how the assembler definitions of uninitialized static variables are output. @end defmac @defmac ASM_OUTPUT_ALIGNED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{alignment}) Like @code{ASM_OUTPUT_LOCAL} except takes the required alignment as a separate, explicit argument. If you define this macro, it is used in place of @code{ASM_OUTPUT_LOCAL}, and gives you more flexibility in handling the required alignment of the variable. The alignment is specified as the number of bits. @end defmac @defmac ASM_OUTPUT_ALIGNED_DECL_LOCAL (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment}) Like @code{ASM_OUTPUT_ALIGNED_LOCAL} except that @var{decl} of the variable to be output, if there is one, or @code{NULL_TREE} if there is no corresponding variable. If you define this macro, GCC will use it in place of both @code{ASM_OUTPUT_LOCAL} and @code{ASM_OUTPUT_ALIGNED_LOCAL}. Define this macro when you need to see the variable's decl in order to chose what to output. @end defmac @node Label Output @subsection Output and Generation of Labels @c prevent bad page break with this line This is about outputting labels. @findex assemble_name @defmac ASM_OUTPUT_LABEL (@var{stream}, @var{name}) A C statement (sans semicolon) to output to the stdio stream @var{stream} the assembler definition of a label named @var{name}. Use the expression @code{assemble_name (@var{stream}, @var{name})} to output the name itself; before and after that, output the additional assembler syntax for defining the name, and a newline. A default definition of this macro is provided which is correct for most systems. @end defmac @defmac ASM_OUTPUT_FUNCTION_LABEL (@var{stream}, @var{name}, @var{decl}) A C statement (sans semicolon) to output to the stdio stream @var{stream} the assembler definition of a label named @var{name} of a function. Use the expression @code{assemble_name (@var{stream}, @var{name})} to output the name itself; before and after that, output the additional assembler syntax for defining the name, and a newline. A default definition of this macro is provided which is correct for most systems. If this macro is not defined, then the function name is defined in the usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}). @end defmac @findex assemble_name_raw @defmac ASM_OUTPUT_INTERNAL_LABEL (@var{stream}, @var{name}) Identical to @code{ASM_OUTPUT_LABEL}, except that @var{name} is known to refer to a compiler-generated label. The default definition uses @code{assemble_name_raw}, which is like @code{assemble_name} except that it is more efficient. @end defmac @defmac SIZE_ASM_OP A C string containing the appropriate assembler directive to specify the size of a symbol, without any arguments. On systems that use ELF, the default (in @file{config/elfos.h}) is @samp{"\t.size\t"}; on other systems, the default is not to define this macro. Define this macro only if it is correct to use the default definitions of @code{ASM_OUTPUT_SIZE_DIRECTIVE} and @code{ASM_OUTPUT_MEASURED_SIZE} for your system. If you need your own custom definitions of those macros, or if you do not need explicit symbol sizes at all, do not define this macro. @end defmac @defmac ASM_OUTPUT_SIZE_DIRECTIVE (@var{stream}, @var{name}, @var{size}) A C statement (sans semicolon) to output to the stdio stream @var{stream} a directive telling the assembler that the size of the symbol @var{name} is @var{size}. @var{size} is a @code{HOST_WIDE_INT}. If you define @code{SIZE_ASM_OP}, a default definition of this macro is provided. @end defmac @defmac ASM_OUTPUT_MEASURED_SIZE (@var{stream}, @var{name}) A C statement (sans semicolon) to output to the stdio stream @var{stream} a directive telling the assembler to calculate the size of the symbol @var{name} by subtracting its address from the current address. If you define @code{SIZE_ASM_OP}, a default definition of this macro is provided. The default assumes that the assembler recognizes a special @samp{.} symbol as referring to the current address, and can calculate the difference between this and another symbol. If your assembler does not recognize @samp{.} or cannot do calculations with it, you will need to redefine @code{ASM_OUTPUT_MEASURED_SIZE} to use some other technique. @end defmac @defmac NO_DOLLAR_IN_LABEL Define this macro if the assembler does not accept the character @samp{$} in label names. By default constructors and destructors in G++ have @samp{$} in the identifiers. If this macro is defined, @samp{.} is used instead. @end defmac @defmac NO_DOT_IN_LABEL Define this macro if the assembler does not accept the character @samp{.} in label names. By default constructors and destructors in G++ have names that use @samp{.}. If this macro is defined, these names are rewritten to avoid @samp{.}. @end defmac @defmac TYPE_ASM_OP A C string containing the appropriate assembler directive to specify the type of a symbol, without any arguments. On systems that use ELF, the default (in @file{config/elfos.h}) is @samp{"\t.type\t"}; on other systems, the default is not to define this macro. Define this macro only if it is correct to use the default definition of @code{ASM_OUTPUT_TYPE_DIRECTIVE} for your system. If you need your own custom definition of this macro, or if you do not need explicit symbol types at all, do not define this macro. @end defmac @defmac TYPE_OPERAND_FMT A C string which specifies (using @code{printf} syntax) the format of the second operand to @code{TYPE_ASM_OP}. On systems that use ELF, the default (in @file{config/elfos.h}) is @samp{"@@%s"}; on other systems, the default is not to define this macro. Define this macro only if it is correct to use the default definition of @code{ASM_OUTPUT_TYPE_DIRECTIVE} for your system. If you need your own custom definition of this macro, or if you do not need explicit symbol types at all, do not define this macro. @end defmac @defmac ASM_OUTPUT_TYPE_DIRECTIVE (@var{stream}, @var{type}) A C statement (sans semicolon) to output to the stdio stream @var{stream} a directive telling the assembler that the type of the symbol @var{name} is @var{type}. @var{type} is a C string; currently, that string is always either @samp{"function"} or @samp{"object"}, but you should not count on this. If you define @code{TYPE_ASM_OP} and @code{TYPE_OPERAND_FMT}, a default definition of this macro is provided. @end defmac @defmac ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl}) A C statement (sans semicolon) to output to the stdio stream @var{stream} any text necessary for declaring the name @var{name} of a function which is being defined. This macro is responsible for outputting the label definition (perhaps using @code{ASM_OUTPUT_FUNCTION_LABEL}). The argument @var{decl} is the @code{FUNCTION_DECL} tree node representing the function. If this macro is not defined, then the function name is defined in the usual manner as a label (by means of @code{ASM_OUTPUT_FUNCTION_LABEL}). You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in the definition of this macro. @end defmac @defmac ASM_DECLARE_FUNCTION_SIZE (@var{stream}, @var{name}, @var{decl}) A C statement (sans semicolon) to output to the stdio stream @var{stream} any text necessary for declaring the size of a function which is being defined. The argument @var{name} is the name of the function. The argument @var{decl} is the @code{FUNCTION_DECL} tree node representing the function. If this macro is not defined, then the function size is not defined. You may wish to use @code{ASM_OUTPUT_MEASURED_SIZE} in the definition of this macro. @end defmac @defmac ASM_DECLARE_COLD_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl}) A C statement (sans semicolon) to output to the stdio stream @var{stream} any text necessary for declaring the name @var{name} of a cold function partition which is being defined. This macro is responsible for outputting the label definition (perhaps using @code{ASM_OUTPUT_FUNCTION_LABEL}). The argument @var{decl} is the @code{FUNCTION_DECL} tree node representing the function. If this macro is not defined, then the cold partition name is defined in the usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}). You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in the definition of this macro. @end defmac @defmac ASM_DECLARE_COLD_FUNCTION_SIZE (@var{stream}, @var{name}, @var{decl}) A C statement (sans semicolon) to output to the stdio stream @var{stream} any text necessary for declaring the size of a cold function partition which is being defined. The argument @var{name} is the name of the cold partition of the function. The argument @var{decl} is the @code{FUNCTION_DECL} tree node representing the function. If this macro is not defined, then the partition size is not defined. You may wish to use @code{ASM_OUTPUT_MEASURED_SIZE} in the definition of this macro. @end defmac @defmac ASM_DECLARE_OBJECT_NAME (@var{stream}, @var{name}, @var{decl}) A C statement (sans semicolon) to output to the stdio stream @var{stream} any text necessary for declaring the name @var{name} of an initialized variable which is being defined. This macro must output the label definition (perhaps using @code{ASM_OUTPUT_LABEL}). The argument @var{decl} is the @code{VAR_DECL} tree node representing the variable. If this macro is not defined, then the variable name is defined in the usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}). You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} and/or @code{ASM_OUTPUT_SIZE_DIRECTIVE} in the definition of this macro. @end defmac @hook TARGET_ASM_DECLARE_CONSTANT_NAME @defmac ASM_DECLARE_REGISTER_GLOBAL (@var{stream}, @var{decl}, @var{regno}, @var{name}) A C statement (sans semicolon) to output to the stdio stream @var{stream} any text necessary for claiming a register @var{regno} for a global variable @var{decl} with name @var{name}. If you don't define this macro, that is equivalent to defining it to do nothing. @end defmac @defmac ASM_FINISH_DECLARE_OBJECT (@var{stream}, @var{decl}, @var{toplevel}, @var{atend}) A C statement (sans semicolon) to finish up declaring a variable name once the compiler has processed its initializer fully and thus has had a chance to determine the size of an array when controlled by an initializer. This is used on systems where it's necessary to declare something about the size of the object. If you don't define this macro, that is equivalent to defining it to do nothing. You may wish to use @code{ASM_OUTPUT_SIZE_DIRECTIVE} and/or @code{ASM_OUTPUT_MEASURED_SIZE} in the definition of this macro. @end defmac @hook TARGET_ASM_GLOBALIZE_LABEL @hook TARGET_ASM_GLOBALIZE_DECL_NAME @hook TARGET_ASM_ASSEMBLE_UNDEFINED_DECL @defmac ASM_WEAKEN_LABEL (@var{stream}, @var{name}) A C statement (sans semicolon) to output to the stdio stream @var{stream} some commands that will make the label @var{name} weak; that is, available for reference from other files but only used if no other definition is available. Use the expression @code{assemble_name (@var{stream}, @var{name})} to output the name itself; before and after that, output the additional assembler syntax for making that name weak, and a newline. If you don't define this macro or @code{ASM_WEAKEN_DECL}, GCC will not support weak symbols and you should not define the @code{SUPPORTS_WEAK} macro. @end defmac @defmac ASM_WEAKEN_DECL (@var{stream}, @var{decl}, @var{name}, @var{value}) Combines (and replaces) the function of @code{ASM_WEAKEN_LABEL} and @code{ASM_OUTPUT_WEAK_ALIAS}, allowing access to the associated function or variable decl. If @var{value} is not @code{NULL}, this C statement should output to the stdio stream @var{stream} assembler code which defines (equates) the weak symbol @var{name} to have the value @var{value}. If @var{value} is @code{NULL}, it should output commands to make @var{name} weak. @end defmac @defmac ASM_OUTPUT_WEAKREF (@var{stream}, @var{decl}, @var{name}, @var{value}) Outputs a directive that enables @var{name} to be used to refer to symbol @var{value} with weak-symbol semantics. @code{decl} is the declaration of @code{name}. @end defmac @defmac SUPPORTS_WEAK A preprocessor constant expression which evaluates to true if the target supports weak symbols. If you don't define this macro, @file{defaults.h} provides a default definition. If either @code{ASM_WEAKEN_LABEL} or @code{ASM_WEAKEN_DECL} is defined, the default definition is @samp{1}; otherwise, it is @samp{0}. @end defmac @defmac TARGET_SUPPORTS_WEAK A C expression which evaluates to true if the target supports weak symbols. If you don't define this macro, @file{defaults.h} provides a default definition. The default definition is @samp{(SUPPORTS_WEAK)}. Define this macro if you want to control weak symbol support with a compiler flag such as @option{-melf}. @end defmac @defmac MAKE_DECL_ONE_ONLY (@var{decl}) A C statement (sans semicolon) to mark @var{decl} to be emitted as a public symbol such that extra copies in multiple translation units will be discarded by the linker. Define this macro if your object file format provides support for this concept, such as the @samp{COMDAT} section flags in the Microsoft Windows PE/COFF format, and this support requires changes to @var{decl}, such as putting it in a separate section. @end defmac @defmac SUPPORTS_ONE_ONLY A C expression which evaluates to true if the target supports one-only semantics. If you don't define this macro, @file{varasm.cc} provides a default definition. If @code{MAKE_DECL_ONE_ONLY} is defined, the default definition is @samp{1}; otherwise, it is @samp{0}. Define this macro if you want to control one-only symbol support with a compiler flag, or if setting the @code{DECL_ONE_ONLY} flag is enough to mark a declaration to be emitted as one-only. @end defmac @hook TARGET_ASM_ASSEMBLE_VISIBILITY @defmac TARGET_WEAK_NOT_IN_ARCHIVE_TOC A C expression that evaluates to true if the target's linker expects that weak symbols do not appear in a static archive's table of contents. The default is @code{0}. Leaving weak symbols out of an archive's table of contents means that, if a symbol will only have a definition in one translation unit and will have undefined references from other translation units, that symbol should not be weak. Defining this macro to be nonzero will thus have the effect that certain symbols that would normally be weak (explicit template instantiations, and vtables for polymorphic classes with noninline key methods) will instead be nonweak. The C++ ABI requires this macro to be zero. Define this macro for targets where full C++ ABI compliance is impossible and where linker restrictions require weak symbols to be left out of a static archive's table of contents. @end defmac @defmac ASM_OUTPUT_EXTERNAL (@var{stream}, @var{decl}, @var{name}) A C statement (sans semicolon) to output to the stdio stream @var{stream} any text necessary for declaring the name of an external symbol named @var{name} which is referenced in this compilation but not defined. The value of @var{decl} is the tree node for the declaration. This macro need not be defined if it does not need to output anything. The GNU assembler and most Unix assemblers don't require anything. @end defmac @hook TARGET_ASM_EXTERNAL_LIBCALL @hook TARGET_ASM_MARK_DECL_PRESERVED @defmac ASM_OUTPUT_LABELREF (@var{stream}, @var{name}) A C statement (sans semicolon) to output to the stdio stream @var{stream} a reference in assembler syntax to a label named @var{name}. This should add @samp{_} to the front of the name, if that is customary on your operating system, as it is in most Berkeley Unix systems. This macro is used in @code{assemble_name}. @end defmac @hook TARGET_MANGLE_ASSEMBLER_NAME @defmac ASM_OUTPUT_SYMBOL_REF (@var{stream}, @var{sym}) A C statement (sans semicolon) to output a reference to @code{SYMBOL_REF} @var{sym}. If not defined, @code{assemble_name} will be used to output the name of the symbol. This macro may be used to modify the way a symbol is referenced depending on information encoded by @code{TARGET_ENCODE_SECTION_INFO}. @end defmac @defmac ASM_OUTPUT_LABEL_REF (@var{stream}, @var{buf}) A C statement (sans semicolon) to output a reference to @var{buf}, the result of @code{ASM_GENERATE_INTERNAL_LABEL}. If not defined, @code{assemble_name} will be used to output the name of the symbol. This macro is not used by @code{output_asm_label}, or the @code{%l} specifier that calls it; the intention is that this macro should be set when it is necessary to output a label differently when its address is being taken. @end defmac @hook TARGET_ASM_INTERNAL_LABEL @defmac ASM_OUTPUT_DEBUG_LABEL (@var{stream}, @var{prefix}, @var{num}) A C statement to output to the stdio stream @var{stream} a debug info label whose name is made from the string @var{prefix} and the number @var{num}. This is useful for VLIW targets, where debug info labels may need to be treated differently than branch target labels. On some systems, branch target labels must be at the beginning of instruction bundles, but debug info labels can occur in the middle of instruction bundles. If this macro is not defined, then @code{(*targetm.asm_out.internal_label)} will be used. @end defmac @defmac ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num}) A C statement to store into the string @var{string} a label whose name is made from the string @var{prefix} and the number @var{num}. This string, when output subsequently by @code{assemble_name}, should produce the output that @code{(*targetm.asm_out.internal_label)} would produce with the same @var{prefix} and @var{num}. If the string begins with @samp{*}, then @code{assemble_name} will output the rest of the string unchanged. It is often convenient for @code{ASM_GENERATE_INTERNAL_LABEL} to use @samp{*} in this way. If the string doesn't start with @samp{*}, then @code{ASM_OUTPUT_LABELREF} gets to output the string, and may change it. (Of course, @code{ASM_OUTPUT_LABELREF} is also part of your machine description, so you should know what it does on your machine.) @end defmac @defmac ASM_FORMAT_PRIVATE_NAME (@var{outvar}, @var{name}, @var{number}) A C expression to assign to @var{outvar} (which is a variable of type @code{char *}) a newly allocated string made from the string @var{name} and the number @var{number}, with some suitable punctuation added. Use @code{alloca} to get space for the string. The string will be used as an argument to @code{ASM_OUTPUT_LABELREF} to produce an assembler label for an internal static variable whose name is @var{name}. Therefore, the string must be such as to result in valid assembler code. The argument @var{number} is different each time this macro is executed; it prevents conflicts between similarly-named internal static variables in different scopes. Ideally this string should not be a valid C identifier, to prevent any conflict with the user's own symbols. Most assemblers allow periods or percent signs in assembler symbols; putting at least one of these between the name and the number will suffice. If this macro is not defined, a default definition will be provided which is correct for most systems. @end defmac @defmac ASM_OUTPUT_DEF (@var{stream}, @var{name}, @var{value}) A C statement to output to the stdio stream @var{stream} assembler code which defines (equates) the symbol @var{name} to have the value @var{value}. @findex SET_ASM_OP If @code{SET_ASM_OP} is defined, a default definition is provided which is correct for most systems. @end defmac @defmac ASM_OUTPUT_DEF_FROM_DECLS (@var{stream}, @var{decl_of_name}, @var{decl_of_value}) A C statement to output to the stdio stream @var{stream} assembler code which defines (equates) the symbol whose tree node is @var{decl_of_name} to have the value of the tree node @var{decl_of_value}. This macro will be used in preference to @samp{ASM_OUTPUT_DEF} if it is defined and if the tree nodes are available. @findex SET_ASM_OP If @code{SET_ASM_OP} is defined, a default definition is provided which is correct for most systems. @end defmac @defmac TARGET_DEFERRED_OUTPUT_DEFS (@var{decl_of_name}, @var{decl_of_value}) A C statement that evaluates to true if the assembler code which defines (equates) the symbol whose tree node is @var{decl_of_name} to have the value of the tree node @var{decl_of_value} should be emitted near the end of the current compilation unit. The default is to not defer output of defines. This macro affects defines output by @samp{ASM_OUTPUT_DEF} and @samp{ASM_OUTPUT_DEF_FROM_DECLS}. @end defmac @defmac ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value}) A C statement to output to the stdio stream @var{stream} assembler code which defines (equates) the weak symbol @var{name} to have the value @var{value}. If @var{value} is @code{NULL}, it defines @var{name} as an undefined weak symbol. Define this macro if the target only supports weak aliases; define @code{ASM_OUTPUT_DEF} instead if possible. @end defmac @defmac OBJC_GEN_METHOD_LABEL (@var{buf}, @var{is_inst}, @var{class_name}, @var{cat_name}, @var{sel_name}) Define this macro to override the default assembler names used for Objective-C methods. The default name is a unique method number followed by the name of the class (e.g.@: @samp{_1_Foo}). For methods in categories, the name of the category is also included in the assembler name (e.g.@: @samp{_1_Foo_Bar}). These names are safe on most systems, but make debugging difficult since the method's selector is not present in the name. Therefore, particular systems define other ways of computing names. @var{buf} is an expression of type @code{char *} which gives you a buffer in which to store the name; its length is as long as @var{class_name}, @var{cat_name} and @var{sel_name} put together, plus 50 characters extra. The argument @var{is_inst} specifies whether the method is an instance method or a class method; @var{class_name} is the name of the class; @var{cat_name} is the name of the category (or @code{NULL} if the method is not in a category); and @var{sel_name} is the name of the selector. On systems where the assembler can handle quoted names, you can use this macro to provide more human-readable names. @end defmac @node Initialization @subsection How Initialization Functions Are Handled @cindex initialization routines @cindex termination routines @cindex constructors, output of @cindex destructors, output of The compiled code for certain languages includes @dfn{constructors} (also called @dfn{initialization routines})---functions to initialize data in the program when the program is started. These functions need to be called before the program is ``started''---that is to say, before @code{main} is called. Compiling some languages generates @dfn{destructors} (also called @dfn{termination routines}) that should be called when the program terminates. To make the initialization and termination functions work, the compiler must output something in the assembler code to cause those functions to be called at the appropriate time. When you port the compiler to a new system, you need to specify how to do this. There are two major ways that GCC currently supports the execution of initialization and termination functions. Each way has two variants. Much of the structure is common to all four variations. @findex __CTOR_LIST__ @findex __DTOR_LIST__ The linker must build two lists of these functions---a list of initialization functions, called @code{__CTOR_LIST__}, and a list of termination functions, called @code{__DTOR_LIST__}. Each list always begins with an ignored function pointer (which may hold 0, @minus{}1, or a count of the function pointers after it, depending on the environment). This is followed by a series of zero or more function pointers to constructors (or destructors), followed by a function pointer containing zero. Depending on the operating system and its executable file format, either @file{crtstuff.c} or @file{libgcc2.c} traverses these lists at startup time and exit time. Constructors are called in reverse order of the list; destructors in forward order. The best way to handle static constructors works only for object file formats which provide arbitrarily-named sections. A section is set aside for a list of constructors, and another for a list of destructors. Traditionally these are called @samp{.ctors} and @samp{.dtors}. Each object file that defines an initialization function also puts a word in the constructor section to point to that function. The linker accumulates all these words into one contiguous @samp{.ctors} section. Termination functions are handled similarly. This method will be chosen as the default by @file{target-def.h} if @code{TARGET_ASM_NAMED_SECTION} is defined. A target that does not support arbitrary sections, but does support special designated constructor and destructor sections may define @code{CTORS_SECTION_ASM_OP} and @code{DTORS_SECTION_ASM_OP} to achieve the same effect. When arbitrary sections are available, there are two variants, depending upon how the code in @file{crtstuff.c} is called. On systems that support a @dfn{.init} section which is executed at program startup, parts of @file{crtstuff.c} are compiled into that section. The program is linked by the @command{gcc} driver like this: @smallexample ld -o @var{output_file} crti.o crtbegin.o @dots{} -lgcc crtend.o crtn.o @end smallexample The prologue of a function (@code{__init}) appears in the @code{.init} section of @file{crti.o}; the epilogue appears in @file{crtn.o}. Likewise for the function @code{__fini} in the @dfn{.fini} section. Normally these files are provided by the operating system or by the GNU C library, but are provided by GCC for a few targets. The objects @file{crtbegin.o} and @file{crtend.o} are (for most targets) compiled from @file{crtstuff.c}. They contain, among other things, code fragments within the @code{.init} and @code{.fini} sections that branch to routines in the @code{.text} section. The linker will pull all parts of a section together, which results in a complete @code{__init} function that invokes the routines we need at startup. To use this variant, you must define the @code{INIT_SECTION_ASM_OP} macro properly. If no init section is available, when GCC compiles any function called @code{main} (or more accurately, any function designated as a program entry point by the language front end calling @code{expand_main_function}), it inserts a procedure call to @code{__main} as the first executable code after the function prologue. The @code{__main} function is defined in @file{libgcc2.c} and runs the global constructors. In file formats that don't support arbitrary sections, there are again two variants. In the simplest variant, the GNU linker (GNU @code{ld}) and an `a.out' format must be used. In this case, @code{TARGET_ASM_CONSTRUCTOR} is defined to produce a @code{.stabs} entry of type @samp{N_SETT}, referencing the name @code{__CTOR_LIST__}, and with the address of the void function containing the initialization code as its value. The GNU linker recognizes this as a request to add the value to a @dfn{set}; the values are accumulated, and are eventually placed in the executable as a vector in the format described above, with a leading (ignored) count and a trailing zero element. @code{TARGET_ASM_DESTRUCTOR} is handled similarly. Since no init section is available, the absence of @code{INIT_SECTION_ASM_OP} causes the compilation of @code{main} to call @code{__main} as above, starting the initialization process. The last variant uses neither arbitrary sections nor the GNU linker. This is preferable when you want to do dynamic linking and when using file formats which the GNU linker does not support, such as `ECOFF'@. In this case, @code{TARGET_HAVE_CTORS_DTORS} is false, initialization and termination functions are recognized simply by their names. This requires an extra program in the linkage step, called @command{collect2}. This program pretends to be the linker, for use with GCC; it does its job by running the ordinary linker, but also arranges to include the vectors of initialization and termination functions. These functions are called via @code{__main} as described above. In order to use this method, @code{use_collect2} must be defined in the target in @file{config.gcc}. @ifinfo The following section describes the specific macros that control and customize the handling of initialization and termination functions. @end ifinfo @node Macros for Initialization @subsection Macros Controlling Initialization Routines Here are the macros that control how the compiler handles initialization and termination functions: @defmac INIT_SECTION_ASM_OP If defined, a C string constant, including spacing, for the assembler operation to identify the following data as initialization code. If not defined, GCC will assume such a section does not exist. When you are using special sections for initialization and termination functions, this macro also controls how @file{crtstuff.c} and @file{libgcc2.c} arrange to run the initialization functions. @end defmac @defmac HAS_INIT_SECTION If defined, @code{main} will not call @code{__main} as described above. This macro should be defined for systems that control start-up code on a symbol-by-symbol basis, such as OSF/1, and should not be defined explicitly for systems that support @code{INIT_SECTION_ASM_OP}. @end defmac @defmac LD_INIT_SWITCH If defined, a C string constant for a switch that tells the linker that the following symbol is an initialization routine. @end defmac @defmac LD_FINI_SWITCH If defined, a C string constant for a switch that tells the linker that the following symbol is a finalization routine. @end defmac @defmac COLLECT_SHARED_INIT_FUNC (@var{stream}, @var{func}) If defined, a C statement that will write a function that can be automatically called when a shared library is loaded. The function should call @var{func}, which takes no arguments. If not defined, and the object format requires an explicit initialization function, then a function called @code{_GLOBAL__DI} will be generated. This function and the following one are used by collect2 when linking a shared library that needs constructors or destructors, or has DWARF2 exception tables embedded in the code. @end defmac @defmac COLLECT_SHARED_FINI_FUNC (@var{stream}, @var{func}) If defined, a C statement that will write a function that can be automatically called when a shared library is unloaded. The function should call @var{func}, which takes no arguments. If not defined, and the object format requires an explicit finalization function, then a function called @code{_GLOBAL__DD} will be generated. @end defmac @defmac INVOKE__main If defined, @code{main} will call @code{__main} despite the presence of @code{INIT_SECTION_ASM_OP}. This macro should be defined for systems where the init section is not actually run automatically, but is still useful for collecting the lists of constructors and destructors. @end defmac @defmac SUPPORTS_INIT_PRIORITY If nonzero, the C++ @code{init_priority} attribute is supported and the compiler should emit instructions to control the order of initialization of objects. If zero, the compiler will issue an error message upon encountering an @code{init_priority} attribute. @end defmac @hook TARGET_HAVE_CTORS_DTORS @hook TARGET_DTORS_FROM_CXA_ATEXIT @hook TARGET_ASM_CONSTRUCTOR @hook TARGET_ASM_DESTRUCTOR If @code{TARGET_HAVE_CTORS_DTORS} is true, the initialization routine generated for the generated object file will have static linkage. If your system uses @command{collect2} as the means of processing constructors, then that program normally uses @command{nm} to scan an object file for constructor functions to be called. On certain kinds of systems, you can define this macro to make @command{collect2} work faster (and, in some cases, make it work at all): @defmac OBJECT_FORMAT_COFF Define this macro if the system uses COFF (Common Object File Format) object files, so that @command{collect2} can assume this format and scan object files directly for dynamic constructor/destructor functions. This macro is effective only in a native compiler; @command{collect2} as part of a cross compiler always uses @command{nm} for the target machine. @end defmac @defmac REAL_NM_FILE_NAME Define this macro as a C string constant containing the file name to use to execute @command{nm}. The default is to search the path normally for @command{nm}. @end defmac @defmac NM_FLAGS @command{collect2} calls @command{nm} to scan object files for static constructors and destructors and LTO info. By default, @option{-n} is passed. Define @code{NM_FLAGS} to a C string constant if other options are needed to get the same output format as GNU @command{nm -n} produces. @end defmac If your system supports shared libraries and has a program to list the dynamic dependencies of a given library or executable, you can define these macros to enable support for running initialization and termination functions in shared libraries: @defmac LDD_SUFFIX Define this macro to a C string constant containing the name of the program which lists dynamic dependencies, like @command{ldd} under SunOS 4. @end defmac @defmac PARSE_LDD_OUTPUT (@var{ptr}) Define this macro to be C code that extracts filenames from the output of the program denoted by @code{LDD_SUFFIX}. @var{ptr} is a variable of type @code{char *} that points to the beginning of a line of output from @code{LDD_SUFFIX}. If the line lists a dynamic dependency, the code must advance @var{ptr} to the beginning of the filename on that line. Otherwise, it must set @var{ptr} to @code{NULL}. @end defmac @defmac SHLIB_SUFFIX Define this macro to a C string constant containing the default shared library extension of the target (e.g., @samp{".so"}). @command{collect2} strips version information after this suffix when generating global constructor and destructor names. This define is only needed on targets that use @command{collect2} to process constructors and destructors. @end defmac @node Instruction Output @subsection Output of Assembler Instructions @c prevent bad page break with this line This describes assembler instruction output. @defmac REGISTER_NAMES A C initializer containing the assembler's names for the machine registers, each one as a C string constant. This is what translates register numbers in the compiler into assembler language. @end defmac @defmac ADDITIONAL_REGISTER_NAMES If defined, a C initializer for an array of structures containing a name and a register number. This macro defines additional names for hard registers, thus allowing the @code{asm} option in declarations to refer to registers using alternate names. @end defmac @defmac OVERLAPPING_REGISTER_NAMES If defined, a C initializer for an array of structures containing a name, a register number and a count of the number of consecutive machine registers the name overlaps. This macro defines additional names for hard registers, thus allowing the @code{asm} option in declarations to refer to registers using alternate names. Unlike @code{ADDITIONAL_REGISTER_NAMES}, this macro should be used when the register name implies multiple underlying registers. This macro should be used when it is important that a clobber in an @code{asm} statement clobbers all the underlying values implied by the register name. For example, on ARM, clobbering the double-precision VFP register ``d0'' implies clobbering both single-precision registers ``s0'' and ``s1''. @end defmac @defmac ASM_OUTPUT_OPCODE (@var{stream}, @var{ptr}) Define this macro if you are using an unusual assembler that requires different names for the machine instructions. The definition is a C statement or statements which output an assembler instruction opcode to the stdio stream @var{stream}. The macro-operand @var{ptr} is a variable of type @code{char *} which points to the opcode name in its ``internal'' form---the form that is written in the machine description. The definition should output the opcode name to @var{stream}, performing any translation you desire, and increment the variable @var{ptr} to point at the end of the opcode so that it will not be output twice. In fact, your macro definition may process less than the entire opcode name, or more than the opcode name; but if you want to process text that includes @samp{%}-sequences to substitute operands, you must take care of the substitution yourself. Just be sure to increment @var{ptr} over whatever text should not be output normally. @findex recog_data.operand If you need to look at the operand values, they can be found as the elements of @code{recog_data.operand}. If the macro definition does nothing, the instruction is output in the usual way. @end defmac @defmac FINAL_PRESCAN_INSN (@var{insn}, @var{opvec}, @var{noperands}) If defined, a C statement to be executed just prior to the output of assembler code for @var{insn}, to modify the extracted operands so they will be output differently. Here the argument @var{opvec} is the vector containing the operands extracted from @var{insn}, and @var{noperands} is the number of elements of the vector which contain meaningful data for this insn. The contents of this vector are what will be used to convert the insn template into assembler code, so you can change the assembler output by changing the contents of the vector. This macro is useful when various assembler syntaxes share a single file of instruction patterns; by defining this macro differently, you can cause a large class of instructions to be output differently (such as with rearranged operands). Naturally, variations in assembler syntax affecting individual insn patterns ought to be handled by writing conditional output routines in those patterns. If this macro is not defined, it is equivalent to a null statement. @end defmac @hook TARGET_ASM_FINAL_POSTSCAN_INSN @defmac PRINT_OPERAND (@var{stream}, @var{x}, @var{code}) A C compound statement to output to stdio stream @var{stream} the assembler syntax for an instruction operand @var{x}. @var{x} is an RTL expression. @var{code} is a value that can be used to specify one of several ways of printing the operand. It is used when identical operands must be printed differently depending on the context. @var{code} comes from the @samp{%} specification that was used to request printing of the operand. If the specification was just @samp{%@var{digit}} then @var{code} is 0; if the specification was @samp{%@var{ltr} @var{digit}} then @var{code} is the ASCII code for @var{ltr}. @findex reg_names If @var{x} is a register, this macro should print the register's name. The names can be found in an array @code{reg_names} whose type is @code{char *[]}. @code{reg_names} is initialized from @code{REGISTER_NAMES}. When the machine description has a specification @samp{%@var{punct}} (a @samp{%} followed by a punctuation character), this macro is called with a null pointer for @var{x} and the punctuation character for @var{code}. @end defmac @defmac PRINT_OPERAND_PUNCT_VALID_P (@var{code}) A C expression which evaluates to true if @var{code} is a valid punctuation character for use in the @code{PRINT_OPERAND} macro. If @code{PRINT_OPERAND_PUNCT_VALID_P} is not defined, it means that no punctuation characters (except for the standard one, @samp{%}) are used in this way. @end defmac @defmac PRINT_OPERAND_ADDRESS (@var{stream}, @var{x}) A C compound statement to output to stdio stream @var{stream} the assembler syntax for an instruction operand that is a memory reference whose address is @var{x}. @var{x} is an RTL expression. @cindex @code{TARGET_ENCODE_SECTION_INFO} usage On some machines, the syntax for a symbolic address depends on the section that the address refers to. On these machines, define the hook @code{TARGET_ENCODE_SECTION_INFO} to store the information into the @code{symbol_ref}, and then check for it here. @xref{Assembler Format}. @end defmac @findex dbr_sequence_length @defmac DBR_OUTPUT_SEQEND (@var{file}) A C statement, to be executed after all slot-filler instructions have been output. If necessary, call @code{dbr_sequence_length} to determine the number of slots filled in a sequence (zero if not currently outputting a sequence), to decide how many no-ops to output, or whatever. Don't define this macro if it has nothing to do, but it is helpful in reading assembly output if the extent of the delay sequence is made explicit (e.g.@: with white space). @end defmac @findex final_sequence Note that output routines for instructions with delay slots must be prepared to deal with not being output as part of a sequence (i.e.@: when the scheduling pass is not run, or when no slot fillers could be found.) The variable @code{final_sequence} is null when not processing a sequence, otherwise it contains the @code{sequence} rtx being output. @findex asm_fprintf @defmac REGISTER_PREFIX @defmacx LOCAL_LABEL_PREFIX @defmacx USER_LABEL_PREFIX @defmacx IMMEDIATE_PREFIX If defined, C string expressions to be used for the @samp{%R}, @samp{%L}, @samp{%U}, and @samp{%I} options of @code{asm_fprintf} (see @file{final.cc}). These are useful when a single @file{md} file must support multiple assembler formats. In that case, the various @file{tm.h} files can define these macros differently. @end defmac @defmac ASM_FPRINTF_EXTENSIONS (@var{file}, @var{argptr}, @var{format}) If defined this macro should expand to a series of @code{case} statements which will be parsed inside the @code{switch} statement of the @code{asm_fprintf} function. This allows targets to define extra printf formats which may useful when generating their assembler statements. Note that uppercase letters are reserved for future generic extensions to asm_fprintf, and so are not available to target specific code. The output file is given by the parameter @var{file}. The varargs input pointer is @var{argptr} and the rest of the format string, starting the character after the one that is being switched upon, is pointed to by @var{format}. @end defmac @defmac ASSEMBLER_DIALECT If your target supports multiple dialects of assembler language (such as different opcodes), define this macro as a C expression that gives the numeric index of the assembler language dialect to use, with zero as the first variant. If this macro is defined, you may use constructs of the form @smallexample @samp{@{option0|option1|option2@dots{}@}} @end smallexample @noindent in the output templates of patterns (@pxref{Output Template}) or in the first argument of @code{asm_fprintf}. This construct outputs @samp{option0}, @samp{option1}, @samp{option2}, etc., if the value of @code{ASSEMBLER_DIALECT} is zero, one, two, etc. Any special characters within these strings retain their usual meaning. If there are fewer alternatives within the braces than the value of @code{ASSEMBLER_DIALECT}, the construct outputs nothing. If it's needed to print curly braces or @samp{|} character in assembler output directly, @samp{%@{}, @samp{%@}} and @samp{%|} can be used. If you do not define this macro, the characters @samp{@{}, @samp{|} and @samp{@}} do not have any special meaning when used in templates or operands to @code{asm_fprintf}. Define the macros @code{REGISTER_PREFIX}, @code{LOCAL_LABEL_PREFIX}, @code{USER_LABEL_PREFIX} and @code{IMMEDIATE_PREFIX} if you can express the variations in assembler language syntax with that mechanism. Define @code{ASSEMBLER_DIALECT} and use the @samp{@{option0|option1@}} syntax if the syntax variant are larger and involve such things as different opcodes or operand order. @end defmac @defmac ASM_OUTPUT_REG_PUSH (@var{stream}, @var{regno}) A C expression to output to @var{stream} some assembler code which will push hard register number @var{regno} onto the stack. The code need not be optimal, since this macro is used only when profiling. @end defmac @defmac ASM_OUTPUT_REG_POP (@var{stream}, @var{regno}) A C expression to output to @var{stream} some assembler code which will pop hard register number @var{regno} off of the stack. The code need not be optimal, since this macro is used only when profiling. @end defmac @node Dispatch Tables @subsection Output of Dispatch Tables @c prevent bad page break with this line This concerns dispatch tables. @cindex dispatch table @defmac ASM_OUTPUT_ADDR_DIFF_ELT (@var{stream}, @var{body}, @var{value}, @var{rel}) A C statement to output to the stdio stream @var{stream} an assembler pseudo-instruction to generate a difference between two labels. @var{value} and @var{rel} are the numbers of two internal labels. The definitions of these labels are output using @code{(*targetm.asm_out.internal_label)}, and they must be printed in the same way here. For example, @smallexample fprintf (@var{stream}, "\t.word L%d-L%d\n", @var{value}, @var{rel}) @end smallexample You must provide this macro on machines where the addresses in a dispatch table are relative to the table's own address. If defined, GCC will also use this macro on all machines when producing PIC@. @var{body} is the body of the @code{ADDR_DIFF_VEC}; it is provided so that the mode and flags can be read. @end defmac @defmac ASM_OUTPUT_ADDR_VEC_ELT (@var{stream}, @var{value}) This macro should be provided on machines where the addresses in a dispatch table are absolute. The definition should be a C statement to output to the stdio stream @var{stream} an assembler pseudo-instruction to generate a reference to a label. @var{value} is the number of an internal label whose definition is output using @code{(*targetm.asm_out.internal_label)}. For example, @smallexample fprintf (@var{stream}, "\t.word L%d\n", @var{value}) @end smallexample @end defmac @defmac ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table}) Define this if the label before a jump-table needs to be output specially. The first three arguments are the same as for @code{(*targetm.asm_out.internal_label)}; the fourth argument is the jump-table which follows (a @code{jump_table_data} containing an @code{addr_vec} or @code{addr_diff_vec}). This feature is used on system V to output a @code{swbeg} statement for the table. If this macro is not defined, these labels are output with @code{(*targetm.asm_out.internal_label)}. @end defmac @defmac ASM_OUTPUT_CASE_END (@var{stream}, @var{num}, @var{table}) Define this if something special must be output at the end of a jump-table. The definition should be a C statement to be executed after the assembler code for the table is written. It should write the appropriate code to stdio stream @var{stream}. The argument @var{table} is the jump-table insn, and @var{num} is the label-number of the preceding label. If this macro is not defined, nothing special is output at the end of the jump-table. @end defmac @hook TARGET_ASM_POST_CFI_STARTPROC @hook TARGET_ASM_EMIT_UNWIND_LABEL @hook TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL @hook TARGET_ASM_EMIT_EXCEPT_PERSONALITY @hook TARGET_ASM_UNWIND_EMIT @hook TARGET_ASM_MAKE_EH_SYMBOL_INDIRECT @hook TARGET_ASM_UNWIND_EMIT_BEFORE_INSN @hook TARGET_ASM_SHOULD_RESTORE_CFA_STATE @node Exception Region Output @subsection Assembler Commands for Exception Regions @c prevent bad page break with this line This describes commands marking the start and the end of an exception region. @defmac EH_FRAME_SECTION_NAME If defined, a C string constant for the name of the section containing exception handling frame unwind information. If not defined, GCC will provide a default definition if the target supports named sections. @file{crtstuff.c} uses this macro to switch to the appropriate section. You should define this symbol if your target supports DWARF 2 frame unwind information and the default definition does not work. @end defmac @defmac EH_FRAME_THROUGH_COLLECT2 If defined, DWARF 2 frame unwind information will identified by specially named labels. The collect2 process will locate these labels and generate code to register the frames. This might be necessary, for instance, if the system linker will not place the eh_frames in-between the sentinals from @file{crtstuff.c}, or if the system linker does garbage collection and sections cannot be marked as not to be collected. @end defmac @defmac EH_TABLES_CAN_BE_READ_ONLY Define this macro to 1 if your target is such that no frame unwind information encoding used with non-PIC code will ever require a runtime relocation, but the linker may not support merging read-only and read-write sections into a single read-write section. @end defmac @defmac MASK_RETURN_ADDR An rtx used to mask the return address found via @code{RETURN_ADDR_RTX}, so that it does not contain any extraneous set bits in it. @end defmac @defmac DWARF2_UNWIND_INFO Define this macro to 0 if your target supports DWARF 2 frame unwind information, but it does not yet work with exception handling. Otherwise, if your target supports this information (if it defines @code{INCOMING_RETURN_ADDR_RTX} and @code{OBJECT_FORMAT_ELF}), GCC will provide a default definition of 1. @end defmac @hook TARGET_EXCEPT_UNWIND_INFO This hook defines the mechanism that will be used for exception handling by the target. If the target has ABI specified unwind tables, the hook should return @code{UI_TARGET}. If the target is to use the @code{setjmp}/@code{longjmp}-based exception handling scheme, the hook should return @code{UI_SJLJ}. If the target supports DWARF 2 frame unwind information, the hook should return @code{UI_DWARF2}. A target may, if exceptions are disabled, choose to return @code{UI_NONE}. This may end up simplifying other parts of target-specific code. The default implementation of this hook never returns @code{UI_NONE}. Note that the value returned by this hook should be constant. It should not depend on anything except the command-line switches described by @var{opts}. In particular, the setting @code{UI_SJLJ} must be fixed at compiler start-up as C pre-processor macros and builtin functions related to exception handling are set up depending on this setting. The default implementation of the hook first honors the @option{--enable-sjlj-exceptions} configure option, then @code{DWARF2_UNWIND_INFO}, and finally defaults to @code{UI_SJLJ}. If @code{DWARF2_UNWIND_INFO} depends on command-line options, the target must define this hook so that @var{opts} is used correctly. @end deftypefn @hook TARGET_UNWIND_TABLES_DEFAULT This variable should be set to @code{true} if the target ABI requires unwinding tables even when exceptions are not used. It must not be modified by command-line option processing. @end deftypevr @defmac DONT_USE_BUILTIN_SETJMP Define this macro to 1 if the @code{setjmp}/@code{longjmp}-based scheme should use the @code{setjmp}/@code{longjmp} functions from the C library instead of the @code{__builtin_setjmp}/@code{__builtin_longjmp} machinery. @end defmac @defmac JMP_BUF_SIZE This macro has no effect unless @code{DONT_USE_BUILTIN_SETJMP} is also defined. Define this macro if the default size of @code{jmp_buf} buffer for the @code{setjmp}/@code{longjmp}-based exception handling mechanism is not large enough, or if it is much too large. The default size is @code{FIRST_PSEUDO_REGISTER * sizeof(void *)}. @end defmac @defmac DWARF_CIE_DATA_ALIGNMENT This macro need only be defined if the target might save registers in the function prologue at an offset to the stack pointer that is not aligned to @code{UNITS_PER_WORD}. The definition should be the negative minimum alignment if @code{STACK_GROWS_DOWNWARD} is true, and the positive minimum alignment otherwise. @xref{DWARF}. Only applicable if the target supports DWARF 2 frame unwind information. @end defmac @hook TARGET_TERMINATE_DW2_EH_FRAME_INFO @hook TARGET_DWARF_REGISTER_SPAN @hook TARGET_DWARF_FRAME_REG_MODE @hook TARGET_INIT_DWARF_REG_SIZES_EXTRA @hook TARGET_ASM_TTYPE @hook TARGET_ARM_EABI_UNWINDER @node Alignment Output @subsection Assembler Commands for Alignment @c prevent bad page break with this line This describes commands for alignment. @defmac JUMP_ALIGN (@var{label}) The alignment (log base 2) to put in front of @var{label}, which is a common destination of jumps and has no fallthru incoming edge. This macro need not be defined if you don't want any special alignment to be done at such a time. Most machine descriptions do not currently define the macro. Unless it's necessary to inspect the @var{label} parameter, it is better to set the variable @var{align_jumps} in the target's @code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's selection in @var{align_jumps} in a @code{JUMP_ALIGN} implementation. @end defmac @defmac LABEL_ALIGN_AFTER_BARRIER (@var{label}) The alignment (log base 2) to put in front of @var{label}, which follows a @code{BARRIER}. This macro need not be defined if you don't want any special alignment to be done at such a time. Most machine descriptions do not currently define the macro. @end defmac @defmac LOOP_ALIGN (@var{label}) The alignment (log base 2) to put in front of @var{label} that heads a frequently executed basic block (usually the header of a loop). This macro need not be defined if you don't want any special alignment to be done at such a time. Most machine descriptions do not currently define the macro. Unless it's necessary to inspect the @var{label} parameter, it is better to set the variable @code{align_loops} in the target's @code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's selection in @code{align_loops} in a @code{LOOP_ALIGN} implementation. @end defmac @defmac LABEL_ALIGN (@var{label}) The alignment (log base 2) to put in front of @var{label}. If @code{LABEL_ALIGN_AFTER_BARRIER} / @code{LOOP_ALIGN} specify a different alignment, the maximum of the specified values is used. Unless it's necessary to inspect the @var{label} parameter, it is better to set the variable @code{align_labels} in the target's @code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's selection in @code{align_labels} in a @code{LABEL_ALIGN} implementation. @end defmac @defmac ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes}) A C statement to output to the stdio stream @var{stream} an assembler instruction to advance the location counter by @var{nbytes} bytes. Those bytes should be zero when loaded. @var{nbytes} will be a C expression of type @code{unsigned HOST_WIDE_INT}. @end defmac @defmac ASM_NO_SKIP_IN_TEXT Define this macro if @code{ASM_OUTPUT_SKIP} should not be used in the text section because it fails to put zeros in the bytes that are skipped. This is true on many Unix systems, where the pseudo--op to skip bytes produces no-op instructions rather than zeros when used in the text section. @end defmac @defmac ASM_OUTPUT_ALIGN (@var{stream}, @var{power}) A C statement to output to the stdio stream @var{stream} an assembler command to advance the location counter to a multiple of 2 to the @var{power} bytes. @var{power} will be a C expression of type @code{int}. @end defmac @defmac ASM_OUTPUT_ALIGN_WITH_NOP (@var{stream}, @var{power}) Like @code{ASM_OUTPUT_ALIGN}, except that the ``nop'' instruction is used for padding, if necessary. @end defmac @defmac ASM_OUTPUT_MAX_SKIP_ALIGN (@var{stream}, @var{power}, @var{max_skip}) A C statement to output to the stdio stream @var{stream} an assembler command to advance the location counter to a multiple of 2 to the @var{power} bytes, but only if @var{max_skip} or fewer bytes are needed to satisfy the alignment request. @var{power} and @var{max_skip} will be a C expression of type @code{int}. @end defmac @need 3000 @node Debugging Info @section Controlling Debugging Information Format @c prevent bad page break with this line This describes how to specify debugging information. @menu * All Debuggers:: Macros that affect all debugging formats uniformly. * DBX Options:: Macros enabling specific options in DBX format. * DBX Hooks:: Hook macros for varying DBX format. * File Names and DBX:: Macros controlling output of file names in DBX format. * DWARF:: Macros for DWARF format. * VMS Debug:: Macros for VMS debug format. * CTF Debug:: Macros for CTF debug format. * BTF Debug:: Macros for BTF debug format. @end menu @node All Debuggers @subsection Macros Affecting All Debugging Formats @c prevent bad page break with this line These macros affect all debugging formats. @defmac DBX_REGISTER_NUMBER (@var{regno}) A C expression that returns the DBX register number for the compiler register number @var{regno}. In the default macro provided, the value of this expression will be @var{regno} itself. But sometimes there are some registers that the compiler knows about and DBX does not, or vice versa. In such cases, some register may need to have one number in the compiler and another for DBX@. If two registers have consecutive numbers inside GCC, and they can be used as a pair to hold a multiword value, then they @emph{must} have consecutive numbers after renumbering with @code{DBX_REGISTER_NUMBER}. Otherwise, debuggers will be unable to access such a pair, because they expect register pairs to be consecutive in their own numbering scheme. If you find yourself defining @code{DBX_REGISTER_NUMBER} in way that does not preserve register pairs, then what you must do instead is redefine the actual register numbering scheme. @end defmac @defmac DEBUGGER_AUTO_OFFSET (@var{x}) A C expression that returns the integer offset value for an automatic variable having address @var{x} (an RTL expression). The default computation assumes that @var{x} is based on the frame-pointer and gives the offset from the frame-pointer. This is required for targets that produce debugging output for DBX and allow the frame-pointer to be eliminated when the @option{-g} option is used. @end defmac @defmac DEBUGGER_ARG_OFFSET (@var{offset}, @var{x}) A C expression that returns the integer offset value for an argument having address @var{x} (an RTL expression). The nominal offset is @var{offset}. @end defmac @defmac PREFERRED_DEBUGGING_TYPE A C expression that returns the type of debugging output GCC should produce when the user specifies just @option{-g}. Define this if you have arranged for GCC to support more than one format of debugging output. Currently, the allowable values are @code{DBX_DEBUG}, @code{DWARF2_DEBUG}, @code{XCOFF_DEBUG}, @code{VMS_DEBUG}, and @code{VMS_AND_DWARF2_DEBUG}. When the user specifies @option{-ggdb}, GCC normally also uses the value of this macro to select the debugging output format, but with two exceptions. If @code{DWARF2_DEBUGGING_INFO} is defined, GCC uses the value @code{DWARF2_DEBUG}. Otherwise, if @code{DBX_DEBUGGING_INFO} is defined, GCC uses @code{DBX_DEBUG}. The value of this macro only affects the default debugging output; the user can always get a specific type of output by using @option{-gstabs}, @option{-gdwarf-2}, @option{-gxcoff}, or @option{-gvms}. @end defmac @node DBX Options @subsection Specific Options for DBX Output @c prevent bad page break with this line These are specific options for DBX output. @defmac DBX_DEBUGGING_INFO Define this macro if GCC should produce debugging output for DBX in response to the @option{-g} option. @end defmac @defmac XCOFF_DEBUGGING_INFO Define this macro if GCC should produce XCOFF format debugging output in response to the @option{-g} option. This is a variant of DBX format. @end defmac @defmac DEFAULT_GDB_EXTENSIONS Define this macro to control whether GCC should by default generate GDB's extended version of DBX debugging information (assuming DBX-format debugging information is enabled at all). If you don't define the macro, the default is 1: always generate the extended information if there is any occasion to. @end defmac @defmac DEBUG_SYMS_TEXT Define this macro if all @code{.stabs} commands should be output while in the text section. @end defmac @defmac ASM_STABS_OP A C string constant, including spacing, naming the assembler pseudo op to use instead of @code{"\t.stabs\t"} to define an ordinary debugging symbol. If you don't define this macro, @code{"\t.stabs\t"} is used. This macro applies only to DBX debugging information format. @end defmac @defmac ASM_STABD_OP A C string constant, including spacing, naming the assembler pseudo op to use instead of @code{"\t.stabd\t"} to define a debugging symbol whose value is the current location. If you don't define this macro, @code{"\t.stabd\t"} is used. This macro applies only to DBX debugging information format. @end defmac @defmac ASM_STABN_OP A C string constant, including spacing, naming the assembler pseudo op to use instead of @code{"\t.stabn\t"} to define a debugging symbol with no name. If you don't define this macro, @code{"\t.stabn\t"} is used. This macro applies only to DBX debugging information format. @end defmac @defmac DBX_NO_XREFS Define this macro if DBX on your system does not support the construct @samp{xs@var{tagname}}. On some systems, this construct is used to describe a forward reference to a structure named @var{tagname}. On other systems, this construct is not supported at all. @end defmac @defmac DBX_CONTIN_LENGTH A symbol name in DBX-format debugging information is normally continued (split into two separate @code{.stabs} directives) when it exceeds a certain length (by default, 80 characters). On some operating systems, DBX requires this splitting; on others, splitting must not be done. You can inhibit splitting by defining this macro with the value zero. You can override the default splitting-length by defining this macro as an expression for the length you desire. @end defmac @defmac DBX_CONTIN_CHAR Normally continuation is indicated by adding a @samp{\} character to the end of a @code{.stabs} string when a continuation follows. To use a different character instead, define this macro as a character constant for the character you want to use. Do not define this macro if backslash is correct for your system. @end defmac @defmac DBX_STATIC_STAB_DATA_SECTION Define this macro if it is necessary to go to the data section before outputting the @samp{.stabs} pseudo-op for a non-global static variable. @end defmac @defmac DBX_TYPE_DECL_STABS_CODE The value to use in the ``code'' field of the @code{.stabs} directive for a typedef. The default is @code{N_LSYM}. @end defmac @defmac DBX_STATIC_CONST_VAR_CODE The value to use in the ``code'' field of the @code{.stabs} directive for a static variable located in the text section. DBX format does not provide any ``right'' way to do this. The default is @code{N_FUN}. @end defmac @defmac DBX_REGPARM_STABS_CODE The value to use in the ``code'' field of the @code{.stabs} directive for a parameter passed in registers. DBX format does not provide any ``right'' way to do this. The default is @code{N_RSYM}. @end defmac @defmac DBX_REGPARM_STABS_LETTER The letter to use in DBX symbol data to identify a symbol as a parameter passed in registers. DBX format does not customarily provide any way to do this. The default is @code{'P'}. @end defmac @defmac DBX_FUNCTION_FIRST Define this macro if the DBX information for a function and its arguments should precede the assembler code for the function. Normally, in DBX format, the debugging information entirely follows the assembler code. @end defmac @defmac DBX_BLOCKS_FUNCTION_RELATIVE Define this macro, with value 1, if the value of a symbol describing the scope of a block (@code{N_LBRAC} or @code{N_RBRAC}) should be relative to the start of the enclosing function. Normally, GCC uses an absolute address. @end defmac @defmac DBX_LINES_FUNCTION_RELATIVE Define this macro, with value 1, if the value of a symbol indicating the current line number (@code{N_SLINE}) should be relative to the start of the enclosing function. Normally, GCC uses an absolute address. @end defmac @defmac DBX_USE_BINCL Define this macro if GCC should generate @code{N_BINCL} and @code{N_EINCL} stabs for included header files, as on Sun systems. This macro also directs GCC to output a type number as a pair of a file number and a type number within the file. Normally, GCC does not generate @code{N_BINCL} or @code{N_EINCL} stabs, and it outputs a single number for a type number. @end defmac @node DBX Hooks @subsection Open-Ended Hooks for DBX Format @c prevent bad page break with this line These are hooks for DBX format. @defmac DBX_OUTPUT_SOURCE_LINE (@var{stream}, @var{line}, @var{counter}) A C statement to output DBX debugging information before code for line number @var{line} of the current source file to the stdio stream @var{stream}. @var{counter} is the number of time the macro was invoked, including the current invocation; it is intended to generate unique labels in the assembly output. This macro should not be defined if the default output is correct, or if it can be made correct by defining @code{DBX_LINES_FUNCTION_RELATIVE}. @end defmac @defmac NO_DBX_FUNCTION_END Some stabs encapsulation formats (in particular ECOFF), cannot handle the @code{.stabs "",N_FUN,,0,0,Lscope-function-1} gdb dbx extension construct. On those machines, define this macro to turn this feature off without disturbing the rest of the gdb extensions. @end defmac @defmac NO_DBX_BNSYM_ENSYM Some assemblers cannot handle the @code{.stabd BNSYM/ENSYM,0,0} gdb dbx extension construct. On those machines, define this macro to turn this feature off without disturbing the rest of the gdb extensions. @end defmac @node File Names and DBX @subsection File Names in DBX Format @c prevent bad page break with this line This describes file names in DBX format. @defmac DBX_OUTPUT_MAIN_SOURCE_FILENAME (@var{stream}, @var{name}) A C statement to output DBX debugging information to the stdio stream @var{stream}, which indicates that file @var{name} is the main source file---the file specified as the input file for compilation. This macro is called only once, at the beginning of compilation. This macro need not be defined if the standard form of output for DBX debugging information is appropriate. It may be necessary to refer to a label equal to the beginning of the text section. You can use @samp{assemble_name (stream, ltext_label_name)} to do so. If you do this, you must also set the variable @var{used_ltext_label_name} to @code{true}. @end defmac @defmac NO_DBX_MAIN_SOURCE_DIRECTORY Define this macro, with value 1, if GCC should not emit an indication of the current directory for compilation and current source language at the beginning of the file. @end defmac @defmac NO_DBX_GCC_MARKER Define this macro, with value 1, if GCC should not emit an indication that this object file was compiled by GCC@. The default is to emit an @code{N_OPT} stab at the beginning of every source file, with @samp{gcc2_compiled.} for the string and value 0. @end defmac @defmac DBX_OUTPUT_MAIN_SOURCE_FILE_END (@var{stream}, @var{name}) A C statement to output DBX debugging information at the end of compilation of the main source file @var{name}. Output should be written to the stdio stream @var{stream}. If you don't define this macro, nothing special is output at the end of compilation, which is correct for most machines. @end defmac @defmac DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END Define this macro @emph{instead of} defining @code{DBX_OUTPUT_MAIN_SOURCE_FILE_END}, if what needs to be output at the end of compilation is an @code{N_SO} stab with an empty string, whose value is the highest absolute text address in the file. @end defmac @need 2000 @node DWARF @subsection Macros for DWARF Output @c prevent bad page break with this line Here are macros for DWARF output. @defmac DWARF2_DEBUGGING_INFO Define this macro if GCC should produce dwarf version 2 format debugging output in response to the @option{-g} option. @hook TARGET_DWARF_CALLING_CONVENTION To support optional call frame debugging information, you must also define @code{INCOMING_RETURN_ADDR_RTX} and either set @code{RTX_FRAME_RELATED_P} on the prologue insns if you use RTL for the prologue, or call @code{dwarf2out_def_cfa} and @code{dwarf2out_reg_save} as appropriate from @code{TARGET_ASM_FUNCTION_PROLOGUE} if you don't. @end defmac @defmac DWARF2_FRAME_INFO Define this macro to a nonzero value if GCC should always output Dwarf 2 frame information. If @code{TARGET_EXCEPT_UNWIND_INFO} (@pxref{Exception Region Output}) returns @code{UI_DWARF2}, and exceptions are enabled, GCC will output this information not matter how you define @code{DWARF2_FRAME_INFO}. @end defmac @hook TARGET_DEBUG_UNWIND_INFO @defmac DWARF2_ASM_LINE_DEBUG_INFO Define this macro to be a nonzero value if the assembler can generate Dwarf 2 line debug info sections. This will result in much more compact line number tables, and hence is desirable if it works. @end defmac @defmac DWARF2_ASM_VIEW_DEBUG_INFO Define this macro to be a nonzero value if the assembler supports view assignment and verification in @code{.loc}. If it does not, but the user enables location views, the compiler may have to fallback to internal line number tables. @end defmac @hook TARGET_RESET_LOCATION_VIEW @hook TARGET_WANT_DEBUG_PUB_SECTIONS @hook TARGET_DELAY_SCHED2 @hook TARGET_DELAY_VARTRACK @hook TARGET_NO_REGISTER_ALLOCATION @defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2}) A C statement to issue assembly directives that create a difference @var{lab1} minus @var{lab2}, using an integer of the given @var{size}. @end defmac @defmac ASM_OUTPUT_DWARF_VMS_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2}) A C statement to issue assembly directives that create a difference between the two given labels in system defined units, e.g.@: instruction slots on IA64 VMS, using an integer of the given size. @end defmac @defmac ASM_OUTPUT_DWARF_OFFSET (@var{stream}, @var{size}, @var{label}, @var{offset}, @var{section}) A C statement to issue assembly directives that create a section-relative reference to the given @var{label} plus @var{offset}, using an integer of the given @var{size}. The label is known to be defined in the given @var{section}. @end defmac @defmac ASM_OUTPUT_DWARF_PCREL (@var{stream}, @var{size}, @var{label}) A C statement to issue assembly directives that create a self-relative reference to the given @var{label}, using an integer of the given @var{size}. @end defmac @defmac ASM_OUTPUT_DWARF_DATAREL (@var{stream}, @var{size}, @var{label}) A C statement to issue assembly directives that create a reference to the given @var{label} relative to the dbase, using an integer of the given @var{size}. @end defmac @defmac ASM_OUTPUT_DWARF_TABLE_REF (@var{label}) A C statement to issue assembly directives that create a reference to the DWARF table identifier @var{label} from the current section. This is used on some systems to avoid garbage collecting a DWARF table which is referenced by a function. @end defmac @hook TARGET_ASM_OUTPUT_DWARF_DTPREL @need 2000 @node VMS Debug @subsection Macros for VMS Debug Format @c prevent bad page break with this line Here are macros for VMS debug format. @defmac VMS_DEBUGGING_INFO Define this macro if GCC should produce debugging output for VMS in response to the @option{-g} option. The default behavior for VMS is to generate minimal debug info for a traceback in the absence of @option{-g} unless explicitly overridden with @option{-g0}. This behavior is controlled by @code{TARGET_OPTION_OPTIMIZATION} and @code{TARGET_OPTION_OVERRIDE}. @end defmac @need 2000 @node CTF Debug @subsection Macros for CTF Debug Format @c prevent bad page break with this line Here are macros for CTF debug format. @defmac CTF_DEBUGGING_INFO Define this macro if GCC should produce debugging output in CTF debug format in response to the @option{-gctf} option. @end defmac @need 2000 @node BTF Debug @subsection Macros for BTF Debug Format @c prevent bad page break with this line Here are macros for BTF debug format. @defmac BTF_DEBUGGING_INFO Define this macro if GCC should produce debugging output in BTF debug format in response to the @option{-gbtf} option. @end defmac @node Floating Point @section Cross Compilation and Floating Point @cindex cross compilation and floating point @cindex floating point and cross compilation While all modern machines use twos-complement representation for integers, there are a variety of representations for floating point numbers. This means that in a cross-compiler the representation of floating point numbers in the compiled program may be different from that used in the machine doing the compilation. Because different representation systems may offer different amounts of range and precision, all floating point constants must be represented in the target machine's format. Therefore, the cross compiler cannot safely use the host machine's floating point arithmetic; it must emulate the target's arithmetic. To ensure consistency, GCC always uses emulation to work with floating point values, even when the host and target floating point formats are identical. The following macros are provided by @file{real.h} for the compiler to use. All parts of the compiler which generate or optimize floating-point calculations must use these macros. They may evaluate their operands more than once, so operands must not have side effects. @defmac REAL_VALUE_TYPE The C data type to be used to hold a floating point value in the target machine's format. Typically this is a @code{struct} containing an array of @code{HOST_WIDE_INT}, but all code should treat it as an opaque quantity. @end defmac @deftypefn Macro HOST_WIDE_INT REAL_VALUE_FIX (REAL_VALUE_TYPE @var{x}) Truncates @var{x} to a signed integer, rounding toward zero. @end deftypefn @deftypefn Macro {unsigned HOST_WIDE_INT} REAL_VALUE_UNSIGNED_FIX (REAL_VALUE_TYPE @var{x}) Truncates @var{x} to an unsigned integer, rounding toward zero. If @var{x} is negative, returns zero. @end deftypefn @deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_ATOF (const char *@var{string}, machine_mode @var{mode}) Converts @var{string} into a floating point number in the target machine's representation for mode @var{mode}. This routine can handle both decimal and hexadecimal floating point constants, using the syntax defined by the C language for both. @end deftypefn @deftypefn Macro int REAL_VALUE_NEGATIVE (REAL_VALUE_TYPE @var{x}) Returns 1 if @var{x} is negative (including negative zero), 0 otherwise. @end deftypefn @deftypefn Macro int REAL_VALUE_ISINF (REAL_VALUE_TYPE @var{x}) Determines whether @var{x} represents infinity (positive or negative). @end deftypefn @deftypefn Macro int REAL_VALUE_ISNAN (REAL_VALUE_TYPE @var{x}) Determines whether @var{x} represents a ``NaN'' (not-a-number). @end deftypefn @deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_NEGATE (REAL_VALUE_TYPE @var{x}) Returns the negative of the floating point value @var{x}. @end deftypefn @deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_ABS (REAL_VALUE_TYPE @var{x}) Returns the absolute value of @var{x}. @end deftypefn @node Mode Switching @section Mode Switching Instructions @cindex mode switching The following macros control mode switching optimizations: @defmac OPTIMIZE_MODE_SWITCHING (@var{entity}) Define this macro if the port needs extra instructions inserted for mode switching in an optimizing compilation. For an example, the SH4 can perform both single and double precision floating point operations, but to perform a single precision operation, the FPSCR PR bit has to be cleared, while for a double precision operation, this bit has to be set. Changing the PR bit requires a general purpose register as a scratch register, hence these FPSCR sets have to be inserted before reload, i.e.@: you cannot put this into instruction emitting or @code{TARGET_MACHINE_DEPENDENT_REORG}. You can have multiple entities that are mode-switched, and select at run time which entities actually need it. @code{OPTIMIZE_MODE_SWITCHING} should return nonzero for any @var{entity} that needs mode-switching. If you define this macro, you also have to define @code{NUM_MODES_FOR_MODE_SWITCHING}, @code{TARGET_MODE_NEEDED}, @code{TARGET_MODE_PRIORITY} and @code{TARGET_MODE_EMIT}. @code{TARGET_MODE_AFTER}, @code{TARGET_MODE_ENTRY}, and @code{TARGET_MODE_EXIT} are optional. @end defmac @defmac NUM_MODES_FOR_MODE_SWITCHING If you define @code{OPTIMIZE_MODE_SWITCHING}, you have to define this as initializer for an array of integers. Each initializer element N refers to an entity that needs mode switching, and specifies the number of different modes that might need to be set for this entity. The position of the initializer in the initializer---starting counting at zero---determines the integer that is used to refer to the mode-switched entity in question. In macros that take mode arguments / yield a mode result, modes are represented as numbers 0 @dots{} N @minus{} 1. N is used to specify that no mode switch is needed / supplied. @end defmac @hook TARGET_MODE_EMIT @hook TARGET_MODE_NEEDED @hook TARGET_MODE_AFTER @hook TARGET_MODE_ENTRY @hook TARGET_MODE_EXIT @hook TARGET_MODE_PRIORITY @node Target Attributes @section Defining target-specific uses of @code{__attribute__} @cindex target attributes @cindex machine attributes @cindex attributes, target-specific Target-specific attributes may be defined for functions, data and types. These are described using the following target hooks; they also need to be documented in @file{extend.texi}. @hook TARGET_ATTRIBUTE_TABLE @hook TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P @hook TARGET_COMP_TYPE_ATTRIBUTES @hook TARGET_SET_DEFAULT_TYPE_ATTRIBUTES @hook TARGET_MERGE_TYPE_ATTRIBUTES @hook TARGET_MERGE_DECL_ATTRIBUTES @hook TARGET_VALID_DLLIMPORT_ATTRIBUTE_P @defmac TARGET_DECLSPEC Define this macro to a nonzero value if you want to treat @code{__declspec(X)} as equivalent to @code{__attribute((X))}. By default, this behavior is enabled only for targets that define @code{TARGET_DLLIMPORT_DECL_ATTRIBUTES}. The current implementation of @code{__declspec} is via a built-in macro, but you should not rely on this implementation detail. @end defmac @hook TARGET_INSERT_ATTRIBUTES @hook TARGET_HANDLE_GENERIC_ATTRIBUTE @hook TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P @hook TARGET_OPTION_VALID_ATTRIBUTE_P @hook TARGET_OPTION_SAVE @hook TARGET_OPTION_RESTORE @hook TARGET_OPTION_POST_STREAM_IN @hook TARGET_OPTION_PRINT @hook TARGET_OPTION_PRAGMA_PARSE @hook TARGET_OPTION_OVERRIDE @hook TARGET_OPTION_FUNCTION_VERSIONS @hook TARGET_CAN_INLINE_P @hook TARGET_UPDATE_IPA_FN_TARGET_INFO @hook TARGET_NEED_IPA_FN_TARGET_INFO @hook TARGET_RELAYOUT_FUNCTION @node Emulated TLS @section Emulating TLS @cindex Emulated TLS For targets whose psABI does not provide Thread Local Storage via specific relocations and instruction sequences, an emulation layer is used. A set of target hooks allows this emulation layer to be configured for the requirements of a particular target. For instance the psABI may in fact specify TLS support in terms of an emulation layer. The emulation layer works by creating a control object for every TLS object. To access the TLS object, a lookup function is provided which, when given the address of the control object, will return the address of the current thread's instance of the TLS object. @hook TARGET_EMUTLS_GET_ADDRESS @hook TARGET_EMUTLS_REGISTER_COMMON @hook TARGET_EMUTLS_VAR_SECTION @hook TARGET_EMUTLS_TMPL_SECTION @hook TARGET_EMUTLS_VAR_PREFIX @hook TARGET_EMUTLS_TMPL_PREFIX @hook TARGET_EMUTLS_VAR_FIELDS @hook TARGET_EMUTLS_VAR_INIT @hook TARGET_EMUTLS_VAR_ALIGN_FIXED @hook TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS @node MIPS Coprocessors @section Defining coprocessor specifics for MIPS targets. @cindex MIPS coprocessor-definition macros The MIPS specification allows MIPS implementations to have as many as 4 coprocessors, each with as many as 32 private registers. GCC supports accessing these registers and transferring values between the registers and memory using asm-ized variables. For example: @smallexample register unsigned int cp0count asm ("c0r1"); unsigned int d; d = cp0count + 3; @end smallexample (``c0r1'' is the default name of register 1 in coprocessor 0; alternate names may be added as described below, or the default names may be overridden entirely in @code{SUBTARGET_CONDITIONAL_REGISTER_USAGE}.) Coprocessor registers are assumed to be epilogue-used; sets to them will be preserved even if it does not appear that the register is used again later in the function. Another note: according to the MIPS spec, coprocessor 1 (if present) is the FPU@. One accesses COP1 registers through standard mips floating-point support; they are not included in this mechanism. @node PCH Target @section Parameters for Precompiled Header Validity Checking @cindex parameters, precompiled headers @hook TARGET_GET_PCH_VALIDITY @hook TARGET_PCH_VALID_P @hook TARGET_CHECK_PCH_TARGET_FLAGS @hook TARGET_PREPARE_PCH_SAVE @node C++ ABI @section C++ ABI parameters @cindex parameters, c++ abi @hook TARGET_CXX_GUARD_TYPE @hook TARGET_CXX_GUARD_MASK_BIT @hook TARGET_CXX_GET_COOKIE_SIZE @hook TARGET_CXX_COOKIE_HAS_SIZE @hook TARGET_CXX_IMPORT_EXPORT_CLASS @hook TARGET_CXX_CDTOR_RETURNS_THIS @hook TARGET_CXX_KEY_METHOD_MAY_BE_INLINE @hook TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY @hook TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT @hook TARGET_CXX_LIBRARY_RTTI_COMDAT @hook TARGET_CXX_USE_AEABI_ATEXIT @hook TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT @hook TARGET_CXX_ADJUST_CLASS_AT_DEFINITION @hook TARGET_CXX_DECL_MANGLING_CONTEXT @node D Language and ABI @section D ABI parameters @cindex parameters, d abi @hook TARGET_D_CPU_VERSIONS @hook TARGET_D_OS_VERSIONS @hook TARGET_D_REGISTER_CPU_TARGET_INFO @hook TARGET_D_REGISTER_OS_TARGET_INFO @hook TARGET_D_MINFO_SECTION @hook TARGET_D_MINFO_START_NAME @hook TARGET_D_MINFO_END_NAME @hook TARGET_D_HAS_STDCALL_CONVENTION @hook TARGET_D_TEMPLATES_ALWAYS_COMDAT @node Named Address Spaces @section Adding support for named address spaces @cindex named address spaces The draft technical report of the ISO/IEC JTC1 S22 WG14 N1275 standards committee, @cite{Programming Languages - C - Extensions to support embedded processors}, specifies a syntax for embedded processors to specify alternate address spaces. You can configure a GCC port to support section 5.1 of the draft report to add support for address spaces other than the default address space. These address spaces are new keywords that are similar to the @code{volatile} and @code{const} type attributes. Pointers to named address spaces can have a different size than pointers to the generic address space. For example, the SPU port uses the @code{__ea} address space to refer to memory in the host processor, rather than memory local to the SPU processor. Access to memory in the @code{__ea} address space involves issuing DMA operations to move data between the host processor and the local processor memory address space. Pointers in the @code{__ea} address space are either 32 bits or 64 bits based on the @option{-mea32} or @option{-mea64} switches (native SPU pointers are always 32 bits). Internally, address spaces are represented as a small integer in the range 0 to 15 with address space 0 being reserved for the generic address space. To register a named address space qualifier keyword with the C front end, the target may call the @code{c_register_addr_space} routine. For example, the SPU port uses the following to declare @code{__ea} as the keyword for named address space #1: @smallexample #define ADDR_SPACE_EA 1 c_register_addr_space ("__ea", ADDR_SPACE_EA); @end smallexample @hook TARGET_ADDR_SPACE_POINTER_MODE @hook TARGET_ADDR_SPACE_ADDRESS_MODE @hook TARGET_ADDR_SPACE_VALID_POINTER_MODE @hook TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P @hook TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS @hook TARGET_ADDR_SPACE_SUBSET_P @hook TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID @hook TARGET_ADDR_SPACE_CONVERT @hook TARGET_ADDR_SPACE_DEBUG @hook TARGET_ADDR_SPACE_DIAGNOSE_USAGE @node Misc @section Miscellaneous Parameters @cindex parameters, miscellaneous @c prevent bad page break with this line Here are several miscellaneous parameters. @defmac HAS_LONG_COND_BRANCH Define this boolean macro to indicate whether or not your architecture has conditional branches that can span all of memory. It is used in conjunction with an optimization that partitions hot and cold basic blocks into separate sections of the executable. If this macro is set to false, gcc will convert any conditional branches that attempt to cross between sections into unconditional branches or indirect jumps. @end defmac @defmac HAS_LONG_UNCOND_BRANCH Define this boolean macro to indicate whether or not your architecture has unconditional branches that can span all of memory. It is used in conjunction with an optimization that partitions hot and cold basic blocks into separate sections of the executable. If this macro is set to false, gcc will convert any unconditional branches that attempt to cross between sections into indirect jumps. @end defmac @defmac CASE_VECTOR_MODE An alias for a machine mode name. This is the machine mode that elements of a jump-table should have. @end defmac @defmac CASE_VECTOR_SHORTEN_MODE (@var{min_offset}, @var{max_offset}, @var{body}) Optional: return the preferred mode for an @code{addr_diff_vec} when the minimum and maximum offset are known. If you define this, it enables extra code in branch shortening to deal with @code{addr_diff_vec}. To make this work, you also have to define @code{INSN_ALIGN} and make the alignment for @code{addr_diff_vec} explicit. The @var{body} argument is provided so that the offset_unsigned and scale flags can be updated. @end defmac @defmac CASE_VECTOR_PC_RELATIVE Define this macro to be a C expression to indicate when jump-tables should contain relative addresses. You need not define this macro if jump-tables never contain relative addresses, or jump-tables should contain relative addresses only when @option{-fPIC} or @option{-fPIC} is in effect. @end defmac @hook TARGET_CASE_VALUES_THRESHOLD @defmac WORD_REGISTER_OPERATIONS Define this macro to 1 if operations between registers with integral mode smaller than a word are always performed on the entire register. To be more explicit, if you start with a pair of @code{word_mode} registers with known values and you do a subword, for example @code{QImode}, addition on the low part of the registers, then the compiler may consider that the result has a known value in @code{word_mode} too if the macro is defined to 1. Most RISC machines have this property and most CISC machines do not. @end defmac @hook TARGET_MIN_ARITHMETIC_PRECISION @defmac LOAD_EXTEND_OP (@var{mem_mode}) Define this macro to be a C expression indicating when insns that read memory in @var{mem_mode}, an integral mode narrower than a word, set the bits outside of @var{mem_mode} to be either the sign-extension or the zero-extension of the data read. Return @code{SIGN_EXTEND} for values of @var{mem_mode} for which the insn sign-extends, @code{ZERO_EXTEND} for which it zero-extends, and @code{UNKNOWN} for other modes. This macro is not called with @var{mem_mode} non-integral or with a width greater than or equal to @code{BITS_PER_WORD}, so you may return any value in this case. Do not define this macro if it would always return @code{UNKNOWN}. On machines where this macro is defined, you will normally define it as the constant @code{SIGN_EXTEND} or @code{ZERO_EXTEND}. You may return a non-@code{UNKNOWN} value even if for some hard registers the sign extension is not performed, if for the @code{REGNO_REG_CLASS} of these hard registers @code{TARGET_CAN_CHANGE_MODE_CLASS} returns false when the @var{from} mode is @var{mem_mode} and the @var{to} mode is any integral mode larger than this but not larger than @code{word_mode}. You must return @code{UNKNOWN} if for some hard registers that allow this mode, @code{TARGET_CAN_CHANGE_MODE_CLASS} says that they cannot change to @code{word_mode}, but that they can change to another integral mode that is larger then @var{mem_mode} but still smaller than @code{word_mode}. @end defmac @defmac SHORT_IMMEDIATES_SIGN_EXTEND Define this macro to 1 if loading short immediate values into registers sign extends. @end defmac @hook TARGET_MIN_DIVISIONS_FOR_RECIP_MUL @defmac MOVE_MAX The maximum number of bytes that a single instruction can move quickly between memory and registers or between two memory locations. @end defmac @defmac MAX_MOVE_MAX The maximum number of bytes that a single instruction can move quickly between memory and registers or between two memory locations. If this is undefined, the default is @code{MOVE_MAX}. Otherwise, it is the constant value that is the largest value that @code{MOVE_MAX} can have at run-time. @end defmac @defmac SHIFT_COUNT_TRUNCATED A C expression that is nonzero if on this machine the number of bits actually used for the count of a shift operation is equal to the number of bits needed to represent the size of the object being shifted. When this macro is nonzero, the compiler will assume that it is safe to omit a sign-extend, zero-extend, and certain bitwise `and' instructions that truncates the count of a shift operation. On machines that have instructions that act on bit-fields at variable positions, which may include `bit test' instructions, a nonzero @code{SHIFT_COUNT_TRUNCATED} also enables deletion of truncations of the values that serve as arguments to bit-field instructions. If both types of instructions truncate the count (for shifts) and position (for bit-field operations), or if no variable-position bit-field instructions exist, you should define this macro. However, on some machines, such as the 80386 and the 680x0, truncation only applies to shift operations and not the (real or pretended) bit-field operations. Define @code{SHIFT_COUNT_TRUNCATED} to be zero on such machines. Instead, add patterns to the @file{md} file that include the implied truncation of the shift instructions. You need not define this macro if it would always have the value of zero. @end defmac @anchor{TARGET_SHIFT_TRUNCATION_MASK} @hook TARGET_SHIFT_TRUNCATION_MASK @hook TARGET_TRULY_NOOP_TRUNCATION @hook TARGET_MODE_REP_EXTENDED @hook TARGET_SETJMP_PRESERVES_NONVOLATILE_REGS_P @defmac STORE_FLAG_VALUE A C expression describing the value returned by a comparison operator with an integral mode and stored by a store-flag instruction (@samp{cstore@var{mode}4}) when the condition is true. This description must apply to @emph{all} the @samp{cstore@var{mode}4} patterns and all the comparison operators whose results have a @code{MODE_INT} mode. A value of 1 or @minus{}1 means that the instruction implementing the comparison operator returns exactly 1 or @minus{}1 when the comparison is true and 0 when the comparison is false. Otherwise, the value indicates which bits of the result are guaranteed to be 1 when the comparison is true. This value is interpreted in the mode of the comparison operation, which is given by the mode of the first operand in the @samp{cstore@var{mode}4} pattern. Either the low bit or the sign bit of @code{STORE_FLAG_VALUE} be on. Presently, only those bits are used by the compiler. If @code{STORE_FLAG_VALUE} is neither 1 or @minus{}1, the compiler will generate code that depends only on the specified bits. It can also replace comparison operators with equivalent operations if they cause the required bits to be set, even if the remaining bits are undefined. For example, on a machine whose comparison operators return an @code{SImode} value and where @code{STORE_FLAG_VALUE} is defined as @samp{0x80000000}, saying that just the sign bit is relevant, the expression @smallexample (ne:SI (and:SI @var{x} (const_int @var{power-of-2})) (const_int 0)) @end smallexample @noindent can be converted to @smallexample (ashift:SI @var{x} (const_int @var{n})) @end smallexample @noindent where @var{n} is the appropriate shift count to move the bit being tested into the sign bit. There is no way to describe a machine that always sets the low-order bit for a true value, but does not guarantee the value of any other bits, but we do not know of any machine that has such an instruction. If you are trying to port GCC to such a machine, include an instruction to perform a logical-and of the result with 1 in the pattern for the comparison operators and let us know at @email{gcc@@gcc.gnu.org}. Often, a machine will have multiple instructions that obtain a value from a comparison (or the condition codes). Here are rules to guide the choice of value for @code{STORE_FLAG_VALUE}, and hence the instructions to be used: @itemize @bullet @item Use the shortest sequence that yields a valid definition for @code{STORE_FLAG_VALUE}. It is more efficient for the compiler to ``normalize'' the value (convert it to, e.g., 1 or 0) than for the comparison operators to do so because there may be opportunities to combine the normalization with other operations. @item For equal-length sequences, use a value of 1 or @minus{}1, with @minus{}1 being slightly preferred on machines with expensive jumps and 1 preferred on other machines. @item As a second choice, choose a value of @samp{0x80000001} if instructions exist that set both the sign and low-order bits but do not define the others. @item Otherwise, use a value of @samp{0x80000000}. @end itemize Many machines can produce both the value chosen for @code{STORE_FLAG_VALUE} and its negation in the same number of instructions. On those machines, you should also define a pattern for those cases, e.g., one matching @smallexample (set @var{A} (neg:@var{m} (ne:@var{m} @var{B} @var{C}))) @end smallexample Some machines can also perform @code{and} or @code{plus} operations on condition code values with less instructions than the corresponding @samp{cstore@var{mode}4} insn followed by @code{and} or @code{plus}. On those machines, define the appropriate patterns. Use the names @code{incscc} and @code{decscc}, respectively, for the patterns which perform @code{plus} or @code{minus} operations on condition code values. See @file{rs6000.md} for some examples. The GNU Superoptimizer can be used to find such instruction sequences on other machines. If this macro is not defined, the default value, 1, is used. You need not define @code{STORE_FLAG_VALUE} if the machine has no store-flag instructions, or if the value generated by these instructions is 1. @end defmac @defmac FLOAT_STORE_FLAG_VALUE (@var{mode}) A C expression that gives a nonzero @code{REAL_VALUE_TYPE} value that is returned when comparison operators with floating-point results are true. Define this macro on machines that have comparison operations that return floating-point values. If there are no such operations, do not define this macro. @end defmac @defmac VECTOR_STORE_FLAG_VALUE (@var{mode}) A C expression that gives an rtx representing the nonzero true element for vector comparisons. The returned rtx should be valid for the inner mode of @var{mode} which is guaranteed to be a vector mode. Define this macro on machines that have vector comparison operations that return a vector result. If there are no such operations, do not define this macro. Typically, this macro is defined as @code{const1_rtx} or @code{constm1_rtx}. This macro may return @code{NULL_RTX} to prevent the compiler optimizing such vector comparison operations for the given mode. @end defmac @defmac CLZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value}) @defmacx CTZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value}) A C expression that indicates whether the architecture defines a value for @code{clz} or @code{ctz} with a zero operand. A result of @code{0} indicates the value is undefined. If the value is defined for only the RTL expression, the macro should evaluate to @code{1}; if the value applies also to the corresponding optab entry (which is normally the case if it expands directly into the corresponding RTL), then the macro should evaluate to @code{2}. In the cases where the value is defined, @var{value} should be set to this value. If this macro is not defined, the value of @code{clz} or @code{ctz} at zero is assumed to be undefined. This macro must be defined if the target's expansion for @code{ffs} relies on a particular value to get correct results. Otherwise it is not necessary, though it may be used to optimize some corner cases, and to provide a default expansion for the @code{ffs} optab. Note that regardless of this macro the ``definedness'' of @code{clz} and @code{ctz} at zero do @emph{not} extend to the builtin functions visible to the user. Thus one may be free to adjust the value at will to match the target expansion of these operations without fear of breaking the API@. @end defmac @defmac Pmode An alias for the machine mode for pointers. On most machines, define this to be the integer mode corresponding to the width of a hardware pointer; @code{SImode} on 32-bit machine or @code{DImode} on 64-bit machines. On some machines you must define this to be one of the partial integer modes, such as @code{PSImode}. The width of @code{Pmode} must be at least as large as the value of @code{POINTER_SIZE}. If it is not equal, you must define the macro @code{POINTERS_EXTEND_UNSIGNED} to specify how pointers are extended to @code{Pmode}. @end defmac @defmac FUNCTION_MODE An alias for the machine mode used for memory references to functions being called, in @code{call} RTL expressions. On most CISC machines, where an instruction can begin at any byte address, this should be @code{QImode}. On most RISC machines, where all instructions have fixed size and alignment, this should be a mode with the same size and alignment as the machine instruction words - typically @code{SImode} or @code{HImode}. @end defmac @defmac STDC_0_IN_SYSTEM_HEADERS In normal operation, the preprocessor expands @code{__STDC__} to the constant 1, to signify that GCC conforms to ISO Standard C@. On some hosts, like Solaris, the system compiler uses a different convention, where @code{__STDC__} is normally 0, but is 1 if the user specifies strict conformance to the C Standard. Defining @code{STDC_0_IN_SYSTEM_HEADERS} makes GNU CPP follows the host convention when processing system header files, but when processing user files @code{__STDC__} will always expand to 1. @end defmac @hook TARGET_C_PREINCLUDE @hook TARGET_CXX_IMPLICIT_EXTERN_C @defmac SYSTEM_IMPLICIT_EXTERN_C Define this macro if the system header files do not support C++@. This macro handles system header files by pretending that system header files are enclosed in @samp{extern "C" @{@dots{}@}}. @end defmac @findex #pragma @findex pragma @defmac REGISTER_TARGET_PRAGMAS () Define this macro if you want to implement any target-specific pragmas. If defined, it is a C expression which makes a series of calls to @code{c_register_pragma} or @code{c_register_pragma_with_expansion} for each pragma. The macro may also do any setup required for the pragmas. The primary reason to define this macro is to provide compatibility with other compilers for the same target. In general, we discourage definition of target-specific pragmas for GCC@. If the pragma can be implemented by attributes then you should consider defining the target hook @samp{TARGET_INSERT_ATTRIBUTES} as well. Preprocessor macros that appear on pragma lines are not expanded. All @samp{#pragma} directives that do not match any registered pragma are silently ignored, unless the user specifies @option{-Wunknown-pragmas}. @end defmac @deftypefun void c_register_pragma (const char *@var{space}, const char *@var{name}, void (*@var{callback}) (struct cpp_reader *)) @deftypefunx void c_register_pragma_with_expansion (const char *@var{space}, const char *@var{name}, void (*@var{callback}) (struct cpp_reader *)) Each call to @code{c_register_pragma} or @code{c_register_pragma_with_expansion} establishes one pragma. The @var{callback} routine will be called when the preprocessor encounters a pragma of the form @smallexample #pragma [@var{space}] @var{name} @dots{} @end smallexample @var{space} is the case-sensitive namespace of the pragma, or @code{NULL} to put the pragma in the global namespace. The callback routine receives @var{pfile} as its first argument, which can be passed on to cpplib's functions if necessary. You can lex tokens after the @var{name} by calling @code{pragma_lex}. Tokens that are not read by the callback will be silently ignored. The end of the line is indicated by a token of type @code{CPP_EOF}. Macro expansion occurs on the arguments of pragmas registered with @code{c_register_pragma_with_expansion} but not on the arguments of pragmas registered with @code{c_register_pragma}. Note that the use of @code{pragma_lex} is specific to the C and C++ compilers. It will not work in the Java or Fortran compilers, or any other language compilers for that matter. Thus if @code{pragma_lex} is going to be called from target-specific code, it must only be done so when building the C and C++ compilers. This can be done by defining the variables @code{c_target_objs} and @code{cxx_target_objs} in the target entry in the @file{config.gcc} file. These variables should name the target-specific, language-specific object file which contains the code that uses @code{pragma_lex}. Note it will also be necessary to add a rule to the makefile fragment pointed to by @code{tmake_file} that shows how to build this object file. @end deftypefun @defmac HANDLE_PRAGMA_PACK_WITH_EXPANSION Define this macro if macros should be expanded in the arguments of @samp{#pragma pack}. @end defmac @defmac TARGET_DEFAULT_PACK_STRUCT If your target requires a structure packing default other than 0 (meaning the machine default), define this macro to the necessary value (in bytes). This must be a value that would also be valid to use with @samp{#pragma pack()} (that is, a small power of two). @end defmac @defmac DOLLARS_IN_IDENTIFIERS Define this macro to control use of the character @samp{$} in identifier names for the C family of languages. 0 means @samp{$} is not allowed by default; 1 means it is allowed. 1 is the default; there is no need to define this macro in that case. @end defmac @defmac INSN_SETS_ARE_DELAYED (@var{insn}) Define this macro as a C expression that is nonzero if it is safe for the delay slot scheduler to place instructions in the delay slot of @var{insn}, even if they appear to use a resource set or clobbered in @var{insn}. @var{insn} is always a @code{jump_insn} or an @code{insn}; GCC knows that every @code{call_insn} has this behavior. On machines where some @code{insn} or @code{jump_insn} is really a function call and hence has this behavior, you should define this macro. You need not define this macro if it would always return zero. @end defmac @defmac INSN_REFERENCES_ARE_DELAYED (@var{insn}) Define this macro as a C expression that is nonzero if it is safe for the delay slot scheduler to place instructions in the delay slot of @var{insn}, even if they appear to set or clobber a resource referenced in @var{insn}. @var{insn} is always a @code{jump_insn} or an @code{insn}. On machines where some @code{insn} or @code{jump_insn} is really a function call and its operands are registers whose use is actually in the subroutine it calls, you should define this macro. Doing so allows the delay slot scheduler to move instructions which copy arguments into the argument registers into the delay slot of @var{insn}. You need not define this macro if it would always return zero. @end defmac @defmac MULTIPLE_SYMBOL_SPACES Define this macro as a C expression that is nonzero if, in some cases, global symbols from one translation unit may not be bound to undefined symbols in another translation unit without user intervention. For instance, under Microsoft Windows symbols must be explicitly imported from shared libraries (DLLs). You need not define this macro if it would always evaluate to zero. @end defmac @hook TARGET_MD_ASM_ADJUST @defmac MATH_LIBRARY Define this macro as a C string constant for the linker argument to link in the system math library, minus the initial @samp{"-l"}, or @samp{""} if the target does not have a separate math library. You need only define this macro if the default of @samp{"m"} is wrong. @end defmac @defmac LIBRARY_PATH_ENV Define this macro as a C string constant for the environment variable that specifies where the linker should look for libraries. You need only define this macro if the default of @samp{"LIBRARY_PATH"} is wrong. @end defmac @defmac TARGET_POSIX_IO Define this macro if the target supports the following POSIX@ file functions, access, mkdir and file locking with fcntl / F_SETLKW@. Defining @code{TARGET_POSIX_IO} will enable the test coverage code to use file locking when exiting a program, which avoids race conditions if the program has forked. It will also create directories at run-time for cross-profiling. @end defmac @defmac MAX_CONDITIONAL_EXECUTE A C expression for the maximum number of instructions to execute via conditional execution instructions instead of a branch. A value of @code{BRANCH_COST}+1 is the default. @end defmac @defmac IFCVT_MODIFY_TESTS (@var{ce_info}, @var{true_expr}, @var{false_expr}) Used if the target needs to perform machine-dependent modifications on the conditionals used for turning basic blocks into conditionally executed code. @var{ce_info} points to a data structure, @code{struct ce_if_block}, which contains information about the currently processed blocks. @var{true_expr} and @var{false_expr} are the tests that are used for converting the then-block and the else-block, respectively. Set either @var{true_expr} or @var{false_expr} to a null pointer if the tests cannot be converted. @end defmac @defmac IFCVT_MODIFY_MULTIPLE_TESTS (@var{ce_info}, @var{bb}, @var{true_expr}, @var{false_expr}) Like @code{IFCVT_MODIFY_TESTS}, but used when converting more complicated if-statements into conditions combined by @code{and} and @code{or} operations. @var{bb} contains the basic block that contains the test that is currently being processed and about to be turned into a condition. @end defmac @defmac IFCVT_MODIFY_INSN (@var{ce_info}, @var{pattern}, @var{insn}) A C expression to modify the @var{PATTERN} of an @var{INSN} that is to be converted to conditional execution format. @var{ce_info} points to a data structure, @code{struct ce_if_block}, which contains information about the currently processed blocks. @end defmac @defmac IFCVT_MODIFY_FINAL (@var{ce_info}) A C expression to perform any final machine dependent modifications in converting code to conditional execution. The involved basic blocks can be found in the @code{struct ce_if_block} structure that is pointed to by @var{ce_info}. @end defmac @defmac IFCVT_MODIFY_CANCEL (@var{ce_info}) A C expression to cancel any machine dependent modifications in converting code to conditional execution. The involved basic blocks can be found in the @code{struct ce_if_block} structure that is pointed to by @var{ce_info}. @end defmac @defmac IFCVT_MACHDEP_INIT (@var{ce_info}) A C expression to initialize any machine specific data for if-conversion of the if-block in the @code{struct ce_if_block} structure that is pointed to by @var{ce_info}. @end defmac @hook TARGET_MACHINE_DEPENDENT_REORG @hook TARGET_INIT_BUILTINS @hook TARGET_BUILTIN_DECL @hook TARGET_EXPAND_BUILTIN @hook TARGET_RESOLVE_OVERLOADED_BUILTIN @hook TARGET_CHECK_BUILTIN_CALL @hook TARGET_FOLD_BUILTIN @hook TARGET_GIMPLE_FOLD_BUILTIN @hook TARGET_COMPARE_VERSION_PRIORITY @hook TARGET_GET_FUNCTION_VERSIONS_DISPATCHER @hook TARGET_GENERATE_VERSION_DISPATCHER_BODY @hook TARGET_PREDICT_DOLOOP_P @hook TARGET_HAVE_COUNT_REG_DECR_P @hook TARGET_DOLOOP_COST_FOR_GENERIC @hook TARGET_DOLOOP_COST_FOR_ADDRESS @hook TARGET_CAN_USE_DOLOOP_P @hook TARGET_INVALID_WITHIN_DOLOOP @hook TARGET_PREFERRED_DOLOOP_MODE @hook TARGET_LEGITIMATE_COMBINED_INSN @hook TARGET_CAN_FOLLOW_JUMP @hook TARGET_COMMUTATIVE_P @hook TARGET_ALLOCATE_INITIAL_VALUE @hook TARGET_UNSPEC_MAY_TRAP_P @hook TARGET_SET_CURRENT_FUNCTION @defmac TARGET_OBJECT_SUFFIX Define this macro to be a C string representing the suffix for object files on your target machine. If you do not define this macro, GCC will use @samp{.o} as the suffix for object files. @end defmac @defmac TARGET_EXECUTABLE_SUFFIX Define this macro to be a C string representing the suffix to be automatically added to executable files on your target machine. If you do not define this macro, GCC will use the null string as the suffix for executable files. @end defmac @defmac COLLECT_EXPORT_LIST If defined, @code{collect2} will scan the individual object files specified on its command line and create an export list for the linker. Define this macro for systems like AIX, where the linker discards object files that are not referenced from @code{main} and uses export lists. @end defmac @hook TARGET_CANNOT_MODIFY_JUMPS_P @hook TARGET_HAVE_CONDITIONAL_EXECUTION @hook TARGET_GEN_CCMP_FIRST @hook TARGET_GEN_CCMP_NEXT @hook TARGET_GEN_MEMSET_SCRATCH_RTX @hook TARGET_LOOP_UNROLL_ADJUST @defmac POWI_MAX_MULTS If defined, this macro is interpreted as a signed integer C expression that specifies the maximum number of floating point multiplications that should be emitted when expanding exponentiation by an integer constant inline. When this value is defined, exponentiation requiring more than this number of multiplications is implemented by calling the system library's @code{pow}, @code{powf} or @code{powl} routines. The default value places no upper bound on the multiplication count. @end defmac @deftypefn Macro void TARGET_EXTRA_INCLUDES (const char *@var{sysroot}, const char *@var{iprefix}, int @var{stdinc}) This target hook should register any extra include files for the target. The parameter @var{stdinc} indicates if normal include files are present. The parameter @var{sysroot} is the system root directory. The parameter @var{iprefix} is the prefix for the gcc directory. @end deftypefn @deftypefn Macro void TARGET_EXTRA_PRE_INCLUDES (const char *@var{sysroot}, const char *@var{iprefix}, int @var{stdinc}) This target hook should register any extra include files for the target before any standard headers. The parameter @var{stdinc} indicates if normal include files are present. The parameter @var{sysroot} is the system root directory. The parameter @var{iprefix} is the prefix for the gcc directory. @end deftypefn @deftypefn Macro void TARGET_OPTF (char *@var{path}) This target hook should register special include paths for the target. The parameter @var{path} is the include to register. On Darwin systems, this is used for Framework includes, which have semantics that are different from @option{-I}. @end deftypefn @defmac bool TARGET_USE_LOCAL_THUNK_ALIAS_P (tree @var{fndecl}) This target macro returns @code{true} if it is safe to use a local alias for a virtual function @var{fndecl} when constructing thunks, @code{false} otherwise. By default, the macro returns @code{true} for all functions, if a target supports aliases (i.e.@: defines @code{ASM_OUTPUT_DEF}), @code{false} otherwise, @end defmac @defmac TARGET_FORMAT_TYPES If defined, this macro is the name of a global variable containing target-specific format checking information for the @option{-Wformat} option. The default is to have no target-specific format checks. @end defmac @defmac TARGET_N_FORMAT_TYPES If defined, this macro is the number of entries in @code{TARGET_FORMAT_TYPES}. @end defmac @defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES If defined, this macro is the name of a global variable containing target-specific format overrides for the @option{-Wformat} option. The default is to have no target-specific format overrides. If defined, @code{TARGET_FORMAT_TYPES} must be defined, too. @end defmac @defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT If defined, this macro specifies the number of entries in @code{TARGET_OVERRIDES_FORMAT_ATTRIBUTES}. @end defmac @defmac TARGET_OVERRIDES_FORMAT_INIT If defined, this macro specifies the optional initialization routine for target specific customizations of the system printf and scanf formatter settings. @end defmac @hook TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN @hook TARGET_INVALID_CONVERSION @hook TARGET_INVALID_UNARY_OP @hook TARGET_INVALID_BINARY_OP @hook TARGET_PROMOTED_TYPE @hook TARGET_CONVERT_TO_TYPE @hook TARGET_VERIFY_TYPE_CONTEXT @defmac OBJC_JBLEN This macro determines the size of the objective C jump buffer for the NeXT runtime. By default, OBJC_JBLEN is defined to an innocuous value. @end defmac @defmac LIBGCC2_UNWIND_ATTRIBUTE Define this macro if any target-specific attributes need to be attached to the functions in @file{libgcc} that provide low-level support for call stack unwinding. It is used in declarations in @file{unwind-generic.h} and the associated definitions of those functions. @end defmac @hook TARGET_UPDATE_STACK_BOUNDARY @hook TARGET_GET_DRAP_RTX @hook TARGET_ZERO_CALL_USED_REGS @hook TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS @hook TARGET_CONST_ANCHOR @hook TARGET_ASAN_SHADOW_OFFSET @hook TARGET_MEMMODEL_CHECK @hook TARGET_ATOMIC_TEST_AND_SET_TRUEVAL @hook TARGET_HAS_IFUNC_P @hook TARGET_IFUNC_REF_LOCAL_OK @hook TARGET_ATOMIC_ALIGN_FOR_MODE @hook TARGET_ATOMIC_ASSIGN_EXPAND_FENV @hook TARGET_RECORD_OFFLOAD_SYMBOL @hook TARGET_OFFLOAD_OPTIONS @defmac TARGET_SUPPORTS_WIDE_INT On older ports, large integers are stored in @code{CONST_DOUBLE} rtl objects. Newer ports define @code{TARGET_SUPPORTS_WIDE_INT} to be nonzero to indicate that large integers are stored in @code{CONST_WIDE_INT} rtl objects. The @code{CONST_WIDE_INT} allows very large integer constants to be represented. @code{CONST_DOUBLE} is limited to twice the size of the host's @code{HOST_WIDE_INT} representation. Converting a port mostly requires looking for the places where @code{CONST_DOUBLE}s are used with @code{VOIDmode} and replacing that code with code that accesses @code{CONST_WIDE_INT}s. @samp{"grep -i const_double"} at the port level gets you to 95% of the changes that need to be made. There are a few places that require a deeper look. @itemize @bullet @item There is no equivalent to @code{hval} and @code{lval} for @code{CONST_WIDE_INT}s. This would be difficult to express in the md language since there are a variable number of elements. Most ports only check that @code{hval} is either 0 or -1 to see if the value is small. As mentioned above, this will no longer be necessary since small constants are always @code{CONST_INT}. Of course there are still a few exceptions, the alpha's constraint used by the zap instruction certainly requires careful examination by C code. However, all the current code does is pass the hval and lval to C code, so evolving the c code to look at the @code{CONST_WIDE_INT} is not really a large change. @item Because there is no standard template that ports use to materialize constants, there is likely to be some futzing that is unique to each port in this code. @item The rtx costs may have to be adjusted to properly account for larger constants that are represented as @code{CONST_WIDE_INT}. @end itemize All and all it does not take long to convert ports that the maintainer is familiar with. @end defmac @hook TARGET_HAVE_SPECULATION_SAFE_VALUE @hook TARGET_SPECULATION_SAFE_VALUE @hook TARGET_RUN_TARGET_SELFTESTS @hook TARGET_MEMTAG_CAN_TAG_ADDRESSES @hook TARGET_MEMTAG_TAG_SIZE @hook TARGET_MEMTAG_GRANULE_SIZE @hook TARGET_MEMTAG_INSERT_RANDOM_TAG @hook TARGET_MEMTAG_ADD_TAG @hook TARGET_MEMTAG_SET_TAG @hook TARGET_MEMTAG_EXTRACT_TAG @hook TARGET_MEMTAG_UNTAGGED_POINTER @hook TARGET_GCOV_TYPE_SIZE