📄 tm.texi
字号:
The 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 native compiler.@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 native compiler.@itemThe macro @code{MD_STARTFILE_PREFIX}, if defined, but only if this is a native compiler, or we have a target system root.@itemThe macro @code{MD_STARTFILE_PREFIX_1}, if defined, but only if this is a native 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@deftypevar {Target Hook} int TARGET_DEFAULT_TARGET_FLAGSThis variable specifies the initial value of @code{target_flags}.Its default setting is 0.@end deftypevar@cindex optional hardware or system features@cindex features, optional, in system conventions@deftypefn {Target Hook} bool TARGET_HANDLE_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value})This 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{code} specifies the @code{OPT_@var{name}} enumeration valueassociated with the selected option; @var{name} is just a rendering ofthe option name in which non-alphanumeric characters are replaced byunderscores. @var{arg} specifies the string argument and is null ifno argument was given. If the option is flagged as a @code{UInteger}(@pxref{Option properties}), @var{value} is the numeric value of theargument. Otherwise @var{value} is 1 if the positive form of theoption was used and 0 if the ``no-'' form was.@end deftypefn@deftypefn {Target Hook} bool TARGET_HANDLE_C_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value})This 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 default 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@defmac TARGET_VERSIONThis macro is a C statement to print on @code{stderr} a stringdescribing the particular machine description choice. Every machinedescription should define @code{TARGET_VERSION}. For example:@smallexample#ifdef MOTOROLA#define TARGET_VERSION \ fprintf (stderr, " (68k, Motorola syntax)");#else#define TARGET_VERSION \ fprintf (stderr, " (68k, MIT syntax)");#endif@end smallexample@end defmac@defmac OVERRIDE_OPTIONSSometimes certain combinations of command options do not make sense ona particular target machine. You can define a macro@code{OVERRIDE_OPTIONS} to take account of this. This macro, ifdefined, is executed once just after all the command options have beenparsed.Don't use this macro to turn on various extra optimizations for@option{-O}. That is what @code{OPTIMIZATION_OPTIONS} is for.@end defmac@defmac C_COMMON_OVERRIDE_OPTIONSThis is similar to @code{OVERRIDE_OPTIONS} but 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@defmac OPTIMIZATION_OPTIONS (@var{level}, @var{size})Some machines may desire to change what optimizations are performed forvarious optimization levels. This macro, if defined, is executed oncejust after the optimization level is determined and before the remainderof the command options have been parsed. Values set in this macro areused as the default values for the other command line options.@var{level} is the optimization level specified; 2 if @option{-O2} isspecified, 1 if @option{-O} is specified, and 0 if neither is specified.@var{size} is nonzero if @option{-Os} is specified and zero otherwise.You should not use this macro to change options that are notmachine-specific. These should uniformly selected by the sameoptimization level on all supported machines. Use this macro to enablemachine-specific optimizations.@strong{Do not examine @code{write_symbols} inthis macro!} The debugging options are not supposed to alter thegenerated code.@end defmac@deftypefn {Target Hook} bool TARGET_HELP (void)This hook is called in response to the user invoking@option{--target-help} on the command line. It gives the target achance to display extra information on the target specific commandline options found in its @file{.opt} file.@end deftypefn@defmac CAN_DEBUG_WITHOUT_FPDefine this macro if debugging can be performed even without a framepointer. If this macro is defined, GCC will turn on the@option{-fomit-frame-pointer} option whenever @option{-O} is specified.@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 using@code{ggc_alloc}, 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; GCC fundamentally assumes that theorder of words in memory is the same as the order in registers. Thismacro need not be a constant.@end defmac@defmac LIBGCC2_WORDS_BIG_ENDIAN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -