URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [doc/] [tm.texi.in] - Rev 716
Go to most recent revision | Compare with Previous | Blame | View Log
@c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012@c 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} macrosIn addition to the file @file{@var{machine}.md}, a machine descriptionincludes 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 informationabout 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}. Thesource file defines a variable @code{targetm}, which is a structurecontaining pointers to functions and data relating to the targetmachine. @file{@var{machine}.c} should also contain their definitions,if they are not defined elsewhere in GCC, and other functions calledthrough 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.* Old Constraints:: The old way to define machine-specific constraints.* 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.* 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} targetmThe target @file{.c} file must define the global @code{targetm} variablewhich contains pointers to functions and data relating to the targetmachine. The variable is declared in @file{target.h};@file{target-def.h} defines the macro @code{TARGET_INITIALIZER} which isused to initialize the variable, and macros for the default initializersfor elements of the structure. The @file{.c} file should override thosemacros 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_attributesstruct gcc_target targetm = TARGET_INITIALIZER;@end smallexample@end deftypevarWhere a macro should be defined in the @file{.c} file in this manner toform part of the @code{targetm} structure, it is documented below as a``Target Hook'' with a prototype. Many macros will change in futurefrom 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 arespecific to front ends for C-family languages, documented as ``CTarget Hook''. This is declared in @file{c-family/c-target.h}, theinitializer @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 thatare 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 adefault 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 lineYou can control the compilation driver.@defmac DRIVER_SELF_SPECSA list of specs for the driver itself. It should be a suitableinitializer for an array of strings, with no surrounding braces.The driver applies these specs to its own command line between loadingdefault @file{specs} files (but not command-line specified ones) andchoosing the multilib directory or running any subcommands. Itapplies them in the order given, so each spec can depend on theoptions added by earlier ones. It is also possible to remove optionsusing @samp{%<@var{option}} in the usual way.This macro can be useful when a port has several interdependent targetoptions. It provides a way of standardizing the command line sothat 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_SPECSA list of specs used to support configure-time default options (i.e.@:@option{--with} options) in the driver. It should be a suitable initializerfor an array of structures, each containing two strings, without theoutermost pair of surrounding braces.The first item in the pair is the name of the default. This must matchthe code in @file{config.gcc} for the target. The second item is a specto apply if a default with this name was specified. The string@samp{%(VALUE)} in the spec will be replaced by the value of the defaulteverywhere it occurs.The driver will apply these specs to its own command line between loadingdefault @file{specs} files and processing @code{DRIVER_SELF_SPECS}, usingthe same mechanism as @code{DRIVER_SELF_SPECS}.Do not define this macro if it does not need to do anything.@end defmac@defmac CPP_SPECA C string constant that tells the GCC driver program options topass to CPP@. It can also specify how to translate options yougive 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_SPECThis macro is just like @code{CPP_SPEC}, but is used for C++, ratherthan 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_SPECA C string constant that tells the GCC driver program options topass to @code{cc1}, @code{cc1plus}, @code{f771}, and the other languagefront ends.It can also specify how to translate options you give to GCC into optionsfor GCC to pass to front ends.Do not define this macro if it does not need to do anything.@end defmac@defmac CC1PLUS_SPECA C string constant that tells the GCC driver program options topass to @code{cc1plus}. It can also specify how to translate options yougive 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 ofCC1_SPEC in CC1PLUS_SPEC@.@end defmac@defmac ASM_SPECA C string constant that tells the GCC driver program options topass to the assembler. It can also specify how to translate optionsyou 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_SPECA C string constant that tells the GCC driver program how torun any programs which cleanup after the normal assembler.Normally, this is not needed. See the file @file{mips.h} foran example of this.Do not define this macro if it does not need to do anything.@end defmac@defmac AS_NEEDS_DASH_FOR_PIPED_INPUTDefine this macro, with no value, if the driver should give the assembleran argument consisting of a single dash, @option{-}, to instruct it toread from its standard input (which will be a pipe connected to theoutput 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 itsstandard input if given no non-option arguments. If your assemblercannot read standard input at all, use a @samp{%@{pipe:%e@}} construct;see @file{mips.h} for instance.@end defmac@defmac LINK_SPECA C string constant that tells the GCC driver program options topass to the linker. It can also specify how to translate options yougive 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_SPECAnother C string constant used much like @code{LINK_SPEC}. The differencebetween the two is that @code{LIB_SPEC} is used at the end of thecommand given to the linker.If this macro is not defined, a default is provided thatloads the standard C library from the usual place. See @file{gcc.c}.@end defmac@defmac LIBGCC_SPECAnother C string constant that tells the GCC driver programhow and when to place a reference to @file{libgcc.a} into thelinker command line. This constant is placed both before and afterthe value of @code{LIB_SPEC}.If this macro is not defined, the GCC driver provides a default thatpasses the string @option{-lgcc} to the linker.@end defmac@defmac REAL_LIBGCC_SPECBy default, if @code{ENABLE_SHARED_LIBGCC} is defined, the@code{LIBGCC_SPEC} is not directly used by the driver program but isinstead 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}. Ontargets where these modifications are inappropriate, define@code{REAL_LIBGCC_SPEC} instead. @code{REAL_LIBGCC_SPEC} tells thedriver how to place a reference to @file{libgcc} on the link commandline, but, unlike @code{LIBGCC_SPEC}, it is used unmodified.@end defmac@defmac USE_LD_AS_NEEDEDA macro that controls the modifications to @code{LIBGCC_SPEC}mentioned in @code{REAL_LIBGCC_SPEC}. If nonzero, a spec will begenerated that uses --as-needed and the shared libgcc in place of thestatic exception handler library, when linking without any of@code{-static}, @code{-static-libgcc}, or @code{-shared-libgcc}.@end defmac@defmac LINK_EH_SPECIf defined, this C string constant is added to @code{LINK_SPEC}.When @code{USE_LD_AS_NEEDED} is zero or undefined, it also affectsthe modifications to @code{LIBGCC_SPEC} mentioned in@code{REAL_LIBGCC_SPEC}.@end defmac@defmac STARTFILE_SPECAnother C string constant used much like @code{LINK_SPEC}. Thedifference between the two is that @code{STARTFILE_SPEC} is used atthe very beginning of the command given to the linker.If this macro is not defined, a default is provided that loads thestandard C startup file from the usual place. See @file{gcc.c}.@end defmac@defmac ENDFILE_SPECAnother C string constant used much like @code{LINK_SPEC}. Thedifference between the two is that @code{ENDFILE_SPEC} is used atthe 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_SPECGCC @code{-v} will print the thread model GCC was configured to use.However, this doesn't work on platforms that are multilibbed on threadmodels, such as AIX 4.3. On such platforms, define@code{THREAD_MODEL_SPEC} such that it evaluates to a string withoutblanks that names one of the recognized thread models. @code{%*}, thedefault value of this macro, will expand to the value of@code{thread_file} set in @file{config.gcc}.@end defmac@defmac SYSROOT_SUFFIX_SPECDefine this macro to add a suffix to the target sysroot when GCC isconfigured with a sysroot. This will cause GCC to search for usr/lib,et al, within sysroot+suffix.@end defmac@defmac SYSROOT_HEADERS_SUFFIX_SPECDefine this macro to add a headers_suffix to the target sysroot whenGCC is configured with a sysroot. This will cause GCC to pass theupdated sysroot+headers_suffix to CPP, causing it to search forusr/include, et al, within sysroot+headers_suffix.@end defmac@defmac EXTRA_SPECSDefine 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 astring 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 severalrelated targets, which have various @code{@dots{}_SPECS} which are similarto each other, and the maintainer would like one central place to keepthese definitions.For example, the PowerPC System V.4 targets use @code{EXTRA_SPECS} todefine either @code{_CALL_SYSV} when the System V calling sequence isused or @code{_CALL_AIX} when the older AIX-based calling sequence isused.The @file{config/rs6000/rs6000.h} target file defines:@smallexample#define EXTRA_SPECS \@{ "cpp_sysv_default", CPP_SYSV_DEFAULT @},#define CPP_SYS_DEFAULT ""@end smallexampleThe @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 smallexamplewhile 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_1Define this macro if the driver program should find the library@file{libgcc.a}. If you do not define this macro, the driver program will passthe argument @option{-lgcc} to tell the linker to do the search.@end defmac@defmac LINK_GCC_C_SEQUENCE_SPECThe sequence in which libgcc and libc are specified to the linker.By default this is @code{%G %L %G}.@end defmac@defmac LINK_COMMAND_SPECA C string constant giving the complete command line need to execute thelinker. When you do this, you will need to update your port each time achange is made to the link command line within @file{gcc.c}. Therefore,define this macro only if you need to completely redefine the commandline for invoking the linker and there is no other way to accomplishthe effect you need. Overriding this macro may be avoidable by overriding@code{LINK_GCC_C_SEQUENCE_SPEC} instead.@end defmac@defmac LINK_ELIMINATE_DUPLICATE_LDIRECTORIESA nonzero value causes @command{collect2} to remove duplicate @option{-L@var{directory}} searchdirectories from linking commands. Do not give it a nonzero value ifremoving duplicate search directories changes the linker's semantics.@end defmac@hook TARGET_ALWAYS_STRIP_DOTDOT@defmac MULTILIB_DEFAULTSDefine this macro as a C expression for the initializer of an array ofstring to tell the driver program which options are defaults for thistarget 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 inthe 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_LINKDIRDefine this macro to tell @command{gcc} that it should only translatea @option{-B} prefix into a @option{-L} linker option if the prefixindicates an absolute file name.@end defmac@defmac MD_EXEC_PREFIXIf defined, this macro is an additional prefix to try after@code{STANDARD_EXEC_PREFIX}. @code{MD_EXEC_PREFIX} is not searchedwhen the compiler is built as a crosscompiler. If you define @code{MD_EXEC_PREFIX}, then be sure to add itto the list of directories used to find the assembler in @file{configure.in}.@end defmac@defmac STANDARD_STARTFILE_PREFIXDefine this macro as a C string constant if you wish to override thestandard choice of @code{libdir} as the default prefix totry when searching for startup files such as @file{crt0.o}.@code{STANDARD_STARTFILE_PREFIX} is not searched when the compileris built as a cross compiler.@end defmac@defmac STANDARD_STARTFILE_PREFIX_1Define this macro as a C string constant if you wish to override thestandard choice of @code{/lib} as a prefix to try after the default prefixwhen searching for startup files such as @file{crt0.o}.@code{STANDARD_STARTFILE_PREFIX_1} is not searched when the compileris built as a cross compiler.@end defmac@defmac STANDARD_STARTFILE_PREFIX_2Define this macro as a C string constant if you wish to override thestandard choice of @code{/lib} as yet another prefix to try after thedefault prefix when searching for startup files such as @file{crt0.o}.@code{STANDARD_STARTFILE_PREFIX_2} is not searched when the compileris built as a cross compiler.@end defmac@defmac MD_STARTFILE_PREFIXIf defined, this macro supplies an additional prefix to try after thestandard prefixes. @code{MD_EXEC_PREFIX} is not searched when thecompiler is built as a cross compiler.@end defmac@defmac MD_STARTFILE_PREFIX_1If defined, this macro supplies yet another prefix to try after thestandard prefixes. It is not searched when the compiler is built as across compiler.@end defmac@defmac INIT_ENVIRONMENTDefine this macro as a C string constant if you wish to set environmentvariables for programs called by the driver, such as the assembler andloader. The driver passes the value of this macro to @code{putenv} toinitialize the necessary environment variables.@end defmac@defmac LOCAL_INCLUDE_DIRDefine this macro as a C string constant if you wish to override thestandard choice of @file{/usr/local/include} as the default prefix totry 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 itsreplacement.@end defmac@defmac NATIVE_SYSTEM_HEADER_COMPONENTThe ``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_DEFAULTSDefine this macro if you wish to override the entire default search pathfor include files. For a native compiler, the default search pathusually 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 (astring constant), the component name (also a string constant), a flagfor C++-only directories,and a flag showing that the includes in the directory don't need to bewrapped in @code{extern @samp{C}} when compiling C++. Mark the end ofthe 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-suppliedoperating 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 defmacHere is the order of prefixes tried for exec files:@enumerate@itemAny prefixes specified by the user with @option{-B}.@itemThe 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.@itemThe directories specified by the environment variable @code{COMPILER_PATH}.@itemThe macro @code{STANDARD_EXEC_PREFIX}, if the compiler has been installedin the configured-time @var{prefix}.@itemThe location @file{/usr/libexec/gcc/}, but only if this is a native compiler.@itemThe location @file{/usr/lib/gcc/}, but only if this is a native compiler.@itemThe macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a nativecompiler.@end enumerateHere is the order of prefixes tried for startfiles:@enumerate@itemAny prefixes specified by the user with @option{-B}.@itemThe environment variable @code{GCC_EXEC_PREFIX} or its automatically determinedvalue based on the installed toolchain location.@itemThe directories specified by the environment variable @code{LIBRARY_PATH}(or port-specific name; native only, cross compilers do not use this).@itemThe macro @code{STANDARD_EXEC_PREFIX}, but only if the toolchain is installedin the configured @var{prefix} or this is a native compiler.@itemThe location @file{/usr/lib/gcc/}, but only if this is a native compiler.@itemThe macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a nativecompiler.@itemThe macro @code{MD_STARTFILE_PREFIX}, if defined, but only if this is anative compiler, or we have a target system root.@itemThe macro @code{MD_STARTFILE_PREFIX_1}, if defined, but only if this is anative compiler, or we have a target system root.@itemThe macro @code{STANDARD_STARTFILE_PREFIX}, with any sysroot modifications.If this path is relative it will be prefixed by @code{GCC_EXEC_PREFIX} andthe machine suffix or @code{STANDARD_EXEC_PREFIX} and the machine suffix.@itemThe macro @code{STANDARD_STARTFILE_PREFIX_1}, but only if this is a nativecompiler, or we have a target system root. The default for this macro is@file{/lib/}.@itemThe macro @code{STANDARD_STARTFILE_PREFIX_2}, but only if this is a nativecompiler, 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 lineHere are run-time target specifications.@defmac TARGET_CPU_CPP_BUILTINS ()This function-like macro expands to a block of code that definesbuilt-in preprocessor macros and assertions for the target CPU, usingthe functions @code{builtin_define}, @code{builtin_define_std} and@code{builtin_assert}. When the front endcalls this macro it provides a trailing semicolon, and since it hasfinished command line option processing your code can use thoseresults freely.@code{builtin_assert} takes a string in the form you pass to thecommand-line option @option{-A}, such as @code{cpu=mips}, and createsthe assertion. @code{builtin_define} takes a string in the formaccepted by option @option{-D} and unconditionally defines the macro.@code{builtin_define_std} takes a string representing the name of anobject-like macro. If it doesn't lie in the user's namespace,@code{builtin_define_std} defines it unconditionally. Otherwise, itdefines a version with two leading underscores, and another versionwith two leading and trailing underscores, and defines the originalonly if an ISO standard was not requested on the command line. Forexample, 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 preprocessingassembler, this variable will be @code{clk_c} but the function-likemacro @code{preprocessing_asm_p()} will return true, so you might wantto check for that first. If you need to check for strict ANSI, thevariable @code{flag_iso} can be used. The function-like macro@code{preprocessing_trad_p()} can be used to check for traditionalpreprocessing.@end defmac@defmac TARGET_OS_CPP_BUILTINS ()Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optionaland 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 optionaland is used for the target object format. @file{elfos.h} uses thismacro to define @code{__ELF__}, so you probably do not need to defineit yourself.@end defmac@deftypevar {extern int} target_flagsThis variable is declared in @file{options.h}, which is included beforeany target-specific headers.@end deftypevar@hook TARGET_DEFAULT_TARGET_FLAGSThis 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_OPTIONThis hook is called whenever the user specifies one of thetarget-specific options described by the @file{.opt} definition files(@pxref{Options}). It has the opportunity to do some option-specificprocessing and should return true if the option is valid. The defaultdefinition 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 forstoring option state, and @var{loc} is the location at which theoption was passed (@code{UNKNOWN_LOCATION} except for options passedvia attributes).@end deftypefn@hook TARGET_HANDLE_C_OPTIONThis target hook is called whenever the user specifies one of thetarget-specific C language family options described by the @file{.opt}definition files(@pxref{Options}). It has the opportunity to do someoption-specific processing and should return true if the option isvalid. The arguments are like for @code{TARGET_HANDLE_OPTION}. Thedefault definition does nothing but return false.In general, you should use @code{TARGET_HANDLE_OPTION} to handleoptions. However, if processing an option requires routines that areonly available in the C (and related language) front ends, then youshould use @code{TARGET_HANDLE_C_OPTION} instead.@end deftypefn@hook TARGET_OBJC_CONSTRUCT_STRING_OBJECT@hook TARGET_STRING_OBJECT_REF_TYPE_P@hook TARGET_CHECK_STRING_OBJECT_FORMAT_ARG@hook TARGET_OVERRIDE_OPTIONS_AFTER_CHANGEThis target function is similar to the hook @code{TARGET_OPTION_OVERRIDE}but is called when the optimize level is changed via an attribute orpragma or when it is reset at the end of the code affected by theattribute or pragma. It is not called at the beginning of compilationwhen @code{TARGET_OPTION_OVERRIDE} is called so if you want to perform theseactions then, you should have @code{TARGET_OPTION_OVERRIDE} call@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}.@end deftypefn@defmac C_COMMON_OVERRIDE_OPTIONSThis is similar to the @code{TARGET_OPTION_OVERRIDE} hookbut is only used in the Clanguage frontends (C, Objective-C, C++, Objective-C++) and so can beused to alter option flag variables which only exist in thosefrontends.@end defmac@hook TARGET_OPTION_OPTIMIZATION_TABLESome machines may desire to change what optimizations are performed forvarious optimization levels. This variable, if defined, describesoptions to enable at particular sets of optimization levels. Theseoptions are processed oncejust after the optimization level is determined and before the remainderof the command options have been parsed, so may be overridden by otheroptions passed explicitly.This processing is run once at program startup and when the optimizationoptions are changed via @code{#pragma GCC optimize} or by using the@code{optimize} attribute.@end deftypevr@hook TARGET_OPTION_INIT_STRUCT@hook TARGET_OPTION_DEFAULT_PARAMS@defmac SWITCHABLE_TARGETSome targets need to switch between substantially different subtargetsduring compilation. For example, the MIPS target has one subtarget forthe traditional MIPS architecture and another for MIPS16. Source codecan switch between these two subarchitectures using the @code{mips16}and @code{nomips16} attributes.Such subtargets can differ in things like the set of availableregisters, the set of available instructions, the costs of variousoperations, and so on. GCC caches a lot of this type of informationin global variables, and recomputing them for each subtarget takes asignificant amount of time. The compiler therefore provides a facilityfor maintaining several versions of the global variables and quicklyswitching between them; see @file{target-globals.h} for details.Define this macro to 1 if your target needs this facility. The defaultis 0.@end defmac@node Per-Function Data@section Defining data structures for per-function information.@cindex per-function data@cindex data structuresIf the target needs to store information on a per-function basis, GCCprovides a macro and a couple of variables to allow this. Note, justusing statics to store the information is a bad idea, since GCC supportsnested functions, so you can be halfway through encoding one functionwhen another one comes along.GCC defines a data structure called @code{struct function} whichcontains all of the data specific to an individual function. Thisstructure contains a field called @code{machine} whose type is@code{struct machine_function *}, which can be used by targets to pointto 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 anRTX to hold the register containing the function's return address. ThisRTX 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 holdall of the per-function information. Thus when processing of a nestedfunction began the old per-function data had to be pushed onto astack, and when the processing was finished, it had to be popped off thestack. GCC used to provide function pointers called@code{save_machine_status} and @code{restore_machine_status} to handlethe saving and restoring of the target specific information. Since thesingle data area approach is no longer used, these pointers are nolonger supported.@defmac INIT_EXPANDERSMacro called to initialize any target specific information. This macrois called once per function, before generation of any RTL has begun.The intention of this macro is to allow the initialization of thefunction pointer @code{init_machine_status}.@end defmac@deftypevar {void (*)(struct function *)} init_machine_statusIf this function pointer is non-@code{NULL} it will be called once perfunction, before function compilation starts, in order to allow thetarget to perform any target specific initialization of the@code{struct function} structure. It is intended that this would beused 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 usingGC allocation, including the structure itself.@end deftypevar@node Storage Layout@section Storage Layout@cindex storage layoutNote that the definitions of the macros in this table which are sizes oralignments measured in bits do not need to be constant. They can be Cexpressions that refer to static variables, such as the @code{target_flags}.@xref{Run-time Target}.@defmac BITS_BIG_ENDIANDefine this macro to have the value 1 if the most significant bit in abyte has the lowest number; otherwise define it to have the value zero.This means that bit-field instructions count from the most significantbit. If the machine has no bit-field instructions, then this must stillbe defined, but it doesn't matter which value it is defined to. Thismacro need not be a constant.This macro does not affect the way structure fields are packed intobytes or words; that is controlled by @code{BYTES_BIG_ENDIAN}.@end defmac@defmac BYTES_BIG_ENDIANDefine this macro to have the value 1 if the most significant byte in aword has the lowest number. This macro need not be a constant.@end defmac@defmac WORDS_BIG_ENDIANDefine this macro to have the value 1 if, in a multiword object, themost significant word has the lowest number. This applies to bothmemory locations and registers; see @code{REG_WORDS_BIG_ENDIAN} if theorder of words in memory is not the same as the order in registers. Thismacro need not be a constant.@end defmac@defmac REG_WORDS_BIG_ENDIANOn some machines, the order of words in a multiword object differs betweenregisters in memory. In such a situation, define this macro to describethe order of words in a register. The macro @code{WORDS_BIG_ENDIAN} controlsthe order of words in memory.@end defmac@defmac FLOAT_WORDS_BIG_ENDIANDefine this macro to have the value 1 if @code{DFmode}, @code{XFmode} or@code{TFmode} floating point numbers are stored in memory with the wordcontaining the sign bit at the lowest address; otherwise define it tohave the value 0. This macro need not be a constant.You need not define this macro if the ordering is the same as formulti-word integers.@end defmac@defmac BITS_PER_UNITDefine this macro to be the number of bits in an addressable storageunit (byte). If you do not define this macro the default is 8.@end defmac@defmac BITS_PER_WORDNumber of bits in a word. If you do not define this macro, the defaultis @code{BITS_PER_UNIT * UNITS_PER_WORD}.@end defmac@defmac MAX_BITS_PER_WORDMaximum 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 thelargest value that @code{BITS_PER_WORD} can have at run-time.@end defmac@defmac UNITS_PER_WORDNumber of storage units in a word; normally the size of a general-purposeregister, a power of two from 1 or 8.@end defmac@defmac MIN_UNITS_PER_WORDMinimum 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 thesmallest value that @code{UNITS_PER_WORD} can have at run-time.@end defmac@defmac POINTER_SIZEWidth of a pointer, in bits. You must specify a value no wider than thewidth 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 specifya value the default is @code{BITS_PER_WORD}.@end defmac@defmac POINTERS_EXTEND_UNSIGNEDA C expression that determines how pointers should be extended from@code{ptr_mode} to either @code{Pmode} or @code{word_mode}. It isgreater than zero if pointers should be zero-extended, zero if theyshould be sign-extended, and negative if some other sort of conversionis 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 typeis @var{type} and which has the specified mode and signedness is to bestored in a register. This macro is only called when @var{type} is ascalar type.On most RISC machines, which only have operations that operate on a fullregister, 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 mostcases, only integer modes should be widened because wider-precisionfloating-point operations are usually more expensive than their narrowercounterparts.For most machines, the macro definition does not change @var{unsignedp}.However, some machines, have instructions that preferentially handleeither signed or unsigned quantities of certain modes. For example, onthe DEC Alpha, 32-bit loads from memory and 32-bit add instructionssign-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_PROMOTE_FUNCTION_MODELike @code{PROMOTE_MODE}, but it is applied to outgoing function arguments orfunction return values. The target hook should return the new modeand possibly change @code{*@var{punsignedp}} if the promotion shouldchange signedness. This function is called only for scalar @emph{orpointer} types.@var{for_return} allows to distinguish the promotion of arguments andreturn values. If it is @code{1}, a return value is being promoted and@code{TARGET_FUNCTION_VALUE} must perform the same promotions done here.If it is @code{2}, the returned mode should be that of the register inwhich an incoming parameter is copied, or the outgoing result is computed;then the hook should return the same mode as @code{promote_mode}, thoughthe signedness may be different.@var{type} can be NULL when promoting function arguments of libcalls.The default is to not promote arguments and return values. You canalso define the hook to @code{default_promote_function_mode_always_promote}if you would like to apply the same rules given by @code{PROMOTE_MODE}.@end deftypefn@defmac PARM_BOUNDARYNormal alignment required for function parameters on the stack, inbits. All stack parameters receive at least this much alignmentregardless of data type. On most machines, this is the same as thesize of an integer.@end defmac@defmac STACK_BOUNDARYDefine this macro to the minimum alignment enforced by hardware for thestack pointer on this machine. The definition is a C expression for thedesired alignment (measured in bits). This value is used as a defaultif @code{PREFERRED_STACK_BOUNDARY} is not defined. On most machines,this should be the same as @code{PARM_BOUNDARY}.@end defmac@defmac PREFERRED_STACK_BOUNDARYDefine this macro if you wish to preserve a certain alignment for thestack pointer, greater than what the hardware enforces. The definitionis a C expression for the desired alignment (measured in bits). Thismacro must evaluate to a value equal to or larger than@code{STACK_BOUNDARY}.@end defmac@defmac INCOMING_STACK_BOUNDARYDefine this macro if the incoming stack boundary may be differentfrom @code{PREFERRED_STACK_BOUNDARY}. This macro must evaluateto a value equal to or larger than @code{STACK_BOUNDARY}.@end defmac@defmac FUNCTION_BOUNDARYAlignment required for a function entry point, in bits.@end defmac@defmac BIGGEST_ALIGNMENTBiggest alignment that any data type can require on this machine, inbits. Note that this is not the biggest alignment that is supported,just the biggest alignment that, when violated, may cause a fault.@end defmac@defmac MALLOC_ABI_ALIGNMENTAlignment, in bits, a C conformant malloc implementation has toprovide. If not defined, the default value is @code{BITS_PER_WORD}.@end defmac@defmac ATTRIBUTE_ALIGNED_VALUEAlignment used by the @code{__attribute__ ((aligned))} construct. Ifnot defined, the default value is @code{BIGGEST_ALIGNMENT}.@end defmac@defmac MINIMUM_ATOMIC_ALIGNMENTIf defined, the smallest alignment, in bits, that can be given to anobject that can be referenced in one operation, without disturbing anynearby object. Normally, this is @code{BITS_PER_UNIT}, but may be largeron machines that don't have byte or half-word store operations.@end defmac@defmac BIGGEST_FIELD_ALIGNMENTBiggest alignment that any structure or union field can require on thismachine, in bits. If defined, this overrides @code{BIGGEST_ALIGNMENT} forstructure and union fields only, unless the field alignment has been setby the @code{__attribute__ ((aligned (@var{n})))} construct.@end defmac@defmac ADJUST_FIELD_ALIGN (@var{field}, @var{computed})An expression for the alignment of a structure field @var{field} if thealignment computed in the usual way (including applying of@code{BIGGEST_ALIGNMENT} and @code{BIGGEST_FIELD_ALIGNMENT} to thealignment) is @var{computed}. It overrides alignment only if thefield alignment has not been set by the@code{__attribute__ ((aligned (@var{n})))} construct.@end defmac@defmac MAX_STACK_ALIGNMENTBiggest stack alignment guaranteed by the backend. Use this macroto 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_ALIGNMENTBiggest 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. If not defined,the default value is @code{BIGGEST_ALIGNMENT}.On systems that use ELF, the default (in @file{config/elfos.h}) isthe largest supported 32-bit ELF section alignment representable ona 32-bit host e.g. @samp{(((unsigned HOST_WIDEST_INT) 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@defmac DATA_ALIGNMENT (@var{type}, @var{basic-align})If defined, a C expression to compute the alignment for a variable inthe static store. @var{type} is the data type, and @var{basic-align} isthe alignment that the object would ordinarily have. The value of thismacro is used instead of that alignment to align the object.If this macro is not defined, then @var{basic-align} is used.@findex strcpyOne use of this macro is to increase alignment of medium-size data tomake it all fit in fewer cache lines. Another is to cause characterarrays to be word-aligned so that @code{strcpy} calls that copyconstants to character arrays can be done inline.@end defmac@defmac CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})If defined, a C expression to compute the alignment given to a constantthat is being placed in memory. @var{constant} is the constant and@var{basic-align} is the alignment that the object would ordinarilyhave. The value of this macro is used instead of that alignment toalign the object.If this macro is not defined, then @var{basic-align} is used.The typical use of this macro is to increase alignment for stringconstants to be word aligned so that @code{strcpy} calls that copyconstants can be done inline.@end defmac@defmac LOCAL_ALIGNMENT (@var{type}, @var{basic-align})If defined, a C expression to compute the alignment for a variable inthe local store. @var{type} is the data type, and @var{basic-align} isthe alignment that the object would ordinarily have. The value of thismacro 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 tomake 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 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 ordinarilyhave. The value of this macro is used instead of that alignment toalign the slot.If this macro is not defined, then @var{basic-align} is used when@var{type} is @code{NULL}. Otherwise, @code{LOCAL_ALIGNMENT} willbe used.This macro is to set alignment of stack slot to the maximum alignmentof 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 localvariable @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 tomake 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 alignmentfor 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_BOUNDARYAlignment in bits to be given to a structure bit-field that follows anempty field such as @code{int : 0;}.If @code{PCC_BITFIELD_TYPE_MATTERS} is true, it overrides this macro.@end defmac@defmac STRUCTURE_SIZE_BOUNDARYNumber 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_ALIGNMENTDefine this macro to be the value 1 if instructions will fail to workif given data not on the nominal alignment. If instructions will merelygo slower in that case, define this macro as 0.@end defmac@defmac PCC_BITFIELD_TYPE_MATTERSDefine this if you wish to imitate the way many other C compilers handlealignment 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 entirestructure, as if the structure really did contain an ordinary field ofthat type. In addition, the bit-field is placed within the structure sothat 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 forcefour-byte alignment for the whole structure. (The alignment used maynot be four bytes; it is controlled by the other alignment parameters.)An unnamed bit-field will not affect the alignment of the containingstructure.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, somebit-fields may cross more than one alignment boundary. The compiler cansupport 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 outbit-fields as are used by another compiler, here is how to investigatewhat the other compiler does. Compile and run this program:@smallexamplestruct 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 smallexampleIf this prints 2 and 5, then the compiler's behavior is what you wouldget from @code{PCC_BITFIELD_TYPE_MATTERS}.@end defmac@defmac BITFIELD_NBYTES_LIMITEDLike @code{PCC_BITFIELD_TYPE_MATTERS} except that its effect is limitedto aligning a bit-field within the structure.@end defmac@hook TARGET_ALIGN_ANON_BITFIELDWhen @code{PCC_BITFIELD_TYPE_MATTERS} is true this hook will determinewhether unnamed bitfields affect the alignment of the containingstructure. The hook should return true if the structure should inheritthe alignment requirements of an unnamed bitfield's type.@end deftypefn@hook TARGET_NARROW_VOLATILE_BITFIELDThis target hook should return @code{true} if accesses to volatile bitfieldsshould use the narrowest mode possible. It should return @code{false} ifthese accesses should use the bitfield container type.The default is @code{!TARGET_STRICT_ALIGN}.@end deftypefn@defmac MEMBER_TYPE_FORCES_BLK (@var{field}, @var{mode})Return 1 if a structure or array containing @var{field} should be accessed using@code{BLKMODE}.If @var{field} is the only field in the structure, @var{mode} is itsmode, otherwise @var{mode} is VOIDmode. @var{mode} is provided in thecase where structures of one field would require the structure's mode toretain the field's mode.Normally, this is not needed.@end defmac@defmac ROUND_TYPE_ALIGN (@var{type}, @var{computed}, @var{specified})Define this macro as an expression for the alignment of a type (givenby @var{type} as a tree node) if the alignment computed in the usualway is @var{computed} and the alignment explicitly specified was@var{specified}.The default is to use @var{specified} if it is larger; otherwise, usethe smaller of @var{computed} and @code{BIGGEST_ALIGNMENT}@end defmac@defmac MAX_FIXED_MODE_SIZEAn integer expression for the size in bits of the largest integermachine mode that should actually be used. All integer machine modes ofthis size or smaller can be used for structures and unions with theappropriate 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{enum machine_mode} thatspecifies 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 ishaving its mode specified.You need not define this macro if it always returns @code{Pmode}. Youwould most commonly define this macro if the@code{save_stack_@var{level}} patterns need to support both a 32- and a64-bit mode.@end defmac@defmac STACK_SIZE_MODEIf defined, an expression of type @code{enum machine_mode} thatspecifies 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_MODEThis target hook should return the mode to be used for the return valueof compare instructions expanded to libgcc calls. If not defined@code{word_mode} is returned which is the right choice for a majority oftargets.@end deftypefn@hook TARGET_LIBGCC_SHIFT_COUNT_MODEThis target hook should return the mode to be used for the shift count operandof shift instructions expanded to libgcc calls. If not defined@code{word_mode} is returned which is the right choice for a majority oftargets.@end deftypefn@hook TARGET_UNWIND_WORD_MODEReturn machine mode to be used for @code{_Unwind_Word} type.The default is to use @code{word_mode}.@end deftypefn@defmac ROUND_TOWARDS_ZEROIf defined, this macro should be true if the prevailing roundingmode is towards zero.Defining this macro only affects the way @file{libgcc.a} emulatesfloating-point arithmetic.Not defining this macro is equivalent to returning zero.@end defmac@defmac LARGEST_EXPONENT_IS_NORMAL (@var{size})This macro should return true if floats with @var{size}bits do not have a NaN or infinity representation, but use the largestexponent for normal numbers instead.Defining this macro only affects the way @file{libgcc.a} emulatesfloating-point arithmetic.The default definition of this macro returns false for all sizes.@end defmac@hook TARGET_MS_BITFIELD_LAYOUT_PThis target hook returns @code{true} if bit-fields in the given@var{record_type} are to be laid out following the rules of MicrosoftVisual C/C++, namely: (i) a bit-field won't share the same storageunit with the previous bit-field if their underlying types havedifferent sizes, and the bit-field will be aligned to the highestalignment of the underlying types of itself and of the previousbit-field; (ii) a zero-sized bit-field will affect the alignment ofthe whole enclosing structure, even if it is unnamed; except that(iii) a zero-sized bit-field will be disregarded unless it followsanother bit-field of nonzero size. If this hook returns @code{true},other macros that control bit-field layout are ignored.When a bit-field is inserted into a packed record, the whole sizeof the underlying type is used by one or more same-size adjacentbit-fields (that is, if its long:3, 32 bits is used in the record,and any additional adjacent long bit-fields are packed into the samechunk of 32 bits. However, if the size changes, a new field of thatsize is allocated). In an unpacked record, this is the same as usingalignment, but not equivalent when packing.If both MS bit-fields and @samp{__attribute__((packed))} are used,the latter will take precedence. If @samp{__attribute__((packed))} isused on a single field when MS bit-fields are in use, it will takeprecedence for that field, but the alignment of the rest of the structuremay affect its placement.@end deftypefn@hook TARGET_DECIMAL_FLOAT_SUPPORTED_PReturns true if the target supports decimal floating point.@end deftypefn@hook TARGET_FIXED_POINT_SUPPORTED_PReturns true if the target supports fixed-point arithmetic.@end deftypefn@hook TARGET_EXPAND_TO_RTL_HOOKThis hook is called just before expansion into rtl, allowing the targetto perform additional initializations or analysis before the expansion.For example, the rs6000 port uses it to allocate a scratch stack slotfor use in copying SDmode values between memory and floating pointregisters whenever the function being expanded has any SDmodeusage.@end deftypefn@hook TARGET_INSTANTIATE_DECLSThis hook allows the backend to perform additional instantiations on rtlthat are not actually in any insns yet, but will be later.@end deftypefn@hook TARGET_MANGLE_TYPEIf your target defines any fundamental types, or any types your targetuses should be mangled differently from the default, define this hookto return the appropriate encoding for these types as part of a C++mangled name. The @var{type} argument is the tree structure representingthe type to be mangled. The hook may be applied to trees which arenot target-specific fundamental types; it should return @code{NULL}for all such types, as well as arguments it does not recognize. If thereturn value is not @code{NULL}, it must point to a statically-allocatedstring constant.Target-specific fundamental types might be new fundamental types orqualified versions of ordinary fundamental types. Encode newfundamental types as @samp{@w{u @var{n} @var{name}}}, where @var{name}is the name used for the type in source code, and @var{n} is thelength of @var{name} in decimal. Encode qualified versions ofordinary types as @samp{@w{U @var{n} @var{name} @var{code}}}, where@var{name} is the name used for the type qualifier in source code,@var{n} is the length of @var{name} as above, and @var{code} is thecode used to represent the unqualified version of this type. (See@code{write_builtin_type} in @file{cp/mangle.c} for the list ofcodes.) In both cases the spaces are for clarity; do not include anyspaces in your string.This hook is applied to types prior to typedef resolution. If the mangledname for a particular type depends only on that type's main variant, youcan perform typedef resolution yourself using @code{TYPE_MAIN_VARIANT}before mangling.The default version of this hook always returns @code{NULL}, which isappropriate for a target that does not define any new fundamentaltypes.@end deftypefn@node Type Layout@section Layout of Source Language Data TypesThese macros define the sizes and other characteristics of the standardbasic data types used in programs being compiled. Unlike the macros inthe previous section, these apply to specific features of C and relatedlanguages, rather than to fundamental aspects of storage layout.@defmac INT_TYPE_SIZEA C expression for the size in bits of the type @code{int} on thetarget machine. If you don't define this, the default is one word.@end defmac@defmac SHORT_TYPE_SIZEA C expression for the size in bits of the type @code{short} on thetarget 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 oneunit.)@end defmac@defmac LONG_TYPE_SIZEA C expression for the size in bits of the type @code{long} on thetarget machine. If you don't define this, the default is one word.@end defmac@defmac ADA_LONG_TYPE_SIZEOn 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@. Inthat situation, define this macro to be a C expression to be used forthe size of that type. If you don't define this, the default is thevalue of @code{LONG_TYPE_SIZE}.@end defmac@defmac LONG_LONG_TYPE_SIZEA C expression for the size in bits of the type @code{long long} on thetarget machine. If you don't define this, the default is twowords. If you want to support GNU Ada on your machine, the value of thismacro must be at least 64.@end defmac@defmac CHAR_TYPE_SIZEA C expression for the size in bits of the type @code{char} on thetarget machine. If you don't define this, the default is@code{BITS_PER_UNIT}.@end defmac@defmac BOOL_TYPE_SIZEA C expression for the size in bits of the C++ type @code{bool} andC99 type @code{_Bool} on the target machine. If you don't definethis, and you probably shouldn't, the default is @code{CHAR_TYPE_SIZE}.@end defmac@defmac FLOAT_TYPE_SIZEA C expression for the size in bits of the type @code{float} on thetarget machine. If you don't define this, the default is one word.@end defmac@defmac DOUBLE_TYPE_SIZEA C expression for the size in bits of the type @code{double} on thetarget machine. If you don't define this, the default is twowords.@end defmac@defmac LONG_DOUBLE_TYPE_SIZEA C expression for the size in bits of the type @code{long double} onthe target machine. If you don't define this, the default is twowords.@end defmac@defmac SHORT_FRACT_TYPE_SIZEA C expression for the size in bits of the type @code{short _Fract} onthe target machine. If you don't define this, the default is@code{BITS_PER_UNIT}.@end defmac@defmac FRACT_TYPE_SIZEA C expression for the size in bits of the type @code{_Fract} onthe target machine. If you don't define this, the default is@code{BITS_PER_UNIT * 2}.@end defmac@defmac LONG_FRACT_TYPE_SIZEA C expression for the size in bits of the type @code{long _Fract} onthe target machine. If you don't define this, the default is@code{BITS_PER_UNIT * 4}.@end defmac@defmac LONG_LONG_FRACT_TYPE_SIZEA C expression for the size in bits of the type @code{long long _Fract} onthe target machine. If you don't define this, the default is@code{BITS_PER_UNIT * 8}.@end defmac@defmac SHORT_ACCUM_TYPE_SIZEA C expression for the size in bits of the type @code{short _Accum} onthe target machine. If you don't define this, the default is@code{BITS_PER_UNIT * 2}.@end defmac@defmac ACCUM_TYPE_SIZEA C expression for the size in bits of the type @code{_Accum} onthe target machine. If you don't define this, the default is@code{BITS_PER_UNIT * 4}.@end defmac@defmac LONG_ACCUM_TYPE_SIZEA C expression for the size in bits of the type @code{long _Accum} onthe target machine. If you don't define this, the default is@code{BITS_PER_UNIT * 8}.@end defmac@defmac LONG_LONG_ACCUM_TYPE_SIZEA C expression for the size in bits of the type @code{long long _Accum} onthe target machine. If you don't define this, the default is@code{BITS_PER_UNIT * 16}.@end defmac@defmac LIBGCC2_LONG_DOUBLE_TYPE_SIZEDefine this macro if @code{LONG_DOUBLE_TYPE_SIZE} is not constant orif you want routines in @file{libgcc2.a} for a size other than@code{LONG_DOUBLE_TYPE_SIZE}. If you don't define this, thedefault is @code{LONG_DOUBLE_TYPE_SIZE}.@end defmac@defmac LIBGCC2_HAS_DF_MODEDefine this macro if neither @code{DOUBLE_TYPE_SIZE} nor@code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is@code{DFmode} but you want @code{DFmode} routines in @file{libgcc2.a}anyway. If you don't define this and either @code{DOUBLE_TYPE_SIZE}or @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64 then the default is 1,otherwise it is 0.@end defmac@defmac LIBGCC2_HAS_XF_MODEDefine this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not@code{XFmode} but you want @code{XFmode} routines in @file{libgcc2.a}anyway. If you don't define this and @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE}is 80 then the default is 1, otherwise it is 0.@end defmac@defmac LIBGCC2_HAS_TF_MODEDefine this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not@code{TFmode} but you want @code{TFmode} routines in @file{libgcc2.a}anyway. If you don't define this and @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE}is 128 then the default is 1, otherwise it is 0.@end defmac@defmac LIBGCC2_GNU_PREFIXThis macro corresponds to the @code{TARGET_LIBFUNC_GNU_PREFIX} targethook and should be defined if that hook is overriden to be true. Itcauses function names in libgcc to be changed to use a @code{__gnu_}prefix for their name rather than the default @code{__}. A port whichuses this macro should also arrange to use @file{t-gnu-prefix} inthe libgcc @file{config.host}.@end defmac@defmac SF_SIZE@defmacx DF_SIZE@defmacx XF_SIZE@defmacx TF_SIZEDefine these macros to be the size in bits of the mantissa of@code{SFmode}, @code{DFmode}, @code{XFmode} and @code{TFmode} values,if the defaults in @file{libgcc2.h} are inappropriate. By default,@code{FLT_MANT_DIG} is used for @code{SF_SIZE}, @code{LDBL_MANT_DIG}for @code{XF_SIZE} and @code{TF_SIZE}, and @code{DBL_MANT_DIG} or@code{LDBL_MANT_DIG} for @code{DF_SIZE} according to whether@code{DOUBLE_TYPE_SIZE} or@code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64.@end defmac@defmac TARGET_FLT_EVAL_METHODA C expression for the value for @code{FLT_EVAL_METHOD} in @file{float.h},assuming, if applicable, that the floating-point control word is in itsdefault state. If you do not define this macro the value of@code{FLT_EVAL_METHOD} will be zero.@end defmac@defmac WIDEST_HARDWARE_FP_SIZEA C expression for the size in bits of the widest floating-point formatsupported by the hardware. If you define this macro, you must specify avalue 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_CHARAn expression whose value is 1 or 0, according to whether the type@code{char} should be signed or unsigned by default. The user canalways override this default with the options @option{-fsigned-char}and @option{-funsigned-char}.@end defmac@hook TARGET_DEFAULT_SHORT_ENUMSThis target hook should return true if the compiler should give an@code{enum} type only as many bytes as it takes to represent the rangeof possible values of that type. It should return false if all@code{enum} types should be allocated like @code{int}.The default is to return false.@end deftypefn@defmac SIZE_TYPEA C expression for a string describing the name of the data type to usefor size values. The typedef name @code{size_t} is defined using thecontents of the string.The string can contain more than one keyword. If so, separate them withspaces, and write first any length keyword, then @code{unsigned} ifappropriate, and finally @code{int}. The string must exactly match oneof the data type names defined in the function@code{init_decl_processing} in the file @file{c-decl.c}. You may notomit @code{int} or change the order---that would cause the compiler tocrash on startup.If you don't define this macro, the default is @code{"long unsignedint"}.@end defmac@defmac PTRDIFF_TYPEA C expression for a string describing the name of the data type to usefor 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_TYPEA C expression for a string describing the name of the data type to usefor wide characters. The typedef name @code{wchar_t} is defined usingthe contents of the string. See @code{SIZE_TYPE} above for moreinformation.If you don't define this macro, the default is @code{"int"}.@end defmac@defmac WCHAR_TYPE_SIZEA C expression for the size in bits of the data type for widecharacters. This is used in @code{cpp}, which cannot make use of@code{WCHAR_TYPE}.@end defmac@defmac WINT_TYPEA C expression for a string describing the name of the data type touse for wide characters passed to @code{printf} and returned from@code{getwc}. The typedef name @code{wint_t} is defined using thecontents of the string. See @code{SIZE_TYPE} above for moreinformation.If you don't define this macro, the default is @code{"unsigned int"}.@end defmac@defmac INTMAX_TYPEA C expression for a string describing the name of the data type thatcan represent any value of any standard or extended signed integer type.The typedef name @code{intmax_t} is defined using the contents of thestring. 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 asmuch precision as @code{long long int}.@end defmac@defmac UINTMAX_TYPEA C expression for a string describing the name of the data type thatcan represent any value of any standard or extended unsigned integertype. The typedef name @code{uintmax_t} is defined using the contentsof 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 longunsigned int"} that has as much precision as @code{long long unsignedint}.@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_TYPEC 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 correspondingtype is not supported; if GCC is configured to provide@code{<stdint.h>} in such a case, the header provided may not conformto C99, depending on the type in question. The defaults for all ofthese macros are null pointers.@end defmac@defmac TARGET_PTRMEMFUNC_VBIT_LOCATIONThe C++ compiler represents a pointer-to-member-function with a structthat looks like:@smallexamplestruct @{union @{void (*fn)();ptrdiff_t vtable_index;@};ptrdiff_t delta;@};@end smallexample@noindentThe C++ compiler must use one bit to indicate whether the function thatwill be called through a pointer-to-member-function is virtual.Normally, we assume that the low-order bit of a function pointer mustalways be zero. Then, by ensuring that the vtable_index is odd, we candistinguish which variant of the union is in use. But, on someplatforms function pointers can be odd, and so this doesn't work. Inthat case, we use the low-order bit of the @code{delta} field, and shiftthe remainder of the @code{delta} field to the left.GCC will automatically make the right selection about where to storethis 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 lowestbit of pointers to functions indicate whether the function at thataddress is in ARM or Thumb mode. If this is the case of yourarchitecture, you should define this macro to@code{ptrmemfunc_vbit_in_delta}.In general, you should not have to define this macro. On architecturesin 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_DESCRIPTORSNormally, the C++ compiler uses function pointers in vtables. Thismacro allows the target to change to use ``function descriptors''instead. Function descriptors are found on targets for whom afunction pointer is actually a small data structure. Normally thedata structure consists of the actual code address plus a datapointer to which the function's data is relative.If vtables are used, the value of this macro should be the numberof words that the function descriptor occupies.@end defmac@defmac TARGET_VTABLE_ENTRY_ALIGNBy default, the vtable entries are void pointers, the so the alignmentis the same as pointer alignment. The value of this macro specifiesthe alignment of the vtable entry in bits. It should be defined onlywhen special alignment is necessary. */@end defmac@defmac TARGET_VTABLE_DATA_ENTRY_DISTANCEThere are a few non-descriptor entries in the vtable at offsets belowzero. If these entries must be padded (say, to preserve the alignmentspecified by @code{TARGET_VTABLE_ENTRY_ALIGN}), set this to the numberof words in each data entry.@end defmac@node Registers@section Register Usage@cindex register usageThis section explains how to describe what registers the target machinehas, and how (in general) they can be used.The description of which registers a specific instruction can use isdone with register classes; see @ref{Register Classes}. For informationon 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 lineRegisters have various characteristics.@defmac FIRST_PSEUDO_REGISTERNumber of hardware registers known to the compiler. They receivenumbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the firstpseudo register's number really is assigned the number@code{FIRST_PSEUDO_REGISTER}.@end defmac@defmac FIXED_REGISTERS@cindex fixed registerAn initializer that says which registers are used for fixed purposesall throughout the compiled code and are therefore not available forgeneral allocation. These would include the stack pointer, the framepointer (except on machines where that can be used as a generalregister when no frame pointer is needed), the program counter onmachines 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 bycommas and surrounded by braces. The @var{n}th number is 1 ifregister @var{n} is fixed, 0 otherwise.The table initialized from this macro, and the table initialized bythe following one, may be overridden at run time either automatically,by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or bythe 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 registerLike @code{FIXED_REGISTERS} but has 1 for each register that isclobbered (in general) by function calls as well as for fixedregisters. This macro therefore identifies the registers that are notavailable for general allocation of values that must live acrossfunction calls.If a register has 0 in @code{CALL_USED_REGISTERS}, the compilerautomatically saves it on function entry and restores it on functionexit, if the register is used within the function.@end defmac@defmac CALL_REALLY_USED_REGISTERS@cindex call-used register@cindex call-clobbered register@cindex call-saved registerLike @code{CALL_USED_REGISTERS} except this macro doesn't requirethat the entire set of @code{FIXED_REGISTERS} be included.(@code{CALL_USED_REGISTERS} must be a superset of @code{FIXED_REGISTERS}).This macro is optional. If not specified, it defaults to the valueof @code{CALL_USED_REGISTERS}.@end defmac@defmac HARD_REGNO_CALL_PART_CLOBBERED (@var{regno}, @var{mode})@cindex call-used register@cindex call-clobbered register@cindex call-saved registerA C expression that is nonzero if it is not permissible to store avalue of mode @var{mode} in hard register number @var{regno} across acall without some part of it being clobbered. For most machines thismacro need not be defined. It is only required for machines that do notpreserve the entire contents of a register across a call.@end defmac@findex fixed_regs@findex call_used_regs@findex global_regs@findex reg_names@findex reg_class_contents@hook TARGET_CONDITIONAL_REGISTER_USAGEThis hook may conditionally modify five variables@code{fixed_regs}, @code{call_used_regs}, @code{global_regs},@code{reg_names}, and @code{reg_class_contents}, to take into accountany dependence of these register sets on target flags. The first threeof these are of type @code{char []} (interpreted as Boolean vectors).@code{global_regs} is a @code{const char *[]}, and@code{reg_class_contents} is a @code{HARD_REG_SET}. Before the macro iscalled, @code{fixed_regs}, @code{call_used_regs},@code{reg_class_contents}, and @code{reg_names} have been initializedfrom @code{FIXED_REGISTERS}, @code{CALL_USED_REGISTERS},@code{REG_CLASS_CONTENTS}, and @code{REGISTER_NAMES}, respectively.@code{global_regs} has been cleared, and any @option{-ffixed-@var{reg}},@option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}}command options have been applied.@cindex disabling certain registers@cindex controlling register usageIf the usage of an entire class of registers depends on the targetflags, you may indicate this to GCC by using this macro to modify@code{fixed_regs} and @code{call_used_regs} to 1 for each of theregisters in the classes which should not be used by GCC@. Also definethe macro @code{REG_CLASS_FROM_LETTER} / @code{REG_CLASS_FROM_CONSTRAINT}to return @code{NO_REGS} if itis called with a letter for a class that shouldn't be used.(However, if this class is not included in @code{GENERAL_REGS} and allof the insn patterns whose constraints permit this class arecontrolled by target switches, then GCC will automatically avoid usingthese registers when the target switches are opposed to them.)@end deftypefn@defmac INCOMING_REGNO (@var{out})Define this macro if the target machine has register windows. This Cexpression returns the register number as seen by the called functioncorresponding to the register number @var{out} as seen by the callingfunction. Return @var{out} if register number @var{out} is not anoutbound register.@end defmac@defmac OUTGOING_REGNO (@var{in})Define this macro if the target machine has register windows. This Cexpression returns the register number as seen by the calling functioncorresponding to the register number @var{in} as seen by the calledfunction. Return @var{in} if register number @var{in} is not an inboundregister.@end defmac@defmac LOCAL_REGNO (@var{regno})Define this macro if the target machine has register windows. This Cexpression returns true if the register is call-saved but is in theregister window. Unlike most call-saved registers, such registersneed not be explicitly restored on function exit or during non-localgotos.@end defmac@defmac PC_REGNUMIf the program counter has a register number, define this as thatregister 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 lineRegisters are allocated in order.@defmac REG_ALLOC_ORDERIf defined, an initializer for a vector of integers, containing thenumbers of hard registers in the order in which GCC should preferto 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 numberedregisters must always be saved and the save-multiple-registersinstruction supports only sequences of consecutive registers. On suchmachines, define @code{REG_ALLOC_ORDER} to be an initializer that liststhe highest numbered allocable register first.@end defmac@defmac ADJUST_REG_ALLOC_ORDERA C statement (sans semicolon) to choose the order in which to allocatehard 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 nextregister; 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_ORDERNormally, IRA tries to estimate the costs for saving a register in theprologue and restoring it in the epilogue. This discourages it fromusing call-saved registers. If a machine wants to ensure that IRAallocates registers in the order given by REG_ALLOC_ORDER even if somecall-saved registers appear earlier than call-used ones, this macroshould be defined.@end defmac@defmac IRA_HARD_REGNO_ADD_COST_MULTIPLIER (@var{regno})In some case register allocation order is not enough for theIntegrated Register Allocator (@acronym{IRA}) to generate a good code.If this macro is defined, it should return a floating point valuebased on @var{regno}. The cost of using @var{regno} for a pseudo willbe increased by approximately the pseudo's usage frequency times thevalue returned by this macro. Not defining this macro is equivalentto 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 RegistersThis section discusses the macros that describe which kinds of values(specifically, which machine modes) each register can hold, and how manyconsecutive registers are needed for a given mode.@defmac HARD_REGNO_NREGS (@var{regno}, @var{mode})A C expression for the number of consecutive hard registers, startingat register number @var{regno}, required to hold a value of mode@var{mode}. This macro must never return zero, even if a registercannot hold the requested mode - indicate that with HARD_REGNO_MODE_OKand/or CANNOT_CHANGE_MODE_CLASS instead.On a machine where all registers are exactly one word, a suitabledefinition of this macro is@smallexample#define HARD_REGNO_NREGS(REGNO, MODE) \((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \/ UNITS_PER_WORD)@end smallexample@end defmac@defmac HARD_REGNO_NREGS_HAS_PADDING (@var{regno}, @var{mode})A C expression that is nonzero if a value of mode @var{mode}, storedin memory, ends with padding that causes it to take up more space thanin registers starting at register number @var{regno} (as determined bymultiplying GCC's notion of the size of the register when containingthis mode by the number of registers returned by@code{HARD_REGNO_NREGS}). By default this is zero.For example, if a floating-point value is stored in three 32-bitregisters but takes up 128 bits in memory, then this would benonzero.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 berepresented by an offset to the register number, when in fact such a@code{subreg} would contain some of the padding not stored inregisters 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 expressionreturning the greater number of registers required to hold the valueincluding 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 valuesof mode @var{mode} is not the word size. It is a C expression thatshould give the natural size in bytes for the specified mode. It isused by the register allocator to try to optimize its results. Thishappens for example on SPARC 64-bit where the natural size offloating-point registers is still 32-bit.@end defmac@defmac HARD_REGNO_MODE_OK (@var{regno}, @var{mode})A C expression that is nonzero if it is permissible to store a valueof mode @var{mode} in hard register number @var{regno} (or in severalregisters starting with that one). For a machine where all registersare equivalent, a suitable definition is@smallexample#define HARD_REGNO_MODE_OK(REGNO, MODE) 1@end smallexampleYou need not include code to check for the numbers of fixed registers,because the allocation mechanism considers them to be always occupied.@cindex register pairsOn some machines, double-precision values must be kept in even/oddregister pairs. You can implement that by defining this macro to rejectodd register numbers for such modes.The minimum requirement for a mode to be OK in a register is that the@samp{mov@var{mode}} instruction pattern support moves between theregister and other hard register in the same class and that moving avalue into the register and back out not alter it.Since the same instruction used to move @code{word_mode} will work forall narrower integer modes, it is not necessary on any machine for@code{HARD_REGNO_MODE_OK} to distinguish between these modes, providedyou define patterns @samp{movhi}, etc., to take advantage of this. Thisis useful because of the interaction between @code{HARD_REGNO_MODE_OK}and @code{MODES_TIEABLE_P}; it is very desirable for all integer modesto be tieable.Many machines have special registers for floating point arithmetic.Often people assume that floating point machine modes are allowed onlyin floating point registers. This is not true. Any registers thatcan hold integers can safely @emph{hold} a floating point machinemode, whether or not floating arithmetic can be done on it in thoseregisters. Integer move instructions can be used to move the values.On some machines, though, the converse is true: fixed-point machinemodes may not go in floating registers. This is true if the floatingregisters normalize any value stored in them, because storing anon-floating value there would garble it. In this case,@code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes infloating registers. But if the floating registers do not automaticallynormalize, if you can store any bit pattern in one and retrieve itunchanged without a trap, then any machine mode may go in a floatingregister, so you can define this macro to say so.The primary significance of special floating registers is rather thatthey are the registers acceptable in floating point arithmeticinstructions. However, this is of no concern to@code{HARD_REGNO_MODE_OK}. You handle it by writing the properconstraints for those instructions.On some machines, the floating registers are especially slow to access,so that it is better to store a value in a stack frame than in such aregister if floating point arithmetic is not being done. As long as thefloating registers are not in class @code{GENERAL_REGS}, they will notbe used unless some pattern's constraint asks for one.@end defmac@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 toanother register that is not saved by a prologue in an interrupthandler.The default is always nonzero.@end defmac@defmac MODES_TIEABLE_P (@var{mode1}, @var{mode2})A C expression that is nonzero if a value of mode@var{mode1} is accessible in mode @var{mode2} without copying.If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and@code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are always the same forany @var{r}, then @code{MODES_TIEABLE_P (@var{mode1}, @var{mode2})}should be nonzero. If they differ for any @var{r}, you should definethis macro to return zero unless some other mechanism ensures theaccessibility of the value in a narrower mode.You should define this macro to return nonzero in as many cases aspossible since doing so will allow GCC to perform better registerallocation.@end defmac@hook TARGET_HARD_REGNO_SCRATCH_OKThis target hook should return @code{true} if it is OK to use a hard register@var{regno} as scratch reg in peephole2.One common use of this macro is to prevent using of a register thatis not saved by a prologue in an interrupt handler.The default version of this hook always returns @code{true}.@end deftypefn@defmac AVOID_CCMODE_COPIESDefine 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, leafOn some machines, a leaf function (i.e., one which makes no calls) can runmore efficiently if it does not make its own register window. Often thismeans it is required to receive its arguments in the registers where theyare passed by the caller, instead of the registers where they wouldnormally arrive.The special treatment for leaf functions generally applies only whenother conditions are met; for example, often they may use only thoseregisters for its own variables and temporaries. We use the term ``leaffunction'' to mean a function that is suitable for this specialhandling, so that functions with no calls are not necessarily ``leaffunctions''.GCC assigns register numbers before it knows whether the function issuitable for leaf function treatment. So it needs to renumber theregisters in order to output a leaf function. The following macrosaccomplish this.@defmac LEAF_REGISTERSName of a char vector, indexed by hard register number, whichcontains 1 for a register that is allowable in a candidate for leaffunction treatment.If leaf function treatment involves renumbering the registers, then theregisters marked here should be the ones before renumbering---those thatGCC would ordinarily allocate. The registers which will actually beused in the assembler code, after renumbering, should not be marked with 1in this vector.Define this macro only if the target machine offers a way to optimizethe 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 leaffunction before renumbering, then the expression should yield @minus{}1, whichwill cause the compiler to abort.Define this macro only if the target machine offers a way to optimize thetreatment of leaf functions, and registers need to be renumbered to dothis.@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 functionsspecially. They can test the C variable @code{current_function_is_leaf}which is nonzero for leaf functions. @code{current_function_is_leaf} isset prior to local register allocation and is valid for the remainingcompiler passes. They can also test the C variable@code{current_function_uses_only_leaf_regs} which is nonzero for leaffunctions which only use leaf registers.@code{current_function_uses_only_leaf_regs} is valid after all passesthat 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 StackThere are special features to handle computers where some of the``registers'' form a stack. Stack registers are normally written bypushing onto the stack, and are numbered relative to the top of thestack.Currently, GCC can only handle one group of stack-like registers, andthey must be consecutively numbered. Furthermore, the existingsupport for stack-like registers is specific to the 80387 floatingpoint coprocessor. If you have a new architecture that usesstack-like registers, you will need to do substantial work on@file{reg-stack.c} and write your machine description to cooperatewith it, as well as defining these macros.@defmac STACK_REGSDefine this if the machine has any stack-like registers.@end defmac@defmac STACK_REG_COVER_CLASSThis is a cover class containing the stack registers. Define this ifthe machine has any stack-like registers.@end defmac@defmac FIRST_STACK_REGThe number of the first stack-like register. This one is the topof the stack.@end defmac@defmac LAST_STACK_REGThe number of the last stack-like register. This one is the bottom ofthe stack.@end defmac@node Register Classes@section Register Classes@cindex register class definitions@cindex class definitions, registerOn 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 machinerestrictions are described to the compiler using @dfn{register classes}.You define a number of register classes, giving each one a name and sayingwhich of the registers belong to it. Then you can specify register classesthat are allowed as operands to particular instruction patterns.@findex ALL_REGS@findex NO_REGSIn general, each register will belong to several classes. In fact, oneclass must be named @code{ALL_REGS} and contain all the registers. Anotherclass must be named @code{NO_REGS} and contain no registers. Often theunion of two classes will be another class; however, this is not required.@findex GENERAL_REGSOne of the classes must be named @code{GENERAL_REGS}. There is nothingterribly special about the name, but the operand constraint letters@samp{r} and @samp{g} specify this class. If @code{GENERAL_REGS} isthe same as @code{ALL_REGS}, just define it as a macro which expandsto @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 operandconstraints is through machine-dependent operand constraint letters.You can define such letters to correspond to various classes, then usethem in operand constraints.You must define the narrowest register classes for allocatableregisters, so that each class either has no subclasses, or that forsome mode, the move cost between registers within the class ischeaper 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 someinstruction allows both classes. For example, if an instruction allowseither a floating point (coprocessor) register or a general register for acertain 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 theclass computed via @code{reg_class_subunion}.You must also specify certain redundant information about the registerclasses: for each class, which classes contain it and which ones arecontained in it; for each pair of classes, the largest class containedin their union.When a value occupying several consecutive registers is expected in acertain class, all the registers used must belong to that class.Therefore, register classes cannot be used to enforce a requirement fora register pair to start with an even-numbered register. The way tospecify this requirement is with @code{HARD_REGNO_MODE_OK}.Register classes used for input-operands of bitwise-and or shiftinstructions have a special requirement: each such class must have, foreach fixed-point machine mode, a subclass whose registers can transfer thatmode to or from memory. For example, on some machines, the operations forsingle-byte values (@code{QImode}) are limited to certain registers. Whenthis is so, each register class that is used in a bitwise-and or shiftinstruction must have a subclass consisting of registers from whichsingle-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 namesas 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 rathertells how many classes there are.Each register class has a number, which is the value of castingthe class name to type @code{int}. The number serves as an indexin many of the tables described below.@end deftp@defmac N_REG_CLASSESThe number of distinct register classes, defined as follows:@smallexample#define N_REG_CLASSES (int) LIM_REG_CLASSES@end smallexample@end defmac@defmac REG_CLASS_NAMESAn initializer containing the names of the register classes as C stringconstants. These names are used in writing some of the debugging dumps.@end defmac@defmac REG_CLASS_CONTENTSAn initializer containing the contents of the register classes, as integerswhich are bit masks. The @var{n}th integer specifies the contents of class@var{n}. The way the integer @var{mask} is interpreted is thatregister @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 containingseveral integers. Each sub-initializer must be suitable as an initializerfor 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 toregisters 0 through 31, the second integer to registers 32 through 63, andso 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 classwhich is @dfn{minimal}, meaning that no smaller class also contains theregister.@end defmac@defmac BASE_REG_CLASSA macro whose definition is the name of the class to which a validbase register must belong. A base register is one used in an addresswhich 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 allowsthe 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 validbase register must belong in order to be used in a base plus indexregister address. You should define this macro if base plus indexaddresses 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 validbase register for a memory reference in mode @var{mode} to addressspace @var{address_space} must belong. @var{outer_code} and @var{index_code}define the context in which the base register occurs. @var{outer_code} isthe code of the immediately enclosing expression (@code{MEM} for the top levelof an address, @code{ADDRESS} for something that occurs in an@code{address_operand}). @var{index_code} is the code of the correspondingindex expression if @var{outer_code} is @code{PLUS}; @code{SCRATCH} otherwise.@end defmac@defmac INDEX_REG_CLASSA macro whose definition is the name of the class to which a validindex register must belong. An index register is one used in anaddress where its value is either multiplied by a scale factor oradded 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} issuitable 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 thatthat expression may examine the mode of the memory reference in@var{mode}. You should define this macro if the mode of the memoryreference affects whether a register may be used as a base register. Ifyou define this macro, the compiler will use it instead of@code{REGNO_OK_FOR_BASE_P}. The mode may be @code{VOIDmode} foraddresses 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 foruse as a base register in base plus index operand addresses, accessingmemory in mode @var{mode}. It may be either a suitable hard register or apseudo register that has been allocated such a hard register. You shoulddefine this macro if base plus index addresses have different requirementsthan 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} issuitable for use as a base register in operand addresses, accessingmemory in mode @var{mode} in address space @var{address_space}.This is similar to @code{REGNO_MODE_OK_FOR_BASE_P}, exceptthat that expression may examine the context in which the registerappears in the memory reference. @var{outer_code} is the code of theimmediately enclosing expression (@code{MEM} if at the top level of theaddress, @code{ADDRESS} for something that occurs in an@code{address_operand}). @var{index_code} is the code of thecorresponding index expression if @var{outer_code} is @code{PLUS};@code{SCRATCH} otherwise. The mode may be @code{VOIDmode} for addressesthat 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} issuitable for use as an index register in operand addresses. It may beeither a suitable hard register or a pseudo register that has beenallocated such a hard register.The difference between an index register and a base register is thatthe index register may be scaled. If an address involves the sum oftwo registers, neither one of them scaled, then either one may belabeled the ``base'' and the other the ``index''; but whicheverlabeling is used must fit the machine's constraints of which registersmay serve in each capacity. The compiler will try both labelings,looking for one that is valid, and will reload one or both registersonly if neither labeling works.@end defmac@hook TARGET_PREFERRED_RENAME_CLASS@hook TARGET_PREFERRED_RELOAD_CLASSA target hook that places additional restrictions on the register classto use when it is necessary to copy value @var{x} into a register in class@var{rclass}. The value is a register class; perhaps @var{rclass}, or perhapsanother, smaller class.The default version of this hook always returns value of @code{rclass} argument.Sometimes returning a more restrictive class makes better code. Forexample, on the 68000, when @var{x} is an integer constant that is in rangefor a @samp{moveq} instruction, the value of this macro is always@code{DATA_REGS} as long as @var{rclass} includes the data registers.Requiring a data register guarantees that a @samp{moveq} will be used.One case where @code{TARGET_PREFERRED_RELOAD_CLASS} must not return@var{rclass} is if @var{x} is a legitimate constant which cannot beloaded into some register class. By returning @code{NO_REGS} you canforce @var{x} into a memory location. For example, rs6000 can loadimmediate values into general-purpose registers, but does not have aninstruction for loading an immediate value into a floating-pointregister, so @code{TARGET_PREFERRED_RELOAD_CLASS} returns @code{NO_REGS} when@var{x} is a floating-point constant. If the constant can't be loadedinto any kind of register, code generation will be better if@code{TARGET_LEGITIMATE_CONSTANT_P} makes the constant illegitimate insteadof using @code{TARGET_PREFERRED_RELOAD_CLASS}.If an insn has pseudos in it after register allocation, reload will gothrough the alternatives and call repeatedly @code{TARGET_PREFERRED_RELOAD_CLASS}to find the best one. Returning @code{NO_REGS}, in this case, makesreload add a @code{!} in front of the constraint: the x86 back-end usesthis feature to discourage usage of 387 registers when math is done inthe SSE registers (and vice versa).@end deftypefn@defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class})A C expression that places additional restrictions on the register classto 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 perhapsanother, smaller class. On many machines, the following definition issafe:@smallexample#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS@end smallexampleSometimes returning a more restrictive class makes better code. Forexample, on the 68000, when @var{x} is an integer constant that is in rangefor 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 beloaded into some register class. By returning @code{NO_REGS} you canforce @var{x} into a memory location. For example, rs6000 can loadimmediate values into general-purpose registers, but does not have aninstruction for loading an immediate value into a floating-pointregister, so @code{PREFERRED_RELOAD_CLASS} returns @code{NO_REGS} when@var{x} is a floating-point constant. If the constant can't be loadedinto any kind of register, code generation will be better if@code{TARGET_LEGITIMATE_CONSTANT_P} makes the constant illegitimate insteadof using @code{TARGET_PREFERRED_RELOAD_CLASS}.If an insn has pseudos in it after register allocation, reload will gothrough the alternatives and call repeatedly @code{PREFERRED_RELOAD_CLASS}to find the best one. Returning @code{NO_REGS}, in this case, makesreload add a @code{!} in front of the constraint: the x86 back-end usesthis feature to discourage usage of 387 registers when math is done inthe SSE registers (and vice versa).@end defmac@hook TARGET_PREFERRED_OUTPUT_RELOAD_CLASSLike @code{TARGET_PREFERRED_RELOAD_CLASS}, but for output reloads instead ofinput reloads.The default version of this hook always returns value of @code{rclass}argument.You can also use @code{TARGET_PREFERRED_OUTPUT_RELOAD_CLASS} to discouragereload from using some alternatives, like @code{TARGET_PREFERRED_RELOAD_CLASS}.@end deftypefn@defmac LIMIT_RELOAD_CLASS (@var{mode}, @var{class})A C expression that places additional restrictions on the register classto 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} wouldordinarily be used.Unlike @code{PREFERRED_RELOAD_CLASS}, this macro should be used whenthere are certain modes that simply can't 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 whichrequire the macro to do something nontrivial.@end defmac@hook TARGET_SECONDARY_RELOADMany machines have some registers that cannot be copied directly to orfrom memory or even from other types of registers. An example is the@samp{MQ} register, which on most machines, can only be copied to orfrom general registers, but not memory. Below, we shall be using theterm 'intermediate register' when a move operation cannot be performeddirectly, but has to be done by copying the source into the intermediateregister first, and then copying the intermediate register to thedestination. An intermediate register always has the same mode assource and destination. Since it holds the actual value being copied,reload might apply optimizations to re-use an intermediate registerand eliding the copy from the source when it can determine that theintermediate register still holds the required value.Another kind of secondary reload is required on some machines whichallow copying all registers to and from memory, but require a scratchregister for stores to some memory locations (e.g., those with symbolicaddress on the RT, and those with certain symbolic address on the SPARCwhen compiling PIC)@. Scratch registers need not have the same modeas the value being copied, and usually hold a different value thanthat being copied. Special patterns in the md file are needed todescribe how the copy is performed with the help of the scratch register;these patterns also describe the number, register class(es) and mode(s)of the scratch register(s).In some cases, both an intermediate and a scratch register are required.For input reloads, this target hook is called with nonzero @var{in_p},and @var{x} is an rtx that needs to be copied to a register of class@var{reload_class} in @var{reload_mode}. For output reloads, this targethook is called with zero @var{in_p}, and a register of class @var{reload_class}needs to be copied to rtx @var{x} in @var{reload_mode}.If copying a register of @var{reload_class} from/to @var{x} requiresan intermediate register, the hook @code{secondary_reload} shouldreturn the register class required for this intermediate register.If no intermediate register is required, it should return NO_REGS.If more than one intermediate register is required, describe the onethat is closest in the copy chain to the reload register.If scratch registers are needed, you also have to describe how toperform the copy from/to the reload register to/from thisclosest intermediate register. Or if no intermediate register isrequired, but still a scratch register is needed, describe thecopy from/to the reload register to/from the reload operand @var{x}.You do this by setting @code{sri->icode} to the instruction code of a patternin the md file which performs the move. Operands 0 and 1 are the outputand input of this copy, respectively. Operands from operand 2 onward arefor scratch operands. These scratch operands must have a mode, and asingle-register-class@c [later: or memory]output constraint.When an intermediate register is used, the @code{secondary_reload}hook will be called again to determine how to copy the intermediateregister to/from the reload operand @var{x}, so your hook must alsohave code to handle the register class of the intermediate operand.@c [For later: maybe we'll allow multi-alternative reload patterns -@c the port maintainer could name a mov<mode> pattern that has clobbers -@c and match the constraints of input and output to determine the required@c alternative. A restriction would be that constraints used to match@c against reloads registers would have to be written as register class@c constraints, or we need a new target macro / hook that tells us if an@c arbitrary constraint can match an unknown register of a given class.@c Such a macro / hook would also be useful in other places.]@var{x} might be a pseudo-register or a @code{subreg} of apseudo-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 isin memory and the hard register number if it is in a register.Scratch operands in memory (constraint @code{"=m"} / @code{"=&m"}) arecurrently not supported. For the time being, you will have to continueto use @code{SECONDARY_MEMORY_NEEDED} for that purpose.@code{copy_cost} also uses this target hook to find out how values arecopied. If you want it to include some extra cost for the need to allocate(a) scratch register(s), set @code{sri->extra_cost} to the additional cost.Or if two dependent moves are supposed to have a lower cost than the sumof the individual moves due to expected fortuitous scheduling and/or specialforwarding logic, you can set @code{sri->extra_cost} to a negative amount.@end deftypefn@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 thereload phase that it mayneed to allocate at least one register for a reload in addition to theregister to contain the data. Specifically, if copying @var{x} to aregister @var{class} in @var{mode} requires an intermediate register,you were supposed to define @code{SECONDARY_INPUT_RELOAD_CLASS} to return thelargest register class all of whose registers can be used asintermediate registers or scratch registers.If copying a register @var{class} in @var{mode} to @var{x} requires anintermediate or scratch register, @code{SECONDARY_OUTPUT_RELOAD_CLASS}was supposed to be defined be defined to return the largest registerclass required. If therequirements for input and output reloads were the same, the macro@code{SECONDARY_RELOAD_CLASS} should have been used instead of defining bothmacros 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 thismacro if it would always return @code{NO_REGS}.If a scratch register is required (either with or without anintermediate 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 normallyimplemented with a @code{define_expand}, should be similar to the@samp{mov@var{m}} patterns, except that operand 2 is the scratchregister.These patterns need constraints for the reload register and scratchregister thatcontain a single register class. If the original reload register (whoseclass is @var{class}) can meet the constraint given in the pattern, thevalue returned by these macros is used for the class of the scratchregister. 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 apseudo-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 isin 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 ofregisters can only be copied to memory and not to another class ofregisters. In that case, secondary reload registers are not needed andwould not be helpful. Instead, a stack location must be used to performthe copy and the @code{mov@var{m}} pattern should use memory as anintermediate storage. This case often occurs between floating-point andgeneral registers.@end defmac@defmac SECONDARY_MEMORY_NEEDED (@var{class1}, @var{class2}, @var{m})Certain machines have the property that some registers cannot be copiedto some other registers without using memory. Define this macro onthose machines to be a C expression that is nonzero if objects of mode@var{m} in registers of @var{class1} can only be copied to registers ofclass @var{class2} by storing a register of @var{class1} into memoryand loading that memory location into a register of @var{class2}.Do not define this macro if its value would always be zero.@end defmac@defmac SECONDARY_MEMORY_NEEDED_RTX (@var{mode})Normally when @code{SECONDARY_MEMORY_NEEDED} is defined, the compilerallocates a stack slot for a memory location needed for register copies.If this macro is defined, the compiler instead uses the memory locationdefined by this macro.Do not define this macro if you do not define@code{SECONDARY_MEMORY_NEEDED}.@end defmac@defmac SECONDARY_MEMORY_NEEDED_MODE (@var{mode})When the compiler needs a secondary memory location to copy between tworegisters of mode @var{mode}, it normally allocates sufficient memory tohold a quantity of @code{BITS_PER_WORD} bits and performs the store andload operations in a mode that many bits wide and whose class is thesame as that of @var{mode}.This is right thing to do on most machines because it ensures that allbits of the register are copied and prevents accesses to the registersin a narrower mode, which some machines prohibit for floating-pointregisters.However, this default behavior is not correct on some machines, such asthe DEC Alpha, that store short integers in floating-point registersdifferently than in integer registers. On those machines, the defaultwidening will not work correctly and you must define this macro tosuppress that widening in some cases. See the file @file{alpha.h} fordetails.Do not define this macro if you do not define@code{SECONDARY_MEMORY_NEEDED} or if widening @var{mode} to a mode thatis @code{BITS_PER_WORD} bits wide is correct for your machine.@end defmac@hook TARGET_CLASS_LIKELY_SPILLED_PA target hook which returns @code{true} if pseudos that have been assignedto registers of class @var{rclass} would likely be spilled becauseregisters of @var{rclass} are needed for spill registers.The default version of this target hook returns @code{true} if @var{rclass}has exactly one register and @code{false} otherwise. On most machines, thisdefault should be used. Only use this target hook to some other expressionif pseudos allocated by @file{local-alloc.c} end up in memory because theirhard registers were needed for spill registers. If this target hook returns@code{false} for those classes, those pseudos will only be allocated by@file{global.c}, which knows how to reallocate the pseudo to anotherregister. If there would not be another register available for reallocation,you should not change the implementation of this target hook sincethe only effect of such implementation would be to slow down registerallocation.@end deftypefn@hook TARGET_CLASS_MAX_NREGSA target hook returns the maximum number of consecutive registersof class @var{rclass} needed to hold a value of mode @var{mode}.This is closely related to the macro @code{HARD_REGNO_NREGS}. In fact,the value returned by @code{TARGET_CLASS_MAX_NREGS (@var{rclass},@var{mode})} target hook should be the maximum value of@code{HARD_REGNO_NREGS (@var{regno}, @var{mode})} for all @var{regno}values in the class @var{rclass}.This target hook helps control the handling of multiple-word valuesin the reload pass.The default version of this target hook returns the size of @var{mode}in words.@end deftypefn@defmac CLASS_MAX_NREGS (@var{class}, @var{mode})A C expression for the maximum number of consecutive registersof class @var{class} needed to hold a value of mode @var{mode}.This is closely related to the macro @code{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{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 valuesin the reload pass.@end defmac@defmac CANNOT_CHANGE_MODE_CLASS (@var{from}, @var{to}, @var{class})If defined, a C expression that returns nonzero for a @var{class} for whicha change from mode @var{from} to mode @var{to} is invalid.For the example, loading 32-bit integer or floating-point objects intofloating-point registers on the Alpha extends them to 64 bits.Therefore loading a 64-bit object and then storing it as a 32-bit objectdoes not store the low-order 32 bits, as would be the case for a normalregister. Therefore, @file{alpha.h} defines @code{CANNOT_CHANGE_MODE_CLASS}as below:@smallexample#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \(GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \? reg_classes_intersect_p (FLOAT_REGS, (CLASS)) : 0)@end smallexample@end defmac@node Old Constraints@section Obsolete Macros for Defining Constraints@cindex defining constraints, obsolete method@cindex constraints, defining, obsolete methodMachine-specific constraints can be defined with these macros insteadof the machine description constructs described in @ref{DefineConstraints}. This mechanism is obsolete. New ports should not useit; old ports should convert to the new mechanism.@defmac CONSTRAINT_LEN (@var{char}, @var{str})For the constraint at the start of @var{str}, which starts with the letter@var{c}, return the length. This allows you to have register class /constant / extra constraints that are longer than a single letter;you don't need to define this macro if you can do with single-letterconstraints only. The definition of this macro should useDEFAULT_CONSTRAINT_LEN for all the characters that you don't wantto handle specially.There are some sanity checks in genoutput.c that check the constraint lengthsfor the md file, so you can also use this macro to help you while you aretransitioning from a byzantine single-letter-constraint scheme: when youreturn a negative length for a constraint you want to re-use, genoutputwill complain about every instance where it is used in the md file.@end defmac@defmac REG_CLASS_FROM_LETTER (@var{char})A C expression which defines the machine-dependent operand constraintletters for register classes. If @var{char} is such a letter, thevalue should be the register class corresponding to it. Otherwise,the value should be @code{NO_REGS}. The register letter @samp{r},corresponding to class @code{GENERAL_REGS}, will not be passedto this macro; you do not need to handle it.@end defmac@defmac REG_CLASS_FROM_CONSTRAINT (@var{char}, @var{str})Like @code{REG_CLASS_FROM_LETTER}, but you also get the constraint stringpassed in @var{str}, so that you can use suffixes to distinguish betweendifferent variants.@end defmac@defmac CONST_OK_FOR_LETTER_P (@var{value}, @var{c})A C expression that defines the machine-dependent operand constraintletters (@samp{I}, @samp{J}, @samp{K}, @dots{} @samp{P}) that specifyparticular ranges of integer values. If @var{c} is one of thoseletters, the expression should check that @var{value}, an integer, is inthe appropriate range and return 1 if so, 0 otherwise. If @var{c} isnot one of those letters, the value should be 0 regardless of@var{value}.@end defmac@defmac CONST_OK_FOR_CONSTRAINT_P (@var{value}, @var{c}, @var{str})Like @code{CONST_OK_FOR_LETTER_P}, but you also get the constraintstring passed in @var{str}, so that you can use suffixes to distinguishbetween different variants.@end defmac@defmac CONST_DOUBLE_OK_FOR_LETTER_P (@var{value}, @var{c})A C expression that defines the machine-dependent operand constraintletters that specify particular ranges of @code{const_double} values(@samp{G} or @samp{H}).If @var{c} is one of those letters, the expression should check that@var{value}, an RTX of code @code{const_double}, is in the appropriaterange and return 1 if so, 0 otherwise. If @var{c} is not one of thoseletters, the value should be 0 regardless of @var{value}.@code{const_double} is used for all floating-point constants and for@code{DImode} fixed-point constants. A given letter can accept eitheror both kinds of values. It can use @code{GET_MODE} to distinguishbetween these kinds.@end defmac@defmac CONST_DOUBLE_OK_FOR_CONSTRAINT_P (@var{value}, @var{c}, @var{str})Like @code{CONST_DOUBLE_OK_FOR_LETTER_P}, but you also get the constraintstring passed in @var{str}, so that you can use suffixes to distinguishbetween different variants.@end defmac@defmac EXTRA_CONSTRAINT (@var{value}, @var{c})A C expression that defines the optional machine-dependent constraintletters that can be used to segregate specific types of operands, usuallymemory references, for the target machine. Any letter that is notelsewhere defined and not matched by @code{REG_CLASS_FROM_LETTER} /@code{REG_CLASS_FROM_CONSTRAINT}may be used. Normally this macro will not be defined.If it is required for a particular target machine, it should return 1if @var{value} corresponds to the operand type represented by theconstraint letter @var{c}. If @var{c} is not defined as an extraconstraint, the value returned should be 0 regardless of @var{value}.For example, on the ROMP, load instructions cannot have their outputin r0 if the memory reference contains a symbolic address. Constraintletter @samp{Q} is defined as representing a memory address that does@emph{not} contain a symbolic address. An alternative is specified witha @samp{Q} constraint on the input and @samp{r} on the output. The nextalternative specifies @samp{m} on the input and a register class thatdoes not include r0 on the output.@end defmac@defmac EXTRA_CONSTRAINT_STR (@var{value}, @var{c}, @var{str})Like @code{EXTRA_CONSTRAINT}, but you also get the constraint string passedin @var{str}, so that you can use suffixes to distinguish between differentvariants.@end defmac@defmac EXTRA_MEMORY_CONSTRAINT (@var{c}, @var{str})A C expression that defines the optional machine-dependent constraintletters, amongst those accepted by @code{EXTRA_CONSTRAINT}, that shouldbe treated like memory constraints by the reload pass.It should return 1 if the operand type represented by the constraintat the start of @var{str}, the first letter of which is the letter @var{c},comprises a subset of all memory references includingall those whose address is simply a base register. This allows the reloadpass to reload an operand, if it does not directly correspond to the operandtype of @var{c}, by copying its address into a base register.For example, on the S/390, some instructions do not accept arbitrarymemory references, but only those that do not make use of an indexregister. The constraint letter @samp{Q} is defined via@code{EXTRA_CONSTRAINT} as representing a memory address of this type.If the letter @samp{Q} is marked as @code{EXTRA_MEMORY_CONSTRAINT},a @samp{Q} constraint can handle any memory operand, because thereload pass knows it can be reloaded by copying the memory addressinto a base register if required. This is analogous to the wayan @samp{o} constraint can handle any memory operand.@end defmac@defmac EXTRA_ADDRESS_CONSTRAINT (@var{c}, @var{str})A C expression that defines the optional machine-dependent constraintletters, amongst those accepted by @code{EXTRA_CONSTRAINT} /@code{EXTRA_CONSTRAINT_STR}, that shouldbe treated like address constraints by the reload pass.It should return 1 if the operand type represented by the constraintat the start of @var{str}, which starts with the letter @var{c}, comprisesa subset of all memory addresses includingall those that consist of just a base register. This allows the reloadpass to reload an operand, if it does not directly correspond to the operandtype of @var{str}, by copying it into a base register.Any constraint marked as @code{EXTRA_ADDRESS_CONSTRAINT} can onlybe used with the @code{address_operand} predicate. It is treatedanalogously to the @samp{p} constraint.@end defmac@node Stack and Calling@section Stack Layout and Calling Conventions@cindex calling conventions@c prevent bad page break with this lineThis 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::* Stack Smashing Protection::@end menu@node Frame Layout@subsection Basic Stack Layout@cindex stack frame layout@cindex frame layout@c prevent bad page break with this lineHere is the basic stack layout.@defmac STACK_GROWS_DOWNWARDDefine this macro if pushing a word onto the stack moves the stackpointer to a smaller address.When we say, ``define this macro if @dots{}'', it means that thecompiler checks this macro only with @code{#ifdef} so the precisedefinition used does not matter.@end defmac@defmac STACK_PUSH_CODEThis macro defines the operation used when something is pushedon 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 onthe stack direction and on whether the stack pointer pointsto the last item on the stack or whether it points to thespace for the next item on the stack.The default is @code{PRE_DEC} when @code{STACK_GROWS_DOWNWARD} isdefined, which is almost always right, and @code{PRE_INC} otherwise,which is often wrong.@end defmac@defmac FRAME_GROWS_DOWNWARDDefine this macro to nonzero value if the addresses of local variable slotsare at negative offsets from the frame pointer.@end defmac@defmac ARGS_GROW_DOWNWARDDefine this macro if successive arguments to a function occupy decreasingaddresses on the stack.@end defmac@defmac STARTING_FRAME_OFFSETOffset from the frame pointer to the first local variable slot to be allocated.If @code{FRAME_GROWS_DOWNWARD}, find the next slot's offset bysubtracting the first slot's length from @code{STARTING_FRAME_OFFSET}.Otherwise, it is found by adding the length of the first slot to thevalue @code{STARTING_FRAME_OFFSET}.@c i'm not sure if the above is still correct.. had to change it to get@c rid of an overfull. --mew 2feb93@end defmac@defmac STACK_ALIGNMENT_NEEDEDDefine 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{STARTING_FRAME_OFFSET} is nonzero or where thereis a register save block following the local block that doesn't requirealignment to @code{STACK_BOUNDARY}, it may be beneficial to disablestack alignment and do it in the backend.@end defmac@defmac STACK_POINTER_OFFSETOffset from the stack pointer register to the first location at whichoutgoing arguments are placed. If not specified, the default value ofzero is used. This is the proper value for most machines.If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location abovethe 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'saddress. On some machines it may depend on the data type of thefunction.If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location abovethe first argument's address.@end defmac@defmac STACK_DYNAMIC_OFFSET (@var{fundecl})Offset from the stack pointer register to an item dynamically allocatedon the stack, e.g., by @code{alloca}.The default value for this macro is @code{STACK_POINTER_OFFSET} plus thelength of the outgoing arguments. The default is correct for mostmachines. See @file{function.c} for details.@end defmac@defmac INITIAL_FRAME_ADDRESS_RTXA C expression whose value is RTL representing the address of the initialstack frame. This address is passed to @code{RETURN_ADDR_RTX} and@code{DYNAMIC_CHAIN_ADDRESS}. If you don't define this macro, a reasonabledefault value will be used. Define this macro in order to make frame pointerelimination 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 stackframe where the pointer to the caller's frame is stored. Assume that@var{frameaddr} is an RTL expression for the address of the stack frameitself.If you don't define this macro, the default is to return the valueof @var{frameaddr}---that is, the stack frame address is also theaddress of the stack word that points to the previous frame.@end defmac@defmac SETUP_FRAME_ADDRESSESIf defined, a C expression that produces the machine-specific code tosetup the stack so that arbitrary frames can be accessed. For example,on the SPARC, we must flush all of the register windows to the stackbefore we can access arbitrary stack frames. You will seldom need todefine this macro.@end defmac@hook TARGET_BUILTIN_SETJMP_FRAME_VALUEThis target hook should return an rtx that is used to storethe address of the current frame into the built in @code{setjmp} buffer.The default value, @code{virtual_stack_vars_rtx}, is correct for mostmachines. One reason you may need to define this target hook is if@code{hard_frame_pointer_rtx} is the appropriate value on your machine.@end deftypefn@defmac FRAME_ADDR_RTX (@var{frameaddr})A C expression whose value is RTL representing the value of the frameaddress for the current frame. @var{frameaddr} is the frame pointerof the current frame. This is used for __builtin_frame_address.You need only define this macro if the frame address is not the sameas 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 returnaddress for the frame @var{count} steps up from the current frame, afterthe 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 defined.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 todetermine the return address of other frames.@end defmac@defmac RETURN_ADDR_IN_PREVIOUS_FRAMEDefine this if the return address of a particular stack frame is accessedfrom the frame pointer of the previous stack frame.@end defmac@defmac INCOMING_RETURN_ADDR_RTXA C expression whose value is RTL representing the location of theincoming return address at the beginning of any function, before theprologue. This RTL is either a @code{REG}, indicating that the returnvalue is saved in @samp{REG}, or a @code{MEM} representing a location inthe stack.You only need to define this macro if you want to support call framedebugging 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_COLUMNA C expression whose value is an integer giving a DWARF 2 columnnumber that may be used as an alternative return column. The columnmust not correspond to any gcc hard register (that is, it must notbe in the range of @code{DWARF_FRAME_REGNUM}).This macro can be useful if @code{DWARF_FRAME_RETURN_COLUMN} is set to ageneral register, but an alternative column needs to be used for signalframes. Some targets have also used different frame return columnsover time.@end defmac@defmac DWARF_ZERO_REGA C expression whose value is an integer giving a DWARF 2 registernumber that is considered to always have the value zero. This shouldonly be defined if the target has an architected zero register, andsomeone decided it was a good idea to use that register number toterminate the stack backtrace. New ports should avoid this.@end defmac@hook TARGET_DWARF_HANDLE_FRAME_UNSPECThis target hook allows the backend to emit frame-related insns thatcontain UNSPECs or UNSPEC_VOLATILEs. The DWARF 2 call frame debugginginfo engine will invoke it on insns of the form@smallexample(set (reg) (unspec [@dots{}] UNSPEC_INDEX))@end smallexampleand@smallexample(set (reg) (unspec_volatile [@dots{}] UNSPECV_INDEX)).@end smallexampleto let the backend emit the call frame instructions. @var{label} isthe CFI label attached to the insn, @var{pattern} is the pattern ofthe insn and @var{index} is @code{UNSPEC_INDEX} or @code{UNSPECV_INDEX}.@end deftypefn@defmac INCOMING_FRAME_SP_OFFSETA 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 stackframe at the beginning of any function, before the prologue. The top ofthe frame is defined to be the value of the stack pointer in theprevious frame, just before the call instruction.You only need to define this macro if you want to support call framedebugging information like that provided by DWARF 2.@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). Thefinal value should coincide with that calculated by@code{INCOMING_FRAME_SP_OFFSET}. Which is unfortunately not usableduring 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 foundimmediately before the stack frame. Note that this is not the case onsome targets that save registers into the caller's frame, such as SPARCand rs6000, and so such targets need to define this macro.You only need to define this macro if the default is incorrect, and youwant to support call frame debugging information like that provided byDWARF 2.@end defmac@defmac FRAME_POINTER_CFA_OFFSET (@var{fundecl})If defined, a C expression whose value is an integer giving the offsetin 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 isvariable due to the ABI, this may not be possible. If this macro isdefined, it implies that the virtual register instantiation should bebased on the frame pointer instead of the argument pointer. Only oneof @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 offsetin bytes from the canonical frame address (cfa) to the frame base usedin DWARF 2 debug information. The default is zero. A different valuemay 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 fordata by exception handlers, or @code{INVALID_REGNUM} if fewer than@var{N} registers are usable.The exception handling library routines communicate with the exceptionhandlers via a set of agreed upon registers. Ideally these registersshould be call-clobbered; it is possible to use call-saved registers,but may negatively impact code size. The target must support at least2 data registers, but should define 4 if there are enough free registers.You must define this macro if you want to support call frame exceptionhandling like that provided by DWARF 2.@end defmac@defmac EH_RETURN_STACKADJ_RTXA C expression whose value is RTL representing a location in whichto 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 otherwiseuntouched by the epilogue, but could also be a stack slot.Do not define this macro if the stack pointer is saved and restoredby the regular prolog and epilog code in the call frame itself; inthis case, the exception handling library routines will update thestack location to be restored in place. Otherwise, you must definethis macro if you want to support call frame exception handling likethat provided by DWARF 2.@end defmac@defmac EH_RETURN_HANDLER_RTXA C expression whose value is RTL representing a location in whichto store the address of an exception handler to which we shouldreturn. It will not be assigned on code paths that return normally.Typically this is the location in the call frame at which the normalreturn address is stored. For targets that return by popping anaddress off the stack, this might be a memory address just belowthe @emph{target} call frame rather than inside the current callframe. If defined, @code{EH_RETURN_STACKADJ_RTX} will have alreadybeen assigned, so it may be used to calculate the location of thetarget call frame.Some targets have more complex requirements than storing to anaddress calculable during initial code generation. In that casethe @code{eh_return} instruction pattern should be used instead.If you want to support call frame exception handling, you mustdefine either this macro or the @code{eh_return} instruction pattern.@end defmac@defmac RETURN_ADDR_OFFSETIf defined, an integer-valued C expression for which rtl will be generatedto add it to the exception handler address before it is searched in theexception handling tables, and to subtract it again from the address beforeusing 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 exceptionhandling sections. If at all possible, this should be defined suchthat 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_*} definesas found in @file{dwarf2.h}.If this macro is not defined, pointers will not be encoded butrepresented 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 requiredto represent the encoding chosen by @code{ASM_PREFERRED_EH_DATA_FORMAT}.Generic code takes care of pc-relative and indirect encodings; this mustbe defined if the target uses text-relative or data-relative encodings.This is a C statement that branches to @var{done} if the format washandled. @var{encoding} is the format chosen, @var{size} is the numberof 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 specificcode to the call-frame unwinder for use when there is no unwind dataavailable. The most common reason to implement this macro is to unwindthrough 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} forthe stack pointer value. If the frame can be decoded, the registersave addresses should be updated in @var{fs} and the macro shouldevaluate 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 thecall-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 @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 shouldbe updated in @var{fs}.@end defmac@defmac TARGET_USES_WEAK_UNWIND_INFOA C expression that evaluates to true if the target requires unwindinfo to be given comdat linkage. Define it to be @code{1} if comdatlinkage is necessary. The default is @code{0}.@end defmac@node Stack Checking@subsection Specifying How Stack Checking is DoneGCC will check that stack references are within the boundaries of thestack, if the option @option{-fstack-check} is specified, in one ofthree ways:@enumerate@itemIf the value of the @code{STACK_CHECK_BUILTIN} macro is nonzero, GCCwill assume that you have arranged for full stack checking to be doneat appropriate places in the configuration files. GCC will not doother special processing.@itemIf @code{STACK_CHECK_BUILTIN} is zero and the value of the@code{STACK_CHECK_STATIC_BUILTIN} macro is nonzero, GCC will assumethat you have arranged for static stack checking (checking of thestatic stack frame of functions) to be done at appropriate placesin the configuration files. GCC will only emit code to do dynamicstack checking (checking on dynamic stack allocations) using the thirdapproach below.@itemIf 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 enumerateIf 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 allocateddynamically if their size exceeds @code{STACK_CHECK_MAX_VAR_SIZE} bytes.@defmac STACK_CHECK_BUILTINA nonzero value if stack checking is done by the configuration files in amachine-dependent manner. You should define this macro if stack checkingis required by the ABI of your machine or if you would like to do stackchecking in some more efficient way than the generic approach. The defaultvalue of this macro is zero.@end defmac@defmac STACK_CHECK_STATIC_BUILTINA nonzero value if static stack checking is done by the configuration filesin a machine-dependent manner. You should define this macro if you wouldlike to do static stack checking in some more efficient way than the genericapproach. The default value of this macro is zero.@end defmac@defmac STACK_CHECK_PROBE_INTERVAL_EXPAn integer specifying the interval at which GCC must generate stack probeinstructions, defined as 2 raised to this integer. You will normallydefine this macro so that the interval be no larger than the size ofthe ``guard pages'' at the end of a stack area. The default valueof 12 (4096-byte interval) is suitable for most systems.@end defmac@defmac STACK_CHECK_MOVING_SPAn integer which is nonzero if GCC should move the stack pointer page by pagewhen doing probes. This can be necessary on systems where the stack pointercontains the bottom address of the memory area accessible to the executingthread at any point in time. In this situation an alternate signal stackis required in order to be able to recover from a stack overflow. Thedefault value of this macro is zero.@end defmac@defmac STACK_CHECK_PROTECTThe number of bytes of stack needed to recover from a stack overflow, forlanguages where such a recovery is supported. The default value of 75 wordswith the @code{setjmp}/@code{longjmp}-based exception handling mechanism and8192 bytes with other exception handling mechanisms should be adequate formost machines.@end defmacThe following macros are relevant only if neither STACK_CHECK_BUILTINnor STACK_CHECK_STATIC_BUILTIN is defined; you can omit them altogetherin the opposite case.@defmac STACK_CHECK_MAX_FRAME_SIZEThe maximum size of a stack frame, in bytes. GCC will generate probeinstructions in non-leaf functions to ensure at least this many bytes ofstack are available. If a stack frame is larger than this size, stackchecking will not be reliable and GCC will issue a warning. Thedefault is chosen so that GCC only generates one instruction on mostsystems. You should normally not change the default value of this macro.@end defmac@defmac STACK_CHECK_FIXED_FRAME_SIZEGCC uses this value to generate the above warning message. Itrepresents the amount of fixed frame used by a function, not includingspace for any callee-saved registers, temporaries and user variables.You need only specify an upper bound for this amount and will normallyuse the default of four words.@end defmac@defmac STACK_CHECK_MAX_VAR_SIZEThe maximum size, in bytes, of an object that GCC will place in thefixed 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 willnormally not need to override that default.@end defmac@need 2000@node Frame Registers@subsection Registers That Address the Stack Frame@c prevent bad page break with this lineThis discusses registers that address the stack frame.@defmac STACK_POINTER_REGNUMThe register number of the stack pointer register, which must also be afixed register according to @code{FIXED_REGISTERS}. On most machines,the hardware determines which register this is.@end defmac@defmac FRAME_POINTER_REGNUMThe register number of the frame pointer register, which is used toaccess automatic variables in the stack frame. On some machines, thehardware determines which register this is. On other machines, you canchoose any register you wish for this purpose.@end defmac@defmac HARD_FRAME_POINTER_REGNUMOn some machines the offset between the frame pointer and startingoffset of the automatic variables is not known until after registerallocation has been done (for example, because the saved registers arebetween these two locations). On those machines, define@code{FRAME_POINTER_REGNUM} the number of a special, fixed register tobe used internally until the offset is known, and define@code{HARD_FRAME_POINTER_REGNUM} to be the actual hard register numberused for the frame pointer.You should define this macro only in the very rare circumstances when itis not possible to calculate the offset between the frame pointer andthe automatic variables until after register allocation has beencompleted. When this macro is defined, you must also indicate in yourdefinition 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_REGNUMThe register number of the arg pointer register, which is used to accessthe function's argument list. On some machines, this is the same as theframe pointer register. On some machines, the hardware determines whichregister this is. On other machines, you can choose any register youwish for this purpose. If this is not the same register as the framepointer 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_POINTERDefine this to a preprocessor constant that is nonzero if@code{hard_frame_pointer_rtx} and @code{frame_pointer_rtx} should bethe same. The default definition is @samp{(HARD_FRAME_POINTER_REGNUM== FRAME_POINTER_REGNUM)}; you only need to define this macro if thatdefinition is not suitable for use in preprocessor conditionals.@end defmac@defmac HARD_FRAME_POINTER_IS_ARG_POINTERDefine this to a preprocessor constant that is nonzero if@code{hard_frame_pointer_rtx} and @code{arg_pointer_rtx} should be thesame. The default definition is @samp{(HARD_FRAME_POINTER_REGNUM ==ARG_POINTER_REGNUM)}; you only need to define this macro if thatdefinition is not suitable for use in preprocessor conditionals.@end defmac@defmac RETURN_ADDRESS_POINTER_REGNUMThe register number of the return address pointer register, which is used toaccess the current function's return address from the stack. On somemachines, the return address is not at a fixed offset from the framepointer or stack pointer or argument pointer. This register can be definedto 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 returnaddress from the stack.@end defmac@defmac STATIC_CHAIN_REGNUM@defmacx STATIC_CHAIN_INCOMING_REGNUMRegister numbers used for passing a function's static chain pointer. Ifregister windows are used, the register number as seen by the calledfunction is @code{STATIC_CHAIN_INCOMING_REGNUM}, while the registernumber as seen by the calling function is @code{STATIC_CHAIN_REGNUM}. Ifthese registers are the same, @code{STATIC_CHAIN_INCOMING_REGNUM} neednot be defined.The static chain register need not be a fixed register.If the static chain is passed in memory, these macros should not bedefined; instead, the @code{TARGET_STATIC_CHAIN} hook should be used.@end defmac@hook TARGET_STATIC_CHAINThis hook replaces the use of @code{STATIC_CHAIN_REGNUM} et al fortargets that may use different static chain locations for differentnested functions. This may be required if the target has functionattributes that affect the calling conventions of the function andthose calling conventions use different static chain locations.The default version of this hook uses @code{STATIC_CHAIN_REGNUM} et al.If the static chain is passed in memory, this hook should be used toprovide rtx giving @code{mem} expressions that denote where they are stored.Often the @code{mem} expression as seen by the caller will be at an offsetfrom the stack pointer and the @code{mem} expression as seen by the calleewill be at an offset from the frame pointer.@findex stack_pointer_rtx@findex frame_pointer_rtx@findex arg_pointer_rtxThe variables @code{stack_pointer_rtx}, @code{frame_pointer_rtx}, and@code{arg_pointer_rtx} will have been initialized and should be usedto refer to those items.@end deftypefn@defmac DWARF_FRAME_REGISTERSThis macro specifies the maximum number of hard registers that can besaved in a call frame. This is used to size data structures used inDWARF2 exception handling.Prior to GCC 3.0, this macro was needed in order to establish a stableexception handling ABI in the face of adding new hard registers for ISAextensions. In GCC 3.0 and later, the EH ABI is insulated from changesin the number of hard registers. Nevertheless, this macro can still beused to reduce the runtime memory requirements of the exception handlingroutines, which can be substantial if the ISA contains a lot ofregisters 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_REGISTERSThis macro is similar to @code{DWARF_FRAME_REGISTERS}, but is providedfor 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 registersis different than the internal representation for unwind column.Given a dwarf register, this macro should return the internal unwindcolumn number to use instead.See the PowerPC's SPE target for an example.@end defmac@defmac DWARF_FRAME_REGNUM (@var{regno})Define this macro if the target's representation for dwarf registersused in .eh_frame or .debug_frame is different from that used in otherdebug info sections. Given a GCC hard register number, this macroshould 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 infothat GCC has collected using @code{DWARF_FRAME_REGNUM} to those thatshould be output in .debug_frame (@code{@var{for_eh}} is zero) and.eh_frame (@code{@var{for_eh}} is nonzero). The default is toreturn @code{@var{regno}}.@end defmac@defmac REG_VALUE_IN_UNWIND_CONTEXTDefine this macro if the target stores register values as@code{_Unwind_Word} type in unwind context. It should be defined iftarget register size is larger than the size of @code{void *}. Thedefault is to store register values as @code{void *} type.@end defmac@defmac ASSUME_EXTENDED_UNWIND_CONTEXTDefine this macro to be 1 if the target always uses extended unwindcontext 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} isdefined and 0 otherwise.@end defmac@node Elimination@subsection Eliminating Frame Pointer and Arg Pointer@c prevent bad page break with this lineThis is about eliminating the frame pointer and arg pointer.@hook TARGET_FRAME_POINTER_REQUIREDThis target hook should return @code{true} if a function must have and usea frame pointer. This target hook is called in the reload pass. If its returnvalue is @code{true} the function will have a frame pointer.This target hook can in principle examine the current function and decideaccording to the facts, but on most machines the constant @code{false} or theconstant @code{true} suffices. Use @code{false} when the machine allows codeto be generated with no frame pointer, and doing so saves some time or space.Use @code{true} when there is no possible advantage to avoiding a framepointer.In certain cases, the compiler does not know how to produce valid codewithout a frame pointer. The compiler recognizes those cases andautomatically gives the function a frame pointer regardless of what@code{TARGET_FRAME_POINTER_REQUIRED} returns. You don't need to worry aboutthem.In a function that does not require a frame pointer, the frame pointerregister can be allocated for ordinary usage, unless you mark it as afixed register. See @code{FIXED_REGISTERS} for more information.Default return value is @code{false}.@end deftypefn@findex get_frame_size@defmac INITIAL_FRAME_POINTER_OFFSET (@var{depth-var})A C statement to store in the variable @var{depth-var} the differencebetween the frame pointer and the stack pointer values immediately afterthe function prologue. The value would be computed from informationsuch as the result of @code{get_frame_size ()} and the tables ofregisters @code{regs_ever_live} and @code{call_used_regs}.If @code{ELIMINABLE_REGS} is defined, this macro will be not be used andneed not be defined. Otherwise, it must be defined even if@code{TARGET_FRAME_POINTER_REQUIRED} always returns true; in thatcase, you may set @var{depth-var} to anything.@end defmac@defmac ELIMINABLE_REGSIf defined, this macro specifies a table of register pairs used toeliminate unneeded registers that point into the stack frame. If it is notdefined, the only elimination attempted by the compiler is to replacereferences to the frame pointer with references to the stack pointer.The definition of this macro is a list of structure initializations, eachof which specifies an original and replacement register.On some machines, the position of the argument pointer is not known untilthe compilation is completed. In such a case, a separate hard registermust be used for the argument pointer. This register can be eliminated byreplacing 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 smallexampleNote that the elimination of the argument pointer with the stack pointer isspecified first since that is the preferred elimination.@end defmac@hook TARGET_CAN_ELIMINATEThis target hook should returns @code{true} if the compiler is allowed totry to replace register number @var{from_reg} with register number@var{to_reg}. This target hook need only be defined if @code{ELIMINABLE_REGS}is defined, and will usually be @code{true}, since most of the casespreventing register elimination are things that the compiler alreadyknows about.Default return value is @code{true}.@end deftypefn@defmac INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var})This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}. Itspecifies the initial difference between the specified pair ofregisters. This macro must be defined if @code{ELIMINABLE_REGS} isdefined.@end defmac@node Stack Arguments@subsection Passing Function Arguments on the Stack@cindex arguments on stack@cindex stack argumentsThe macros in this section control how arguments are passedon the stack. See the following section for other macros thatcontrol passing certain arguments in registers.@hook TARGET_PROMOTE_PROTOTYPESThis target hook returns @code{true} if an argument declared in aprototype as an integral type smaller than @code{int} should actually bepassed as an @code{int}. In addition to avoiding errors in certaincases of mismatch, it also makes for better code on certain machines.The default is to not promote prototypes.@end deftypefn@defmac PUSH_ARGSA C expression. If nonzero, push insns will be used to passoutgoing arguments.If the target machine does not have a push instruction, set it to zero.That directs GCC to use an alternate strategy: toallocate the entire argument block and then store the arguments intoit. When @code{PUSH_ARGS} is nonzero, @code{PUSH_ROUNDING} must be defined too.@end defmac@defmac PUSH_ARGS_REVERSEDA C expression. If nonzero, function arguments will be evaluated fromlast to first, rather than from first to last. If this macro is notdefined, it defaults to @code{PUSH_ARGS} on targets where the stackand 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 thestack when an instruction attempts to push @var{npushed} bytes.On some machines, the definition@smallexample#define PUSH_ROUNDING(BYTES) (BYTES)@end smallexample@noindentwill suffice. But on other machines, instructions that appearto push one byte actually push two bytes in an attempt to maintainalignment. Then the definition should be@smallexample#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)@end smallexampleIf the value of this macro has a type, it should be an unsigned type.@end defmac@findex current_function_outgoing_args_size@defmac ACCUMULATE_OUTGOING_ARGSA C expression. If nonzero, the maximum amount of space required for outgoing argumentswill be computed and placed into the variable@code{current_function_outgoing_args_size}. No space will be pushedonto the stack for each call; instead, the function prologue shouldincrease 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 beenallocated for arguments even when their values are passed inregisters.The value of this macro is the size, in bytes, of the area reserved forarguments 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 itselfof the function.This space can be allocated by the caller, or be a part of themachine-dependent stack frame: @code{OUTGOING_REG_PARM_STACK_SPACE} sayswhich.@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 OUTGOING_REG_PARM_STACK_SPACE (@var{fntype})Define this to a nonzero value if it is the responsibility of thecaller to allocate the area reserved for arguments passed in registerswhen calling a function of @var{fntype}. @var{fntype} may be NULLif the function called is a library function.If @code{ACCUMULATE_OUTGOING_ARGS} is defined, this macro controlswhether the space for these arguments counts in the value of@code{current_function_outgoing_args_size}.@end defmac@defmac STACK_PARMS_IN_REG_PARM_AREADefine this macro if @code{REG_PARM_STACK_SPACE} is defined, but thestack 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 5feb93Normally, when a parameter is not passed in registers, it is placed on thestack beyond the @code{REG_PARM_STACK_SPACE} area. Defining this macrosuppresses this behavior and causes the parameter to be passed on thestack in its natural location.@end defmac@hook TARGET_RETURN_POPS_ARGSThis target hook returns the number of bytes of its own arguments thata function pops on returning, or 0 if the function pops no argumentsand the caller must therefore pop them all after the function returns.@var{fundecl} is a C variable whose value is a tree node that describesthe function in question. Normally it is a node of type@code{FUNCTION_DECL} that describes the declaration of the function.From this you can obtain the @code{DECL_ATTRIBUTES} of the function.@var{funtype} is a C variable whose value is a tree node thatdescribes the function in question. Normally it is a node of type@code{FUNCTION_TYPE} that describes the data type of the function.From this it is possible to obtain the data types of the value andarguments (if known).When a call to a library function is being considered, @var{fundecl}will contain an identifier node for the library function. Thus, ifyou need to distinguish among various library functions, you can do soby their names. Note that ``library function'' in this context meansa function used to perform arithmetic, whose name is known speciallyin the compiler and was not mentioned in the C code being compiled.@var{size} is the number of bytes of arguments passed on thestack. If a variable number of bytes is passed, it is zero, andargument popping will always be the responsibility of the calling function.On the VAX, all functions always pop their arguments, so the definitionof this macro is @var{size}. On the 68000, using the standardcalling convention, no functions pop their arguments, so the value ofthe macro is always 0 in this case. But an alternative callingconvention is available in which functions that take a fixed number ofarguments pop them but other functions (such as @code{printf}) popnothing (the caller pops all). When this convention is in use,@var{funtype} is examined to determine whether a function takes a fixednumber of arguments.@end deftypefn@defmac CALL_POPS_ARGS (@var{cum})A C expression that should indicate the number of bytes a call sequencepops 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 functionhave been accumulated.On certain architectures, such as the SH5, a call trampoline is usedthat pops certain registers off the stack, depending on the argumentsthat have been passed to the function. Since this is a property of thecall site, not of the called function, @code{RETURN_POPS_ARGS} is notappropriate.@end defmac@node Register Arguments@subsection Passing Arguments in Registers@cindex arguments in registers@cindex registers argumentsThis section describes the macros which let you control how varioustypes of arguments are passed in registers or how they are arranged inthe stack.@hook TARGET_FUNCTION_ARGReturn an RTX indicating whether a function argument is passed in aregister and if so, which register.The arguments are @var{ca}, which summarizes all the previousarguments; @var{mode}, the machine mode of the argument; @var{type},the data type of the argument as a tree node or 0 if that is not known(which happens for C support library functions); and @var{named},which is @code{true} for an ordinary argument and @code{false} fornameless arguments that correspond to @samp{@dots{}} in the calledfunction's prototype. @var{type} can be an incomplete type if asyntax error has previously occurred.The return value is usually either a @code{reg} RTX for the hardregister in which to pass the argument, or zero to pass the argumenton the stack.The value of the expression can also be a @code{parallel} RTX@. This isused when an argument is passed in multiple locations. The mode of the@code{parallel} should be the mode of the entire argument. The@code{parallel} holds any number of @code{expr_list} pairs; each onedescribes where part of the argument is passed. In each@code{expr_list} the first operand must be a @code{reg} RTX for the hardregister in which to pass this part of the argument, and the mode of theregister RTX indicates how large this part of the argument is. Thesecond operand of the @code{expr_list} is a @code{const_int} which givesthe offset in bytes into the entire argument of where this part starts.As a special exception the first @code{expr_list} in the @code{parallel}RTX may have a first operand of zero. This indicates that the entireargument is also stored on the stack.The last time this hook is called, it is called with @code{MODE ==VOIDmode}, and its result is passed to the @code{call} or @code{call_value}pattern as operands 2 and 3 respectively.@cindex @file{stdarg.h} and register argumentsThe usual way to make the ISO library @file{stdarg.h} work on amachine where some arguments are usually passed in registers, is tocause nameless arguments to be passed on the stack instead. This isdone by making @code{TARGET_FUNCTION_ARG} return 0 whenever@var{named} is @code{false}.@cindex @code{TARGET_MUST_PASS_IN_STACK}, and @code{TARGET_FUNCTION_ARG}@cindex @code{REG_PARM_STACK_SPACE}, and @code{TARGET_FUNCTION_ARG}You may use the hook @code{targetm.calls.must_pass_in_stack}in the definition of this macro to determine if this argument is of atype that must be passed in the stack. If @code{REG_PARM_STACK_SPACE}is not defined and @code{TARGET_FUNCTION_ARG} returns nonzero for such anargument, the compiler will abort. If @code{REG_PARM_STACK_SPACE} isdefined, the argument will be computed in the stack and then loaded intoa register.@end deftypefn@hook TARGET_MUST_PASS_IN_STACKThis target hook should return @code{true} if we should not pass @var{type}solely in registers. The file @file{expr.h} defines adefinition that is usually appropriate, refer to @file{expr.h} for additionaldocumentation.@end deftypefn@hook TARGET_FUNCTION_INCOMING_ARGDefine this hook if the target machine has ``register windows'', sothat the register in which a function sees an arguments is notnecessarily the same as the one in which the caller passed theargument.For such machines, @code{TARGET_FUNCTION_ARG} computes the register inwhich the caller passes the value, and@code{TARGET_FUNCTION_INCOMING_ARG} should be defined in a similarfashion to tell the function being called where the arguments willarrive.If @code{TARGET_FUNCTION_INCOMING_ARG} is not defined,@code{TARGET_FUNCTION_ARG} serves both purposes.@end deftypefn@hook TARGET_ARG_PARTIAL_BYTESThis target hook returns the number of bytes at the beginning of anargument that must be put in registers. The value must be zero forarguments that are passed entirely in registers or that are entirelypushed on the stack.On some machines, certain arguments must be passed partially inregisters and partially in memory. On these machines, typically thefirst few words of arguments are passed in registers, and the reston the stack. If a multi-word argument (a @code{double} or astructure) crosses that boundary, its first few words must be passedin registers and the rest must be pushed. This macro tells thecompiler when this occurs, and how many bytes should go in registers.@code{TARGET_FUNCTION_ARG} for these arguments should return the firstregister to be used by the caller for this argument; likewise@code{TARGET_FUNCTION_INCOMING_ARG}, for the called function.@end deftypefn@hook TARGET_PASS_BY_REFERENCEThis target hook should return @code{true} if an argument at theposition indicated by @var{cum} should be passed by reference. Thispredicate is queried after target independent reasons for beingpassed by reference, such as @code{TREE_ADDRESSABLE (type)}.If the hook returns true, a copy of that argument is made in memory and apointer to the argument is passed instead of the argument itself.The pointer is passed in whatever way is appropriate for passing a pointerto that type.@end deftypefn@hook TARGET_CALLEE_COPIESThe function argument described by the parameters to this hook isknown to be passed by reference. The hook should return true if thefunction argument should be copied by the callee instead of copiedby the caller.For any argument for which the hook returns true, if it can bedetermined that the argument is not modified, then a copy neednot be generated.The default version of this hook always returns false.@end deftypefn@defmac CUMULATIVE_ARGSA C type for declaring a variable that is used as the first argumentof @code{TARGET_FUNCTION_ARG} and other related values. For sometarget machines, the type @code{int} suffices and can hold the numberof bytes of argument so far.There is no need to record in @code{CUMULATIVE_ARGS} anything about thearguments that have been passed on the stack. The compiler has othervariables to keep track of that. For target machines on which allarguments are passed on the stack, there is no need to store anything in@code{CUMULATIVE_ARGS}; however, the data structure must exist andshould 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 afunction, but after the @var{cfun} descriptor for the function has beencreated. The back end may use this macro to update @var{cfun} toreflect 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. Thevariable has type @code{CUMULATIVE_ARGS}. The value of @var{fntype}is the tree node for the data type of the function which will receivethe args, or 0 if the args are to a compiler support library function.For direct calls that are not libcalls, @var{fndecl} contain thedeclaration node of the function. @var{fndecl} is also set when@code{INIT_CUMULATIVE_ARGS} is used to find arguments for the functionbeing compiled. @var{n_named_args} is set to the number of namedarguments, including a structure return address if it is passed as aparameter, 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 whichcontains the name of the function, as a string. @var{libname} is 0 whenan ordinary C function call is being processed. Thus, each time thismacro is called, either @var{libname} or @var{fntype} is nonzero, butnever 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 macrois 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 offinding the arguments for the function being compiled. If this macro isundefined, @code{INIT_CUMULATIVE_ARGS} is used instead.The value passed for @var{libname} is always 0, since library routineswith special calling conventions are never compiled with GCC@. Theargument @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_ADVANCEThis hook updates the summarizer variable pointed to by @var{ca} toadvance past an argument in the argument list. The values @var{mode},@var{type} and @var{named} describe that argument. Once this is done,the variable @var{cum} is suitable for analyzing the @emph{following}argument with @code{TARGET_FUNCTION_ARG}, etc.This hook need not do anything if the argument in question was passedon the stack. The compiler knows how to track the amount of stack spaceused for arguments without any special help.@end deftypefn@defmac FUNCTION_ARG_OFFSET (@var{mode}, @var{type})If defined, a C expression that is the number of bytes to add to theoffset of the argument passed in memory. This is needed for the SPU,which passes @code{char} and @code{short} arguments in the preferredslot that is in the middle of the quad word instead of starting at thetop.@end defmac@defmac FUNCTION_ARG_PADDING (@var{mode}, @var{type})If defined, a C expression which determines whether, and in which direction,to pad out an argument with extra space. The value should be of type@code{enum direction}: either @code{upward} to pad above the argument,@code{downward} to pad below, or @code{none} to inhibit padding.The @emph{amount} of padding is not controlled by this macro, but by thetarget hook @code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}. It isalways just enough to reach the next multiple of that boundary.This macro has a default definition which is right for most systems.For little-endian machines, the default is to pad upward. Forbig-endian machines, the default is to pad downward for an argument ofconstant size shorter than an @code{int}, and upward otherwise.@end defmac@defmac PAD_VARARGS_DOWNIf defined, a C expression which determines whether the defaultimplementation of va_arg will attempt to pad down before reading thenext argument, if that argument is smaller than its aligned space ascontrolled by @code{PARM_BOUNDARY}. If this macro is not defined, all sucharguments 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 andmemory. @var{first} is nonzero if this is the only element. Defining thismacro allows better control of register function parameters on big-endianmachines, without using @code{PARALLEL} rtl. In particular,@code{MUST_PASS_IN_STACK} need not test padding and mode of types inregisters, 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 sorequired.@end defmac@hook TARGET_FUNCTION_ARG_BOUNDARYThis hook returns the alignment boundary, in bits, of an argumentwith the specified mode and type. The default hook returns@code{PARM_BOUNDARY} for all arguments.@end deftypefn@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 hardregister in which function arguments are sometimes passed. This does@emph{not} include implicit arguments such as the static chain andthe structure-value address. On many machines, no registers can beused for this purpose since all function arguments are pushed on thestack.@end defmac@hook TARGET_SPLIT_COMPLEX_ARGThis hook should return true if parameter of type @var{type} are passedas two scalar parameters. By default, GCC will attempt to pack complexarguments into the target's word size. Some ABIs require complex argumentsto be split and treated as their individual components. For example, onAIX64, complex floats should be passed in a pair of floating pointregisters, even though a complex float would fit in one 64-bit floatingpoint register.The default value of this hook is @code{NULL}, which is treated as alwaysfalse.@end deftypefn@hook TARGET_BUILD_BUILTIN_VA_LISTThis hook returns a type node for @code{va_list} for the target.The default version of the hook returns @code{void*}.@end deftypefn@hook TARGET_ENUM_VA_LIST_PThis target hook is used in function @code{c_common_nodes_and_builtins}to iterate through the target specific builtin types for va_list. Thevariable @var{idx} is used as iterator. @var{pname} has to be a pointerto a @code{const char *} and @var{ptree} a pointer to a @code{tree} typedvariable.The arguments @var{pname} and @var{ptree} are used to store the result ofthis macro and are set to the name of the va_list builtin type and itsinternal type.If the return value of this macro is zero, then there is no more element.Otherwise the @var{IDX} should be increased for the next call of thismacro to iterate through all types.@end deftypefn@hook TARGET_FN_ABI_VA_LISTThis hook returns the va_list type of the calling convention specified by@var{fndecl}.The default version of this hook returns @code{va_list_type_node}.@end deftypefn@hook TARGET_CANONICAL_VA_LIST_TYPEThis hook returns the va_list type of the calling convention specified by thetype of @var{type}. If @var{type} is not a valid va_list type, it returns@code{NULL_TREE}.@end deftypefn@hook TARGET_GIMPLIFY_VA_ARG_EXPRThis hook performs target-specific gimplification of@code{VA_ARG_EXPR}. The first two parameters correspond to thearguments to @code{va_arg}; the latter two are as in@code{gimplify.c:gimplify_expr}.@end deftypefn@hook TARGET_VALID_POINTER_MODEDefine this to return nonzero if the port can handle pointerswith machine mode @var{mode}. The default version of thishook returns true for both @code{ptr_mode} and @code{Pmode}.@end deftypefn@hook TARGET_REF_MAY_ALIAS_ERRNO@hook TARGET_SCALAR_MODE_SUPPORTED_PDefine this to return nonzero if the port is prepared to handleinsns involving scalar mode @var{mode}. For a scalar mode to beconsidered supported, all the basic arithmetic and comparisonsmust work.The default version of this hook returns true for any moderequired to handle the basic C types (as defined by the port).Included here are the double-word arithmetic supported by thecode in @file{optabs.c}.@end deftypefn@hook TARGET_VECTOR_MODE_SUPPORTED_PDefine this to return nonzero if the port is prepared to handleinsns involving vector mode @var{mode}. At the very least, itmust have move patterns for this mode.@end deftypefn@hook TARGET_ARRAY_MODE_SUPPORTED_P@hook TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_PDefine this to return nonzero for machine modes for which the port hassmall register classes. If this target hook returns nonzero for a given@var{mode}, the compiler will try to minimize the lifetime of registersin @var{mode}. The hook may be called with @code{VOIDmode} as argument.In this case, the hook is expected to return nonzero if it returns nonzerofor any mode.On some machines, it is risky to let hard registers live across arbitraryinsns. Typically, these machines have instructions that require valuesto be in specific registers (like an accumulator), and reload will failif the required hard register is used for another purpose across such aninsn.Passes before reload do not know which hard registers will be usedin an instruction, but the machine modes of the registers set or used inthe instruction are already known. And for some machines, registerclasses are small for, say, integer registers but not for floating pointregisters. For example, the AMD x86-64 architecture requires specificregisters for the legacy x86 integer instructions, but there are manySSE registers for floating point operations. On such targets, a goodstrategy may be to return nonzero from this hook for @code{INTEGRAL_MODE_P}machine modes but zero for the SSE register classes.The default version of this hook returns false for any mode. It is alwayssafe to redefine this hook to return with a nonzero value. But if youunnecessarily define it, you will reduce the amount of optimizationsthat can be performed in some cases. If you do not define this hookto return a nonzero value when it is required, the compiler will run outof spill registers and print a fatal error message.@end deftypefn@hook TARGET_FLAGS_REGNUM@node Scalar Return@subsection How Scalar Function Values Are Returned@cindex return values in registers@cindex values, returned by functions@cindex scalars, returned as valuesThis section discusses the macros that control returning scalars asvalues---values that can fit in registers.@hook TARGET_FUNCTION_VALUEDefine this to return an RTX representing the place where a functionreturns or receives a value of data type @var{ret_type}, a tree noderepresenting a data type. @var{fn_decl_or_type} is a tree noderepresenting @code{FUNCTION_DECL} or @code{FUNCTION_TYPE} of afunction being called. If @var{outgoing} is false, the hook shouldcompute the register in which the caller will see the return value.Otherwise, the hook should return an RTX representing the place wherea function returns a value.On many machines, only @code{TYPE_MODE (@var{ret_type})} is relevant.(Actually, on most machines, scalar values are returned in the sameplace regardless of mode.) The value of the expression is usually a@code{reg} RTX for the hard register where the return value is stored.The value can also be a @code{parallel} RTX, if the return value is inmultiple places. See @code{TARGET_FUNCTION_ARG} for an explanation of the@code{parallel} form. Note that the callee will populate everylocation specified in the @code{parallel}, but if the first element ofthe @code{parallel} contains the whole return value, callers will usethat element as the canonical location and ignore the others. The m68kport uses this type of @code{parallel} to return pointers in both@samp{%a0} (the canonical location) and @samp{%d0}.If @code{TARGET_PROMOTE_FUNCTION_RETURN} returns true, you must applythe same promotion rules specified in @code{PROMOTE_MODE} if@var{valtype} is a scalar type.If the precise function being called is known, @var{func} is a treenode (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a nullpointer. This makes it possible to use a different value-returningconvention for specific functions when all their calls areknown.Some target machines have ``register windows'' so that the register inwhich a function returns its value is not the same as the one in whichthe caller sees the value. For such machines, you should returndifferent RTX depending on @var{outgoing}.@code{TARGET_FUNCTION_VALUE} is not used for return values withaggregate data types, because these are returned in another way. See@code{TARGET_STRUCT_VALUE_RTX} and related macros, below.@end deftypefn@defmac FUNCTION_VALUE (@var{valtype}, @var{func})This macro has been deprecated. Use @code{TARGET_FUNCTION_VALUE} fora new target instead.@end defmac@defmac LIBCALL_VALUE (@var{mode})A C expression to create an RTX representing the place where a libraryfunction returns a value of mode @var{mode}.Note that ``library function'' in this context means a compilersupport routine, used to perform arithmetic, whose name is knownspecially by the compiler and was not mentioned in the C code beingcompiled.@end defmac@hook TARGET_LIBCALL_VALUEDefine this hook if the back-end needs to know the name of the libcallfunction in order to determine where the result should be returned.The mode of the result is given by @var{mode} and the name of the calledlibrary function is given by @var{fun}. The hook should return an RTXrepresenting the place where the library function result will be returned.If this hook is not defined, then LIBCALL_VALUE will be used.@end deftypefn@defmac FUNCTION_VALUE_REGNO_P (@var{regno})A C expression that is nonzero if @var{regno} is the number of a hardregister in which the values of called function may come back.A register whose use for returning values is limited to serving as thesecond of a pair (for a value of type @code{double}, say) need not berecognized by this macro. So for most machines, this definitionsuffices:@smallexample#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)@end smallexampleIf the machine has register windows, so that the caller and the calledfunction use different registers for the return value, this macroshould 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_PA target hook that return @code{true} if @var{regno} is the number of a hardregister in which the values of called function may come back.A register whose use for returning values is limited to serving as thesecond of a pair (for a value of type @code{double}, say) need not berecognized by this target hook.If the machine has register windows, so that the caller and the calledfunction use different registers for the return value, this target hookshould recognize only the caller's register numbers.If this hook is not defined, then FUNCTION_VALUE_REGNO_P will be used.@end deftypefn@defmac APPLY_RESULT_SIZEDefine this macro if @samp{untyped_call} and @samp{untyped_return}need more space than is implied by @code{FUNCTION_VALUE_REGNO_P} forsaving and restoring an arbitrary return value.@end defmac@hook TARGET_RETURN_IN_MSBThis hook should return true if values of type @var{type} are returnedat the most significant end of a register (in other words, if they arepadded at the least significant end). You can assume that @var{type}is returned in a register; the caller is required to check this.Note that the register provided by @code{TARGET_FUNCTION_VALUE} mustbe able to hold the complete return value. For example, if a 1-, 2-or 3-byte structure is returned at the most significant end of a4-byte register, @code{TARGET_FUNCTION_VALUE} should provide an@code{SImode} rtx.@end deftypefn@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 addressWhen a function value's mode is @code{BLKmode} (and in some othercases), the value is not returned according to@code{TARGET_FUNCTION_VALUE} (@pxref{Scalar Return}). Instead, thecaller passes the address of a block of memory in which the valueshould be stored. This address is called the @dfn{structure valueaddress}.This section describes how to control returning structure values inmemory.@hook TARGET_RETURN_IN_MEMORYThis target hook should return a nonzero value to say to return thefunction value in memory, just as large structures are always returned.Here @var{type} will be the data type of the value, and @var{fntype}will be the type of the function doing the returning, or @code{NULL} forlibcalls.Note that values of mode @code{BLKmode} must be explicitly handledby this function. Also, the option @option{-fpcc-struct-return}takes effect regardless of this macro. On most systems, it ispossible to leave the hook undefined; this causes a defaultdefinition to be used, whose value is the constant 1 for @code{BLKmode}values, and 0 otherwise.Do not use this hook to indicate that structures and unions should alwaysbe returned in memory. You should instead use @code{DEFAULT_PCC_STRUCT_RETURN}to indicate this.@end deftypefn@defmac DEFAULT_PCC_STRUCT_RETURNDefine this macro to be 1 if all structure and union return values must bein memory. Since this results in slower code, this should be definedonly if needed for compatibility with other compilers or with an ABI@.If you define this macro to be 0, then the conventions used for structureand 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_RTXThis target hook should return the location of the structure valueaddress (normally a @code{mem} or @code{reg}), or 0 if the address ispassed as an ``invisible'' first argument. Note that @var{fndecl} maybe @code{NULL}, for libcalls. You do not need to define this targethook if the address is always passed as an ``invisible'' firstargument.On some architectures the place where the structure value addressis found by the called function is not the same place that thecaller put it. This can be due to register windows, or it couldbe because the function prologue moves it to a different place.@var{incoming} is @code{1} or @code{2} when the location is needed inthe context of the called function, and @code{0} in the context ofthe caller.If @var{incoming} is nonzero and the address is to be found on thestack, return a @code{mem} which refers to the frame pointer. If@var{incoming} is @code{2}, the result is being used to fetch thestructure value address at the beginning of a function. If you needto emit adjusting code, you should do it at this point.@end deftypefn@defmac PCC_STATIC_STRUCT_RETURNDefine this macro if the usual system convention on the target machinefor returning structures and unions is for the called function to returnthe address of a static variable containing the value.Do not define this if the usual system convention is for the caller topass an address to the subroutine.This macro has effect in @option{-fpcc-struct-return} mode, but it doesnothing when you use @option{-freg-struct-return} mode.@end defmac@hook TARGET_GET_RAW_RESULT_MODE@hook TARGET_GET_RAW_ARG_MODE@node Caller Saves@subsection Caller-Saves Register AllocationIf you enable it, GCC can save registers around function calls. Thismakes it possible to use call-clobbered registers to hold variables thatmust live across calls.@defmac CALLER_SAVE_PROFITABLE (@var{refs}, @var{calls})A C expression to determine whether it is worthwhile to consider placinga pseudo-register in a call-clobbered hard register and saving andrestoring it around each function call. The expression should be 1 whenthis is worth doing, and 0 otherwise.If you don't define this macro, a default is used which is good on mostmachines: @code{4 * @var{calls} < @var{refs}}.@end defmac@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 bereturned. For most machines this macro need not be defined since GCCwill select the smallest suitable mode.@end defmac@node Function Entry@subsection Function Entry and Exit@cindex function entry and exit@cindex prologue@cindex epilogueThis section describes the macros that output function entry(@dfn{prologue}) and exit (@dfn{epilogue}) code.@hook TARGET_ASM_FUNCTION_PROLOGUEIf defined, a function that outputs the assembler code for entry to afunction. The prologue is responsible for setting up the stack frame,initializing the frame pointer register, saving registers that must besaved, and allocating @var{size} additional bytes of storage for thelocal variables. @var{size} is an integer. @var{file} is a stdiostream to which the assembler code should be output.The label for the beginning of the function need not be output by thismacro. That has already been done when the macro is run.@findex regs_ever_liveTo determine which registers to save, the macro can refer to the array@code{regs_ever_live}: element @var{r} is nonzero if hard register@var{r} is used anywhere within the function. This implies the functionprologue should save register @var{r}, provided it is not one of thecall-used registers. (@code{TARGET_ASM_FUNCTION_EPILOGUE} must likewise use@code{regs_ever_live}.)On machines that have ``register windows'', the function entry code doesnot save on the stack the registers that are in the windows, even ifthey are supposed to be preserved by function calls; instead it takesappropriate steps to ``push'' the register stack, if any non-call-usedregisters are used in the function.@findex frame_pointer_neededOn machines where functions may or may not have frame-pointers, thefunction entry code must vary accordingly; it must set up the framepointer if one is wanted, and not otherwise. To determine whether aframe pointer is in wanted, the macro can refer to the variable@code{frame_pointer_needed}. The variable's value will be 1 at runtime in a function that needs a frame pointer. @xref{Elimination}.The function entry code is responsible for allocating any stack spacerequired for the function. This stack space consists of the regionslisted below. In most cases, these regions are allocated in theorder listed, with the last listed region closest to the top of thestack (the lowest address if @code{STACK_GROWS_DOWNWARD} is defined, andthe highest address if it is not defined). You can use a different orderfor a machine if doing so is more convenient or required forcompatibility reasons. Except in cases where required by standardor by a debugger, there is no reason why the stack layout used by GCCneed agree with that used by other compilers for a machine.@end deftypefn@hook TARGET_ASM_FUNCTION_END_PROLOGUEIf defined, a function that outputs assembler code at the end of aprologue. This should be used when the function prologue is beingemitted as RTL, and you have some extra assembler that needs to beemitted. @xref{prologue instruction pattern}.@end deftypefn@hook TARGET_ASM_FUNCTION_BEGIN_EPILOGUEIf defined, a function that outputs assembler code at the start of anepilogue. This should be used when the function epilogue is beingemitted as RTL, and you have some extra assembler that needs to beemitted. @xref{epilogue instruction pattern}.@end deftypefn@hook TARGET_ASM_FUNCTION_EPILOGUEIf defined, a function that outputs the assembler code for exit from afunction. The epilogue is responsible for restoring the savedregisters and stack pointer to their values when the function wascalled, and returning control to the caller. This macro takes thesame arguments as the macro @code{TARGET_ASM_FUNCTION_PROLOGUE}, and theregisters to restore are determined from @code{regs_ever_live} and@code{CALL_USED_REGISTERS} in the same way.On some machines, there is a single instruction that does all the workof returning from the function. On these machines, give thatinstruction the name @samp{return} and do not define the macro@code{TARGET_ASM_FUNCTION_EPILOGUE} at all.Do not define a pattern named @samp{return} if you want the@code{TARGET_ASM_FUNCTION_EPILOGUE} to be used. If you want the targetswitches to control whether return instructions or epilogues are used,define a @samp{return} pattern with a validity condition that tests thetarget switches appropriately. If the @samp{return} pattern's validitycondition is false, epilogues will be used.On machines where functions may or may not have frame-pointers, thefunction exit code must vary accordingly. Sometimes the code for thesetwo cases is completely different. To determine whether a frame pointeris wanted, the macro can refer to the variable@code{frame_pointer_needed}. The variable's value will be 1 when compilinga function that needs a frame pointer.Normally, @code{TARGET_ASM_FUNCTION_PROLOGUE} and@code{TARGET_ASM_FUNCTION_EPILOGUE} must treat leaf functions specially.The C variable @code{current_function_is_leaf} is nonzero for such afunction. @xref{Leaf Functions}.On some machines, some functions pop their arguments on exit whileothers leave that for the caller to do. For example, the 68020 whengiven @option{-mrtd} pops arguments in functions that take a fixednumber of arguments.@findex current_function_pops_argsYour definition of the macro @code{RETURN_POPS_ARGS} decides whichfunctions pop their own arguments. @code{TARGET_ASM_FUNCTION_EPILOGUE}needs to know what was decided. The number of bytes of the currentfunction's arguments that this function should pop is available in@code{crtl->args.pops_args}. @xref{Scalar Return}.@end deftypefn@itemize @bullet@item@findex current_function_pretend_args_sizeA region of @code{current_function_pretend_args_size} bytes ofuninitialized space just underneath the first argument arriving on thestack. (This may not be at the very start of the allocated stack regionif the calling sequence has pushed anything else since pushing the stackarguments. But usually, on such machines, nothing else has been pushedyet, because the function prologue itself does all the pushing.) Thisregion is used on machines where an argument may be passed partly inregisters and partly in memory, and, in some cases to support thefeatures in @code{<stdarg.h>}.@itemAn 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 asthe return address and pointers to previous stack frames, ismachine-specific and usually depends on which registers have been usedin the function. Machines with register windows often do not requirea save area.@itemA region of at least @var{size} bytes, possibly rounded up to an allocationboundary, to contain the local variables of the function. On some machines,this region and the save area may occur in the opposite order, with thesave area closer to the top of the stack.@item@cindex @code{ACCUMULATE_OUTGOING_ARGS} and stack framesOptionally, when @code{ACCUMULATE_OUTGOING_ARGS} is defined, a region of@code{current_function_outgoing_args_size} bytes to be used for outgoingargument lists of the function. @xref{Stack Arguments}.@end itemize@defmac EXIT_IGNORE_STACKDefine this macro as a C expression that is nonzero if the returninstruction or the function epilogue ignores the value of the stackpointer; in other words, if it is safe to delete an instruction toadjust the stack pointer before a return from the function. Thedefault is 0.Note that this macro's value is relevant only for functions for whichframe pointers are maintained. It is never safe to delete a finalstack adjustment in a function that has no frame pointer, and thecompiler 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 areused by the epilogue or the @samp{return} pattern. The stack and framepointer 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 areused by the exception handling mechanism, and so should be considered liveon entry to an exception edge.@end defmac@defmac DELAY_SLOTS_FOR_EPILOGUEDefine this macro if the function epilogue contains delay slots to whichinstructions from the rest of the function can be ``moved''. Thedefinition should be a C expression whose value is an integerrepresenting the number of delay slots there.@end defmac@defmac ELIGIBLE_FOR_EPILOGUE_DELAY (@var{insn}, @var{n})A C expression that returns 1 if @var{insn} can be placed in delayslot number @var{n} of the epilogue.The argument @var{n} is an integer which identifies the delay slot nowbeing considered (since different slots may have different rules ofeligibility). It is never negative and is always less than the numberof epilogue delay slots (what @code{DELAY_SLOTS_FOR_EPILOGUE} returns).If you reject a particular insn for a given delay slot, in principle, itmay be reconsidered for a subsequent delay slot. Also, other insns may(at least in principle) be considered for the so far unfilled delayslot.@findex current_function_epilogue_delay_list@findex final_scan_insnThe insns accepted to fill the epilogue delay slots are put in an RTLlist made with @code{insn_list} objects, stored in the variable@code{current_function_epilogue_delay_list}. The insn for the firstdelay slot comes first in the list. Your definition of the macro@code{TARGET_ASM_FUNCTION_EPILOGUE} should fill the delay slots byoutputting the insns in this list, usually by calling@code{final_scan_insn}.You need not define this macro if you did not define@code{DELAY_SLOTS_FOR_EPILOGUE}.@end defmac@hook TARGET_ASM_OUTPUT_MI_THUNKA function that outputs the assembler code for a thunkfunction, used to implement C++ virtual function calls with multipleinheritance. The thunk acts as a wrapper around a virtual function,adjusting the implicit object parameter before handing control off tothe real function.First, emit code to add the integer @var{delta} to the location thatcontains the incoming first argument. Assume that this argumentcontains a pointer, and is the one used to pass the @code{this} pointerin C++. This is the incoming argument @emph{before} the function prologue,e.g.@: @samp{%o0} on a sparc. The addition must preserve the values ofall other incoming arguments.Then, if @var{vcall_offset} is nonzero, an additional adjustment should bemade after adding @code{delta}. In particular, if @var{p} is theadjusted pointer, the following adjustment should be made:@smallexamplep += (*((ptrdiff_t **)p))[vcall_offset/sizeof(ptrdiff_t)]@end smallexampleAfter the additions, emit code to jump to @var{function}, which is a@code{FUNCTION_DECL}. This is a direct pure jump, not a call, and doesnot touch the return address. Hence returning from @var{FUNCTION} willreturn to whoever called the current @samp{thunk}.The effect must be as if @var{function} had been called directly withthe adjusted first argument. This macro is responsible for emitting allof the code for a thunk function; @code{TARGET_ASM_FUNCTION_PROLOGUE}and @code{TARGET_ASM_FUNCTION_EPILOGUE} are not invoked.The @var{thunk_fndecl} is redundant. (@var{delta} and @var{function}have already been extracted from it.) It might possibly be useful onsome targets, but probably not.If you do not define this macro, the target-independent code in the C++front end will generate a less efficient heavyweight thunk that calls@var{function} instead of jumping to it. The generic approach doesnot support varargs.@end deftypefn@hook TARGET_ASM_CAN_OUTPUT_MI_THUNKA function that returns true if TARGET_ASM_OUTPUT_MI_THUNK would be ableto output the assembler code for the thunk function specified by thearguments it is passed, and false otherwise. In the latter case, thegeneric approach will be used by the C++ front end, with the limitationspreviously exposed.@end deftypefn@node Profiling@subsection Generating Code for Profiling@cindex profiling, code generationThese 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} someassembler code to call the profiling subroutine @code{mcount}.@findex mcountThe details of how @code{mcount} expects to be called are determined byyour operating system environment, not by GCC@. To figure them out,compile a small program for profiling using the system's installed Ccompiler and look at the assembler code that results.Older implementations of @code{mcount} expect the address of a countervariable to be loaded into some register. The name of this variable is@samp{LP} followed by the number @var{labelno}, so you would generatethe name using @samp{LP%d} in a @code{fprintf}.@end defmac@defmac PROFILE_HOOKA C statement or compound statement to output to @var{file} some assemblycode to call the profiling subroutine @code{mcount} even the target doesnot support profiling.@end defmac@defmac NO_PROFILE_COUNTERSDefine this macro to be an expression with a nonzero value if the@code{mcount} subroutine on your system does not need a counter variableallocated for each function. This is true for almost all modernimplementations. If you define this macro, you must not use the@var{labelno} argument to @code{FUNCTION_PROFILER}.@end defmac@defmac PROFILE_BEFORE_PROLOGUEDefine this macro if the code for function profiling should come beforethe function prologue. Normally, the profiling code comes after.@end defmac@node Tail Calls@subsection Permitting tail calls@cindex tail calls@hook TARGET_FUNCTION_OK_FOR_SIBCALLTrue if it is ok to do sibling call optimization for the specifiedcall expression @var{exp}. @var{decl} will be the called function,or @code{NULL} if this is an indirect call.It is not uncommon for limitations of calling conventions to preventtail calls to functions outside the current unit of translation, orduring PIC compilation. The hook is used to enforce these restrictions,as the @code{sibcall} md pattern can not fail, or fall over to a``normal'' call. The criteria for successful sibling call optimizationmay vary greatly between different architectures.@end deftypefn@hook TARGET_EXTRA_LIVE_ON_ENTRYAdd any hard registers to @var{regs} that are live on entry to thefunction. This hook only needs to be defined to provide registers thatcannot be found by examination of FUNCTION_ARG_REGNO_P, the callee savedregisters, STATIC_CHAIN_INCOMING_REGNUM, STATIC_CHAIN_REGNUM,TARGET_STRUCT_VALUE_RTX, FRAME_POINTER_REGNUM, EH_USES,FRAME_POINTER_REGNUM, ARG_POINTER_REGNUM, and the PIC_OFFSET_TABLE_REGNUM.@end deftypefn@hook TARGET_SET_UP_BY_PROLOGUE@node Stack Smashing Protection@subsection Stack smashing protection@cindex stack smashing protection@hook TARGET_STACK_PROTECT_GUARDThis hook returns a @code{DECL} node for the external variable to usefor the stack protection guard. This variable is initialized by theruntime to some random value and is used to initialize the guard valuethat is placed at the top of the local stack frame. The type of thisvariable must be @code{ptr_type_node}.The default version of this hook creates a variable called@samp{__stack_chk_guard}, which is normally defined in @file{libgcc2.c}.@end deftypefn@hook TARGET_STACK_PROTECT_FAILThis hook returns a tree expression that alerts the runtime that thestack protect guard variable has been modified. This expression shouldinvolve a call to a @code{noreturn} function.The default version of this hook invokes a function called@samp{__stack_chk_fail}, taking no arguments. This function isnormally defined in @file{libgcc2.c}.@end deftypefn@hook TARGET_SUPPORTS_SPLIT_STACK@node Varargs@section Implementing the Varargs Macros@cindex varargs implementationGCC comes with an implementation of @code{<varargs.h>} and@code{<stdarg.h>} that work without change on machines that pass argumentson the stack. Other machines require their own implementations ofvarargs, and the two machine independent header files must haveconditionals to include it.ISO @code{<stdarg.h>} differs from traditional @code{<varargs.h>} mainly inthe calling convention for @code{va_start}. The traditionalimplementation takes just one argument, which is the variable in whichto store the argument pointer. The ISO implementation of@code{va_start} takes an additional second argument. The user issupposed to write the last named argument of the function here.However, @code{va_start} should not use this argument. The way to findthe end of the named arguments is with the built-in functions describedbelow.@defmac __builtin_saveregs ()Use this built-in function to save the argument registers in memory sothat the varargs mechanism can access them. Both ISO and traditionalversions of @code{va_start} must use @code{__builtin_saveregs}, unlessyou use @code{TARGET_SETUP_INCOMING_VARARGS} (see below) instead.On some machines, @code{__builtin_saveregs} is open-coded under thecontrol of the target hook @code{TARGET_EXPAND_BUILTIN_SAVEREGS}. Onother 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 thebeginning 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 startsto 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 stackargument, as type @code{void *}. If @code{ARGS_GROW_DOWNWARD}, itreturns the address of the location above the first anonymous stackargument. Use it in @code{va_start} to initialize the pointer forfetching arguments from the stack. Also use it in @code{va_start} toverify that the second parameter @var{lastarg} is the last named argumentof the current function.@end defmac@defmac __builtin_classify_type (@var{object})Since each machine has its own conventions for which data types arepassed in which kind of register, your implementation of @code{va_arg}has to embody these conventions. The easiest way to categorize thespecified data type is to use @code{__builtin_classify_type} togetherwith @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 whatkind of type that is---integer, floating, pointer, structure, and so on.The file @file{typeclass.h} defines an enumeration that you can use tointerpret the values of @code{__builtin_classify_type}.@end defmacThese machine description macros help implement varargs:@hook TARGET_EXPAND_BUILTIN_SAVEREGSIf defined, this hook produces the machine-specific code for a call to@code{__builtin_saveregs}. This code will be moved to the verybeginning of the function, before any parameter access are made. Thereturn value of this function should be an RTX that contains the valueto use as the return of @code{__builtin_saveregs}.@end deftypefn@hook TARGET_SETUP_INCOMING_VARARGSThis target hook offers an alternative to using@code{__builtin_saveregs} and defining the hook@code{TARGET_EXPAND_BUILTIN_SAVEREGS}. Use it to store the anonymousregister arguments into the stack so that all the arguments appear tohave been passed consecutively on the stack. Once this is done, you canuse the standard implementation of varargs that works for machines thatpass all their arguments on the stack.The argument @var{args_so_far} points to the @code{CUMULATIVE_ARGS} datastructure, containing the values that are obtained after processing thenamed arguments. The arguments @var{mode} and @var{type} describe thelast named argument---its machine mode and its data type as a tree node.The target hook should do two things: first, push onto the stack all theargument registers @emph{not} used for the named arguments, and second,store the size of the data thus pushed into the @code{int}-valuedvariable pointed to by @var{pretend_args_size}. The value that youstore here will serve as additional offset for setting up the stackframe.Because you must generate code to push the anonymous arguments atcompile time without knowing their data types,@code{TARGET_SETUP_INCOMING_VARARGS} is only useful on machines thathave just a single category of argument register and use it uniformlyfor all data types.If the argument @var{second_time} is nonzero, it means that thearguments of the function are being analyzed for the second time. Thishappens for an inline function, which is not actually compiled until theend of the source file. The hook @code{TARGET_SETUP_INCOMING_VARARGS} shouldnot generate any instructions in this case.@end deftypefn@hook TARGET_STRICT_ARGUMENT_NAMINGDefine this hook to return @code{true} if the location where a functionargument is passed depends on whether or not it is a named argument.This hook controls how the @var{named} argument to @code{TARGET_FUNCTION_ARG}is set for varargs and stdarg functions. If this hook returns@code{true}, the @var{named} argument is always true for namedarguments, and false for unnamed arguments. If it returns @code{false},but @code{TARGET_PRETEND_OUTGOING_VARARGS_NAMED} returns @code{true},then all arguments are treated as named. Otherwise, all named argumentsexcept the last are treated as named.You need not define this hook if it always returns @code{false}.@end deftypefn@hook TARGET_PRETEND_OUTGOING_VARARGS_NAMEDIf you need to conditionally change ABIs so that one works with@code{TARGET_SETUP_INCOMING_VARARGS}, but the other works like neither@code{TARGET_SETUP_INCOMING_VARARGS} nor @code{TARGET_STRICT_ARGUMENT_NAMING} wasdefined, then define this hook to return @code{true} if@code{TARGET_SETUP_INCOMING_VARARGS} is used, @code{false} otherwise.Otherwise, you should not define this hook.@end deftypefn@node Trampolines@section Trampolines for Nested Functions@cindex trampolines for nested functions@cindex nested functions, trampolines forA @dfn{trampoline} is a small piece of code that is created at run timewhen the address of a nested function is taken. It normally resides onthe stack, in the stack frame of the containing function. These macrostell GCC how to generate code to allocate and initialize atrampoline.The instructions in the trampoline must do two things: load a constantaddress into the static chain register, and jump to the real address ofthe nested function. On CISC machines such as the m68k, this requirestwo instructions, a move immediate and a jump. Then the two addressesexist in the trampoline as word-long immediate operands. On RISCmachines, it is often necessary to load each address into a register intwo parts. Then pieces of each address form separate immediateoperands.The code generated to initialize the trampoline must store the variableparts---the static chain value and the function address---into theimmediate operands of the instructions. On a CISC machine, this issimply a matter of copying each address to a memory reference at theproper offset from the start of the trampoline. On a RISC machine, itmay be necessary to take out pieces of the address and store themseparately.@hook TARGET_ASM_TRAMPOLINE_TEMPLATEThis hook is called by @code{assemble_trampoline_template} to output,on the stream @var{f}, assembler code for a block of data that containsthe constant parts of a trampoline. This code should not include alabel---the label is taken care of automatically.If you do not define this hook, it means no template is neededfor the target. Do not define this hook on systems where the block movecode to copy the trampoline into place would be larger than the codeto generate it on the spot.@end deftypefn@defmac TRAMPOLINE_SECTIONReturn 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_SIZEA C expression for the size in bytes of the trampoline, as an integer.@end defmac@defmac TRAMPOLINE_ALIGNMENTAlignment 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_INITThis hook is called to initialize a trampoline.@var{m_tramp} is an RTX for the memory block for the trampoline; @var{fndecl}is the @code{FUNCTION_DECL} for the nested function; @var{static_chain} is anRTX for the static chain value that should be passed to the functionwhen it is called.If the target defines @code{TARGET_ASM_TRAMPOLINE_TEMPLATE}, then thefirst thing this hook should do is emit a block move into @var{m_tramp}from the memory block returned by @code{assemble_trampoline_template}.Note that the block move need only cover the constant parts of thetrampoline. If the target isolates the variable parts of the trampolineto the end, not all @code{TRAMPOLINE_SIZE} bytes need be copied.If the target requires any other actions, such as flushing caches orenabling stack execution, these actions should be performed afterinitializing the trampoline proper.@end deftypefn@hook TARGET_TRAMPOLINE_ADJUST_ADDRESSThis hook should perform any machine-specific adjustment inthe address of the trampoline. Its argument contains the address of thememory block that was passed to @code{TARGET_TRAMPOLINE_INIT}. In casethe address to be used for a function call should be different from theaddress at which the template was stored, the different address shouldbe returned; otherwise @var{addr} should be returned unchanged.If this hook is not defined, @var{addr} will be used for function calls.@end deftypefnImplementing trampolines is difficult on many machines because they haveseparate instruction and data caches. Writing into a stack locationfails to clear the memory in the instruction cache, so when the programjumps to that location, it executes the old contents.Here are two possible solutions. One is to clear the relevant parts ofthe instruction cache whenever a trampoline is set up. The other is tomake all trampolines identical, by having them jump to a standardsubroutine. The former technique makes trampoline execution faster; thelatter makes initialization faster.To clear the instruction cache when a trampoline is initialized, definethe following macro.@defmac CLEAR_INSN_CACHE (@var{beg}, @var{end})If defined, expands to a C expression clearing the @emph{instructioncache} in the specified interval. The definition of this macro wouldtypically be a series of @code{asm} statements. Both @var{beg} and@var{end} are both pointer expressions.@end defmacTo use a standard subroutine, define the following macro. In addition,you must make sure that the instructions in a trampoline fill an entirecache line with identical instructions, or else ensure that thebeginning of the trampoline code is always aligned at the same point inits cache line. Look in @file{m68k.h} as a guide.@defmac TRANSFER_FROM_TRAMPOLINEDefine this macro if trampolines need a special subroutine to do theirwork. The macro should expand to a series of @code{asm} statementswhich 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 compiledC function when you jump to the subroutine, you can do so by placing aspecial label of your own in the assembler code. Use one @code{asm}statement to generate an assembler label, and another to make the labelglobal. Then trampolines can use that label to jump directly to yourspecial 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 lineHere is an explanation of implicit calls to library routines.@defmac DECLARE_LIBRARY_RENAMESThis macro, if defined, should expand to a piece of C code that will getexpanded when compiling functions for libgcc.a. It can be used toprovide alternate names for GCC's internal library functions if thereare ABI-mandated names that the compiler should provide.@end defmac@findex set_optab_libfunc@findex init_one_libfunc@hook TARGET_INIT_LIBFUNCSThis hook should declare additional library routines or renameexisting ones, using the functions @code{set_optab_libfunc} and@code{init_one_libfunc} defined in @file{optabs.c}.@code{init_optabs} calls this macro after initializing all the normallibrary routines.The default is to do nothing. Most ports don't need to define this hook.@end deftypefn@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 thatimplements the floating point comparison operator @var{comparison} inmode @var{mode} will return a boolean, and @var{false} if it willreturn a tristate.GCC's own floating point libraries return tristates from thecomparison operators, so the default returns false always. Most portsdon't need to define this macro.@end defmac@defmac TARGET_LIB_INT_CMP_BIASEDThis macro should evaluate to @code{true} if the integer comparisonfunctions (like @code{__cmpdi2}) return 0 to indicate that the firstoperand 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 routinesin @file{libgcc.a}, you do not need to define this macro.@end defmac@cindex @code{EDOM}, implicit usage@findex matherr@defmac TARGET_EDOMThe value of @code{EDOM} on the target machine, as a C integer constantexpression. If you don't define this macro, GCC does not attempt todeposit the value of @code{EDOM} into @code{errno} directly. Look in@file{/usr/include/errno.h} to find the value of @code{EDOM} on yoursystem.If you do not define @code{TARGET_EDOM}, then compiled code reportsdomain errors by calling the library function and letting it report theerror. If mathematical functions on your system use @code{matherr} whenthere is an error, then you should leave @code{TARGET_EDOM} undefined sothat @code{matherr} is used normally.@end defmac@cindex @code{errno}, implicit usage@defmac GEN_ERRNO_RTXDefine this macro as a C expression to create an rtl expression thatrefers to the global ``variable'' @code{errno}. (On certain systems,@code{errno} may not actually be a variable.) If you don't define thismacro, a reasonable default is used.@end defmac@cindex C99 math functions, implicit usage@defmac TARGET_C99_FUNCTIONSWhen this macro is nonzero, GCC will implicitly optimize @code{sin} calls into@code{sinf} and similarly for other functions defined by C99 standard. Thedefault is zero because a number of existing systems lack support for thesefunctions in their runtime so this macro needs to be redefined to one onsystems that do support the C99 runtime.@end defmac@cindex sincos math function, implicit usage@defmac TARGET_HAS_SINCOSWhen this macro is nonzero, GCC will implicitly optimize calls to @code{sin}and @code{cos} with the same argument to a call to @code{sincos}. Thedefault is zero. The target has to provide the following functions:@smallexamplevoid sincos(double x, double *sin, double *cos);void sincosf(float x, float *sin, float *cos);void sincosl(long double x, long double *sin, long double *cos);@end smallexample@end defmac@defmac NEXT_OBJC_RUNTIMESet this macro to 1 to use the "NeXT" Objective-C message sending conventionsby default. This calling convention involves passing the object, the selectorand 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 havethe NeXT runtime installed.If the macro is set to 0, the "GNU" Objective-C message sending conventionwill be used by default. This convention passes just the object and theselector to the method-lookup function, which returns a pointer to the method.In either case, it remains possible to select code-generation for the alternatescheme, 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 lineThis is about addressing modes.@defmac HAVE_PRE_INCREMENT@defmacx HAVE_PRE_DECREMENT@defmacx HAVE_POST_INCREMENT@defmacx HAVE_POST_DECREMENTA 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_DISPA C expression that is nonzero if the machine supports pre- orpost-address side-effect generation involving constants other thanthe size of the memory operand.@end defmac@defmac HAVE_PRE_MODIFY_REG@defmacx HAVE_POST_MODIFY_REGA C expression that is nonzero if the machine supports pre- orpost-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 whichis 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 whichconstant 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 explicitlyknown, 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_ADDRESSA number, the maximum number of registers that can appear in a validmemory address. Note that it is up to you to specify a value equal tothe maximum number that @code{TARGET_LEGITIMATE_ADDRESS_P} would everaccept.@end defmac@hook TARGET_LEGITIMATE_ADDRESS_PA function that returns whether @var{x} (an RTX) is a legitimate memoryaddress on the target machine for a memory operand of mode @var{mode}.Legitimate addresses are defined in two variants: a strict variant and anon-strict one. The @var{strict} parameter chooses which variant isdesired by the caller.The strict variant is used in the reload pass. It must be defined sothat any pseudo-register that has not been allocated a hard register isconsidered a memory reference. This is because in contexts where somekind of register is required, a pseudo-register with no hard registermust be rejected. For non-hard registers, the strict variant should lookup the @code{reg_renumber} array; it should then proceed using the hardregister number in the array, or treat the pseudo as a memory referenceif the array holds @code{-1}.The non-strict variant is used in other passes. It must be defined toaccept all pseudo-registers in every context where some kind ofregister is required.Normally, constant addresses which are the sum of a @code{symbol_ref}and an integer are stored inside a @code{const} RTX to mark them asconstant. Therefore, there is no need to recognize such sumsspecifically as legitimate addresses. Normally you would simplyrecognize any @code{const} as legitimate.Usually @code{PRINT_OPERAND_ADDRESS} is not prepared to handle constantsums that are not marked with @code{const}. It assumes that a naked@code{plus} indicates indexing. If so, then you @emph{must} reject suchnaked constant sums as illegitimate addresses, so that none of them willbe given to @code{PRINT_OPERAND_ADDRESS}.@cindex @code{TARGET_ENCODE_SECTION_INFO} and address validationOn some machines, whether a symbolic address is legitimate depends onthe section that the address refers to. On these machines, define thetarget hook @code{TARGET_ENCODE_SECTION_INFO} to store the informationinto the @code{symbol_ref}, and then check for it here. When you see a@code{const}, you will have to look inside it to find the@code{symbol_ref} in order to determine the section. @xref{AssemblerFormat}.@cindex @code{GO_IF_LEGITIMATE_ADDRESS}Some ports are still using a deprecated legacy substitute forthis hook, the @code{GO_IF_LEGITIMATE_ADDRESS} macro. This macrohas this syntax:@example#define GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label})@end example@noindentand should @code{goto @var{label}} if the address @var{x} is a validaddress on the target machine for a memory operand of mode @var{mode}.@findex REG_OK_STRICTCompiler source files that want to use the strict variant of thismacro define the macro @code{REG_OK_STRICT}. You should use an@code{#ifdef REG_OK_STRICT} conditional to define the strict variant inthat case and the non-strict variant otherwise.Using the hook is usually simpler because it limits the number offiles that are recompiled when changes are made.@end deftypefn@defmac TARGET_MEM_CONSTRAINTA single character to be used instead of the default @code{'m'}character for general memory addresses. This defines the constraintletter which matches the memory addresses accepted by@code{TARGET_LEGITIMATE_ADDRESS_P}. Define this macro if you want tosupport new address formats in your back end without changing thesemantics of the @code{'m'} constraint. This is necessary in order topreserve 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.c}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.c}.It is always safe for this macro to not be defined. It exists sothat alias analysis can understand machine-dependent addresses.The typical use of this macro is to handle addresses containinga label_ref or symbol_ref within an UNSPEC@.@end defmac@hook TARGET_LEGITIMIZE_ADDRESSThis hook is given an invalid memory address @var{x} for anoperand of mode @var{mode} and should try to return a valid memoryaddress.@findex break_out_memory_refs@var{x} will always be the result of a call to @code{break_out_memory_refs},and @var{oldx} will be the operand that was given to that function to produce@var{x}.The code of the hook should not alter the substructure of@var{x}. If it transforms @var{x} into a more legitimate form, itshould return the new @var{x}.It is not necessary for this hook to come up with a legitimate address.The compiler has standard ways of doing so in all cases. In fact, itis safe to omit this hook or make it return @var{x} if it cannot finda valid way to legitimize the address. But often a machine-dependentstrategy can generate better code.@end deftypefn@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 addressthat 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 forperformance reasons.For example, on the i386, it is sometimes possible to use a singlereload register instead of two by reloading a sum of two pseudoregisters into a register. On the other hand, for number of RISCprocessors offsets are limited so that often an intermediate addressneeds to be generated in order to address a stack slot. By defining@code{LEGITIMIZE_RELOAD_ADDRESS} appropriately, the intermediate addressesgenerated for adjacent some stack slots can be made identical, and thusbe shared.@emph{Note}: This macro should be used with caution. It is necessaryto 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 knowledgeof reload internals.@emph{Note}: This macro must be able to reload an address created by aprevious invocation of this macro. If it fails to handle such addressesthen the compiler may generate incorrect code or abort.@findex push_reloadThe macro definition should use @code{push_reload} to indicate parts thatneed reloading; @var{opnum}, @var{type} and @var{ind_levels} are usuallysuitable 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, itshould 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_pThe macro definition may use @code{strict_memory_address_p} to test ifthe address has become legitimate.@findex copy_rtxIf you want to change only a part of @var{x}, one standard way of doingthis is to use @code{copy_rtx}. Note, however, that it unshares only asingle level of rtl. Thus, if the part to be changed is not at thetop level, you'll need to replace first the top level.It is not necessary for this macro to come up with a legitimateaddress; but often a machine-dependent strategy can generate better code.@end defmac@hook TARGET_MODE_DEPENDENT_ADDRESS_PThis hook returns @code{true} if memory address @var{addr} can havedifferent meanings depending on the machine mode of the memoryreference it is used for or if the address is valid for some modesbut not others.Autoincrement and autodecrement addresses typically have mode-dependenteffects because the amount of the increment or decrement is the sizeof the operand being addressed. Some machines have other mode-dependentaddresses. Many RISC machines have no mode-dependent addresses.You may assume that @var{addr} is a valid address for the machine.The default version of this hook returns @code{false}.@end deftypefn@defmac GO_IF_MODE_DEPENDENT_ADDRESS (@var{addr}, @var{label})A C statement or compound statement with a conditional @code{goto@var{label};} executed if memory address @var{x} (an RTX) can havedifferent meanings depending on the machine mode of the memoryreference it is used for or if the address is valid for some modesbut not others.Autoincrement and autodecrement addresses typically have mode-dependenteffects because the amount of the increment or decrement is the sizeof the operand being addressed. Some machines have other mode-dependentaddresses. Many RISC machines have no mode-dependent addresses.You may assume that @var{addr} is a valid address for the machine.These are obsolete macros, replaced by the@code{TARGET_MODE_DEPENDENT_ADDRESS_P} target hook.@end defmac@hook TARGET_LEGITIMATE_CONSTANT_PThis hook returns true if @var{x} is a legitimate constant for a@var{mode}-mode immediate operand on the target machine. You can assume that@var{x} satisfies @code{CONSTANT_P}, so you need not check this.The default definition returns true.@end deftypefn@hook TARGET_DELEGITIMIZE_ADDRESSThis hook is used to undo the possibly obfuscating effects of the@code{LEGITIMIZE_ADDRESS} and @code{LEGITIMIZE_RELOAD_ADDRESS} targetmacros. Some backend implementations of these macros wrap symbolreferences inside an @code{UNSPEC} rtx to represent PIC or similaraddressing modes. This target hook allows GCC's optimizers to understandthe semantics of these opaque @code{UNSPEC}s by converting them backinto their original form.@end deftypefn@hook TARGET_CONST_NOT_OK_FOR_DEBUG_PThis hook should return true if @var{x} should not be emitted intodebug sections.@end deftypefn@hook TARGET_CANNOT_FORCE_CONST_MEMThis hook should return true if @var{x} is of a form that cannot (orshould not) be spilled to the constant pool. @var{mode} is the modeof @var{x}.The default version of this hook returns false.The primary reason to define this hook is to prevent reload fromdeciding that a non-legitimate constant would be better reloadedfrom the constant pool instead of spilling and reloading a registerholding the constant. This restriction is often true of addressesof TLS symbols for various targets.@end deftypefn@hook TARGET_USE_BLOCKS_FOR_CONSTANT_PThis hook should return true if pool entries for constant @var{x} canbe placed in an @code{object_block} structure. @var{mode} is the modeof @var{x}.The default version returns false for all constants.@end deftypefn@hook TARGET_BUILTIN_RECIPROCALThis hook should return the DECL of a function that implements reciprocal ofthe builtin function with builtin function code @var{fn}, or@code{NULL_TREE} if such a function is not available. @var{md_fn} is truewhen @var{fn} is a code of a machine-dependent builtin function. When@var{sqrt} is true, additional optimizations that apply only to the reciprocalof a square root function are performed, and only reciprocals of @code{sqrt}function are valid.@end deftypefn@hook TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOADThis hook should return the DECL of a function @var{f} that given anaddress @var{addr} as an argument returns a mask @var{m} that can beused to extract from two vectors the relevant data that resides in@var{addr} in case @var{addr} is not properly aligned.The autovectorizer, when vectorizing a load operation from an address@var{addr} that may be unaligned, will generate two vector loads fromthe two aligned addresses around @var{addr}. It then generates a@code{REALIGN_LOAD} operation to extract the relevant data from thetwo loaded vectors. The first two arguments to @code{REALIGN_LOAD},@var{v1} and @var{v2}, are the two vectors, each of size @var{VS}, andthe third argument, @var{OFF}, defines how the data will be extractedfrom these two vectors: if @var{OFF} is 0, then the returned vector is@var{v2}; otherwise, the returned vector is composed from the last@var{VS}-@var{OFF} elements of @var{v1} concatenated to the first@var{OFF} elements of @var{v2}.If this hook is defined, the autovectorizer will generate a callto @var{f} (using the DECL tree that this hook returns) and willuse the return value of @var{f} as the argument @var{OFF} to@code{REALIGN_LOAD}. Therefore, the mask @var{m} returned by @var{f}should comply with the semantics expected by @code{REALIGN_LOAD}described above.If this hook is not defined, then @var{addr} will be used asthe argument @var{OFF} to @code{REALIGN_LOAD}, in which case the lowlog2(@var{VS}) @minus{} 1 bits of @var{addr} will be considered.@end deftypefn@hook TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVENThis hook should return the DECL of a function @var{f} that implementswidening multiplication of the even elements of two input vectors of type @var{x}.If this hook is defined, the autovectorizer will use it along with the@code{TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD} target hook when vectorizingwidening multiplication in cases that the order of the results does not have to bepreserved (e.g.@: used only by a reduction computation). Otherwise, the@code{widen_mult_hi/lo} idioms will be used.@end deftypefn@hook TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODDThis hook should return the DECL of a function @var{f} that implementswidening multiplication of the odd elements of two input vectors of type @var{x}.If this hook is defined, the autovectorizer will use it along with the@code{TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN} target hook when vectorizingwidening multiplication in cases that the order of the results does not have to bepreserved (e.g.@: used only by a reduction computation). Otherwise, the@code{widen_mult_hi/lo} idioms will be used.@end deftypefn@hook TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COSTReturns cost of different scalar or vector statements for vectorization cost model.For vector memory operations the cost may depend on type (@var{vectype}) andmisalignment value (@var{misalign}).@end deftypefn@hook TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLEReturn true if vector alignment is reachable (by peeling N iterations) for the given type.@end deftypefn@hook TARGET_VECTORIZE_VEC_PERM_CONST_OKReturn true if a vector created for @code{vec_perm_const} is valid.@end deftypefn@hook TARGET_VECTORIZE_BUILTIN_CONVERSIONThis hook should return the DECL of a function that implements conversion of theinput vector of type @var{src_type} to type @var{dest_type}.The value of @var{code} is one of the enumerators in @code{enum tree_code} andspecifies how the conversion is to be applied(truncation, rounding, etc.).If this hook is defined, the autovectorizer will use the@code{TARGET_VECTORIZE_BUILTIN_CONVERSION} target hook when vectorizingconversion. Otherwise, it will return @code{NULL_TREE}.@end deftypefn@hook TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTIONThis hook should return the decl of a function that implements thevectorized variant of the builtin function with builtin function code@var{code} or @code{NULL_TREE} if such a function is not available.The value of @var{fndecl} is the builtin function declaration. Thereturn type of the vectorized function shall be of vector type@var{vec_type_out} and the argument types should be @var{vec_type_in}.@end deftypefn@hook TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENTThis hook should return true if the target supports misaligned vectorstore/load of a specific factor denoted in the @var{misalignment}parameter. The vector store/load should be of machine mode @var{mode} andthe elements in the vectors should be of type @var{type}. @var{is_packed}parameter is true if the memory access is defined in a packed struct.@end deftypefn@hook TARGET_VECTORIZE_PREFERRED_SIMD_MODEThis hook should return the preferred mode for vectorizing scalarmode @var{mode}. The default isequal to @code{word_mode}, because the vectorizer can do sometransformations even in absence of specialized @acronym{SIMD} hardware.@end deftypefn@hook TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZESThis hook should return a mask of sizes that should be iterated overafter trying to autovectorize using the vector size derived from themode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}.The default is zero which means to not iterate over other vector sizes.@end deftypefn@hook TARGET_VECTORIZE_BUILTIN_TM_LOAD@hook TARGET_VECTORIZE_BUILTIN_TM_STORE@hook TARGET_VECTORIZE_BUILTIN_GATHERTarget builtin that implements vector gather operation. @var{mem_vectype}is the vector type of the load and @var{index_type} is scalar type ofthe index, scaled by @var{scale}.The default is @code{NULL_TREE} which means to not vectorize gatherloads.@end deftypefn@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:@smallexamplestatic int a, b, c;int foo (void) @{ return a + b + c; @}@end smallexamplethe code for @code{foo} will usually calculate three separate symbolicaddresses: those of @code{a}, @code{b} and @code{c}. On some targets,it would be better to calculate just one symbolic address and accessthe three variables relative to it. The equivalent pseudocode wouldbe something like:@smallexampleint 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 knowin order to make effective use of section anchors. It won't usesection 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_OFFSETThe minimum offset that should be applied to a section anchor.On most targets, it should be the smallest offset that can beapplied to a base register while still giving a legitimate addressfor every mode. The default value is 0.@end deftypevr@hook TARGET_MAX_ANCHOR_OFFSETLike @code{TARGET_MIN_ANCHOR_OFFSET}, but the maximum (inclusive)offset that should be applied to section anchors. The defaultvalue is 0.@end deftypevr@hook TARGET_ASM_OUTPUT_ANCHORWrite the assembly code to define section anchor @var{x}, which is a@code{SYMBOL_REF} for which @samp{SYMBOL_REF_ANCHOR_P (@var{x})} is true.The hook is called with the assembly output position set to the beginningof @code{SYMBOL_REF_BLOCK (@var{x})}.If @code{ASM_OUTPUT_DEF} is available, the hook's default definition usesit to define the symbol as @samp{. + SYMBOL_REF_BLOCK_OFFSET (@var{x})}.If @code{ASM_OUTPUT_DEF} is not available, the hook's default definitionis @code{NULL}, which disables the use of section anchors altogether.@end deftypefn@hook TARGET_USE_ANCHORS_FOR_SYMBOL_PReturn true if GCC should attempt to use anchors to access @code{SYMBOL_REF}@var{x}. You can assume @samp{SYMBOL_REF_HAS_BLOCK_INFO_P (@var{x})} and@samp{!SYMBOL_REF_ANCHOR_P (@var{x})}.The default version is correct for most targets, but you might need tointercept this hook to handle things like target-specific attributesor target-specific sections.@end deftypefn@node Condition Code@section Condition Code Status@cindex condition code statusThe macros in this section can be split in two families, according to thetwo ways of representing condition codes in GCC.The first representation is the so called @code{(cc0)} representation(@pxref{Jump Patterns}), where all instructions can have an implicitclobber of the condition codes. The second is the condition coderegister representation, which provides better schedulability forarchitectures that do have a condition code register, but on whichmost instructions do not affect it. The latter category includesmost RISC machines.The implicit clobbering poses a strong restriction on the placement ofthe definition and use of the condition code, which need to be in adjacentinsns for machines using @code{(cc0)}. This can prevent importantoptimizations on some machines. For example, on the IBM RS/6000, thereis a delay for taken branches unless the condition code register is setthree instructions earlier than the conditional branch. The instructionscheduler cannot perform this optimization if it is not permitted toseparate the definition and use of the condition code register.For this reason, it is possible and suggested to use a register torepresent the condition code for new ports. If there is a specificcondition code register in the machine, use a hard register. If thecondition 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 modethat is in class @code{MODE_CC}.Alternatively, you can use @code{BImode} if the comparison operator isspecified already in the compare instruction. In this case, you are notinterested in most macros in this section.@menu* CC0 Condition Codes:: Old style representation of condition codes.* MODE_CC Condition Codes:: Modern representation of condition codes.* Cond Exec Macros:: Macros to control conditional execution.@end menu@node CC0 Condition Codes@subsection Representation of condition codes using @code{(cc0)}@findex cc0@findex cc_statusThe file @file{conditions.h} defines a variable @code{cc_status} todescribe how the condition code was computed (in case the interpretation ofthe condition code depends on the instruction that it was set by). Thisvariable contains the RTL expressions on which the condition code iscurrently based, and several standard flags.Sometimes additional machine-specific flags must be defined in the machinedescription header file. It can also add additional machine-specificinformation by defining @code{CC_STATUS_MDEP}.@defmac CC_STATUS_MDEPC code for a data type which is used for declaring the @code{mdep}component of @code{cc_status}. It defaults to @code{int}.This macro is not used on machines that do not use @code{cc0}.@end defmac@defmac CC_STATUS_MDEP_INITA C expression to initialize the @code{mdep} field to ``empty''.The default definition does nothing, since most machines don't usethe field anyway. If you want to use the field, you should probablydefine this macro to initialize it.This macro is not used on machines that do not use @code{cc0}.@end defmac@defmac NOTICE_UPDATE_CC (@var{exp}, @var{insn})A C compound statement to set the components of @code{cc_status}appropriately for an insn @var{insn} whose body is @var{exp}. It isthis macro's responsibility to recognize insns that set the conditioncode as a byproduct of other activity as well as those that explicitlyset @code{(cc0)}.This macro is not used on machines that do not use @code{cc0}.If there are insns that do not set the condition code but do alterother machine registers, this macro must check to see whether theyinvalidate the expressions that the condition code is recorded asreflecting. For example, on the 68000, insns that store in addressregisters do not set the condition code, which means that usually@code{NOTICE_UPDATE_CC} can leave @code{cc_status} unaltered for suchinsns. But suppose that the previous insn set the condition codebased on location @samp{a4@@(102)} and the current insn stores a newvalue in @samp{a4}. Although the condition code is not changed bythis, it will no longer be true that it reflects the contents of@samp{a4@@(102)}. Therefore, @code{NOTICE_UPDATE_CC} must alter@code{cc_status} in this case to say that nothing is known about thecondition code value.The definition of @code{NOTICE_UPDATE_CC} must be prepared to dealwith the results of peephole optimization: insns whose patterns are@code{parallel} RTXs containing various @code{reg}, @code{mem} orconstants which are just the operands. The RTL structure of theseinsns is not sufficient to indicate what the insns actually do. What@code{NOTICE_UPDATE_CC} should do when it sees one is just to run@code{CC_STATUS_INIT}.A possible definition of @code{NOTICE_UPDATE_CC} is to call a functionthat looks at an attribute (@pxref{Insn Attributes}) named, for example,@samp{cc}. This avoids having detailed information about patterns intwo places, the @file{md} file and in @code{NOTICE_UPDATE_CC}.@end defmac@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 instructionsthan compares, for example the branch can use directly the conditioncode set by a subtract instruction. However, on some machineswhen the condition code is set this way some bits (such as the overflowbit) are not set in the same way as a test instruction, so that a differentbranch instruction must be used for some conditional branches. Whenthis happens, use the machine mode of the condition code register torecord different formats of the condition code register. Modes canalso be used to record which compare instruction (e.g. a signed or anunsigned 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 choosea mode given an operand of a compare. This is needed because the modeshave to be chosen not only during RTL generation but also, for example,by instruction combination. The result of @code{SELECT_CC_MODE} shouldbe consistent with the mode used in the patterns; for example to supportthe case of the add on the SPARC discussed above, we have the pattern@smallexample(define_insn ""[(set (reg:CC_NOOV 0)(compare:CC_NOOV(plus:SI (match_operand:SI 0 "register_operand" "%r")(match_operand:SI 1 "arith_operand" "rI"))(const_int 0)))]"""@dots{}")@end smallexample@noindenttogether with a @code{SELECT_CC_MODE} that returns @code{CC_NOOVmode}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 == EQ || OP == NE) ? CCFPmode : CCFPEmode) \: ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \|| GET_CODE (X) == NEG) \? CC_NOOVmode : CCmode))@end smallexampleAnother reason to use modes is to retain information on which operandswere used by the comparison; see @code{REVERSIBLE_CC_MODE} later inthis section.You should define this macro if and only if you define extra CC modesin @file{@var{machine}-modes.def}.@end defmac@defmac CANONICALIZE_COMPARISON (@var{code}, @var{op0}, @var{op1})On some machines not all possible comparisons are defined, but you canconvert an invalid comparison into a valid one. For example, the Alphadoes not have a @code{GT} comparison, but you can use an @code{LT}comparison instead and swap the order of the operands.On such machines, define this macro to be a C statement to do anyrequired conversions. @var{code} is the initial comparison codeand @var{op0} and @var{op1} are the left and right operands of thecomparison, respectively. You should modify @var{code}, @var{op0}, and@var{op1} as required.GCC will not assume that the comparison resulting from this macro isvalid but will see if the resulting insn matches a pattern in the@file{md} file.You need not define this macro if it would never change the comparisoncode or operands.@end defmac@defmac REVERSIBLE_CC_MODE (@var{mode})A C expression whose value is one if it is always safe to reverse acomparison 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 thefloating-point format is anything other than @code{IEEE_FLOAT_FORMAT}.For example, here is the definition used on the SPARC, where floating-pointinequality comparisons are always given @code{CCFPEmode}:@smallexample#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)@end smallexample@end defmac@defmac REVERSE_CONDITION (@var{code}, @var{mode})A C expression whose value is reversed condition code of the @var{code} forcomparison 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 casemachine has some non-standard way how to reverse certain conditionals. Forinstance in case all floating point conditions are non-trapping, compiler mayfreely convert unordered compares to ordered one. Then definition may looklike:@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_REGSOn targets which do not use @code{(cc0)}, and which use a hardregister rather than a pseudo-register to hold condition codes, theregular CSE passes are often not able to identify cases in which thehard register is set to a common value. Use this hook to enable asmall pass which optimizes such cases. This hook should return trueto enable this pass, and it should set the integers to which itsarguments point to the hard register numbers used for condition codes.When there is only one such register, as is true on most systems, theinteger pointed to by @var{p2} should be set to@code{INVALID_REGNUM}.The default version of this hook returns false.@end deftypefn@hook TARGET_CC_MODES_COMPATIBLEOn targets which use multiple condition code modes in class@code{MODE_CC}, it is sometimes the case that a comparison can bevalidly done in more than one mode. On such a system, define thistarget hook to take two mode arguments and to return a mode in whichboth comparisons may be validly done. If there is no such mode,return @code{VOIDmode}.The default version of this hook checks whether the modes are thesame. If they are, it returns that mode. If they are different, itreturns @code{VOIDmode}.@end deftypefn@node Cond Exec Macros@subsection Macros to control conditional execution@findex conditional execution@findex predicationThere is one macro that may need to be defined for targetssupporting conditional execution, independent of how theyrepresent conditional branches.@defmac REVERSE_CONDEXEC_PREDICATES_P (@var{op1}, @var{op2})A C expression that returns true if the conditional execution predicate@var{op1}, a comparison operation, is the inverse of @var{op2} and viceversa. Define this to return 0 if the target has conditional executionpredicates that cannot be reversed safely. There is no need to validatethat the arguments of op1 and op2 are the same, this is done separately.If no expansion is specified, this macro is defined as follows:@smallexample#define REVERSE_CONDEXEC_PREDICATES_P (x, y) \(GET_CODE ((x)) == reversed_comparison_code ((y), NULL))@end smallexample@end defmac@node Costs@section Describing Relative Costs of Operations@cindex costs of instructions@cindex relative costs@cindex speed of instructionsThese macros let you describe the relative speed of various operationson 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 aregister in class @var{from} to one in class @var{to}. The classes areexpressed using the enumeration values such as @code{GENERAL_REGS}. Avalue of 2 is the default; other values are interpreted relative tothat.It is not required that the cost always equal 2 when @var{from} is thesame as @var{to}; on some machines it is expensive to move betweenregisters if they are not general registers.If reload sees an insn consisting of a single @code{set} between twohard registers, and if @code{REGISTER_MOVE_COST} applied to theirclasses returns a value of 2, reload does not check to ensure that theconstraints of the insn are met. Setting a cost of other than 2 willallow reload to verify that the constraints are met. You should do thisif 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_COSTThis target hook should return the cost of moving data of mode @var{mode}from a register in class @var{from} to one in class @var{to}. The classesare expressed using the enumeration values such as @code{GENERAL_REGS}.A value of 2 is the default; other values are interpreted relative tothat.It is not required that the cost always equal 2 when @var{from} is thesame as @var{to}; on some machines it is expensive to move betweenregisters if they are not general registers.If reload sees an insn consisting of a single @code{set} between twohard registers, and if @code{TARGET_REGISTER_MOVE_COST} applied to theirclasses returns a value of 2, reload does not check to ensure that theconstraints of the insn are met. Setting a cost of other than 2 willallow reload to verify that the constraints are met. You should do thisif the @samp{mov@var{m}} pattern's constraints do not allow such copying.The default version of this function returns 2.@end deftypefn@defmac MEMORY_MOVE_COST (@var{mode}, @var{class}, @var{in})A C expression for the cost of moving data of mode @var{mode} between aregister of class @var{class} and memory; @var{in} is zero if the valueis to be written to memory, nonzero if it is to be read in. This costis relative to those in @code{REGISTER_MOVE_COST}. If moving betweenregisters and memory is more expensive than between two registers, youshould define this macro to express the relative cost.If you do not define this macro, GCC uses a default cost of 4 plusthe cost of copying via a secondary reload register, if one isneeded. If your machine requires a secondary reload register to copybetween memory and a register of @var{class} but the reload mechanism ismore complex than copying via an intermediate, define this macro toreflect the actual cost of the move.GCC defines the function @code{memory_move_secondary_cost} ifsecondary reloads are needed. It computes the costs due to copying viaa secondary register. If your machine copies from memory using asecondary register in the conventional way but the default base value of4 is not correct for your machine, define this macro to add some othervalue to the result of that function. The arguments to that functionare 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_COSTThis target hook should return the cost of moving data of mode @var{mode}between a register of class @var{rclass} and memory; @var{in} is @code{false}if the value is to be written to memory, @code{true} if it is to be read in.This cost is relative to those in @code{TARGET_REGISTER_MOVE_COST}.If moving between registers and memory is more expensive than between tworegisters, you should add this target hook to express the relative cost.If you do not add this target hook, GCC uses a default cost of 4 plusthe cost of copying via a secondary reload register, if one isneeded. If your machine requires a secondary reload register to copybetween memory and a register of @var{rclass} but the reload mechanism ismore complex than copying via an intermediate, use this target hook toreflect the actual cost of the move.GCC defines the function @code{memory_move_secondary_cost} ifsecondary reloads are needed. It computes the costs due to copying viaa secondary register. If your machine copies from memory using asecondary register in the conventional way but the default base value of4 is not correct for your machine, use this target hook to add some othervalue to the result of that function. The arguments to that functionare the same as to this target hook.@end deftypefn@defmac BRANCH_COST (@var{speed_p}, @var{predictable_p})A C expression for the cost of a branch instruction. A value of 1 isthe default; other values are interpreted relative to that. Parameter@var{speed_p} is true when the branch in question should be optimizedfor speed. When it is false, @code{BRANCH_COST} should return a valueoptimal for code size rather than performance. @var{predictable_p} istrue for well-predicted branches. On many architectures the@code{BRANCH_COST} can be reduced then.@end defmacHere are additional macros which do not specify precise relative costs,but only that certain actions are more expensive than GCC wouldordinarily expect.@defmac SLOW_BYTE_ACCESSDefine this macro as a C expression which is nonzero if accessing lessthan a word of memory (i.e.@: a @code{char} or a @code{short}) is nofaster than accessing a word of memory, i.e., if such accessrequire more than one instruction or if there is no difference in costbetween byte and (aligned) word loads.When this macro is not defined, the compiler will access a field byfinding the smallest containing object; when it is defined, a fullwordload will be used if alignment permits. Unless bytes accesses arefaster than word accesses, using word accesses is preferable since itmay eliminate subsequent memory access if subsequent accesses occur toother fields in the same word of the structure, but to different bytes.@end defmac@defmac SLOW_UNALIGNED_ACCESS (@var{mode}, @var{alignment})Define this macro to be the value 1 if memory accesses described by the@var{mode} and @var{alignment} parameters have a cost many times greaterthan aligned accesses, for example if they are emulated in a traphandler.When this macro is nonzero, the compiler will act as if@code{STRICT_ALIGNMENT} were nonzero when generating code for blockmoves. This can cause significantly more instructions to be produced.Therefore, do not set this macro nonzero if unaligned accesses only add acycle or two to the time for a memory access.If the value of this macro is always zero, it need not be defined. Ifthis macro is defined, it should produce a nonzero value when@code{STRICT_ALIGNMENT} is nonzero.@end defmac@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 astring move insn or a library call. Increasing the value will alwaysmake 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 countsthe number of such sequences.The parameter @var{speed} is true if the code is currently beingoptimized for speed rather than size.If you don't define this, a reasonable default is used.@end defmac@defmac MOVE_BY_PIECES_P (@var{size}, @var{alignment})A C expression used to determine whether @code{move_by_pieces} will be used tocopy a chunk of memory, or whether some other block move mechanismwill be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns lessthan @code{MOVE_RATIO}.@end defmac@defmac MOVE_MAX_PIECESA C expression used by @code{move_by_pieces} to determine the largest unita load or store used to copy memory is. Defaults to @code{MOVE_MAX}.@end defmac@defmac CLEAR_RATIO (@var{speed})The threshold of number of scalar move insns, @emph{below} which a sequenceof insns should be generated to clear memory instead of a string clear insnor a library call. Increasing the value will always make code faster, buteventually incurs high cost in increased code size.The parameter @var{speed} is true if the code is currently beingoptimized for speed rather than size.If you don't define this, a reasonable default is used.@end defmac@defmac CLEAR_BY_PIECES_P (@var{size}, @var{alignment})A C expression used to determine whether @code{clear_by_pieces} will be usedto clear a chunk of memory, or whether some other block clear mechanismwill be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns lessthan @code{CLEAR_RATIO}.@end defmac@defmac SET_RATIO (@var{speed})The threshold of number of scalar move insns, @emph{below} which a sequenceof insns should be generated to set memory to a constant value, instead ofa block set insn or a library call.Increasing the value will always make code faster, buteventually incurs high cost in increased code size.The parameter @var{speed} is true if the code is currently beingoptimized for speed rather than size.If you don't define this, it defaults to the value of @code{MOVE_RATIO}.@end defmac@defmac SET_BY_PIECES_P (@var{size}, @var{alignment})A C expression used to determine whether @code{store_by_pieces} will beused to set a chunk of memory to a constant value, or whether someother mechanism will be used. Used by @code{__builtin_memset} whenstoring values other than constant zero.Defaults to 1 if @code{move_by_pieces_ninsns} returns lessthan @code{SET_RATIO}.@end defmac@defmac STORE_BY_PIECES_P (@var{size}, @var{alignment})A C expression used to determine whether @code{store_by_pieces} will beused to set a chunk of memory to a constant string value, or whether someother mechanism will be used. Used by @code{__builtin_strcpy} whencalled with a constant source string.Defaults to 1 if @code{move_by_pieces_ninsns} returns lessthan @code{MOVE_RATIO}.@end defmac@defmac USE_LOAD_POST_INCREMENT (@var{mode})A C expression used to determine whether a load postincrement is a goodthing 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 goodthing 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 goodthing 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 goodthing 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 goodthing 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 goodthing 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 goodthing 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 goodthing to use for a given mode. Defaults to the value of@code{HAVE_PRE_DECREMENT}.@end defmac@defmac NO_FUNCTION_CSEDefine this macro if it is as good or better to call a constantfunction address than to call an address kept in a register.@end defmac@defmac RANGE_TEST_NON_SHORT_CIRCUITDefine 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_RTX_COSTSThis target hook describes the relative costs of RTL expressions.The cost may depend on the precise form of the expression, which isavailable for examination in @var{x}, and the fact that @var{x} appearsas operand @var{opno} of an expression with rtx code @var{outer_code}.That is, the hook can assume that there is some rtx @var{y} suchthat @samp{GET_CODE (@var{y}) == @var{outer_code}} and such thateither (a) @samp{XEXP (@var{y}, @var{opno}) == @var{x}} or(b) @samp{XVEC (@var{y}, @var{opno})} contains @var{x}.@var{code} is @var{x}'s expression code---redundant, since it can beobtained with @code{GET_CODE (@var{x})}.In implementing this hook, you can use the construct@code{COSTS_N_INSNS (@var{n})} to specify a cost equal to @var{n} fastinstructions.On entry to the hook, @code{*@var{total}} contains a default estimatefor the cost of the expression. The hook should modify this value asnecessary. Traditionally, the default costs are @code{COSTS_N_INSNS (5)}for multiplications, @code{COSTS_N_INSNS (7)} for division and modulusoperations, and @code{COSTS_N_INSNS (1)} for all other operations.When optimizing for code size, i.e.@: when @code{speed} isfalse, this target hook should be used to estimate the relativesize cost of an expression, again relative to @code{COSTS_N_INSNS}.The hook returns true when all subexpressions of @var{x} have beenprocessed, and false when @code{rtx_cost} should recurse.@end deftypefn@hook TARGET_ADDRESS_COSTThis hook computes the cost of an addressing mode that contains@var{address}. If not defined, the cost is computed fromthe @var{address} expression and the @code{TARGET_RTX_COST} hook.For most CISC machines, the default cost is a good approximation of thetrue cost of the addressing mode. However, on RISC machines, allinstructions normally have the same length and execution time. Henceall addresses will have equal costs.In cases where more than one form of an address is known, the form withthe lowest cost will be used. If multiple forms have the same, lowest,cost, the one that is the most complex will be used.For example, suppose an address that is equal to the sum of a registerand a constant is used twice in the same basic block. When this macrois not defined, the address will be computed in a register and memoryreferences will be indirect through that register. On machines wherethe cost of the addressing mode containing the sum is no higher thanthat of a simple indirect reference, this will produce an additionalinstruction and possibly require an additional register. Properspecification of this macro eliminates this overhead for such machines.This hook is never called with an invalid address.On machines where an address involving more than one register is ascheap as an address computation involving only one register, defining@code{TARGET_ADDRESS_COST} to reflect this can cause two registers tobe live over a region of code where only one would have been if@code{TARGET_ADDRESS_COST} were not defined in that manner. This effectshould be considered in the definition of this macro. Equivalent costsshould probably only be given to addresses with different numbers ofregisters on machines with lots of registers.@end deftypefn@node Scheduling@section Adjusting the Instruction SchedulerThe instruction scheduler may need a fair amount of machine-specificadjustment in order to produce good code. GCC provides several targethooks for this purpose. It is usually enough to define just a few ofthem: try the first ones in this list first.@hook TARGET_SCHED_ISSUE_RATEThis hook returns the maximum number of instructions that can everissue at the same time on the target machine. The default is one.Although the insn scheduler can define itself the possibility of issuean insn on the same cycle, the value can serve as an additionalconstraint to issue insns on the same simulated processor cycle (seehooks @samp{TARGET_SCHED_REORDER} and @samp{TARGET_SCHED_REORDER2}).This value must be constant over the entire compilation. If you needit to vary depending on what the instructions are, you must use@samp{TARGET_SCHED_VARIABLE_ISSUE}.@end deftypefn@hook TARGET_SCHED_VARIABLE_ISSUEThis hook is executed by the scheduler after it has scheduled an insnfrom the ready list. It should return the number of insns which canstill be issued in the current cycle. The default is@samp{@w{@var{more} - 1}} for insns other than @code{CLOBBER} and@code{USE}, which normally are not counted against the issue rate.You should define this hook if some insns take more machine resourcesthan others, so that fewer insns can follow them in the same cycle.@var{file} is either a null pointer, or a stdio stream to write anydebug output to. @var{verbose} is the verbose level provided by@option{-fsched-verbose-@var{n}}. @var{insn} is the instruction thatwas scheduled.@end deftypefn@hook TARGET_SCHED_ADJUST_COSTThis function corrects the value of @var{cost} based on therelationship between @var{insn} and @var{dep_insn} through thedependence @var{link}. It should return the new value. The defaultis to make no adjustment to @var{cost}. This can be used for exampleto specify to the scheduler using the traditional pipeline descriptionthat an output- or anti-dependence does not incur the same cost as adata-dependence. If the scheduler using the automaton based pipelinedescription, the cost of anti-dependence is zero and the cost ofoutput-dependence is maximum of one and the difference of latencytimes of the first and the second insns. If these values are notacceptable, you could use the hook to modify them too. See also@pxref{Processor pipeline description}.@end deftypefn@hook TARGET_SCHED_ADJUST_PRIORITYThis hook adjusts the integer scheduling priority @var{priority} of@var{insn}. It should return the new priority. Increase the priority toexecute @var{insn} earlier, reduce the priority to execute @var{insn}later. Do not define this hook if you do not need to adjust thescheduling priorities of insns.@end deftypefn@hook TARGET_SCHED_REORDERThis hook is executed by the scheduler after it has scheduled the readylist, to allow the machine description to reorder it (for example tocombine two small instructions together on @samp{VLIW} machines).@var{file} is either a null pointer, or a stdio stream to write anydebug output to. @var{verbose} is the verbose level provided by@option{-fsched-verbose-@var{n}}. @var{ready} is a pointer to the readylist of instructions that are ready to be scheduled. @var{n_readyp} isa pointer to the number of elements in the ready list. The schedulerreads the ready list in reverse order, starting with@var{ready}[@var{*n_readyp} @minus{} 1] and going to @var{ready}[0]. @var{clock}is the timer tick of the scheduler. You may modify the ready list andthe number of ready insns. The return value is the number of insns thatcan issue this cycle; normally this is just @code{issue_rate}. See also@samp{TARGET_SCHED_REORDER2}.@end deftypefn@hook TARGET_SCHED_REORDER2Like @samp{TARGET_SCHED_REORDER}, but called at a different time. Thatfunction is called whenever the scheduler starts a new cycle. This oneis called once per iteration over a cycle, immediately after@samp{TARGET_SCHED_VARIABLE_ISSUE}; it can reorder the ready list andreturn the number of insns to be scheduled in the same cycle. Definingthis hook can be useful if there are frequent situations wherescheduling one insn causes other insns to become ready in the samecycle. These other insns can then be taken into account properly.@end deftypefn@hook TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOKThis hook is called after evaluation forward dependencies of insns inchain given by two parameter values (@var{head} and @var{tail}correspondingly) but before insns scheduling of the insn chain. Forexample, it can be used for better insn classification if it requiresanalysis of dependencies. This hook can use backward and forwarddependencies of the insn scheduler because they are alreadycalculated.@end deftypefn@hook TARGET_SCHED_INITThis hook is executed by the scheduler at the beginning of each block ofinstructions that are to be scheduled. @var{file} is either a nullpointer, or a stdio stream to write any debug output to. @var{verbose}is the verbose level provided by @option{-fsched-verbose-@var{n}}.@var{max_ready} is the maximum number of insns in the current schedulingregion that can be live at the same time. This can be used to allocatescratch space if it is needed, e.g.@: by @samp{TARGET_SCHED_REORDER}.@end deftypefn@hook TARGET_SCHED_FINISHThis hook is executed by the scheduler at the end of each block ofinstructions that are to be scheduled. It can be used to performcleanup of any actions done by the other scheduling hooks. @var{file}is either a null pointer, or a stdio stream to write any debug outputto. @var{verbose} is the verbose level provided by@option{-fsched-verbose-@var{n}}.@end deftypefn@hook TARGET_SCHED_INIT_GLOBALThis hook is executed by the scheduler after function level initializations.@var{file} is either a null pointer, or a stdio stream to write any debug output to.@var{verbose} is the verbose level provided by @option{-fsched-verbose-@var{n}}.@var{old_max_uid} is the maximum insn uid when scheduling begins.@end deftypefn@hook TARGET_SCHED_FINISH_GLOBALThis is the cleanup hook corresponding to @code{TARGET_SCHED_INIT_GLOBAL}.@var{file} is either a null pointer, or a stdio stream to write any debug output to.@var{verbose} is the verbose level provided by @option{-fsched-verbose-@var{n}}.@end deftypefn@hook TARGET_SCHED_DFA_PRE_CYCLE_INSNThe hook returns an RTL insn. The automaton state used in thepipeline hazard recognizer is changed as if the insn were scheduledwhen the new simulated processor cycle starts. Usage of the hook maysimplify the automaton pipeline description for some @acronym{VLIW}processors. If the hook is defined, it is used only for the automatonbased pipeline description. The default is not to change the statewhen the new simulated processor cycle starts.@end deftypefn@hook TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSNThe hook can be used to initialize data used by the previous hook.@end deftypefn@hook TARGET_SCHED_DFA_POST_CYCLE_INSNThe hook is analogous to @samp{TARGET_SCHED_DFA_PRE_CYCLE_INSN} but usedto changed the state as if the insn were scheduled when the newsimulated processor cycle finishes.@end deftypefn@hook TARGET_SCHED_INIT_DFA_POST_CYCLE_INSNThe hook is analogous to @samp{TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN} butused to initialize data used by the previous hook.@end deftypefn@hook TARGET_SCHED_DFA_PRE_ADVANCE_CYCLEThe hook to notify target that the current simulated cycle is about to finish.The hook is analogous to @samp{TARGET_SCHED_DFA_PRE_CYCLE_INSN} but usedto change the state in more complicated situations - e.g., when advancingstate on a single insn is not enough.@end deftypefn@hook TARGET_SCHED_DFA_POST_ADVANCE_CYCLEThe hook to notify target that new simulated cycle has just started.The hook is analogous to @samp{TARGET_SCHED_DFA_POST_CYCLE_INSN} but usedto change the state in more complicated situations - e.g., when advancingstate on a single insn is not enough.@end deftypefn@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEADThis hook controls better choosing an insn from the ready insn queuefor the @acronym{DFA}-based insn scheduler. Usually the schedulerchooses the first insn from the queue. If the hook returns a positivevalue, an additional scheduler code tries all permutations of@samp{TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD ()}subsequent ready insns to choose an insn whose issue will result inmaximal number of issued insns on the same cycle. For the@acronym{VLIW} processor, the code could actually solve the problem ofpacking simple insns into the @acronym{VLIW} insn. Of course, if therules of @acronym{VLIW} packing are described in the automaton.This code also could be used for superscalar @acronym{RISC}processors. Let us consider a superscalar @acronym{RISC} processorwith 3 pipelines. Some insns can be executed in pipelines @var{A} or@var{B}, some insns can be executed only in pipelines @var{B} or@var{C}, and one insn can be executed in pipeline @var{B}. Theprocessor may issue the 1st insn into @var{A} and the 2nd one into@var{B}. In this case, the 3rd insn will wait for freeing @var{B}until the next cycle. If the scheduler issues the 3rd insn the first,the processor could issue all 3 insns per cycle.Actually this code demonstrates advantages of the automaton basedpipeline hazard recognizer. We try quickly and easy many insnschedules to choose the best one.The default is no multipass scheduling.@end deftypefn@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARDThis hook controls what insns from the ready insn queue will beconsidered for the multipass insn scheduling. If the hook returnszero for @var{insn}, the insn will be not chosen tobe issued.The default is that any ready insns can be chosen to be issued.@end deftypefn@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_BEGINThis hook prepares the target backend for a new round of multipassscheduling.@end deftypefn@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_ISSUEThis hook is called when multipass scheduling evaluates instruction INSN.@end deftypefn@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_BACKTRACKThis is called when multipass scheduling backtracks from evaluation ofan instruction.@end deftypefn@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_ENDThis hook notifies the target about the result of the concluded currentround of multipass scheduling.@end deftypefn@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_INITThis hook initializes target-specific data used in multipass scheduling.@end deftypefn@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_FINIThis hook finalizes target-specific data used in multipass scheduling.@end deftypefn@hook TARGET_SCHED_DFA_NEW_CYCLEThis hook is called by the insn scheduler before issuing @var{insn}on cycle @var{clock}. If the hook returns nonzero,@var{insn} is not issued on this processor cycle. Instead,the processor cycle is advanced. If *@var{sort_p}is zero, the insn ready queue is not sorted on the new cyclestart as usually. @var{dump} and @var{verbose} specify the file andverbosity level to use for debugging output.@var{last_clock} and @var{clock} are, respectively, theprocessor cycle on which the previous insn has been issued,and the current processor cycle.@end deftypefn@hook TARGET_SCHED_IS_COSTLY_DEPENDENCEThis hook is used to define which dependences are considered costly bythe target, so costly that it is not advisable to schedule the insns thatare involved in the dependence too close to one another. The parametersto this hook are as follows: The first parameter @var{_dep} is the dependencebeing evaluated. The second parameter @var{cost} is the cost of thedependence as estimated by the scheduler, and the thirdparameter @var{distance} is the distance in cycles between the two insns.The hook returns @code{true} if considering the distance between the twoinsns the dependence between them is considered costly by the target,and @code{false} otherwise.Defining this hook can be useful in multiple-issue out-of-order machines,where (a) it's practically hopeless to predict the actual data/resourcedelays, however: (b) there's a better chance to predict the actual groupingthat will be formed, and (c) correctly emulating the grouping can be veryimportant. In such targets one may want to allow issuing dependent insnscloser to one another---i.e., closer than the dependence distance; however,not in cases of ``costly dependences'', which this hooks allows to define.@end deftypefn@hook TARGET_SCHED_H_I_D_EXTENDEDThis hook is called by the insn scheduler after emitting a new instruction tothe instruction stream. The hook notifies a target backend to extend itsper instruction data structures.@end deftypefn@hook TARGET_SCHED_ALLOC_SCHED_CONTEXTReturn a pointer to a store large enough to hold target scheduling context.@end deftypefn@hook TARGET_SCHED_INIT_SCHED_CONTEXTInitialize store pointed to by @var{tc} to hold target scheduling context.It @var{clean_p} is true then initialize @var{tc} as if scheduler is at thebeginning of the block. Otherwise, copy the current context into @var{tc}.@end deftypefn@hook TARGET_SCHED_SET_SCHED_CONTEXTCopy target scheduling context pointed to by @var{tc} to the current context.@end deftypefn@hook TARGET_SCHED_CLEAR_SCHED_CONTEXTDeallocate internal data in target scheduling context pointed to by @var{tc}.@end deftypefn@hook TARGET_SCHED_FREE_SCHED_CONTEXTDeallocate a store for target scheduling context pointed to by @var{tc}.@end deftypefn@hook TARGET_SCHED_SPECULATE_INSNThis hook is called by the insn scheduler when @var{insn} has onlyspeculative dependencies and therefore can be scheduled speculatively.The hook is used to check if the pattern of @var{insn} has a speculativeversion and, in case of successful check, to generate that speculativepattern. The hook should return 1, if the instruction has a speculative form,or @minus{}1, if it doesn't. @var{request} describes the type of requestedspeculation. If the return value equals 1 then @var{new_pat} is assignedthe generated speculative pattern.@end deftypefn@hook TARGET_SCHED_NEEDS_BLOCK_PThis hook is called by the insn scheduler during generation of recovery codefor @var{insn}. It should return @code{true}, if the corresponding checkinstruction should branch to recovery code, or @code{false} otherwise.@end deftypefn@hook TARGET_SCHED_GEN_SPEC_CHECKThis hook is called by the insn scheduler to generate a pattern for recoverycheck instruction. If @var{mutate_p} is zero, then @var{insn} is aspeculative instruction for which the check should be generated.@var{label} is either a label of a basic block, where recovery code shouldbe emitted, or a null pointer, when requested check doesn't branch torecovery code (a simple check). If @var{mutate_p} is nonzero, thena pattern for a branchy check corresponding to a simple check denoted by@var{insn} should be generated. In this case @var{label} can't be null.@end deftypefn@hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD_SPECThis hook is used as a workaround for@samp{TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD} not beingcalled on the first instruction of the ready list. The hook is used todiscard speculative instructions that stand first in the ready list frombeing scheduled on the current cycle. If the hook returns @code{false},@var{insn} will not be chosen to be issued.For non-speculative instructions,the hook should always return @code{true}. For example, in the ia64 backendthe hook is used to cancel data speculative insns when the ALAT tableis nearly full.@end deftypefn@hook TARGET_SCHED_SET_SCHED_FLAGSThis hook is used by the insn scheduler to find out what features should beenabled/used.The structure *@var{spec_info} should be filled in by the target.The structure describes speculation types that can be used in the scheduler.@end deftypefn@hook TARGET_SCHED_SMS_RES_MIIThis hook is called by the swing modulo scheduler to calculate aresource-based lower bound which is based on the resources available inthe machine and the resources required by each instruction. The targetbackend can use @var{g} to calculate such bound. A very simple lowerbound will be used in case this hook is not implemented: the total numberof instructions divided by the issue rate.@end deftypefn@hook TARGET_SCHED_DISPATCHThis hook is called by Haifa Scheduler. It returns true if dispatch schedulingis supported in hardware and the condition specified in the parameter is true.@end deftypefn@hook TARGET_SCHED_DISPATCH_DOThis hook is called by Haifa Scheduler. It performs the operation specifiedin its second parameter.@end deftypefn@hook TARGET_SCHED_EXPOSED_PIPELINE@hook TARGET_SCHED_REASSOCIATION_WIDTH@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 10feb93An object file is divided into sections containing different types ofdata. In the most common case, there are three sections: the @dfn{textsection}, which holds instructions and read-only data; the @dfn{datasection}, which holds initialized writable data; and the @dfn{bsssection}, which holds uninitialized data. Some systems have other kindsof sections.@file{varasm.c} 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} variableis to define the associated @code{@var{FOO}_SECTION_ASM_OP} macro,as described below. The macros are only read once, when @file{varasm.c}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 makeuse of the @code{@var{FOO}_SECTION_ASM_OP} macros, and expect themto be string literals.Some assemblers require a different string to be written every time asection is selected. If your assembler falls into this category, youshould 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 notcreate a distinct @code{readonly_data_section}, the default is toreuse @code{text_section}.All the other @file{varasm.c} sections are optional, and are nullif the target does not provide them.@defmac TEXT_SECTION_ASM_OPA C expression whose value is a string, including spacing, containing theassembler operation that should precede instructions and read-only data.Normally @code{"\t.text"} is right.@end defmac@defmac HOT_TEXT_SECTION_NAMEIf defined, a C string constant for the name of the section containing mostfrequently executed functions of the program. If not defined, GCC will providea default definition if the target supports named sections.@end defmac@defmac UNLIKELY_EXECUTED_TEXT_SECTION_NAMEIf defined, a C string constant for the name of the section containing unlikelyexecuted functions in the program.@end defmac@defmac DATA_SECTION_ASM_OPA C expression whose value is a string, including spacing, containing theassembler operation to identify the following data as writable initializeddata. Normally @code{"\t.data"} is right.@end defmac@defmac SDATA_SECTION_ASM_OPIf defined, a C expression whose value is a string, including spacing,containing the assembler operation to identify the following data asinitialized, writable small data.@end defmac@defmac READONLY_DATA_SECTION_ASM_OPA C expression whose value is a string, including spacing, containing theassembler operation to identify the following data as read-only initializeddata.@end defmac@defmac BSS_SECTION_ASM_OPIf defined, a C expression whose value is a string, including spacing,containing the assembler operation to identify the following data asuninitialized 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 beused.@end defmac@defmac SBSS_SECTION_ASM_OPIf defined, a C expression whose value is a string, including spacing,containing the assembler operation to identify the following data asuninitialized, writable small data.@end defmac@defmac TLS_COMMON_ASM_OPIf defined, a C expression whose value is a string containing theassembler operation to identify the following data as thread-localcommon data. The default is @code{".tls_common"}.@end defmac@defmac TLS_SECTION_ASM_FLAGIf defined, a C expression whose value is a character constantcontaining the flag used to mark a section as a TLS section. Thedefault is @code{'T'}.@end defmac@defmac INIT_SECTION_ASM_OPIf defined, a C expression whose value is a string, including spacing,containing the assembler operation to identify the following data asinitialization code. If not defined, GCC will assume such a section doesnot exist. This section has no corresponding @code{init_section}variable; it is used entirely in runtime code.@end defmac@defmac FINI_SECTION_ASM_OPIf defined, a C expression whose value is a string, including spacing,containing the assembler operation to identify the following data asfinalization code. If not defined, GCC will assume such a section doesnot exist. This section has no corresponding @code{fini_section}variable; it is used entirely in runtime code.@end defmac@defmac INIT_ARRAY_SECTION_ASM_OPIf defined, a C expression whose value is a string, including spacing,containing the assembler operation to identify the following data aspart of the @code{.init_array} (or equivalent) section. If notdefined, GCC will assume such a section does not exist. Do not defineboth this macro and @code{INIT_SECTION_ASM_OP}.@end defmac@defmac FINI_ARRAY_SECTION_ASM_OPIf defined, a C expression whose value is a string, including spacing,containing the assembler operation to identify the following data aspart of the @code{.fini_array} (or equivalent) section. If notdefined, GCC will assume such a section does not exist. Do not defineboth this macro and @code{FINI_SECTION_ASM_OP}.@end defmac@defmac CRT_CALL_STATIC_FUNCTION (@var{section_op}, @var{function})If defined, an ASM statement that switches to a different sectionvia @var{section_op}, calls @var{function}, and switches back tothe text section. This is used in @file{crtstuff.c} if@code{INIT_SECTION_ASM_OP} or @code{FINI_SECTION_ASM_OP} to callsto initialization and finalization functions from the init and finisections. By default, this macro uses a simple function call. Someports need hand-crafted assembly code to avoid dependencies onregisters initialized in the function prologue or to ensure thatconstant pools don't end up too far way in the text section.@end defmac@defmac TARGET_LIBGCC_SDATA_SECTIONIf defined, a string which names the section into which smallvariables defined in crtstuff and libgcc should go. This is usefulwhen the target has options for optimizing access to small data, andyou want the crtstuff and libgcc routines to be conservative in whatthey expect of your application yet liberal in what your applicationexpects. For example, for targets with a @code{.sdata} section (likeMIPS), you could compile crtstuff with @code{-G 0} so that it doesn'trequire small data support from your application, but use this macroto put small data into @code{.sdata} so that your application canaccess these variables whether it uses small data or not.@end defmac@defmac FORCE_CODE_SECTION_ALIGNIf defined, an ASM statement that aligns a code section to somearbitrary boundary. This is used to force all fragments of the@code{.init} and @code{.fini} sections to have to same alignmentand thus prevent the linker from having to add any padding.@end defmac@defmac JUMP_TABLES_IN_TEXT_SECTIONDefine this macro to be an expression with a nonzero value if jumptables (for @code{tablejump} insns) should be output in the textsection, along with the assembler instructions. Otherwise, thereadonly data section is used.This macro is irrelevant if there is no separate readonly data section.@end defmac@hook TARGET_ASM_INIT_SECTIONSDefine this hook if you need to do something special to set up the@file{varasm.c} sections, or if your target has some special sectionsof its own that you need to create.GCC calls this hook after processing the command line, but before writingany assembly code, and before calling any of the section-returning hooksdescribed below.@end deftypefn@hook TARGET_ASM_RELOC_RW_MASKReturn a mask describing how relocations should be treated whenselecting sections. Bit 1 should be set if global relocationsshould be placed in a read-write section; bit 0 should be set iflocal relocations should be placed in a read-write section.The default version of this function returns 3 when @option{-fpic}is in effect, and 0 otherwise. The hook is typically redefinedwhen the target cannot support (some kinds of) dynamic relocationsin read-only sections even in executables.@end deftypefn@hook TARGET_ASM_SELECT_SECTIONReturn the section into which @var{exp} should be placed. You canassume that @var{exp} is either a @code{VAR_DECL} node or a constant ofsome sort. @var{reloc} indicates whether the initial value of @var{exp}requires link-time relocations. Bit 0 is set when variable containslocal relocations only, while bit 1 is set for global relocations.@var{align} is the constant alignment in bits.The default version of this function takes care of putting read-onlyvariables in @code{readonly_data_section}.See also @var{USE_SELECT_SECTION_FOR_FUNCTIONS}.@end deftypefn@defmac USE_SELECT_SECTION_FOR_FUNCTIONSDefine this macro if you wish TARGET_ASM_SELECT_SECTION to be calledfor @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 thefunction has been determined to be likely to be called, and nonzero ifit is unlikely to be called.@end defmac@hook TARGET_ASM_UNIQUE_SECTIONBuild up a unique section name, expressed as a @code{STRING_CST} node,and assign it to @samp{DECL_SECTION_NAME (@var{decl})}.As with @code{TARGET_ASM_SELECT_SECTION}, @var{reloc} indicates whetherthe initial value of @var{exp} requires link-time relocations.The default version of this function appends the symbol name to theELF section name that would normally be used for the symbol. Forexample, the function @code{foo} would be placed in @code{.text.foo}.Whatever the actual target object format, this is often good enough.@end deftypefn@hook TARGET_ASM_FUNCTION_RODATA_SECTIONReturn the readonly data section associated with@samp{DECL_SECTION_NAME (@var{decl})}.The default version of this function selects @code{.gnu.linkonce.r.name} ifthe function's section is @code{.gnu.linkonce.t.name}, @code{.rodata.name}if function is in @code{.text.name}, and the normal readonly-data sectionotherwise.@end deftypefn@hook TARGET_ASM_MERGEABLE_RODATA_PREFIX@hook TARGET_ASM_TM_CLONE_TABLE_SECTION@hook TARGET_ASM_SELECT_RTX_SECTIONReturn the section into which a constant @var{x}, of mode @var{mode},should be placed. You can assume that @var{x} is some kind ofconstant in RTL@. The argument @var{mode} is redundant except in thecase of a @code{const_int} rtx. @var{align} is the constant alignmentin bits.The default version of this function takes care of putting symbolicconstants in @code{flag_pic} mode in @code{data_section} and everythingelse in @code{readonly_data_section}.@end deftypefn@hook TARGET_MANGLE_DECL_ASSEMBLER_NAMEDefine this hook if you need to postprocess the assembler name generatedby target-independent code. The @var{id} provided to this hook will bethe computed name (e.g., the macro @code{DECL_NAME} of the @var{decl} in C,or the mangled name of the @var{decl} in C++). The return value of thehook is an @code{IDENTIFIER_NODE} for the appropriate mangled name onyour target system. The default implementation of this hook justreturns the @var{id} provided.@end deftypefn@hook TARGET_ENCODE_SECTION_INFODefine this hook if references to a symbol or a constant must betreated differently depending on something about the variable orfunction named by the symbol (such as what section it is in).The hook is executed immediately after rtl has been created for@var{decl}, which may be a variable or function declaration oran entry in the constant pool. In either case, @var{rtl} is thertl in question. Do @emph{not} use @code{DECL_RTL (@var{decl})}in this hook; that field may not have been initialized yet.In the case of a constant, it is safe to assume that the rtl isa @code{mem} whose address is a @code{symbol_ref}. Most declswill also have this form, but that is not guaranteed. Globalregister variables, for instance, will have a @code{reg} for theirrtl. (Normally the right thing to do with such unusual rtl isleave it alone.)The @var{new_decl_p} argument will be true if this is the first timethat @code{TARGET_ENCODE_SECTION_INFO} has been invoked on this decl. It willbe false for subsequent invocations, which will happen for duplicatedeclarations. Whether or not anything must be done for the duplicatedeclaration depends on whether the hook examines @code{DECL_ATTRIBUTES}.@var{new_decl_p} is always true when the hook is called for a constant.@cindex @code{SYMBOL_REF_FLAG}, in @code{TARGET_ENCODE_SECTION_INFO}The usual thing for this hook to do is to record flags in the@code{symbol_ref}, using @code{SYMBOL_REF_FLAG} or @code{SYMBOL_REF_FLAGS}.Historically, the name string was modified if it was necessary toencode more than one bit of information, but this practice is nowdiscouraged; use @code{SYMBOL_REF_FLAGS}.The default definition of this hook, @code{default_encode_section_info}in @file{varasm.c}, sets a number of commonly-useful bits in@code{SYMBOL_REF_FLAGS}. Check whether the default does what you needbefore overriding it.@end deftypefn@hook TARGET_STRIP_NAME_ENCODINGDecode @var{name} and return the real name part, sansthe characters that @code{TARGET_ENCODE_SECTION_INFO}may have added.@end deftypefn@hook TARGET_IN_SMALL_DATA_PReturns true if @var{exp} should be placed into a ``small data'' section.The default version of this hook always returns false.@end deftypefn@hook TARGET_HAVE_SRODATA_SECTIONContains the value true if the target places read-only``small data'' into a separate section. The default value is false.@end deftypevr@hook TARGET_PROFILE_BEFORE_PROLOGUE@hook TARGET_BINDS_LOCAL_PReturns true if @var{exp} names an object for which name resolutionrules must resolve to the current ``module'' (dynamic shared libraryor executable image).The default version of this hook implements the name resolution rulesfor ELF, which has a looser model of global name binding than othercurrently supported object file formats.@end deftypefn@hook TARGET_HAVE_TLSContains the value true if the target supports thread-local storage.The default value is false.@end deftypevr@node PIC@section Position Independent Code@cindex position independent code@cindex PICThis section describes macros that help implement generation of positionindependent code. Simply defining these macros is not enough togenerate 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}. Youmust modify the definition of @samp{movsi} to do something appropriatewhen the source operand contains a symbolic address. You may alsoneed to alter the handling of switch statements so that they userelative 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_REGNUMThe register number of the register used to address a table of staticdata addresses in memory. In some cases this register is defined by aprocessor's ``application binary interface'' (ABI)@. When this macrois defined, RTL is generated for this register once, as with the stackpointer and frame pointer registers. If this macro is not defined, itis up to the machine-dependent files to allocate such a register (ifnecessary). 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_CLOBBEREDA 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 definethis 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 immediateoperand on the target machine when generating position independent code.You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need notcheck this. You can also assume @var{flag_pic} is true, so you need notcheck it either. You need not define this macro if all constants(including @code{SYMBOL_REF}) can be immediate operands when generatingposition independent code.@end defmac@node Assembler Format@section Defining the Output Assembler LanguageThis section describes macros whose principal purpose is to describe howto write instructions in assembler language---rather than what theinstructions 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 initializationand termination routines.* Macros for Initialization::Specific macros that control the handling ofinitialization 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 lineThis describes the overall framework of an assembly file.@findex default_file_start@hook TARGET_ASM_FILE_STARTOutput to @code{asm_out_file} any text which the assembler expects tofind at the beginning of a file. The default behavior is controlledby two flags, documented below. Unless your target's assembler isquite unusual, if you override the default, you should call@code{default_file_start} at some point in your target hook. Thislets other target files rely on these variables.@end deftypefn@hook TARGET_ASM_FILE_START_APP_OFFIf this flag is true, the text of the macro @code{ASM_APP_OFF} will beprinted as the very first line in the assembly file, unless@option{-fverbose-asm} is in effect. (If that macro has been definedto the empty string, this variable has no effect.) With the normaldefinition of @code{ASM_APP_OFF}, the effect is to notify the GNUassembler that it need not bother stripping comments or extrawhitespace from its input. This allows it to work a bit faster.The default is false. You should not set it to true unless you haveverified that your port does not generate any extra whitespace orcomments that will cause GAS to issue errors in NO_APP mode.@end deftypevr@hook TARGET_ASM_FILE_START_FILE_DIRECTIVEIf this flag is true, @code{output_file_directive} will be calledfor the primary source file, immediately after printing@code{ASM_APP_OFF} (if that is enabled). Most ELF assemblers expectthis to be done. The default is false.@end deftypevr@hook TARGET_ASM_FILE_ENDOutput to @code{asm_out_file} any text which the assembler expectsto find at the end of a file. The default is to output nothing.@end deftypefn@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 onthe stack being executable. If your system uses this convention, youshould define @code{TARGET_ASM_FILE_END} to this function. If youneed to do other things in that hook, have your hook function callthis function.@end deftypefun@hook TARGET_ASM_LTO_STARTOutput to @code{asm_out_file} any text which the assembler expectsto find at the start of an LTO section. The default is to outputnothing.@end deftypefn@hook TARGET_ASM_LTO_ENDOutput to @code{asm_out_file} any text which the assembler expectsto find at the end of an LTO section. The default is to outputnothing.@end deftypefn@hook TARGET_ASM_CODE_ENDOutput to @code{asm_out_file} any text which is needed before emittingunwind info and debug info at the end of a file. Some targets emithere PIC setup thunks that cannot be emitted at the end of file,because they couldn't have unwind info then. The default is to outputnothing.@end deftypefn@defmac ASM_COMMENT_STARTA C string constant describing how to begin a comment in the targetassembler language. The compiler assumes that the comment will end atthe end of the line.@end defmac@defmac ASM_APP_ONA 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 mostassemblers but tells the GNU assembler that it must check the linesthat follow for all valid assembler constructs.@end defmac@defmac ASM_APP_OFFA 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 thetime-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 informationwhich indicates that filename @var{name} is the current source file tothe stdio stream @var{stream}.This macro need not be defined if the standard form of outputfor the file format in use is appropriate.@end defmac@hook TARGET_ASM_OUTPUT_SOURCE_FILENAME@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 tothe assembler source. So you can use it to canonicalize the formatof the filename using this macro.@end defmac@defmac ASM_OUTPUT_IDENT (@var{stream}, @var{string})A C statement to output something to the assembler file to handle a@samp{#ident} directive containing the text @var{string}. If thismacro is not defined, nothing is output for a @samp{#ident} directive.@end defmac@hook TARGET_ASM_NAMED_SECTIONOutput assembly directives to switch to section @var{name}. The sectionshould have attributes as specified by @var{flags}, which is a bit maskof the @code{SECTION_*} flags defined in @file{output.h}. If @var{decl}is non-NULL, it is the @code{VAR_DECL} or @code{FUNCTION_DECL} with whichthis section is associated.@end deftypefn@hook TARGET_ASM_FUNCTION_SECTIONReturn preferred text (sub)section for function @var{decl}.Main purpose of this function is to separate cold, normal and hotfunctions. @var{startup} is true when function is known to be used onlyat startup (from static constructors or it is @code{main()}).@var{exit} is true when function is known to be used only at exit(from static destructors).Return NULL if function should go to default text section.@end deftypefn@hook TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS@hook TARGET_HAVE_NAMED_SECTIONSThis 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_SECTIONSThis flag is true if we can create zeroed data by switching to a BSSsection and then using @code{ASM_OUTPUT_SKIP} to allocate the space.This is true on most ELF targets.@end deftypevr@hook TARGET_SECTION_TYPE_FLAGSChoose a set of section attributes for use by @code{TARGET_ASM_NAMED_SECTION}based on a variable or function decl, a section name, and whether or not thedeclaration's initializer may contain runtime relocations. @var{decl} may benull, in which case read-write data should be assumed.The default version of this function handles choosing code vs data,read-only vs read-write data, and @code{flag_pic}. You should onlyneed to override this if your target has special flags that might beset via @code{__attribute__}.@end deftypefn@hook TARGET_ASM_RECORD_GCC_SWITCHESProvides the target with the ability to record the gcc command lineswitches that have been passed to the compiler, and options that areenabled. The @var{type} argument specifies what is being recorded.It can take the following values:@table @gcctabopt@item SWITCH_TYPE_PASSED@var{text} is a command line switch that has been set by the user.@item SWITCH_TYPE_ENABLED@var{text} is an option which has been enabled. This might be as adirect result of a command line switch, or because it is enabled bydefault or because it has been enabled as a side effect of a differentcommand line switch. For example, the @option{-O2} switch enablesvarious different individual optimization passes.@item SWITCH_TYPE_DESCRIPTIVE@var{text} is either NULL or some descriptive text which should beignored. If @var{text} is NULL then it is being used to warn thetarget hook that either recording is starting or ending. The firsttime @var{type} is SWITCH_TYPE_DESCRIPTIVE and @var{text} is NULL, thewarning is for start up and the second time the warning is forwind down. This feature is to allow the target hook to make anynecessary preparations before it starts to record switches and toperform any necessary tidying up after it has finished recordingswitches.@item SWITCH_TYPE_LINE_STARTThis option can be ignored by this target hook.@item SWITCH_TYPE_LINE_ENDThis option can be ignored by this target hook.@end tableThe hook's return value must be zero. Other return values may besupported in the future.By default this hook is set to NULL, but an example implementation isprovided for ELF based targets. Called @var{elf_record_gcc_switches},it records the switches as ASCII text inside a new, string mergeablesection in the assembler output file. The name of the new section isprovided by the @code{TARGET_ASM_RECORD_GCC_SWITCHES_SECTION} targethook.@end deftypefn@hook TARGET_ASM_RECORD_GCC_SWITCHES_SECTIONThis is the name of the section that will be created by the exampleELF implementation of the @code{TARGET_ASM_RECORD_GCC_SWITCHES} targethook.@end deftypevr@need 2000@node Data Output@subsection Output of Data@hook TARGET_ASM_BYTE_OP@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_HI_OP@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_TI_OP@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_HI_OP@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_TI_OPThese hooks specify assembly directives for creating certain kindsof integer object. The @code{TARGET_ASM_BYTE_OP} directive creates abyte-sized object, the @code{TARGET_ASM_ALIGNED_HI_OP} one creates analigned two-byte object, and so on. Any of the hooks may be@code{NULL}, indicating that no suitable directive is available.The compiler will print these strings at the start of a new line,followed immediately by the object's initial value. In most cases,the string should contain a tab, a pseudo-op, and then another tab.@end deftypevr@hook TARGET_ASM_INTEGERThe @code{assemble_integer} function uses this hook to output aninteger object. @var{x} is the object's value, @var{size} is its sizein bytes and @var{aligned_p} indicates whether it is aligned. Thefunction should return @code{true} if it was able to output theobject. If it returns false, @code{assemble_integer} will try tosplit the object into smaller parts.The default implementation of this hook will use the@code{TARGET_ASM_BYTE_OP} family of strings, returning @code{false}when the relevant string is @code{NULL}.@end deftypefn@hook TARGET_ASM_OUTPUT_ADDR_CONST_EXTRAA target hook to recognize @var{rtx} patterns that @code{output_addr_const}can't deal with, and output assembly code to @var{file} corresponding tothe pattern @var{x}. This may be used to allow machine-dependent@code{UNSPEC}s to appear within constants.If target hook fails to recognize a pattern, it must return @code{false},so that a standard error message is printed. If it prints an error messageitself, by calling, for example, @code{output_operand_lossage}, it may justreturn @code{true}.@end deftypefn@defmac ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len})A C statement to output to the stdio stream @var{stream} an assemblerinstruction 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 theBerkeley 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_FUNCTIONYou may define this macro as a C expression. You should define theexpression to have a nonzero value if GCC should output the constantpool for a function before the code for the function, or a zero value ifGCC should output the constant pool after the function. If you donot define this macro, the usual case, GCC will output the constantpool 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 theconstant pool for a function. @var{funname} is a string givingthe name of the function. Should the return type of the functionbe required, it can be obtained via @var{fundecl}. @var{size}is the size, in bytes, of the constant pool that will be writtenimmediately after this call.If no constant-pool prefix is required, the usual case, this macro neednot 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 theconstant pool, if it needs special treatment. (This macro need not doanything for RTL expressions that can be output normally.)The argument @var{file} is the standard I/O stream to output theassembler code on. @var{x} is the RTL expression for the constant tooutput, 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 muchalignment.The argument @var{labelno} is a number to use in an internal label forthe address of this pool entry. The definition of this macro isresponsible 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 smallexampleWhen you output a pool entry specially, you should end with a@code{goto} to the label @var{jumpto}. This will prevent the same poolentry 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 constantpool for a function. @var{funname} is a string giving the name of thefunction. Should the return type of the function be required, you canobtain it via @var{fundecl}. @var{size} is the size, in bytes, of theconstant pool that GCC wrote immediately before this call.If no constant-pool epilogue is required, the usual case, you need notdefine 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} isused as a logical line separator by the assembler. @var{STR} pointsto the position in the string where @var{C} was found; this can be used ifa line separator uses multiple characters.If you do not define this macro, the default is that onlythe character @samp{;} is treated as a logical line separator.@end defmac@hook TARGET_ASM_OPEN_PARENThese target hooks are C string constants, describing the syntax in theassembler for grouping arithmetic expressions. If not overridden, theydefault to normal parentheses, which is correct for most assemblers.@end deftypevrThese macros are provided by @file{real.h} for writing the definitionsof @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 thetarget's floating point representation, and store its bit pattern inthe variable @var{l}. For @code{REAL_VALUE_TO_TARGET_SINGLE} and@code{REAL_VALUE_TO_TARGET_DECIMAL32}, this variable should be asimple @code{long int}. For the others, it should be an array of@code{long int}. The number of elements in this array is determinedby the size of the desired target floating point data type: 32 bits ofit go in each @code{long int} array element. Each array element holds32 bits of the result, even if @code{long int} is wider than 32 bitson the host machine.The array element values are designed so that you can print them outusing @code{fprintf} in the order they should appear in the targetmachine's memory.@end defmac@node Uninitialized Data@subsection Output of Uninitialized VariablesEach of the macros in this section is used to do the whole job ofoutputting 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 ispossible that @var{size} may be zero, for instance if a struct with noother member than a zero-length array is defined. In this case, thebackend must output a symbol definition that allocates at least onebyte, both so that the address of the resulting object does not compareequal to any other, and because some object formats cannot even expressthe concept of a zero-sized common symbol, as that is how they representan ordinary undefined external.Use the expression @code{assemble_name (@var{stream}, @var{name})} tooutput the name itself; before and after that, output the additionalassembler syntax for defining the name, and a newline.This macro controls how the assembler definitions of uninitializedcommon 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 aseparate, explicit argument. If you define this macro, it is used inplace of @code{ASM_OUTPUT_COMMON}, and gives you more flexibility inhandling the required alignment of the variable. The alignment is specifiedas 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 thevariable to be output, if there is one, or @code{NULL_TREE} if thereis no corresponding variable. If you define this macro, GCC will use itin place of both @code{ASM_OUTPUT_COMMON} and@code{ASM_OUTPUT_ALIGNED_COMMON}. Define this macro when you need to seethe 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.c} 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 definingthe 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 aswitchable 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 anon-common form of global BSS in order to handle uninitialized globalsefficiently. C++ is one example of this. However, if the target doesnot support global BSS, the front end may choose to make globalscommon 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})} tooutput the name itself; before and after that, output the additionalassembler syntax for defining the name, and a newline.This macro controls how the assembler definitions of uninitializedstatic 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 aseparate, explicit argument. If you define this macro, it is used inplace of @code{ASM_OUTPUT_LOCAL}, and gives you more flexibility inhandling the required alignment of the variable. The alignment is specifiedas 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_DECL} except that @var{decl} of thevariable to be output, if there is one, or @code{NULL_TREE} if thereis no corresponding variable. If you define this macro, GCC will use itin place of both @code{ASM_OUTPUT_DECL} and@code{ASM_OUTPUT_ALIGNED_DECL}. Define this macro when you need to seethe 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 lineThis 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})} tooutput the name itself; before and after that, output the additionalassembler syntax for defining the name, and a newline. A defaultdefinition 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} ofa function.Use the expression @code{assemble_name (@var{stream}, @var{name})} tooutput the name itself; before and after that, output the additionalassembler syntax for defining the name, and a newline. A defaultdefinition of this macro is provided which is correct for most systems.If this macro is not defined, then the function name is defined in theusual 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 knownto refer to a compiler-generated label. The default definition uses@code{assemble_name_raw}, which is like @code{assemble_name} exceptthat it is more efficient.@end defmac@defmac SIZE_ASM_OPA C string containing the appropriate assembler directive to specify thesize of a symbol, without any arguments. On systems that use ELF, thedefault (in @file{config/elfos.h}) is @samp{"\t.size\t"}; on othersystems, the default is not to define this macro.Define this macro only if it is correct to use the default definitionsof @code{ASM_OUTPUT_SIZE_DIRECTIVE} and @code{ASM_OUTPUT_MEASURED_SIZE}for your system. If you need your own custom definitions of thosemacros, or if you do not need explicit symbol sizes at all, do notdefine 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 thesymbol @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 isprovided.@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 ofthe symbol @var{name} by subtracting its address from the currentaddress.If you define @code{SIZE_ASM_OP}, a default definition of this macro isprovided. The default assumes that the assembler recognizes a special@samp{.} symbol as referring to the current address, and can calculatethe difference between this and another symbol. If your assembler doesnot recognize @samp{.} or cannot do calculations with it, you will needto redefine @code{ASM_OUTPUT_MEASURED_SIZE} to use some other technique.@end defmac@defmac TYPE_ASM_OPA C string containing the appropriate assembler directive to specify thetype of a symbol, without any arguments. On systems that use ELF, thedefault (in @file{config/elfos.h}) is @samp{"\t.type\t"}; on othersystems, 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 owncustom definition of this macro, or if you do not need explicit symboltypes at all, do not define this macro.@end defmac@defmac TYPE_OPERAND_FMTA C string which specifies (using @code{printf} syntax) the format ofthe second operand to @code{TYPE_ASM_OP}. On systems that use ELF, thedefault (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 owncustom definition of this macro, or if you do not need explicit symboltypes 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 thesymbol @var{name} is @var{type}. @var{type} is a C string; currently,that string is always either @samp{"function"} or @samp{"object"}, butyou should not count on this.If you define @code{TYPE_ASM_OP} and @code{TYPE_OPERAND_FMT}, a defaultdefinition 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 afunction which is being defined. This macro is responsible foroutputting 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 theusual manner as a label (by means of @code{ASM_OUTPUT_FUNCTION_LABEL}).You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in the definitionof 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 functionwhich is being defined. The argument @var{name} is the name of thefunction. The argument @var{decl} is the @code{FUNCTION_DECL} tree noderepresenting 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 definitionof 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 aninitialized variable which is being defined. This macro must output thelabel 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 theusual 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_NAMEA target hook to output to the stdio stream @var{file} any text necessaryfor declaring the name @var{name} of a constant which is being defined. Thistarget hook is responsible for outputting the label definition (perhaps using@code{assemble_label}). The argument @var{exp} is the value of the constant,and @var{size} is the size of the constant in bytes. The @var{name}will be an internal label.The default version of this target hook, define the @var{name} in theusual manner as a label (by means of @code{assemble_label}).You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in this target hook.@end deftypefn@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 donothing.@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 nameonce the compiler has processed its initializer fully and thus has had achance to determine the size of an array when controlled by aninitializer. This is used on systems where it's necessary to declaresomething about the size of the object.If you don't define this macro, that is equivalent to defining it to donothing.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_LABELThis target hook is a function to output to the stdio stream@var{stream} some commands that will make the label @var{name} global;that is, available for reference from other files.The default implementation relies on a proper definition of@code{GLOBAL_ASM_OP}.@end deftypefn@hook TARGET_ASM_GLOBALIZE_DECL_NAMEThis target hook is a function to output to the stdio stream@var{stream} some commands that will make the name associated with @var{decl}global; that is, available for reference from other files.The default implementation uses the TARGET_ASM_GLOBALIZE_LABEL target hook.@end deftypefn@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 ifno other definition is available. Use the expression@code{assemble_name (@var{stream}, @var{name})} to output the nameitself; before and after that, output the additional assembler syntaxfor making that name weak, and a newline.If you don't define this macro or @code{ASM_WEAKEN_DECL}, GCC will notsupport 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 functionor variable decl. If @var{value} is not @code{NULL}, this C statementshould output to the stdio stream @var{stream} assembler code whichdefines (equates) the weak symbol @var{name} to have the value@var{value}. If @var{value} is @code{NULL}, it should output commandsto 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 tosymbol @var{value} with weak-symbol semantics. @code{decl} is thedeclaration of @code{name}.@end defmac@defmac SUPPORTS_WEAKA preprocessor constant expression which evaluates to true if the targetsupports weak symbols.If you don't define this macro, @file{defaults.h} provides a defaultdefinition. 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_WEAKA C expression which evaluates to true if the target supports weak symbols.If you don't define this macro, @file{defaults.h} provides a defaultdefinition. The default definition is @samp{(SUPPORTS_WEAK)}. Definethis macro if you want to control weak symbol support with a compilerflag 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 apublic symbol such that extra copies in multiple translation units willbe discarded by the linker. Define this macro if your object fileformat provides support for this concept, such as the @samp{COMDAT}section flags in the Microsoft Windows PE/COFF format, and this supportrequires changes to @var{decl}, such as putting it in a separate section.@end defmac@defmac SUPPORTS_ONE_ONLYA C expression which evaluates to true if the target supports one-onlysemantics.If you don't define this macro, @file{varasm.c} provides a defaultdefinition. If @code{MAKE_DECL_ONE_ONLY} is defined, the defaultdefinition is @samp{1}; otherwise, it is @samp{0}. Define this macro ifyou want to control one-only symbol support with a compiler flag, or ifsetting the @code{DECL_ONE_ONLY} flag is enough to mark a declaration tobe emitted as one-only.@end defmac@hook TARGET_ASM_ASSEMBLE_VISIBILITYThis target hook is a function to output to @var{asm_out_file} somecommands that will make the symbol(s) associated with @var{decl} havehidden, protected or internal visibility as specified by @var{visibility}.@end deftypefn@defmac TARGET_WEAK_NOT_IN_ARCHIVE_TOCA C expression that evaluates to true if the target's linker expectsthat 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 andwill have undefined references from other translation units, thatsymbol should not be weak. Defining this macro to be nonzero willthus have the effect that certain symbols that would normally be weak(explicit template instantiations, and vtables for polymorphic classeswith noninline key methods) will instead be nonweak.The C++ ABI requires this macro to be zero. Define this macro fortargets where full C++ ABI compliance is impossible and where linkerrestrictions require weak symbols to be left out of a static archive'stable 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 externalsymbol named @var{name} which is referenced in this compilation butnot defined. The value of @var{decl} is the tree node for thedeclaration.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_LIBCALLThis target hook is a function to output to @var{asm_out_file} an assemblerpseudo-op to declare a library function name external. The name of thelibrary function is given by @var{symref}, which is a @code{symbol_ref}.@end deftypefn@hook TARGET_ASM_MARK_DECL_PRESERVEDThis target hook is a function to output to @var{asm_out_file} an assemblerdirective to annotate @var{symbol} as used. The Darwin target uses the.no_dead_code_strip directive.@end deftypefn@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 thatis customary on your operating system, as it is in most Berkeley Unixsystems. 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 usedto modify the way a symbol is referenced depending on informationencoded 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}, theresult 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 setwhen it is necessary to output a label differently when its address isbeing taken.@end defmac@hook TARGET_ASM_INTERNAL_LABELA function to output to the stdio stream @var{stream} a label whosename is made from the string @var{prefix} and the number @var{labelno}.It is absolutely essential that these labels be distinct from the labelsused for user-level functions and variables. Otherwise, certain programswill have name conflicts with internal labels.It is desirable to exclude internal labels from the symbol table of theobject file. Most assemblers have a naming convention for labels thatshould be excluded; on many systems, the letter @samp{L} at thebeginning of a label has this effect. You should find out whatconvention your system uses, and follow it.The default version of this function utilizes @code{ASM_GENERATE_INTERNAL_LABEL}.@end deftypefn@defmac ASM_OUTPUT_DEBUG_LABEL (@var{stream}, @var{prefix}, @var{num})A C statement to output to the stdio stream @var{stream} a debug infolabel whose name is made from the string @var{prefix} and the number@var{num}. This is useful for VLIW targets, where debug info labelsmay need to be treated differently than branch target labels. On somesystems, branch target labels must be at the beginning of instructionbundles, but debug info labels can occur in the middle of instructionbundles.If this macro is not defined, then @code{(*targetm.asm_out.internal_label)} will beused.@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 nameis made from the string @var{prefix} and the number @var{num}.This string, when output subsequently by @code{assemble_name}, shouldproduce the output that @code{(*targetm.asm_out.internal_label)} would producewith the same @var{prefix} and @var{num}.If the string begins with @samp{*}, then @code{assemble_name} willoutput the rest of the string unchanged. It is often convenient for@code{ASM_GENERATE_INTERNAL_LABEL} to use @samp{*} in this way. If thestring doesn't start with @samp{*}, then @code{ASM_OUTPUT_LABELREF} getsto output the string, and may change it. (Of course,@code{ASM_OUTPUT_LABELREF} is also part of your machine description, soyou 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 punctuationadded. Use @code{alloca} to get space for the string.The string will be used as an argument to @code{ASM_OUTPUT_LABELREF} toproduce an assembler label for an internal static variable whose name is@var{name}. Therefore, the string must be such as to result in validassembler code. The argument @var{number} is different each time thismacro is executed; it prevents conflicts between similarly-namedinternal static variables in different scopes.Ideally this string should not be a valid C identifier, to prevent anyconflict with the user's own symbols. Most assemblers allow periodsor percent signs in assembler symbols; putting at least one of thesebetween the name and the number will suffice.If this macro is not defined, a default definition will be providedwhich 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 codewhich defines (equates) the symbol @var{name} to have the value @var{value}.@findex SET_ASM_OPIf @code{SET_ASM_OP} is defined, a default definition is provided which iscorrect 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 codewhich 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 willbe used in preference to @samp{ASM_OUTPUT_DEF} if it is defined and ifthe tree nodes are available.@findex SET_ASM_OPIf @code{SET_ASM_OP} is defined, a default definition is provided which iscorrect 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 valueof the tree node @var{decl_of_value} should be emitted near the end of thecurrent 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 codewhich defines (equates) the weak symbol @var{name} to have the value@var{value}. If @var{value} is @code{NULL}, it defines @var{name} asan 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 forObjective-C methods.The default name is a unique method number followed by the name of theclass (e.g.@: @samp{_1_Foo}). For methods in categories, the name ofthe 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 sincethe method's selector is not present in the name. Therefore, particularsystems define other ways of computing names.@var{buf} is an expression of type @code{char *} which gives you abuffer in which to store the name; its length is as long as@var{class_name}, @var{cat_name} and @var{sel_name} put together, plus50 characters extra.The argument @var{is_inst} specifies whether the method is an instancemethod 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 notin a category); and @var{sel_name} is the name of the selector.On systems where the assembler can handle quoted names, you can use thismacro to provide more human-readable names.@end defmac@defmac ASM_DECLARE_CLASS_REFERENCE (@var{stream}, @var{name})A C statement (sans semicolon) to output to the stdio stream@var{stream} commands to declare that the label @var{name} is anObjective-C class reference. This is only needed for targets whoselinkers have special support for NeXT-style runtimes.@end defmac@defmac ASM_DECLARE_UNRESOLVED_REFERENCE (@var{stream}, @var{name})A C statement (sans semicolon) to output to the stdio stream@var{stream} commands to declare that the label @var{name} is anunresolved Objective-C class reference. This is only needed for targetswhose linkers have special support for NeXT-style runtimes.@end defmac@node Initialization@subsection How Initialization Functions Are Handled@cindex initialization routines@cindex termination routines@cindex constructors, output of@cindex destructors, output ofThe compiled code for certain languages includes @dfn{constructors}(also called @dfn{initialization routines})---functions to initializedata in the program when the program is started. These functions needto 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 programterminates.To make the initialization and termination functions work, the compilermust output something in the assembler code to cause those functions tobe called at the appropriate time. When you port the compiler to a newsystem, you need to specify how to do this.There are two major ways that GCC currently supports the execution ofinitialization 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 ofinitialization functions, called @code{__CTOR_LIST__}, and a list oftermination functions, called @code{__DTOR_LIST__}.Each list always begins with an ignored function pointer (which may hold0, @minus{}1, or a count of the function pointers after it, depending onthe environment). This is followed by a series of zero or more functionpointers to constructors (or destructors), followed by a functionpointer containing zero.Depending on the operating system and its executable file format, either@file{crtstuff.c} or @file{libgcc2.c} traverses these lists at startuptime and exit time. Constructors are called in reverse order of thelist; destructors in forward order.The best way to handle static constructors works only for object fileformats which provide arbitrarily-named sections. A section is setaside for a list of constructors, and another for a list of destructors.Traditionally these are called @samp{.ctors} and @samp{.dtors}. Eachobject file that defines an initialization function also puts a word inthe constructor section to point to that function. The linkeraccumulates 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 notsupport arbitrary sections, but does support special designatedconstructor 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, dependingupon how the code in @file{crtstuff.c} is called. On systems thatsupport a @dfn{.init} section which is executed at program startup,parts of @file{crtstuff.c} are compiled into that section. Theprogram is linked by the @command{gcc} driver like this:@smallexampleld -o @var{output_file} crti.o crtbegin.o @dots{} -lgcc crtend.o crtn.o@end smallexampleThe prologue of a function (@code{__init}) appears in the @code{.init}section of @file{crti.o}; the epilogue appears in @file{crtn.o}. Likewisefor the function @code{__fini} in the @dfn{.fini} section. Normally thesefiles are provided by the operating system or by the GNU C library, butare 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, codefragments within the @code{.init} and @code{.fini} sections that branchto routines in the @code{.text} section. The linker will pull all partsof a section together, which results in a complete @code{__init} functionthat 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 programentry point by the language front end calling @code{expand_main_function}),it inserts a procedure call to @code{__main} as the first executable codeafter the function prologue. The @code{__main} function is definedin @file{libgcc2.c} and runs the global constructors.In file formats that don't support arbitrary sections, there are againtwo 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 initializationcode as its value. The GNU linker recognizes this as a request to addthe value to a @dfn{set}; the values are accumulated, and are eventuallyplaced in the executable as a vector in the format described above, witha leading (ignored) count and a trailing zero element.@code{TARGET_ASM_DESTRUCTOR} is handled similarly. Since no initsection is available, the absence of @code{INIT_SECTION_ASM_OP} causesthe compilation of @code{main} to call @code{__main} as above, startingthe 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 usingfile formats which the GNU linker does not support, such as `ECOFF'@. Inthis case, @code{TARGET_HAVE_CTORS_DTORS} is false, initialization andtermination functions are recognized simply by their names. This requiresan extra program in the linkage step, called @command{collect2}. This programpretends to be the linker, for use with GCC; it does its job by runningthe ordinary linker, but also arranges to include the vectors ofinitialization and termination functions. These functions are calledvia @code{__main} as described above. In order to use this method,@code{use_collect2} must be defined in the target in @file{config.gcc}.@ifinfoThe following section describes the specific macros that control andcustomize the handling of initialization and termination functions.@end ifinfo@node Macros for Initialization@subsection Macros Controlling Initialization RoutinesHere are the macros that control how the compiler handles initializationand termination functions:@defmac INIT_SECTION_ASM_OPIf defined, a C string constant, including spacing, for the assembleroperation to identify the following data as initialization code. If notdefined, GCC will assume such a section does not exist. When you areusing special sections for initialization and termination functions, thismacro also controls how @file{crtstuff.c} and @file{libgcc2.c} arrange torun the initialization functions.@end defmac@defmac HAS_INIT_SECTIONIf defined, @code{main} will not call @code{__main} as described above.This macro should be defined for systems that control start-up codeon a symbol-by-symbol basis, such as OSF/1, and should notbe defined explicitly for systems that support @code{INIT_SECTION_ASM_OP}.@end defmac@defmac LD_INIT_SWITCHIf defined, a C string constant for a switch that tells the linker thatthe following symbol is an initialization routine.@end defmac@defmac LD_FINI_SWITCHIf defined, a C string constant for a switch that tells the linker thatthe 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 beautomatically called when a shared library is loaded. The functionshould call @var{func}, which takes no arguments. If not defined, andthe object format requires an explicit initialization function, then afunction called @code{_GLOBAL__DI} will be generated.This function and the following one are used by collect2 when linking ashared library that needs constructors or destructors, or has DWARF2exception 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 beautomatically called when a shared library is unloaded. The functionshould call @var{func}, which takes no arguments. If not defined, andthe object format requires an explicit finalization function, then afunction called @code{_GLOBAL__DD} will be generated.@end defmac@defmac INVOKE__mainIf defined, @code{main} will call @code{__main} despite the presence of@code{INIT_SECTION_ASM_OP}. This macro should be defined for systemswhere the init section is not actually run automatically, but is stilluseful for collecting the lists of constructors and destructors.@end defmac@defmac SUPPORTS_INIT_PRIORITYIf nonzero, the C++ @code{init_priority} attribute is supported and thecompiler should emit instructions to control the order of initializationof objects. If zero, the compiler will issue an error message uponencountering an @code{init_priority} attribute.@end defmac@hook TARGET_HAVE_CTORS_DTORSThis value is true if the target supports some ``native'' method ofcollecting constructors and destructors to be run at startup and exit.It is false if we must use @command{collect2}.@end deftypevr@hook TARGET_ASM_CONSTRUCTORIf defined, a function that outputs assembler code to arrange to callthe function referenced by @var{symbol} at initialization time.Assume that @var{symbol} is a @code{SYMBOL_REF} for a function takingno arguments and with no return value. If the target supports initializationpriorities, @var{priority} is a value between 0 and @code{MAX_INIT_PRIORITY};otherwise it must be @code{DEFAULT_INIT_PRIORITY}.If this macro is not defined by the target, a suitable default willbe chosen if (1) the target supports arbitrary section names, (2) thetarget defines @code{CTORS_SECTION_ASM_OP}, or (3) @code{USE_COLLECT2}is not defined.@end deftypefn@hook TARGET_ASM_DESTRUCTORThis is like @code{TARGET_ASM_CONSTRUCTOR} but used for terminationfunctions rather than initialization functions.@end deftypefnIf @code{TARGET_HAVE_CTORS_DTORS} is true, the initialization routinegenerated for the generated object file will have static linkage.If your system uses @command{collect2} as the means of processingconstructors, then that program normally uses @command{nm} to scanan 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_COFFDefine this macro if the system uses COFF (Common Object File Format)object files, so that @command{collect2} can assume this format and scanobject files directly for dynamic constructor/destructor functions.This macro is effective only in a native compiler; @command{collect2} aspart of a cross compiler always uses @command{nm} for the target machine.@end defmac@defmac REAL_NM_FILE_NAMEDefine this macro as a C string constant containing the file name to useto 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 staticconstructors and destructors and LTO info. By default, @option{-n} ispassed. Define @code{NM_FLAGS} to a C string constant if other optionsare needed to get the same output format as GNU @command{nm -n}produces.@end defmacIf your system supports shared libraries and has a program to list thedynamic dependencies of a given library or executable, you can definethese macros to enable support for running initialization andtermination functions in shared libraries:@defmac LDD_SUFFIXDefine this macro to a C string constant containing the name of the programwhich 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 outputof the program denoted by @code{LDD_SUFFIX}. @var{ptr} is a variableof type @code{char *} that points to the beginning of a line of outputfrom @code{LDD_SUFFIX}. If the line lists a dynamic dependency, thecode must advance @var{ptr} to the beginning of the filename on thatline. Otherwise, it must set @var{ptr} to @code{NULL}.@end defmac@defmac SHLIB_SUFFIXDefine this macro to a C string constant containing the default sharedlibrary extension of the target (e.g., @samp{".so"}). @command{collect2}strips version information after this suffix when generating globalconstructor and destructor names. This define is only needed on targetsthat 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 lineThis describes assembler instruction output.@defmac REGISTER_NAMESA C initializer containing the assembler's names for the machineregisters, each one as a C string constant. This is what translatesregister numbers in the compiler into assembler language.@end defmac@defmac ADDITIONAL_REGISTER_NAMESIf defined, a C initializer for an array of structures containing a nameand a register number. This macro defines additional names for hardregisters, thus allowing the @code{asm} option in declarations to referto registers using alternate names.@end defmac@defmac OVERLAPPING_REGISTER_NAMESIf defined, a C initializer for an array of structures containing aname, a register number and a count of the number of consecutivemachine registers the name overlaps. This macro defines additionalnames for hard registers, thus allowing the @code{asm} option indeclarations to refer to registers using alternate names. Unlike@code{ADDITIONAL_REGISTER_NAMES}, this macro should be used when theregister 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 theregister name. For example, on ARM, clobbering the double-precisionVFP 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 thatrequires different names for the machine instructions.The definition is a C statement or statements which output anassembler instruction opcode to the stdio stream @var{stream}. Themacro-operand @var{ptr} is a variable of type @code{char *} whichpoints to the opcode name in its ``internal'' form---the form that iswritten in the machine description. The definition should output theopcode name to @var{stream}, performing any translation you desire, andincrement the variable @var{ptr} to point at the end of the opcodeso that it will not be output twice.In fact, your macro definition may process less than the entire opcodename, or more than the opcode name; but if you want to process textthat includes @samp{%}-sequences to substitute operands, you must takecare of the substitution yourself. Just be sure to increment@var{ptr} over whatever text should not be output normally.@findex recog_data.operandIf you need to look at the operand values, they can be found as theelements of @code{recog_data.operand}.If the macro definition does nothing, the instruction is outputin 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 ofassembler code for @var{insn}, to modify the extracted operands sothey will be output differently.Here the argument @var{opvec} is the vector containing the operandsextracted from @var{insn}, and @var{noperands} is the number ofelements of the vector which contain meaningful data for this insn.The contents of this vector are what will be used to convert the insntemplate into assembler code, so you can change the assembler outputby changing the contents of the vector.This macro is useful when various assembler syntaxes share a singlefile of instruction patterns; by defining this macro differently, youcan cause a large class of instructions to be output differently (suchas with rearranged operands). Naturally, variations in assemblersyntax affecting individual insn patterns ought to be handled bywriting 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_INSNIf defined, this target hook is a function which is executed just after theoutput of assembler code for @var{insn}, to change the mode of the assemblerif necessary.Here the argument @var{opvec} is the vector containing the operandsextracted from @var{insn}, and @var{noperands} is the number ofelements of the vector which contain meaningful data for this insn.The contents of this vector are what was used to convert the insntemplate into assembler code, so you can change the assembler modeby checking the contents of the vector.@end deftypefn@defmac PRINT_OPERAND (@var{stream}, @var{x}, @var{code})A C compound statement to output to stdio stream @var{stream} theassembler syntax for an instruction operand @var{x}. @var{x} is anRTL expression.@var{code} is a value that can be used to specify one of several waysof printing the operand. It is used when identical operands must beprinted differently depending on the context. @var{code} comes fromthe @samp{%} specification that was used to request printing of theoperand. 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_namesIf @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 calledwith 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 validpunctuation character for use in the @code{PRINT_OPERAND} macro. If@code{PRINT_OPERAND_PUNCT_VALID_P} is not defined, it means that nopunctuation characters (except for the standard one, @samp{%}) are usedin this way.@end defmac@defmac PRINT_OPERAND_ADDRESS (@var{stream}, @var{x})A C compound statement to output to stdio stream @var{stream} theassembler syntax for an instruction operand that is a memory referencewhose address is @var{x}. @var{x} is an RTL expression.@cindex @code{TARGET_ENCODE_SECTION_INFO} usageOn some machines, the syntax for a symbolic address depends on thesection 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{AssemblerFormat}.@end defmac@findex dbr_sequence_length@defmac DBR_OUTPUT_SEQEND (@var{file})A C statement, to be executed after all slot-filler instructions havebeen output. If necessary, call @code{dbr_sequence_length} todetermine the number of slots filled in a sequence (zero if notcurrently 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 inreading assembly output if the extent of the delay sequence is madeexplicit (e.g.@: with white space).@end defmac@findex final_sequenceNote that output routines for instructions with delay slots must beprepared 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 befound.) The variable @code{final_sequence} is null when notprocessing a sequence, otherwise it contains the @code{sequence} rtxbeing output.@findex asm_fprintf@defmac REGISTER_PREFIX@defmacx LOCAL_LABEL_PREFIX@defmacx USER_LABEL_PREFIX@defmacx IMMEDIATE_PREFIXIf 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.c}). These are useful when a single @file{md} file mustsupport 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 ofthe @code{asm_fprintf} function. This allows targets to define extraprintf formats which may useful when generating their assemblerstatements. Note that uppercase letters are reserved for futuregeneric extensions to asm_fprintf, and so are not available to targetspecific code. The output file is given by the parameter @var{file}.The varargs input pointer is @var{argptr} and the rest of the formatstring, starting the character after the one that is being switchedupon, is pointed to by @var{format}.@end defmac@defmac ASSEMBLER_DIALECTIf your target supports multiple dialects of assembler language (such asdifferent opcodes), define this macro as a C expression that gives thenumeric index of the assembler language dialect to use, with zero as thefirst variant.If this macro is defined, you may use constructs of the form@smallexample@samp{@{option0|option1|option2@dots{}@}}@end smallexample@noindentin the output templates of patterns (@pxref{Output Template}) or in thefirst 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 characterswithin these strings retain their usual meaning. If there are feweralternatives within the braces than the value of@code{ASSEMBLER_DIALECT}, the construct outputs nothing.If you do not define this macro, the characters @samp{@{}, @samp{|} and@samp{@}} do not have any special meaning when used in templates oroperands 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 expressthe variations in assembler language syntax with that mechanism. Define@code{ASSEMBLER_DIALECT} and use the @samp{@{option0|option1@}} syntaxif the syntax variant are larger and involve such things as differentopcodes or operand order.@end defmac@defmac ASM_OUTPUT_REG_PUSH (@var{stream}, @var{regno})A C expression to output to @var{stream} some assembler codewhich will push hard register number @var{regno} onto the stack.The code need not be optimal, since this macro is used only whenprofiling.@end defmac@defmac ASM_OUTPUT_REG_POP (@var{stream}, @var{regno})A C expression to output to @var{stream} some assembler codewhich will pop hard register number @var{regno} off of the stack.The code need not be optimal, since this macro is used only whenprofiling.@end defmac@node Dispatch Tables@subsection Output of Dispatch Tables@c prevent bad page break with this lineThis 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 assemblerpseudo-instruction to generate a difference between two labels.@var{value} and @var{rel} are the numbers of two internal labels. Thedefinitions of these labels are output using@code{(*targetm.asm_out.internal_label)}, and they must be printed in the sameway here. For example,@smallexamplefprintf (@var{stream}, "\t.word L%d-L%d\n",@var{value}, @var{rel})@end smallexampleYou must provide this macro on machines where the addresses in adispatch table are relative to the table's own address. If defined, GCCwill 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 themode 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 addressesin 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 toa label. @var{value} is the number of an internal label whosedefinition is output using @code{(*targetm.asm_out.internal_label)}.For example,@smallexamplefprintf (@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 outputspecially. The first three arguments are the same as for@code{(*targetm.asm_out.internal_label)}; the fourth argument is thejump-table which follows (a @code{jump_insn} containing an@code{addr_vec} or @code{addr_diff_vec}).This feature is used on system V to output a @code{swbeg} statementfor 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 ajump-table. The definition should be a C statement to be executedafter the assembler code for the table is written. It should writethe appropriate code to stdio stream @var{stream}. The argument@var{table} is the jump-table insn, and @var{num} is the label-numberof the preceding label.If this macro is not defined, nothing special is output at the end ofthe jump-table.@end defmac@hook TARGET_ASM_EMIT_UNWIND_LABELThis target hook emits a label at the beginning of each FDE@. Itshould be defined on targets where FDEs need special labels, and itshould write the appropriate label, for the FDE associated with thefunction declaration @var{decl}, to the stdio stream @var{stream}.The third argument, @var{for_eh}, is a boolean: true if this is for anexception table. The fourth argument, @var{empty}, is a boolean:true if this is a placeholder label for an omitted FDE@.The default is that FDEs are not given nonlocal labels.@end deftypefn@hook TARGET_ASM_EMIT_EXCEPT_TABLE_LABELThis target hook emits a label at the beginning of the exception table.It should be defined on targets where it is desirable for the tableto be broken up according to function.The default is that no label is emitted.@end deftypefn@hook TARGET_ASM_EMIT_EXCEPT_PERSONALITY@hook TARGET_ASM_UNWIND_EMITThis target hook emits assembly directives required to unwind thegiven instruction. This is only used when @code{TARGET_EXCEPT_UNWIND_INFO}returns @code{UI_TARGET}.@end deftypefn@hook TARGET_ASM_UNWIND_EMIT_BEFORE_INSN@node Exception Region Output@subsection Assembler Commands for Exception Regions@c prevent bad page break with this lineThis describes commands marking the start and the end of an exceptionregion.@defmac EH_FRAME_SECTION_NAMEIf defined, a C string constant for the name of the section containingexception handling frame unwind information. If not defined, GCC willprovide 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 frameunwind information and the default definition does not work.@end defmac@defmac EH_FRAME_IN_DATA_SECTIONIf defined, DWARF 2 frame unwind information will be placed in thedata section even though the target supports named sections. Thismight be necessary, for instance, if the system linker does garbagecollection and sections cannot be marked as not to be collected.Do not define this macro unless @code{TARGET_ASM_NAMED_SECTION} isalso defined.@end defmac@defmac EH_TABLES_CAN_BE_READ_ONLYDefine this macro to 1 if your target is such that no frame unwindinformation encoding used with non-PIC code will ever require aruntime relocation, but the linker may not support merging read-onlyand read-write sections into a single read-write section.@end defmac@defmac MASK_RETURN_ADDRAn rtx used to mask the return address found via @code{RETURN_ADDR_RTX}, sothat it does not contain any extraneous set bits in it.@end defmac@defmac DWARF2_UNWIND_INFODefine this macro to 0 if your target supports DWARF 2 frame unwindinformation, 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 either @code{UNALIGNED_INT_ASM_OP}or @code{OBJECT_FORMAT_ELF}), GCC will provide a default definition of 1.@end defmac@hook TARGET_EXCEPT_UNWIND_INFOThis hook defines the mechanism that will be used for exception handlingby the target. If the target has ABI specified unwind tables, the hookshould return @code{UI_TARGET}. If the target is to use the@code{setjmp}/@code{longjmp}-based exception handling scheme, the hookshould return @code{UI_SJLJ}. If the target supports DWARF 2 frame unwindinformation, 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. Thedefault implementation of this hook never returns @code{UI_NONE}.Note that the value returned by this hook should be constant. It shouldnot depend on anything except the command-line switches described by@var{opts}. In particular, thesetting @code{UI_SJLJ} must be fixed at compiler start-up as C pre-processormacros and builtin functions related to exception handling are set updepending 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 targetmust define this hook so that @var{opts} is used correctly.@end deftypefn@hook TARGET_UNWIND_TABLES_DEFAULTThis variable should be set to @code{true} if the target ABI requires unwindingtables even when exceptions are not used. It must not be modified bycommand-line option processing.@end deftypevr@defmac DONT_USE_BUILTIN_SETJMPDefine this macro to 1 if the @code{setjmp}/@code{longjmp}-based schemeshould use the @code{setjmp}/@code{longjmp} functions from the C libraryinstead of the @code{__builtin_setjmp}/@code{__builtin_longjmp} machinery.@end defmac@defmac DWARF_CIE_DATA_ALIGNMENTThis macro need only be defined if the target might save registers in thefunction prologue at an offset to the stack pointer that is not aligned to@code{UNITS_PER_WORD}. The definition should be the negative minimumalignment if @code{STACK_GROWS_DOWNWARD} is defined, and the positiveminimum alignment otherwise. @xref{SDB and DWARF}. Only applicable ifthe target supports DWARF 2 frame unwind information.@end defmac@hook TARGET_TERMINATE_DW2_EH_FRAME_INFOContains the value true if the target should add a zero word onto theend of a Dwarf-2 frame info section when used for exception handling.Default value is false if @code{EH_FRAME_SECTION_NAME} is defined, andtrue otherwise.@end deftypevr@hook TARGET_DWARF_REGISTER_SPANGiven a register, this hook should return a parallel of registers torepresent where to find the register pieces. Define this hook if theregister and its mode are represented in Dwarf in non-contiguouslocations, or if the register should be represented in more than oneregister in Dwarf. Otherwise, this hook should return @code{NULL_RTX}.If not defined, the default is to return @code{NULL_RTX}.@end deftypefn@hook TARGET_INIT_DWARF_REG_SIZES_EXTRAIf some registers are represented in Dwarf-2 unwind information inmultiple pieces, define this hook to fill in information about thesizes of those pieces in the table used by the unwinder at runtime.It will be called by @code{expand_builtin_init_dwarf_reg_sizes} afterfilling in a single size corresponding to each hard register;@var{address} is the address of the table.@end deftypefn@hook TARGET_ASM_TTYPEThis hook is used to output a reference from a frame unwinding table tothe type_info object identified by @var{sym}. It should return @code{true}if the reference was output. Returning @code{false} will cause thereference to be output using the normal Dwarf2 routines.@end deftypefn@hook TARGET_ARM_EABI_UNWINDERThis flag should be set to @code{true} on targets that use an ARM EABIbased unwinding library, and @code{false} on other targets. This effectsthe format of unwinding tables, and how the unwinder in entered afterrunning a cleanup. The default is @code{false}.@end deftypevr@node Alignment Output@subsection Assembler Commands for Alignment@c prevent bad page break with this lineThis describes commands for alignment.@defmac JUMP_ALIGN (@var{label})The alignment (log base 2) to put in front of @var{label}, which isa common destination of jumps and has no fallthru incoming edge.This macro need not be defined if you don't want any special alignmentto be done at such a time. Most machine descriptions do not currentlydefine the macro.Unless it's necessary to inspect the @var{label} parameter, it is betterto set the variable @var{align_jumps} in the target's@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user'sselection in @var{align_jumps} in a @code{JUMP_ALIGN} implementation.@end defmac@hook TARGET_ASM_JUMP_ALIGN_MAX_SKIPThe maximum number of bytes to skip before @var{label} when applying@code{JUMP_ALIGN}. This works only if@code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.@end deftypefn@defmac LABEL_ALIGN_AFTER_BARRIER (@var{label})The alignment (log base 2) to put in front of @var{label}, which followsa @code{BARRIER}.This macro need not be defined if you don't want any special alignmentto be done at such a time. Most machine descriptions do not currentlydefine the macro.@end defmac@hook TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIPThe maximum number of bytes to skip before @var{label} when applying@code{LABEL_ALIGN_AFTER_BARRIER}. This works only if@code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.@end deftypefn@defmac LOOP_ALIGN (@var{label})The alignment (log base 2) to put in front of @var{label}, which followsa @code{NOTE_INSN_LOOP_BEG} note.This macro need not be defined if you don't want any special alignmentto be done at such a time. Most machine descriptions do not currentlydefine the macro.Unless it's necessary to inspect the @var{label} parameter, it is betterto set the variable @code{align_loops} in the target's@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user'sselection in @code{align_loops} in a @code{LOOP_ALIGN} implementation.@end defmac@hook TARGET_ASM_LOOP_ALIGN_MAX_SKIPThe maximum number of bytes to skip when applying @code{LOOP_ALIGN} to@var{label}. This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} isdefined.@end deftypefn@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 betterto set the variable @code{align_labels} in the target's@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user'sselection in @code{align_labels} in a @code{LABEL_ALIGN} implementation.@end defmac@hook TARGET_ASM_LABEL_ALIGN_MAX_SKIPThe maximum number of bytes to skip when applying @code{LABEL_ALIGN}to @var{label}. This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN}is defined.@end deftypefn@defmac ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})A C statement to output to the stdio stream @var{stream} an assemblerinstruction to advance the location counter by @var{nbytes} bytes.Those bytes should be zero when loaded. @var{nbytes} will be a Cexpression of type @code{unsigned HOST_WIDE_INT}.@end defmac@defmac ASM_NO_SKIP_IN_TEXTDefine this macro if @code{ASM_OUTPUT_SKIP} should not be used in thetext 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 bytesproduces no-op instructions rather than zeros when used in the textsection.@end defmac@defmac ASM_OUTPUT_ALIGN (@var{stream}, @var{power})A C statement to output to the stdio stream @var{stream} an assemblercommand 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 usedfor 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 assemblercommand 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 tosatisfy the alignment request. @var{power} and @var{max_skip} will bea 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 lineThis 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.* SDB and DWARF:: Macros for SDB (COFF) and DWARF formats.* VMS Debug:: Macros for VMS debug format.@end menu@node All Debuggers@subsection Macros Affecting All Debugging Formats@c prevent bad page break with this lineThese macros affect all debugging formats.@defmac DBX_REGISTER_NUMBER (@var{regno})A C expression that returns the DBX register number for the compilerregister number @var{regno}. In the default macro provided, the valueof this expression will be @var{regno} itself. But sometimes there aresome registers that the compiler knows about and DBX does not, or viceversa. In such cases, some register may need to have one number in thecompiler and another for DBX@.If two registers have consecutive numbers inside GCC, and they can beused as a pair to hold a multiword value, then they @emph{must} haveconsecutive numbers after renumbering with @code{DBX_REGISTER_NUMBER}.Otherwise, debuggers will be unable to access such a pair, because theyexpect register pairs to be consecutive in their own numbering scheme.If you find yourself defining @code{DBX_REGISTER_NUMBER} in way thatdoes not preserve register pairs, then what you must do instead isredefine the actual register numbering scheme.@end defmac@defmac DEBUGGER_AUTO_OFFSET (@var{x})A C expression that returns the integer offset value for an automaticvariable having address @var{x} (an RTL expression). The defaultcomputation assumes that @var{x} is based on the frame-pointer andgives the offset from the frame-pointer. This is required for targetsthat produce debugging output for DBX or COFF-style debugging outputfor SDB and allow the frame-pointer to be eliminated when the@option{-g} options is used.@end defmac@defmac DEBUGGER_ARG_OFFSET (@var{offset}, @var{x})A C expression that returns the integer offset value for an argumenthaving address @var{x} (an RTL expression). The nominal offset is@var{offset}.@end defmac@defmac PREFERRED_DEBUGGING_TYPEA C expression that returns the type of debugging output GCC shouldproduce when the user specifies just @option{-g}. Definethis if you have arranged for GCC to support more than one format ofdebugging output. Currently, the allowable values are @code{DBX_DEBUG},@code{SDB_DEBUG}, @code{DWARF_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 thevalue of this macro to select the debugging output format, but with twoexceptions. If @code{DWARF2_DEBUGGING_INFO} is defined, GCC uses thevalue @code{DWARF2_DEBUG}. Otherwise, if @code{DBX_DEBUGGING_INFO} isdefined, GCC uses @code{DBX_DEBUG}.The value of this macro only affects the default debugging output; theuser can always get a specific type of output by using @option{-gstabs},@option{-gcoff}, @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 lineThese are specific options for DBX output.@defmac DBX_DEBUGGING_INFODefine this macro if GCC should produce debugging output for DBXin response to the @option{-g} option.@end defmac@defmac XCOFF_DEBUGGING_INFODefine this macro if GCC should produce XCOFF format debugging outputin response to the @option{-g} option. This is a variant of DBX format.@end defmac@defmac DEFAULT_GDB_EXTENSIONSDefine this macro to control whether GCC should by default generateGDB's extended version of DBX debugging information (assuming DBX-formatdebugging information is enabled at all). If you don't define themacro, the default is 1: always generate the extended informationif there is any occasion to.@end defmac@defmac DEBUG_SYMS_TEXTDefine this macro if all @code{.stabs} commands should be output whilein the text section.@end defmac@defmac ASM_STABS_OPA C string constant, including spacing, naming the assembler pseudo op touse 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 macroapplies only to DBX debugging information format.@end defmac@defmac ASM_STABD_OPA C string constant, including spacing, naming the assembler pseudo op touse instead of @code{"\t.stabd\t"} to define a debugging symbol whosevalue is the current location. If you don't define this macro,@code{"\t.stabd\t"} is used. This macro applies only to DBX debugginginformation format.@end defmac@defmac ASM_STABN_OPA C string constant, including spacing, naming the assembler pseudo op touse instead of @code{"\t.stabn\t"} to define a debugging symbol with noname. If you don't define this macro, @code{"\t.stabn\t"} is used. Thismacro applies only to DBX debugging information format.@end defmac@defmac DBX_NO_XREFSDefine this macro if DBX on your system does not support the construct@samp{xs@var{tagname}}. On some systems, this construct is used todescribe a forward reference to a structure named @var{tagname}.On other systems, this construct is not supported at all.@end defmac@defmac DBX_CONTIN_LENGTHA symbol name in DBX-format debugging information is normallycontinued (split into two separate @code{.stabs} directives) when itexceeds a certain length (by default, 80 characters). On someoperating systems, DBX requires this splitting; on others, splittingmust not be done. You can inhibit splitting by defining this macrowith the value zero. You can override the default splitting-length bydefining this macro as an expression for the length you desire.@end defmac@defmac DBX_CONTIN_CHARNormally continuation is indicated by adding a @samp{\} character tothe end of a @code{.stabs} string when a continuation follows. To usea different character instead, define this macro as a characterconstant for the character you want to use. Do not define this macroif backslash is correct for your system.@end defmac@defmac DBX_STATIC_STAB_DATA_SECTIONDefine this macro if it is necessary to go to the data section beforeoutputting the @samp{.stabs} pseudo-op for a non-global staticvariable.@end defmac@defmac DBX_TYPE_DECL_STABS_CODEThe value to use in the ``code'' field of the @code{.stabs} directivefor a typedef. The default is @code{N_LSYM}.@end defmac@defmac DBX_STATIC_CONST_VAR_CODEThe value to use in the ``code'' field of the @code{.stabs} directivefor a static variable located in the text section. DBX format does notprovide any ``right'' way to do this. The default is @code{N_FUN}.@end defmac@defmac DBX_REGPARM_STABS_CODEThe value to use in the ``code'' field of the @code{.stabs} directivefor 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_LETTERThe letter to use in DBX symbol data to identify a symbol as a parameterpassed in registers. DBX format does not customarily provide any way todo this. The default is @code{'P'}.@end defmac@defmac DBX_FUNCTION_FIRSTDefine this macro if the DBX information for a function and itsarguments should precede the assembler code for the function. Normally,in DBX format, the debugging information entirely follows the assemblercode.@end defmac@defmac DBX_BLOCKS_FUNCTION_RELATIVEDefine this macro, with value 1, if the value of a symbol describingthe scope of a block (@code{N_LBRAC} or @code{N_RBRAC}) should berelative to the start of the enclosing function. Normally, GCC usesan absolute address.@end defmac@defmac DBX_LINES_FUNCTION_RELATIVEDefine this macro, with value 1, if the value of a symbol indicatingthe current line number (@code{N_SLINE}) should be relative to thestart of the enclosing function. Normally, GCC uses an absolute address.@end defmac@defmac DBX_USE_BINCLDefine this macro if GCC should generate @code{N_BINCL} and@code{N_EINCL} stabs for included header files, as on Sun systems. Thismacro also directs GCC to output a type number as a pair of a filenumber and a type number within the file. Normally, GCC does notgenerate @code{N_BINCL} or @code{N_EINCL} stabs, and it outputs a singlenumber for a type number.@end defmac@node DBX Hooks@subsection Open-Ended Hooks for DBX Format@c prevent bad page break with this lineThese are hooks for DBX format.@defmac DBX_OUTPUT_LBRAC (@var{stream}, @var{name})Define this macro to say how to output to @var{stream} the debugginginformation for the start of a scope level for variable names. Theargument @var{name} is the name of an assembler symbol (for use with@code{assemble_name}) whose value is the address where the scope begins.@end defmac@defmac DBX_OUTPUT_RBRAC (@var{stream}, @var{name})Like @code{DBX_OUTPUT_LBRAC}, but for the end of a scope level.@end defmac@defmac DBX_OUTPUT_NFUN (@var{stream}, @var{lscope_label}, @var{decl})Define this macro if the target machine requires special handling tooutput an @code{N_FUN} entry for the function @var{decl}.@end defmac@defmac DBX_OUTPUT_SOURCE_LINE (@var{stream}, @var{line}, @var{counter})A C statement to output DBX debugging information before code for linenumber @var{line} of the current source file to the stdio stream@var{stream}. @var{counter} is the number of time the macro wasinvoked, including the current invocation; it is intended to generateunique labels in the assembly output.This macro should not be defined if the default output is correct, orif it can be made correct by defining @code{DBX_LINES_FUNCTION_RELATIVE}.@end defmac@defmac NO_DBX_FUNCTION_ENDSome 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 withoutdisturbing the rest of the gdb extensions.@end defmac@defmac NO_DBX_BNSYM_ENSYMSome assemblers cannot handle the @code{.stabd BNSYM/ENSYM,0,0} gdb dbxextension construct. On those machines, define this macro to turn thisfeature 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 lineThis 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 sourcefile---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 outputfor DBX debugging information is appropriate.It may be necessary to refer to a label equal to the beginning of thetext 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_DIRECTORYDefine this macro, with value 1, if GCC should not emit an indicationof the current directory for compilation and current source language atthe beginning of the file.@end defmac@defmac NO_DBX_GCC_MARKERDefine this macro, with value 1, if GCC should not emit an indicationthat this object file was compiled by GCC@. The default is to emitan @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 ofcompilation of the main source file @var{name}. Output should bewritten to the stdio stream @var{stream}.If you don't define this macro, nothing special is output at the endof compilation, which is correct for most machines.@end defmac@defmac DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_ENDDefine this macro @emph{instead of} defining@code{DBX_OUTPUT_MAIN_SOURCE_FILE_END}, if what needs to be output atthe 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 SDB and DWARF@subsection Macros for SDB and DWARF Output@c prevent bad page break with this lineHere are macros for SDB and DWARF output.@defmac SDB_DEBUGGING_INFODefine this macro if GCC should produce COFF-style debugging outputfor SDB in response to the @option{-g} option.@end defmac@defmac DWARF2_DEBUGGING_INFODefine this macro if GCC should produce dwarf version 2 formatdebugging output in response to the @option{-g} option.@hook TARGET_DWARF_CALLING_CONVENTIONDefine this to enable the dwarf attribute @code{DW_AT_calling_convention} tobe emitted for each function. Instead of an integer return the enumvalue for the @code{DW_CC_} tag.@end deftypefnTo support optional call frame debugging information, you must alsodefine @code{INCOMING_RETURN_ADDR_RTX} and either set@code{RTX_FRAME_RELATED_P} on the prologue insns if you use RTL for theprologue, 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_INFODefine this macro to a nonzero value if GCC should always outputDwarf 2 frame information. If @code{TARGET_EXCEPT_UNWIND_INFO}(@pxref{Exception Region Output}) returns @code{UI_DWARF2}, andexceptions are enabled, GCC will output this information not matterhow you define @code{DWARF2_FRAME_INFO}.@end defmac@hook TARGET_DEBUG_UNWIND_INFOThis hook defines the mechanism that will be used for describing frameunwind information to the debugger. Normally the hook will return@code{UI_DWARF2} if DWARF 2 debug information is enabled, andreturn @code{UI_NONE} otherwise.A target may return @code{UI_DWARF2} even when DWARF 2 debug informationis disabled in order to always output DWARF 2 frame information.A target may return @code{UI_TARGET} if it has ABI specified unwind tables.This will suppress generation of the normal debug frame unwind information.@end deftypefn@defmac DWARF2_ASM_LINE_DEBUG_INFODefine this macro to be a nonzero value if the assembler can generate Dwarf 2line debug info sections. This will result in much more compact line numbertables, and hence is desirable if it works.@end defmac@hook TARGET_WANT_DEBUG_PUB_SECTIONS@hook TARGET_DELAY_SCHED2@hook TARGET_DELAY_VARTRACK@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 differencebetween the two given labels in system defined units, e.g. instructionslots on IA64 VMS, using an integer of the given size.@end defmac@defmac ASM_OUTPUT_DWARF_OFFSET (@var{stream}, @var{size}, @var{label}, @var{section})A C statement to issue assembly directives that create asection-relative reference to the given @var{label}, using an integer of thegiven @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-relativereference to the given @var{label}, 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 tothe DWARF table identifier @var{label} from the current section. Thisis used on some systems to avoid garbage collecting a DWARF table whichis referenced by a function.@end defmac@hook TARGET_ASM_OUTPUT_DWARF_DTPRELIf defined, this target hook is a function which outputs a DTP-relativereference to the given TLS symbol of the specified size.@end deftypefn@defmac PUT_SDB_@dots{}Define these macros to override the assembler syntax for the specialSDB assembler directives. See @file{sdbout.c} for a list of thesemacros and their arguments. If the standard syntax is used, you neednot define them yourself.@end defmac@defmac SDB_DELIMSome assemblers do not support a semicolon as a delimiter, even betweenSDB assembler directives. In that case, define this macro to be thedelimiter to use (usually @samp{\n}). It is not necessary to definea new set of @code{PUT_SDB_@var{op}} macros if this is the only changerequired.@end defmac@defmac SDB_ALLOW_UNKNOWN_REFERENCESDefine this macro to allow references to unknown structure,union, or enumeration tags to be emitted. Standard COFF does notallow handling of unknown references, MIPS ECOFF has support forit.@end defmac@defmac SDB_ALLOW_FORWARD_REFERENCESDefine this macro to allow references to structure, union, orenumeration tags that have not yet been seen to be handled. Someassemblers choke if forward tags are used, while some require it.@end defmac@defmac SDB_OUTPUT_SOURCE_LINE (@var{stream}, @var{line})A C statement to output SDB debugging information before code for linenumber @var{line} of the current source file to the stdio stream@var{stream}. The default is to emit an @code{.ln} directive.@end defmac@need 2000@node VMS Debug@subsection Macros for VMS Debug Format@c prevent bad page break with this lineHere are macros for VMS debug format.@defmac VMS_DEBUGGING_INFODefine this macro if GCC should produce debugging output for VMSin response to the @option{-g} option. The default behavior for VMSis to generate minimal debug info for a traceback in the absence of@option{-g} unless explicitly overridden with @option{-g0}. Thisbehavior is controlled by @code{TARGET_OPTION_OPTIMIZATION} and@code{TARGET_OPTION_OVERRIDE}.@end defmac@node Floating Point@section Cross Compilation and Floating Point@cindex cross compilation and floating point@cindex floating point and cross compilationWhile all modern machines use twos-complement representation for integers,there are a variety of representations for floating point numbers. Thismeans that in a cross-compiler the representation of floating point numbersin the compiled program may be different from that used in the machinedoing the compilation.Because different representation systems may offer different amounts ofrange and precision, all floating point constants must be represented inthe target machine's format. Therefore, the cross compiler cannotsafely use the host machine's floating point arithmetic; it must emulatethe target's arithmetic. To ensure consistency, GCC always usesemulation to work with floating point values, even when the host andtarget floating point formats are identical.The following macros are provided by @file{real.h} for the compiler touse. All parts of the compiler which generate or optimizefloating-point calculations must use these macros. They may evaluatetheir operands more than once, so operands must not have side effects.@defmac REAL_VALUE_TYPEThe C data type to be used to hold a floating point value in the targetmachine's format. Typically this is a @code{struct} containing anarray of @code{HOST_WIDE_INT}, but all code should treat it as an opaquequantity.@end defmac@deftypefn Macro int REAL_VALUES_EQUAL (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})Compares for equality the two values, @var{x} and @var{y}. If the targetfloating point format supports negative zeroes and/or NaNs,@samp{REAL_VALUES_EQUAL (-0.0, 0.0)} is true, and@samp{REAL_VALUES_EQUAL (NaN, NaN)} is false.@end deftypefn@deftypefn Macro int REAL_VALUES_LESS (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})Tests whether @var{x} is less than @var{y}.@end deftypefn@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}, enum machine_mode @var{mode})Converts @var{string} into a floating point number in the target machine'srepresentation for mode @var{mode}. This routine can handle bothdecimal and hexadecimal floating point constants, using the syntaxdefined 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 void REAL_ARITHMETIC (REAL_VALUE_TYPE @var{output}, enum tree_code @var{code}, REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})Calculates an arithmetic operation on the two floating point values@var{x} and @var{y}, storing the result in @var{output} (which must be avariable).The operation to be performed is specified by @var{code}. Only thefollowing codes are supported: @code{PLUS_EXPR}, @code{MINUS_EXPR},@code{MULT_EXPR}, @code{RDIV_EXPR}, @code{MAX_EXPR}, @code{MIN_EXPR}.If @code{REAL_ARITHMETIC} is asked to evaluate division by zero and thetarget's floating point format cannot represent infinity, it will call@code{abort}. Callers should check for this situation first, using@code{MODE_HAS_INFINITIES}. @xref{Storage Layout}.@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@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_TRUNCATE (REAL_VALUE_TYPE @var{mode}, enum machine_mode @var{x})Truncates the floating point value @var{x} to fit in @var{mode}. Thereturn value is still a full-size @code{REAL_VALUE_TYPE}, but it has anappropriate bit pattern to be output as a floating constant whoseprecision accords with mode @var{mode}.@end deftypefn@deftypefn Macro void REAL_VALUE_TO_INT (HOST_WIDE_INT @var{low}, HOST_WIDE_INT @var{high}, REAL_VALUE_TYPE @var{x})Converts a floating point value @var{x} into a double-precision integerwhich is then stored into @var{low} and @var{high}. If the value is notintegral, it is truncated.@end deftypefn@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, HOST_WIDE_INT @var{low}, HOST_WIDE_INT @var{high}, enum machine_mode @var{mode})Converts a double-precision integer found in @var{low} and @var{high},into a floating point value which is then stored into @var{x}. Thevalue is truncated to fit in mode @var{mode}.@end deftypefn@node Mode Switching@section Mode Switching Instructions@cindex mode switchingThe following macros control mode switching optimizations:@defmac OPTIMIZE_MODE_SWITCHING (@var{entity})Define this macro if the port needs extra instructions inserted for modeswitching in an optimizing compilation.For an example, the SH4 can perform both single and double precisionfloating point operations, but to perform a single precision operation,the FPSCR PR bit has to be cleared, while for a double precisionoperation, this bit has to be set. Changing the PR bit requires a generalpurpose register as a scratch register, hence these FPSCR sets have tobe inserted before reload, i.e.@: you can't put this into instruction emittingor @code{TARGET_MACHINE_DEPENDENT_REORG}.You can have multiple entities that are mode-switched, and select at run timewhich entities actually need it. @code{OPTIMIZE_MODE_SWITCHING} shouldreturn 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{MODE_NEEDED},@code{MODE_PRIORITY_TO_MODE} and @code{EMIT_MODE_SET}.@code{MODE_AFTER}, @code{MODE_ENTRY}, and @code{MODE_EXIT}are optional.@end defmac@defmac NUM_MODES_FOR_MODE_SWITCHINGIf you define @code{OPTIMIZE_MODE_SWITCHING}, you have to define this asinitializer for an array of integers. Each initializer elementN refers to an entity that needs mode switching, and specifies the numberof different modes that might need to be set for this entity.The position of the initializer in the initializer---starting counting atzero---determines the integer that is used to refer to the mode-switchedentity in question.In macros that take mode arguments / yield a mode result, modes arerepresented as numbers 0 @dots{} N @minus{} 1. N is used to specify that no modeswitch is needed / supplied.@end defmac@defmac MODE_NEEDED (@var{entity}, @var{insn})@var{entity} is an integer specifying a mode-switched entity. If@code{OPTIMIZE_MODE_SWITCHING} is defined, you must define this macro toreturn an integer value not larger than the corresponding element in@code{NUM_MODES_FOR_MODE_SWITCHING}, to denote the mode that @var{entity} mustbe switched into prior to the execution of @var{insn}.@end defmac@defmac MODE_AFTER (@var{mode}, @var{insn})If this macro is defined, it is evaluated for every @var{insn} duringmode switching. It determines the mode that an insn results in (ifdifferent from the incoming mode).@end defmac@defmac MODE_ENTRY (@var{entity})If this macro is defined, it is evaluated for every @var{entity} that needsmode switching. It should evaluate to an integer, which is a mode that@var{entity} is assumed to be switched to at function entry. If @code{MODE_ENTRY}is defined then @code{MODE_EXIT} must be defined.@end defmac@defmac MODE_EXIT (@var{entity})If this macro is defined, it is evaluated for every @var{entity} that needsmode switching. It should evaluate to an integer, which is a mode that@var{entity} is assumed to be switched to at function exit. If @code{MODE_EXIT}is defined then @code{MODE_ENTRY} must be defined.@end defmac@defmac MODE_PRIORITY_TO_MODE (@var{entity}, @var{n})This macro specifies the order in which modes for @var{entity} are processed.0 is the highest priority, @code{NUM_MODES_FOR_MODE_SWITCHING[@var{entity}] - 1} thelowest. The value of the macro should be an integer designating a modefor @var{entity}. For any fixed @var{entity}, @code{mode_priority_to_mode}(@var{entity}, @var{n}) shall be a bijection in 0 @dots{}@code{num_modes_for_mode_switching[@var{entity}] - 1}.@end defmac@defmac EMIT_MODE_SET (@var{entity}, @var{mode}, @var{hard_regs_live})Generate one or more insns to set @var{entity} to @var{mode}.@var{hard_reg_live} is the set of hard registers live at the point wherethe insn(s) are to be inserted.@end defmac@node Target Attributes@section Defining target-specific uses of @code{__attribute__}@cindex target attributes@cindex machine attributes@cindex attributes, target-specificTarget-specific attributes may be defined for functions, data and types.These are described using the following target hooks; they also need tobe documented in @file{extend.texi}.@hook TARGET_ATTRIBUTE_TABLEIf defined, this target hook points to an array of @samp{structattribute_spec} (defined in @file{tree.h}) specifying the machinespecific attributes for this target and some of the restrictions on theentities to which these attributes are applied and the arguments theytake.@end deftypevr@hook TARGET_ATTRIBUTE_TAKES_IDENTIFIER_PIf defined, this target hook is a function which returns true if themachine-specific attribute named @var{name} expects an identifiergiven as its first argument to be passed on as a plain identifier, notsubjected to name lookup. If this is not defined, the default isfalse for all machine-specific attributes.@end deftypefn@hook TARGET_COMP_TYPE_ATTRIBUTESIf defined, this target hook is a function which returns zero if the attributes on@var{type1} and @var{type2} are incompatible, one if they are compatible,and two if they are nearly compatible (which causes a warning to begenerated). If this is not defined, machine-specific attributes aresupposed always to be compatible.@end deftypefn@hook TARGET_SET_DEFAULT_TYPE_ATTRIBUTESIf defined, this target hook is a function which assigns default attributes tothe newly defined @var{type}.@end deftypefn@hook TARGET_MERGE_TYPE_ATTRIBUTESDefine this target hook if the merging of type attributes needs specialhandling. If defined, the result is a list of the combined@code{TYPE_ATTRIBUTES} of @var{type1} and @var{type2}. It is assumedthat @code{comptypes} has already been called and returned 1. Thisfunction may call @code{merge_attributes} to handle machine-independentmerging.@end deftypefn@hook TARGET_MERGE_DECL_ATTRIBUTESDefine this target hook if the merging of decl attributes needs specialhandling. If defined, the result is a list of the combined@code{DECL_ATTRIBUTES} of @var{olddecl} and @var{newdecl}.@var{newdecl} is a duplicate declaration of @var{olddecl}. Examples ofwhen this is needed are when one attribute overrides another, or when anattribute is nullified by a subsequent definition. This function maycall @code{merge_attributes} to handle machine-independent merging.@findex TARGET_DLLIMPORT_DECL_ATTRIBUTESIf the only target-specific handling you require is @samp{dllimport}for Microsoft Windows targets, you should define the macro@code{TARGET_DLLIMPORT_DECL_ATTRIBUTES} to @code{1}. The compilerwill then define a function called@code{merge_dllimport_decl_attributes} which can then be defined asthe expansion of @code{TARGET_MERGE_DECL_ATTRIBUTES}. You can alsoadd @code{handle_dll_attribute} in the attribute table for your portto perform initial processing of the @samp{dllimport} and@samp{dllexport} attributes. This is done in @file{i386/cygwin.h} and@file{i386/i386.c}, for example.@end deftypefn@hook TARGET_VALID_DLLIMPORT_ATTRIBUTE_P@defmac TARGET_DECLSPECDefine this macro to a nonzero value if you want to treat@code{__declspec(X)} as equivalent to @code{__attribute((X))}. Bydefault, this behavior is enabled only for targets that define@code{TARGET_DLLIMPORT_DECL_ATTRIBUTES}. The current implementationof @code{__declspec} is via a built-in macro, but you should not relyon this implementation detail.@end defmac@hook TARGET_INSERT_ATTRIBUTESDefine this target hook if you want to be able to add attributes to a declwhen it is being created. This is normally useful for back ends whichwish to implement a pragma by using the attributes which correspond tothe pragma's effect. The @var{node} argument is the decl which is beingcreated. The @var{attr_ptr} argument is a pointer to the attribute listfor this decl. The list itself should not be modified, since it may beshared with other decls, but attributes may be chained on the head ofthe list and @code{*@var{attr_ptr}} modified to point to the newattributes, or a copy of the list may be made if further changes areneeded.@end deftypefn@hook TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P@cindex inliningThis target hook returns @code{true} if it is ok to inline @var{fndecl}into the current function, despite its having target-specificattributes, @code{false} otherwise. By default, if a function has atarget specific attribute attached to it, it will not be inlined.@end deftypefn@hook TARGET_OPTION_VALID_ATTRIBUTE_PThis hook is called to parse the @code{attribute(option("..."))}, andit allows the function to set different target machine compile timeoptions for the current function that might be different than theoptions specified on the command line. The hook should return@code{true} if the options are valid.The hook should set the @var{DECL_FUNCTION_SPECIFIC_TARGET} field inthe function declaration to hold a pointer to a target specific@var{struct cl_target_option} structure.@end deftypefn@hook TARGET_OPTION_SAVEThis hook is called to save any additional target specific informationin the @var{struct cl_target_option} structure for function specificoptions.@xref{Option file format}.@end deftypefn@hook TARGET_OPTION_RESTOREThis hook is called to restore any additional target specificinformation in the @var{struct cl_target_option} structure forfunction specific options.@end deftypefn@hook TARGET_OPTION_PRINTThis hook is called to print any additional target specificinformation in the @var{struct cl_target_option} structure forfunction specific options.@end deftypefn@hook TARGET_OPTION_PRAGMA_PARSEThis target hook parses the options for @code{#pragma GCC option} toset the machine specific options for functions that occur later in theinput stream. The options should be the same as handled by the@code{TARGET_OPTION_VALID_ATTRIBUTE_P} hook.@end deftypefn@hook TARGET_OPTION_OVERRIDESometimes certain combinations of command options do not make sense ona particular target machine. You can override the hook@code{TARGET_OPTION_OVERRIDE} to take account of this. This hooks is calledonce just after all the command options have been parsed.Don't use this hook to turn on various extra optimizations for@option{-O}. That is what @code{TARGET_OPTION_OPTIMIZATION} is for.If you need to do something whenever the optimization level ischanged via the optimize attribute or pragma, see@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}@end deftypefn@hook TARGET_CAN_INLINE_PThis target hook returns @code{false} if the @var{caller} functioncannot inline @var{callee}, based on target specific information. Bydefault, inlining is not allowed if the callee function has functionspecific target options and the caller does not use the same options.@end deftypefn@node Emulated TLS@section Emulating TLS@cindex Emulated TLSFor targets whose psABI does not provide Thread Local Storage viaspecific relocations and instruction sequences, an emulation layer isused. A set of target hooks allows this emulation layer to beconfigured for the requirements of a particular target. For instancethe psABI may in fact specify TLS support in terms of an emulationlayer.The emulation layer works by creating a control object for every TLSobject. To access the TLS object, a lookup function is providedwhich, when given the address of the control object, will return theaddress of the current thread's instance of the TLS object.@hook TARGET_EMUTLS_GET_ADDRESSContains the name of the helper function that uses a TLS controlobject to locate a TLS instance. The default causes libgcc'semulated TLS helper function to be used.@end deftypevr@hook TARGET_EMUTLS_REGISTER_COMMONContains the name of the helper function that should be used atprogram startup to register TLS objects that are implicitlyinitialized to zero. If this is @code{NULL}, all TLS objects willhave explicit initializers. The default causes libgcc's emulated TLSregistration function to be used.@end deftypevr@hook TARGET_EMUTLS_VAR_SECTIONContains the name of the section in which TLS control variables shouldbe placed. The default of @code{NULL} allows these to be placed inany section.@end deftypevr@hook TARGET_EMUTLS_TMPL_SECTIONContains the name of the section in which TLS initializers should beplaced. The default of @code{NULL} allows these to be placed in anysection.@end deftypevr@hook TARGET_EMUTLS_VAR_PREFIXContains the prefix to be prepended to TLS control variable names.The default of @code{NULL} uses a target-specific prefix.@end deftypevr@hook TARGET_EMUTLS_TMPL_PREFIXContains the prefix to be prepended to TLS initializer objects. Thedefault of @code{NULL} uses a target-specific prefix.@end deftypevr@hook TARGET_EMUTLS_VAR_FIELDSSpecifies a function that generates the FIELD_DECLs for a TLS controlobject type. @var{type} is the RECORD_TYPE the fields are for and@var{name} should be filled with the structure tag, if the default of@code{__emutls_object} is unsuitable. The default creates a type suitablefor libgcc's emulated TLS function.@end deftypefn@hook TARGET_EMUTLS_VAR_INITSpecifies a function that generates the CONSTRUCTOR to initialize aTLS control object. @var{var} is the TLS control object, @var{decl}is the TLS object and @var{tmpl_addr} is the address of theinitializer. The default initializes libgcc's emulated TLS control object.@end deftypefn@hook TARGET_EMUTLS_VAR_ALIGN_FIXEDSpecifies whether the alignment of TLS control variable objects isfixed and should not be increased as some backends may do to optimizesingle objects. The default is false.@end deftypevr@hook TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESSSpecifies whether a DWARF @code{DW_OP_form_tls_address} location descriptormay be used to describe emulated TLS control objects.@end deftypevr@node MIPS Coprocessors@section Defining coprocessor specifics for MIPS targets.@cindex MIPS coprocessor-definition macrosThe MIPS specification allows MIPS implementations to have as many as 4coprocessors, each with as many as 32 private registers. GCC supportsaccessing these registers and transferring values between the registersand memory using asm-ized variables. For example:@smallexampleregister unsigned int cp0count asm ("c0r1");unsigned int d;d = cp0count + 3;@end smallexample(``c0r1'' is the default name of register 1 in coprocessor 0; alternatenames may be added as described below, or the default names may beoverridden entirely in @code{SUBTARGET_CONDITIONAL_REGISTER_USAGE}.)Coprocessor registers are assumed to be epilogue-used; sets to them willbe preserved even if it does not appear that the register is used againlater in the function.Another note: according to the MIPS spec, coprocessor 1 (if present) isthe FPU@. One accesses COP1 registers through standard mipsfloating-point support; they are not included in this mechanism.There is one macro used in defining the MIPS coprocessor interface whichyou may want to override in subtargets; it is described below.@defmac ALL_COP_ADDITIONAL_REGISTER_NAMESA comma-separated list (with leading comma) of pairs describing thealternate names of coprocessor registers. The format of each entry should be@smallexample@{ @var{alternatename}, @var{register_number}@}@end smallexampleDefault: empty.@end defmac@node PCH Target@section Parameters for Precompiled Header Validity Checking@cindex parameters, precompiled headers@hook TARGET_GET_PCH_VALIDITYThis hook returns a pointer to the data needed by@code{TARGET_PCH_VALID_P} and sets@samp{*@var{sz}} to the size of the data in bytes.@end deftypefn@hook TARGET_PCH_VALID_PThis hook checks whether the options used to create a PCH file arecompatible with the current settings. It returns @code{NULL}if so and a suitable error message if not. Error messages willbe presented to the user and must be localized using @samp{_(@var{msg})}.@var{data} is the data that was returned by @code{TARGET_GET_PCH_VALIDITY}when the PCH file was created and @var{sz} is the size of that data in bytes.It's safe to assume that the data was created by the same version of thecompiler, so no format checking is needed.The default definition of @code{default_pch_valid_p} should besuitable for most targets.@end deftypefn@hook TARGET_CHECK_PCH_TARGET_FLAGSIf this hook is nonnull, the default implementation of@code{TARGET_PCH_VALID_P} will use it to check for compatible valuesof @code{target_flags}. @var{pch_flags} specifies the value that@code{target_flags} had when the PCH file was created. The returnvalue is the same as for @code{TARGET_PCH_VALID_P}.@end deftypefn@hook TARGET_PREPARE_PCH_SAVE@node C++ ABI@section C++ ABI parameters@cindex parameters, c++ abi@hook TARGET_CXX_GUARD_TYPEDefine this hook to override the integer type used for guard variables.These are used to implement one-time construction of static objects. Thedefault is long_long_integer_type_node.@end deftypefn@hook TARGET_CXX_GUARD_MASK_BITThis hook determines how guard variables are used. It should return@code{false} (the default) if the first byte should be used. A return value of@code{true} indicates that only the least significant bit should be used.@end deftypefn@hook TARGET_CXX_GET_COOKIE_SIZEThis hook returns the size of the cookie to use when allocating an arraywhose elements have the indicated @var{type}. Assumes that it is alreadyknown that a cookie is needed. The default is@code{max(sizeof (size_t), alignof(type))}, as defined in section 2.7 of theIA64/Generic C++ ABI@.@end deftypefn@hook TARGET_CXX_COOKIE_HAS_SIZEThis hook should return @code{true} if the element size should be stored inarray cookies. The default is to return @code{false}.@end deftypefn@hook TARGET_CXX_IMPORT_EXPORT_CLASSIf defined by a backend this hook allows the decision made to exportclass @var{type} to be overruled. Upon entry @var{import_export}will contain 1 if the class is going to be exported, @minus{}1 if it is goingto be imported and 0 otherwise. This function should return themodified value and perform any other actions necessary to support thebackend's targeted operating system.@end deftypefn@hook TARGET_CXX_CDTOR_RETURNS_THISThis hook should return @code{true} if constructors and destructors returnthe address of the object created/destroyed. The default is to return@code{false}.@end deftypefn@hook TARGET_CXX_KEY_METHOD_MAY_BE_INLINEThis hook returns true if the key method for a class (i.e., the methodwhich, if defined in the current translation unit, causes the virtualtable to be emitted) may be an inline function. Under the standardItanium C++ ABI the key method may be an inline function so long asthe function is not declared inline in the class definition. Undersome variants of the ABI, an inline function can never be the keymethod. The default is to return @code{true}.@end deftypefn@hook TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY@hook TARGET_CXX_CLASS_DATA_ALWAYS_COMDATThis hook returns true (the default) if virtual tables and othersimilar implicit class data objects are always COMDAT if they haveexternal linkage. If this hook returns false, then class data forclasses whose virtual table will be emitted in only one translationunit will not be COMDAT.@end deftypefn@hook TARGET_CXX_LIBRARY_RTTI_COMDATThis hook returns true (the default) if the RTTI information forthe basic types which is defined in the C++ runtime should alwaysbe COMDAT, false if it should not be COMDAT.@end deftypefn@hook TARGET_CXX_USE_AEABI_ATEXITThis hook returns true if @code{__aeabi_atexit} (as defined by the ARM EABI)should be used to register static destructors when @option{-fuse-cxa-atexit}is in effect. The default is to return false to use @code{__cxa_atexit}.@end deftypefn@hook TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXITThis hook returns true if the target @code{atexit} function can be usedin the same manner as @code{__cxa_atexit} to register C++ staticdestructors. This requires that @code{atexit}-registered functions inshared libraries are run in the correct order when the libraries areunloaded. The default is to return false.@end deftypefn@hook TARGET_CXX_ADJUST_CLASS_AT_DEFINITION@node Named Address Spaces@section Adding support for named address spaces@cindex named address spacesThe draft technical report of the ISO/IEC JTC1 S22 WG14 N1275standards committee, @cite{Programming Languages - C - Extensions tosupport embedded processors}, specifies a syntax for embeddedprocessors to specify alternate address spaces. You can configure aGCC port to support section 5.1 of the draft report to add support foraddress spaces other than the default address space. These addressspaces 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 thanpointers to the generic address space.For example, the SPU port uses the @code{__ea} address space to referto memory in the host processor, rather than memory local to the SPUprocessor. Access to memory in the @code{__ea} address space involvesissuing DMA operations to move data between the host processor and thelocal 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 arealways 32 bits).Internally, address spaces are represented as a small integer in therange 0 to 15 with address space 0 being reserved for the genericaddress 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 fornamed address space #1:@smallexample#define ADDR_SPACE_EA 1c_register_addr_space ("__ea", ADDR_SPACE_EA);@end smallexample@hook TARGET_ADDR_SPACE_POINTER_MODEDefine this to return the machine mode to use for pointers to@var{address_space} if the target supports named address spaces.The default version of this hook returns @code{ptr_mode} for thegeneric address space only.@end deftypefn@hook TARGET_ADDR_SPACE_ADDRESS_MODEDefine this to return the machine mode to use for addresses in@var{address_space} if the target supports named address spaces.The default version of this hook returns @code{Pmode} for thegeneric address space only.@end deftypefn@hook TARGET_ADDR_SPACE_VALID_POINTER_MODEDefine this to return nonzero if the port can handle pointerswith machine mode @var{mode} to address space @var{as}. This targethook is the same as the @code{TARGET_VALID_POINTER_MODE} target hook,except that it includes explicit named address space support. The defaultversion of this hook returns true for the modes returned by either the@code{TARGET_ADDR_SPACE_POINTER_MODE} or @code{TARGET_ADDR_SPACE_ADDRESS_MODE}target hooks for the given address space.@end deftypefn@hook TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_PDefine this to return true if @var{exp} is a valid address for mode@var{mode} in the named address space @var{as}. The @var{strict}parameter says whether strict addressing is in effect after reload hasfinished. This target hook is the same as the@code{TARGET_LEGITIMATE_ADDRESS_P} target hook, except that it includesexplicit named address space support.@end deftypefn@hook TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESSDefine this to modify an invalid address @var{x} to be a valid addresswith mode @var{mode} in the named address space @var{as}. This targethook is the same as the @code{TARGET_LEGITIMIZE_ADDRESS} target hook,except that it includes explicit named address space support.@end deftypefn@hook TARGET_ADDR_SPACE_SUBSET_PDefine this to return whether the @var{subset} named address space iscontained within the @var{superset} named address space. Pointers toa named address space that is a subset of another named address spacewill be converted automatically without a cast if used together inarithmetic operations. Pointers to a superset address space can beconverted to pointers to a subset address space via explicit casts.@end deftypefn@hook TARGET_ADDR_SPACE_CONVERTDefine this to convert the pointer expression represented by the RTL@var{op} with type @var{from_type} that points to a named addressspace to a new pointer expression with type @var{to_type} that pointsto a different named address space. When this hook it called, it isguaranteed that one of the two address spaces is a subset of the other,as determined by the @code{TARGET_ADDR_SPACE_SUBSET_P} target hook.@end deftypefn@node Misc@section Miscellaneous Parameters@cindex parameters, miscellaneous@c prevent bad page break with this lineHere are several miscellaneous parameters.@defmac HAS_LONG_COND_BRANCHDefine this boolean macro to indicate whether or not your architecturehas conditional branches that can span all of memory. It is used inconjunction with an optimization that partitions hot and cold basicblocks into separate sections of the executable. If this macro isset to false, gcc will convert any conditional branches that attemptto cross between sections into unconditional branches or indirect jumps.@end defmac@defmac HAS_LONG_UNCOND_BRANCHDefine this boolean macro to indicate whether or not your architecturehas unconditional branches that can span all of memory. It is used inconjunction with an optimization that partitions hot and cold basicblocks into separate sections of the executable. If this macro isset to false, gcc will convert any unconditional branches that attemptto cross between sections into indirect jumps.@end defmac@defmac CASE_VECTOR_MODEAn alias for a machine mode name. This is the machine mode thatelements 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} andmake the alignment for @code{addr_diff_vec} explicit.The @var{body} argument is provided so that the offset_unsigned and scaleflags can be updated.@end defmac@defmac CASE_VECTOR_PC_RELATIVEDefine this macro to be a C expression to indicate when jump-tablesshould contain relative addresses. You need not define this macro ifjump-tables never contain relative addresses, or jump-tables shouldcontain relative addresses only when @option{-fPIC} or @option{-fPIC}is in effect.@end defmac@hook TARGET_CASE_VALUES_THRESHOLDThis function return the smallest number of different values for which itis best to use a jump-table instead of a tree of conditional branches.The default is four for machines with a @code{casesi} instruction andfive otherwise. This is best for most machines.@end deftypefn@defmac CASE_USE_BIT_TESTSDefine this macro to be a C expression to indicate whether C switchstatements may be implemented by a sequence of bit tests. This isadvantageous on processors that can efficiently implement left shiftof 1 by the number of bits held in a register, but inappropriate ontargets that would require a loop. By default, this macro returns@code{true} if the target defines an @code{ashlsi3} pattern, and@code{false} otherwise.@end defmac@defmac WORD_REGISTER_OPERATIONSDefine this macro if operations between registers with integral modesmaller than a word are always performed on the entire register.Most RISC machines have this property and most CISC machines do not.@end defmac@defmac LOAD_EXTEND_OP (@var{mem_mode})Define this macro to be a C expression indicating when insns that readmemory in @var{mem_mode}, an integral mode narrower than a word, set thebits outside of @var{mem_mode} to be either the sign-extension or thezero-extension of the data read. Return @code{SIGN_EXTEND} for valuesof @var{mem_mode} for which theinsn 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 widthgreater than or equal to @code{BITS_PER_WORD}, so you may return anyvalue in this case. Do not define this macro if it would always return@code{UNKNOWN}. On machines where this macro is defined, you will normallydefine it as the constant @code{SIGN_EXTEND} or @code{ZERO_EXTEND}.You may return a non-@code{UNKNOWN} value even if for some hard registersthe sign extension is not performed, if for the @code{REGNO_REG_CLASS}of these hard registers @code{CANNOT_CHANGE_MODE_CLASS} returns nonzerowhen the @var{from} mode is @var{mem_mode} and the @var{to} mode is anyintegral mode larger than this but not larger than @code{word_mode}.You must return @code{UNKNOWN} if for some hard registers that allow thismode, @code{CANNOT_CHANGE_MODE_CLASS} says that they cannot change to@code{word_mode}, but that they can change to another integral mode thatis larger then @var{mem_mode} but still smaller than @code{word_mode}.@end defmac@defmac SHORT_IMMEDIATES_SIGN_EXTENDDefine this macro if loading short immediate values into registers signextends.@end defmac@defmac FIXUNS_TRUNC_LIKE_FIX_TRUNCDefine this macro if the same instructions that convert a floatingpoint number to a signed fixed point number also convert validly to anunsigned one.@end defmac@hook TARGET_MIN_DIVISIONS_FOR_RECIP_MULWhen @option{-ffast-math} is in effect, GCC tries to optimizedivisions by the same divisor, by turning them into multiplications bythe reciprocal. This target hook specifies the minimum number of divisionsthat should be there for GCC to perform the optimization for a variableof mode @var{mode}. The default implementation returns 3 if the machinehas an instruction for the division, and 2 if it does not.@end deftypefn@defmac MOVE_MAXThe maximum number of bytes that a single instruction can move quicklybetween memory and registers or between two memory locations.@end defmac@defmac MAX_MOVE_MAXThe maximum number of bytes that a single instruction can move quicklybetween memory and registers or between two memory locations. If thisis undefined, the default is @code{MOVE_MAX}. Otherwise, it is theconstant value that is the largest value that @code{MOVE_MAX} can haveat run-time.@end defmac@defmac SHIFT_COUNT_TRUNCATEDA C expression that is nonzero if on this machine the number of bitsactually used for the count of a shift operation is equal to the numberof bits needed to represent the size of the object being shifted. Whenthis macro is nonzero, the compiler will assume that it is safe to omita sign-extend, zero-extend, and certain bitwise `and' instructions thattruncates the count of a shift operation. On machines that haveinstructions that act on bit-fields at variable positions, which mayinclude `bit test' instructions, a nonzero @code{SHIFT_COUNT_TRUNCATED}also enables deletion of truncations of the values that serve asarguments to bit-field instructions.If both types of instructions truncate the count (for shifts) andposition (for bit-field operations), or if no variable-position bit-fieldinstructions exist, you should define this macro.However, on some machines, such as the 80386 and the 680x0, truncationonly applies to shift operations and not the (real or pretended)bit-field operations. Define @code{SHIFT_COUNT_TRUNCATED} to be zero onsuch machines. Instead, add patterns to the @file{md} file that includethe 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_MASKThis function describes how the standard shift patterns for @var{mode}deal with shifts by negative amounts or by more than the width of the mode.@xref{shift patterns}.On many machines, the shift patterns will apply a mask @var{m} to theshift count, meaning that a fixed-width shift of @var{x} by @var{y} isequivalent to an arbitrary-width shift of @var{x} by @var{y & m}. Ifthis is true for mode @var{mode}, the function should return @var{m},otherwise it should return 0. A return value of 0 indicates that noparticular behavior is guaranteed.Note that, unlike @code{SHIFT_COUNT_TRUNCATED}, this function does@emph{not} apply to general shift rtxes; it applies only to instructionsthat are generated by the named shift patterns.The default implementation of this function returns@code{GET_MODE_BITSIZE (@var{mode}) - 1} if @code{SHIFT_COUNT_TRUNCATED}and 0 otherwise. This definition is always safe, but if@code{SHIFT_COUNT_TRUNCATED} is false, and some shift patternsnevertheless truncate the shift count, you may get better codeby overriding it.@end deftypefn@defmac TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec})A C expression which is nonzero if on this machine it is safe to``convert'' an integer of @var{inprec} bits to one of @var{outprec}bits (where @var{outprec} is smaller than @var{inprec}) by merelyoperating on it as if it had only @var{outprec} bits.On many machines, this expression can be 1.@c rearranged this, removed the phrase "it is reported that". this was@c to fix an overfull hbox. --mew 10feb93When @code{TRULY_NOOP_TRUNCATION} returns 1 for a pair of sizes formodes for which @code{MODES_TIEABLE_P} is 0, suboptimal code can result.If this is the case, making @code{TRULY_NOOP_TRUNCATION} return 0 insuch cases may improve things.@end defmac@hook TARGET_MODE_REP_EXTENDEDThe representation of an integral mode can be such that the valuesare always extended to a wider integral mode. Return@code{SIGN_EXTEND} if values of @var{mode} are represented insign-extended form to @var{rep_mode}. Return @code{UNKNOWN}otherwise. (Currently, none of the targets use zero-extendedrepresentation this way so unlike @code{LOAD_EXTEND_OP},@code{TARGET_MODE_REP_EXTENDED} is expected to return either@code{SIGN_EXTEND} or @code{UNKNOWN}. Also no target extends@var{mode} to @var{rep_mode} so that @var{rep_mode} is not the nextwidest integral mode and currently we take advantage of this fact.)Similarly to @code{LOAD_EXTEND_OP} you may return a non-@code{UNKNOWN}value even if the extension is not performed on certain hard registersas long as for the @code{REGNO_REG_CLASS} of these hard registers@code{CANNOT_CHANGE_MODE_CLASS} returns nonzero.Note that @code{TARGET_MODE_REP_EXTENDED} and @code{LOAD_EXTEND_OP}describe two related properties. If you define@code{TARGET_MODE_REP_EXTENDED (mode, word_mode)} you probably also wantto define @code{LOAD_EXTEND_OP (mode)} to return the same type ofextension.In order to enforce the representation of @code{mode},@code{TRULY_NOOP_TRUNCATION} should return false when truncating to@code{mode}.@end deftypefn@defmac STORE_FLAG_VALUEA C expression describing the value returned by a comparison operatorwith an integral mode and stored by a store-flag instruction(@samp{cstore@var{mode}4}) when the condition is true. This description mustapply to @emph{all} the @samp{cstore@var{mode}4} patterns and all thecomparison operators whose results have a @code{MODE_INT} mode.A value of 1 or @minus{}1 means that the instruction implementing thecomparison operator returns exactly 1 or @minus{}1 when the comparison is trueand 0 when the comparison is false. Otherwise, the value indicateswhich bits of the result are guaranteed to be 1 when the comparison istrue. This value is interpreted in the mode of the comparisonoperation, 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 bythe compiler.If @code{STORE_FLAG_VALUE} is neither 1 or @minus{}1, the compiler willgenerate code that depends only on the specified bits. It can alsoreplace comparison operators with equivalent operations if they causethe 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, theexpression@smallexample(ne:SI (and:SI @var{x} (const_int @var{power-of-2})) (const_int 0))@end smallexample@noindentcan be converted to@smallexample(ashift:SI @var{x} (const_int @var{n}))@end smallexample@noindentwhere @var{n} is the appropriate shift count to move the bit beingtested into the sign bit.There is no way to describe a machine that always sets the low-order bitfor 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 youare trying to port GCC to such a machine, include an instruction toperform a logical-and of the result with 1 in the pattern for thecomparison operators and let us know at @email{gcc@@gcc.gnu.org}.Often, a machine will have multiple instructions that obtain a valuefrom a comparison (or the condition codes). Here are rules to guide thechoice of value for @code{STORE_FLAG_VALUE}, and hence the instructionsto be used:@itemize @bullet@itemUse 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 thecomparison operators to do so because there may be opportunities tocombine the normalization with other operations.@itemFor equal-length sequences, use a value of 1 or @minus{}1, with @minus{}1 beingslightly preferred on machines with expensive jumps and 1 preferred onother machines.@itemAs a second choice, choose a value of @samp{0x80000001} if instructionsexist that set both the sign and low-order bits but do not define theothers.@itemOtherwise, use a value of @samp{0x80000000}.@end itemizeMany machines can produce both the value chosen for@code{STORE_FLAG_VALUE} and its negation in the same number ofinstructions. On those machines, you should also define a pattern forthose cases, e.g., one matching@smallexample(set @var{A} (neg:@var{m} (ne:@var{m} @var{B} @var{C})))@end smallexampleSome machines can also perform @code{and} or @code{plus} operations oncondition code values with less instructions than the corresponding@samp{cstore@var{mode}4} insn followed by @code{and} or @code{plus}. On thosemachines, 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 tofind such instruction sequences on other machines.If this macro is not defined, the default value, 1, is used. You neednot define @code{STORE_FLAG_VALUE} if the machine has no store-flaginstructions, 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 isreturned when comparison operators with floating-point results are true.Define this macro on machines that have comparison operations that returnfloating-point values. If there are no such operations, do not definethis macro.@end defmac@defmac VECTOR_STORE_FLAG_VALUE (@var{mode})A C expression that gives a rtx representing the nonzero true elementfor vector comparisons. The returned rtx should be valid for the innermode of @var{mode} which is guaranteed to be a vector mode. Definethis macro on machines that have vector comparison operations thatreturn a vector result. If there are no such operations, do not definethis macro. Typically, this macro is defined as @code{const1_rtx} or@code{constm1_rtx}. This macro may return @code{NULL_RTX} to preventthe compiler optimizing such vector comparison operations for thegiven 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 valuefor @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 shouldevaluate to @code{1}; if the value applies also to the corresponding optabentry (which is normally the case if it expands directly intothe corresponding RTL), then the macro should evaluate to @code{2}.In the cases where the value is defined, @var{value} should be set tothis 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 itis not necessary, though it may be used to optimize some corner cases, andto 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 functionsvisible to the user. Thus one may be free to adjust the value at willto match the target expansion of these operations without fear ofbreaking the API@.@end defmac@defmac PmodeAn alias for the machine mode for pointers. On most machines, definethis to be the integer mode corresponding to the width of a hardwarepointer; @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 integermodes, 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 extendedto @code{Pmode}.@end defmac@defmac FUNCTION_MODEAn alias for the machine mode used for memory references to functionsbeing 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 fixedsize and alignment, this should be a mode with the same size and alignmentas the machine instruction words - typically @code{SImode} or @code{HImode}.@end defmac@defmac STDC_0_IN_SYSTEM_HEADERSIn normal operation, the preprocessor expands @code{__STDC__} to theconstant 1, to signify that GCC conforms to ISO Standard C@. On somehosts, like Solaris, the system compiler uses a different convention,where @code{__STDC__} is normally 0, but is 1 if the user specifiesstrict conformance to the C Standard.Defining @code{STDC_0_IN_SYSTEM_HEADERS} makes GNU CPP follows the hostconvention when processing system header files, but when processing userfiles @code{__STDC__} will always expand to 1.@end defmac@defmac NO_IMPLICIT_EXTERN_CDefine this macro if the system header files support C++ as well as C@.This macro inhibits the usual method of using system header files inC++, which is to pretend that the file's contents 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 anysetup required for the pragmas.The primary reason to define this macro is to provide compatibility withother compilers for the same target. In general, we discouragedefinition of target-specific pragmas for GCC@.If the pragma can be implemented by attributes then you should considerdefining 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 aresilently 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 apragma 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 callbackroutine receives @var{pfile} as its first argument, which can be passedon 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 thecallback will be silently ignored. The end of the line is indicated bya token of type @code{CPP_EOF}. Macro expansion occurs on thearguments of pragmas registered with@code{c_register_pragma_with_expansion} but not on the arguments ofpragmas 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 anyother language compilers for that matter. Thus if @code{pragma_lex} is goingto be called from target-specific code, it must only be done so whenbuilding the C and C++ compilers. This can be done by defining thevariables @code{c_target_objs} and @code{cxx_target_objs} in thetarget entry in the @file{config.gcc} file. These variables should namethe target-specific, language-specific object file which contains thecode that uses @code{pragma_lex}. Note it will also be necessary to add arule to the makefile fragment pointed to by @code{tmake_file} that showshow to build this object file.@end deftypefun@defmac HANDLE_PRAGMA_PACK_WITH_EXPANSIONDefine this macro if macros should be expanded in thearguments of @samp{#pragma pack}.@end defmac@hook TARGET_HANDLE_PRAGMA_EXTERN_PREFIX@defmac TARGET_DEFAULT_PACK_STRUCTIf your target requires a structure packing default other than 0 (meaningthe 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_IDENTIFIERSDefine this macro to control use of the character @samp{$} inidentifier names for the C family of languages. 0 means @samp{$} isnot 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 NO_DOLLAR_IN_LABELDefine this macro if the assembler does not accept the character@samp{$} in label names. By default constructors and destructors inG++ have @samp{$} in the identifiers. If this macro is defined,@samp{.} is used instead.@end defmac@defmac NO_DOT_IN_LABELDefine 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 namesare rewritten to avoid @samp{.}.@end defmac@defmac INSN_SETS_ARE_DELAYED (@var{insn})Define this macro as a C expression that is nonzero if it is safe for thedelay 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 thatevery @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 thedelay 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 wheresome @code{insn} or @code{jump_insn} is really a function call and its operandsare registers whose use is actually in the subroutine it calls, you shoulddefine this macro. Doing so allows the delay slot scheduler to moveinstructions which copy arguments into the argument registers into the delayslot of @var{insn}.You need not define this macro if it would always return zero.@end defmac@defmac MULTIPLE_SYMBOL_SPACESDefine this macro as a C expression that is nonzero if, in some cases,global symbols from one translation unit may not be bound to undefinedsymbols in another translation unit without user intervention. Forinstance, under Microsoft Windows symbols must be explicitly importedfrom shared libraries (DLLs).You need not define this macro if it would always evaluate to zero.@end defmac@hook TARGET_MD_ASM_CLOBBERSThis target hook should add to @var{clobbers} @code{STRING_CST} trees forany hard regs the port wishes to automatically clobber for an asm.It should return the result of the last @code{tree_cons} used to add aclobber. The @var{outputs}, @var{inputs} and @var{clobber} lists are thecorresponding parameters to the asm and may be inspected to avoidclobbering a register that is an input or output of the asm. You can use@code{tree_overlaps_hard_reg_set}, declared in @file{tree.h}, to testfor overlap with regards to asm-declared registers.@end deftypefn@defmac MATH_LIBRARYDefine this macro as a C string constant for the linker argument to linkin the system math library, minus the initial @samp{"-l"}, or@samp{""} if the target does not have aseparate math library.You need only define this macro if the default of @samp{"m"} is wrong.@end defmac@defmac LIBRARY_PATH_ENVDefine this macro as a C string constant for the environment variable thatspecifies 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_IODefine this macro if the target supports the following POSIX@ filefunctions, access, mkdir and file locking with fcntl / F_SETLKW@.Defining @code{TARGET_POSIX_IO} will enable the test coverage codeto use file locking when exiting a program, which avoids race conditionsif the program has forked. It will also create directories at run-timefor cross-profiling.@end defmac@defmac MAX_CONDITIONAL_EXECUTEA C expression for the maximum number of instructions to execute viaconditional execution instructions instead of a branch. A value of@code{BRANCH_COST}+1 is the default if the machine does not use cc0, and1 if it does use cc0.@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 theconditionals used for turning basic blocks into conditionally executed code.@var{ce_info} points to a data structure, @code{struct ce_if_block}, whichcontains information about the currently processed blocks. @var{true_expr}and @var{false_expr} are the tests that are used for converting thethen-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 complicatedif-statements into conditions combined by @code{and} and @code{or} operations.@var{bb} contains the basic block that contains the test that is currentlybeing 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 tobe converted to conditional execution format. @var{ce_info} points toa data structure, @code{struct ce_if_block}, which contains informationabout the currently processed blocks.@end defmac@defmac IFCVT_MODIFY_FINAL (@var{ce_info})A C expression to perform any final machine dependent modifications inconverting code to conditional execution. The involved basic blockscan be found in the @code{struct ce_if_block} structure that is pointedto by @var{ce_info}.@end defmac@defmac IFCVT_MODIFY_CANCEL (@var{ce_info})A C expression to cancel any machine dependent modifications inconverting code to conditional execution. The involved basic blockscan be found in the @code{struct ce_if_block} structure that is pointedto by @var{ce_info}.@end defmac@defmac IFCVT_INIT_EXTRA_FIELDS (@var{ce_info})A C expression to initialize any extra fields in a @code{struct ce_if_block}structure, which are defined by the @code{IFCVT_EXTRA_FIELDS} macro.@end defmac@defmac IFCVT_EXTRA_FIELDSIf defined, it should expand to a set of field declarations that will beadded to the @code{struct ce_if_block} structure. These should be initializedby the @code{IFCVT_INIT_EXTRA_FIELDS} macro.@end defmac@hook TARGET_MACHINE_DEPENDENT_REORGIf non-null, this hook performs a target-specific pass over theinstruction stream. The compiler will run it at all optimization levels,just before the point at which it normally does delayed-branch scheduling.The exact purpose of the hook varies from target to target. Some useit to do transformations that are necessary for correctness, such aslaying out in-function constant pools or avoiding hardware hazards.Others use it as an opportunity to do some machine-dependent optimizations.You need not implement the hook if it has nothing to do. The defaultdefinition is null.@end deftypefn@hook TARGET_INIT_BUILTINSDefine this hook if you have any machine-specific built-in functionsthat need to be defined. It should be a function that performs thenecessary setup.Machine specific built-in functions can be useful to expand special machineinstructions that would otherwise not normally be generated becausethey have no equivalent in the source language (for example, SIMD vectorinstructions or prefetch instructions).To create a built-in function, call the function@code{lang_hooks.builtin_function}which is defined by the language front end. You can use any type nodes setup by @code{build_common_tree_nodes};only language front ends that use those two functions will call@samp{TARGET_INIT_BUILTINS}.@end deftypefn@hook TARGET_BUILTIN_DECLDefine this hook if you have any machine-specific built-in functionsthat need to be defined. It should be a function that returns thebuiltin function declaration for the builtin function code @var{code}.If there is no such builtin and it cannot be initialized at this timeif @var{initialize_p} is true the function should return @code{NULL_TREE}.If @var{code} is out of range the function should return@code{error_mark_node}.@end deftypefn@hook TARGET_EXPAND_BUILTINExpand a call to a machine specific built-in function that was set up by@samp{TARGET_INIT_BUILTINS}. @var{exp} is the expression for thefunction call; the result should go to @var{target} if that isconvenient, and have mode @var{mode} if that is convenient.@var{subtarget} may be used as the target for computing one of@var{exp}'s operands. @var{ignore} is nonzero if the value is to beignored. This function should return the result of the call to thebuilt-in function.@end deftypefn@hook TARGET_RESOLVE_OVERLOADED_BUILTINSelect a replacement for a machine specific built-in function thatwas set up by @samp{TARGET_INIT_BUILTINS}. This is done@emph{before} regular type checking, and so allows the target toimplement a crude form of function overloading. @var{fndecl} is thedeclaration of the built-in function. @var{arglist} is the list ofarguments passed to the built-in function. The result is acomplete expression that implements the operation, usuallyanother @code{CALL_EXPR}.@var{arglist} really has type @samp{VEC(tree,gc)*}@end deftypefn@hook TARGET_FOLD_BUILTINFold a call to a machine specific built-in function that was set up by@samp{TARGET_INIT_BUILTINS}. @var{fndecl} is the declaration of thebuilt-in function. @var{n_args} is the number of arguments passed tothe function; the arguments themselves are pointed to by @var{argp}.The result is another tree containing a simplified expression for thecall's result. If @var{ignore} is true the value will be ignored.@end deftypefn@hook TARGET_INVALID_WITHIN_DOLOOPTake an instruction in @var{insn} and return NULL if it is valid within alow-overhead loop, otherwise return a string explaining why doloopcould not be applied.Many targets use special registers for low-overhead looping. For anyinstruction that clobbers these this function should return a string indicatingthe reason why the doloop could not be applied.By default, the RTL loop optimizer does not use a present doloop pattern forloops containing function calls or branch on table instructions.@end deftypefn@defmac MD_CAN_REDIRECT_BRANCH (@var{branch1}, @var{branch2})Take a branch insn in @var{branch1} and another in @var{branch2}.Return true if redirecting @var{branch1} to the destination of@var{branch2} is possible.On some targets, branches may have a limited range. Optimizing thefilling of delay slots can result in branches being redirected, and thismay in turn cause a branch offset to overflow.@end defmac@hook TARGET_COMMUTATIVE_PThis target hook returns @code{true} if @var{x} is considered to be commutative.Usually, this is just COMMUTATIVE_P (@var{x}), but the HP PA doesn't considerPLUS to be commutative inside a MEM@. @var{outer_code} is the rtx codeof the enclosing rtl, if known, otherwise it is UNKNOWN.@end deftypefn@hook TARGET_ALLOCATE_INITIAL_VALUEWhen the initial value of a hard register has been copied in a pseudoregister, it is often not necessary to actually allocate another registerto this pseudo register, because the original hard register or a stack slotit has been saved into can be used. @code{TARGET_ALLOCATE_INITIAL_VALUE}is called at the start of register allocation once for each hard registerthat had its initial value copied by using@code{get_func_hard_reg_initial_val} or @code{get_hard_reg_initial_val}.Possible values are @code{NULL_RTX}, if you don't wantto do any special allocation, a @code{REG} rtx---that would typically bethe hard register itself, if it is known not to be clobbered---or a@code{MEM}.If you are returning a @code{MEM}, this is only a hint for the allocator;it might decide to use another register anyways.You may use @code{current_function_leaf_function} in the hook, functionsthat use @code{REG_N_SETS}, to determine if the hardregister in question will not be clobbered.The default value of this hook is @code{NULL}, which disables any specialallocation.@end deftypefn@hook TARGET_UNSPEC_MAY_TRAP_PThis target hook returns nonzero if @var{x}, an @code{unspec} or@code{unspec_volatile} operation, might cause a trap. Targets can usethis hook to enhance precision of analysis for @code{unspec} and@code{unspec_volatile} operations. You may call @code{may_trap_p_1}to analyze inner elements of @var{x} in which case @var{flags} should bepassed along.@end deftypefn@hook TARGET_SET_CURRENT_FUNCTIONThe compiler invokes this hook whenever it changes its current functioncontext (@code{cfun}). You can define this function ifthe back end needs to perform any initialization or reset actions on aper-function basis. For example, it may be used to implement functionattributes that affect register usage or code generation patterns.The argument @var{decl} is the declaration for the new function context,and may be null to indicate that the compiler has left a function contextand is returning to processing at the top level.The default hook function does nothing.GCC sets @code{cfun} to a dummy function context during initialization ofsome parts of the back end. The hook function is not invoked in thissituation; you need not worry about the hook being invoked recursively,or when the back end is in a partially-initialized state.@code{cfun} might be @code{NULL} to indicate processing at top level,outside of any function scope.@end deftypefn@defmac TARGET_OBJECT_SUFFIXDefine this macro to be a C string representing the suffix for objectfiles on your target machine. If you do not define this macro, GCC willuse @samp{.o} as the suffix for object files.@end defmac@defmac TARGET_EXECUTABLE_SUFFIXDefine this macro to be a C string representing the suffix to beautomatically added to executable files on your target machine. If youdo not define this macro, GCC will use the null string as the suffix forexecutable files.@end defmac@defmac COLLECT_EXPORT_LISTIf defined, @code{collect2} will scan the individual object filesspecified on its command line and create an export list for the linker.Define this macro for systems like AIX, where the linker discardsobject files that are not referenced from @code{main} and uses exportlists.@end defmac@defmac MODIFY_JNI_METHOD_CALL (@var{mdecl})Define this macro to a C expression representing a variant of themethod call @var{mdecl}, if Java Native Interface (JNI) methodsmust be invoked differently from other methods on your target.For example, on 32-bit Microsoft Windows, JNI methods must be invoked usingthe @code{stdcall} calling convention and this macro is thendefined as this expression:@smallexamplebuild_type_attribute_variant (@var{mdecl},build_tree_list(get_identifier ("stdcall"),NULL))@end smallexample@end defmac@hook TARGET_CANNOT_MODIFY_JUMPS_PThis target hook returns @code{true} past the point in which new jumpinstructions could be created. On machines that require a register forevery jump such as the SHmedia ISA of SH5, this point would typically bereload, so this target hook should be defined to a function such as:@smallexamplestatic boolcannot_modify_jumps_past_reload_p ()@{return (reload_completed || reload_in_progress);@}@end smallexample@end deftypefn@hook TARGET_BRANCH_TARGET_REGISTER_CLASSThis target hook returns a register class for which branch target registeroptimizations should be applied. All registers in this class should beusable interchangeably. After reload, registers in this class will bere-allocated and loads will be hoisted out of loops and be subjectedto inter-block scheduling.@end deftypefn@hook TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVEDBranch target register optimization will by default exclude callee-savedregistersthat are not already live during the current function; if this target hookreturns true, they will be included. The target code must than make surethat all target registers in the class returned by@samp{TARGET_BRANCH_TARGET_REGISTER_CLASS} that might need saving aresaved. @var{after_prologue_epilogue_gen} indicates if prologues andepilogues have already been generated. Note, even if you only returntrue when @var{after_prologue_epilogue_gen} is false, you still are likelyto have to make special provisions in @code{INITIAL_ELIMINATION_OFFSET}to reserve space for caller-saved target registers.@end deftypefn@hook TARGET_HAVE_CONDITIONAL_EXECUTIONThis target hook returns true if the target supports conditional execution.This target hook is required only when the target has several differentmodes and they have different conditional execution capability, such as ARM.@end deftypefn@hook TARGET_LOOP_UNROLL_ADJUSTThis target hook returns a new value for the number of times @var{loop}should be unrolled. The parameter @var{nunroll} is the number of timesthe loop is to be unrolled. The parameter @var{loop} is a pointer tothe loop, which is going to be checked for unrolling. This target hookis required only when the target has special constraints like maximumnumber of memory accesses.@end deftypefn@defmac POWI_MAX_MULTSIf defined, this macro is interpreted as a signed integer C expressionthat specifies the maximum number of floating point multiplicationsthat should be emitted when expanding exponentiation by an integerconstant inline. When this value is defined, exponentiation requiringmore than this number of multiplications is implemented by calling thesystem 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 thetarget. The parameter @var{stdinc} indicates if normal include filesare 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 thetarget 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 Darwinsystems, this is used for Framework includes, which have semanticsthat 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 aliasfor a virtual function @var{fndecl} when constructing thunks,@code{false} otherwise. By default, the macro returns @code{true} for allfunctions, if a target supports aliases (i.e.@: defines@code{ASM_OUTPUT_DEF}), @code{false} otherwise,@end defmac@defmac TARGET_FORMAT_TYPESIf defined, this macro is the name of a global variable containingtarget-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_TYPESIf defined, this macro is the number of entries in@code{TARGET_FORMAT_TYPES}.@end defmac@defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTESIf defined, this macro is the name of a global variable containingtarget-specific format overrides for the @option{-Wformat} option. Thedefault 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_COUNTIf defined, this macro specifies the number of entries in@code{TARGET_OVERRIDES_FORMAT_ATTRIBUTES}.@end defmac@defmac TARGET_OVERRIDES_FORMAT_INITIf defined, this macro specifies the optional initializationroutine for target specific customizations of the system printfand scanf formatter settings.@end defmac@hook TARGET_RELAXED_ORDERINGIf set to @code{true}, means that the target's memory model does notguarantee that loads which do not depend on one another will accessmain memory in the order of the instruction stream; if ordering isimportant, an explicit memory barrier must be used. This is true ofmany recent processors which implement a policy of ``relaxed,''``weak,'' or ``release'' memory consistency, such as Alpha, PowerPC,and ia64. The default is @code{false}.@end deftypevr@hook TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FNIf defined, this macro returns the diagnostic message when it isillegal to pass argument @var{val} to function @var{funcdecl}with prototype @var{typelist}.@end deftypefn@hook TARGET_INVALID_CONVERSIONIf defined, this macro returns the diagnostic message when it isinvalid to convert from @var{fromtype} to @var{totype}, or @code{NULL}if validity should be determined by the front end.@end deftypefn@hook TARGET_INVALID_UNARY_OPIf defined, this macro returns the diagnostic message when it isinvalid to apply operation @var{op} (where unary plus is denoted by@code{CONVERT_EXPR}) to an operand of type @var{type}, or @code{NULL}if validity should be determined by the front end.@end deftypefn@hook TARGET_INVALID_BINARY_OPIf defined, this macro returns the diagnostic message when it isinvalid to apply operation @var{op} to operands of types @var{type1}and @var{type2}, or @code{NULL} if validity should be determined bythe front end.@end deftypefn@hook TARGET_INVALID_PARAMETER_TYPEIf defined, this macro returns the diagnostic message when it isinvalid for functions to include parameters of type @var{type},or @code{NULL} if validity should be determined bythe front end. This is currently used only by the C and C++ front ends.@end deftypefn@hook TARGET_INVALID_RETURN_TYPEIf defined, this macro returns the diagnostic message when it isinvalid for functions to have return type @var{type},or @code{NULL} if validity should be determined bythe front end. This is currently used only by the C and C++ front ends.@end deftypefn@hook TARGET_PROMOTED_TYPEIf defined, this target hook returns the type to which values of@var{type} should be promoted when they appear in expressions,analogous to the integer promotions, or @code{NULL_TREE} to use thefront end's normal promotion rules. This hook is useful when there aretarget-specific types with special promotion rules.This is currently used only by the C and C++ front ends.@end deftypefn@hook TARGET_CONVERT_TO_TYPEIf defined, this hook returns the result of converting @var{expr} to@var{type}. It should return the converted expression,or @code{NULL_TREE} to apply the front end's normal conversion rules.This hook is useful when there are target-specific types with specialconversion rules.This is currently used only by the C and C++ front ends.@end deftypefn@defmac TARGET_USE_JCR_SECTIONThis macro determines whether to use the JCR section to register Javaclasses. By default, TARGET_USE_JCR_SECTION is defined to 1 if bothSUPPORTS_WEAK and TARGET_HAVE_NAMED_SECTIONS are true, else 0.@end defmac@defmac OBJC_JBLENThis macro determines the size of the objective C jump buffer for theNeXT runtime. By default, OBJC_JBLEN is defined to an innocuous value.@end defmac@defmac LIBGCC2_UNWIND_ATTRIBUTEDefine this macro if any target-specific attributes need to be attachedto the functions in @file{libgcc} that provide low-level support forcall 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_BOUNDARYDefine this macro to update the current function stack boundary ifnecessary.@end deftypefn@hook TARGET_GET_DRAP_RTXThis hook should return an rtx for Dynamic Realign Argument Pointer (DRAP) if adifferent argument pointer register is needed to access the function'sargument list due to stack realignment. Return @code{NULL} if no DRAPis needed.@end deftypefn@hook TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGSWhen optimization is disabled, this hook indicates whether or notarguments should be allocated to stack slots. Normally, GCC allocatesstacks slots for arguments when not optimizing in order to makedebugging easier. However, when a function is declared with@code{__attribute__((naked))}, there is no stack frame, and the compilercannot safely move arguments from the registers in which they are passedto the stack. Therefore, this hook should return true in general, butfalse for naked functions. The default implementation always returns true.@end deftypefn@hook TARGET_CONST_ANCHOROn some architectures it can take multiple instructions to synthesizea constant. If there is another constant already in a register thatis close enough in value then it is preferable that the new constantis computed from this register using immediate addition orsubtraction. We accomplish this through CSE. Besides the value ofthe constant we also add a lower and an upper constant anchor to theavailable expressions. These are then queried when encountering newconstants. The anchors are computed by rounding the constant up anddown to a multiple of the value of @code{TARGET_CONST_ANCHOR}.@code{TARGET_CONST_ANCHOR} should be the maximum positive valueaccepted by immediate-add plus one. We currently assume that thevalue of @code{TARGET_CONST_ANCHOR} is a power of 2. For example, onMIPS, where add-immediate takes a 16-bit signed value,@code{TARGET_CONST_ANCHOR} is set to @samp{0x8000}. The default valueis zero, which disables this optimization. @end deftypevr@hook TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
Go to most recent revision | Compare with Previous | Blame | View Log
