comparison gcc/doc/tm.texi @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents 3bfb6c00c1e0
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
53 * Target Attributes:: Defining target-specific uses of @code{__attribute__}. 53 * Target Attributes:: Defining target-specific uses of @code{__attribute__}.
54 * Emulated TLS:: Emulated TLS support. 54 * Emulated TLS:: Emulated TLS support.
55 * MIPS Coprocessors:: MIPS coprocessor support and how to customize it. 55 * MIPS Coprocessors:: MIPS coprocessor support and how to customize it.
56 * PCH Target:: Validity checking for precompiled headers. 56 * PCH Target:: Validity checking for precompiled headers.
57 * C++ ABI:: Controlling C++ ABI changes. 57 * C++ ABI:: Controlling C++ ABI changes.
58 * Named Address Spaces:: Adding support for named address spaces
58 * Misc:: Everything else. 59 * Misc:: Everything else.
59 @end menu 60 @end menu
60 61
61 @node Target Structure 62 @node Target Structure
62 @section The Global @code{targetm} Variable 63 @section The Global @code{targetm} Variable
748 @deftypevar {extern int} target_flags 749 @deftypevar {extern int} target_flags
749 This variable is declared in @file{options.h}, which is included before 750 This variable is declared in @file{options.h}, which is included before
750 any target-specific headers. 751 any target-specific headers.
751 @end deftypevar 752 @end deftypevar
752 753
753 @deftypevar {Target Hook} int TARGET_DEFAULT_TARGET_FLAGS 754 @deftypevr {Target Hook} int TARGET_DEFAULT_TARGET_FLAGS
754 This variable specifies the initial value of @code{target_flags}. 755 This variable specifies the initial value of @code{target_flags}.
755 Its default setting is 0. 756 Its default setting is 0.
756 @end deftypevar 757 @end deftypevr
757 758
758 @cindex optional hardware or system features 759 @cindex optional hardware or system features
759 @cindex features, optional, in system conventions 760 @cindex features, optional, in system conventions
760 761
761 @deftypefn {Target Hook} bool TARGET_HANDLE_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value}) 762 @deftypefn {Target Hook} bool TARGET_HANDLE_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value})
811 defined, is executed once just after all the command options have been 812 defined, is executed once just after all the command options have been
812 parsed. 813 parsed.
813 814
814 Don't use this macro to turn on various extra optimizations for 815 Don't use this macro to turn on various extra optimizations for
815 @option{-O}. That is what @code{OPTIMIZATION_OPTIONS} is for. 816 @option{-O}. That is what @code{OPTIMIZATION_OPTIONS} is for.
816 @end defmac 817
818 If you need to do something whenever the optimization level is
819 changed via the optimize attribute or pragma, see
820 @code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}
821 @end defmac
822
823 @deftypefn {Target Hook} void TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE (void)
824 This target function is similar to the macro @code{OVERRIDE_OPTIONS}
825 but is called when the optimize level is changed via an attribute or
826 pragma or when it is reset at the end of the code affected by the
827 attribute or pragma. It is not called at the beginning of compilation
828 when @code{OVERRIDE_OPTIONS} is called so if you want to perform these
829 actions then, you should have @code{OVERRIDE_OPTIONS} call
830 @code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}.
831 @end deftypefn
817 832
818 @defmac C_COMMON_OVERRIDE_OPTIONS 833 @defmac C_COMMON_OVERRIDE_OPTIONS
819 This is similar to @code{OVERRIDE_OPTIONS} but is only used in the C 834 This is similar to @code{OVERRIDE_OPTIONS} but is only used in the C
820 language frontends (C, Objective-C, C++, Objective-C++) and so can be 835 language frontends (C, Objective-C, C++, Objective-C++) and so can be
821 used to alter option flag variables which only exist in those 836 used to alter option flag variables which only exist in those
1037 @var{unsignedp} according to which kind of extension is more efficient. 1052 @var{unsignedp} according to which kind of extension is more efficient.
1038 1053
1039 Do not define this macro if it would never modify @var{m}. 1054 Do not define this macro if it would never modify @var{m}.
1040 @end defmac 1055 @end defmac
1041 1056
1042 @defmac PROMOTE_FUNCTION_MODE 1057 @deftypefn {Target Hook} enum machine_mode TARGET_PROMOTE_FUNCTION_MODE (tree @var{type}, enum machine_mode @var{mode}, int *@var{punsignedp}, tree @var{funtype}, int @var{for_return})
1043 Like @code{PROMOTE_MODE}, but is applied to outgoing function arguments or 1058 Like @code{PROMOTE_MODE}, but it is applied to outgoing function arguments or
1044 function return values, as specified by @code{TARGET_PROMOTE_FUNCTION_ARGS} 1059 function return values. The target hook should return the new mode
1045 and @code{TARGET_PROMOTE_FUNCTION_RETURN}, respectively. 1060 and possibly change @code{*@var{punsignedp}} if the promotion should
1046 1061 change signedness. This function is called only for scalar @emph{or
1047 The default is @code{PROMOTE_MODE}. 1062 pointer} types.
1048 @end defmac 1063
1049 1064 @var{for_return} allows to distinguish the promotion of arguments and
1050 @deftypefn {Target Hook} bool TARGET_PROMOTE_FUNCTION_ARGS (tree @var{fntype}) 1065 return values. If it is @code{1}, a return value is being promoted and
1051 This target hook should return @code{true} if the promotion described by 1066 @code{TARGET_FUNCTION_VALUE} must perform the same promotions done here.
1052 @code{PROMOTE_FUNCTION_MODE} should be done for outgoing function 1067 If it is @code{2}, the returned mode should be that of the register in
1053 arguments. 1068 which an incoming parameter is copied, or the outgoing result is computed;
1054 @end deftypefn 1069 then the hook should return the same mode as @code{promote_mode}, though
1055 1070 the signedness may be different.
1056 @deftypefn {Target Hook} bool TARGET_PROMOTE_FUNCTION_RETURN (tree @var{fntype}) 1071
1057 This target hook should return @code{true} if the promotion described by 1072 The default is to not promote arguments and return values. You can
1058 @code{PROMOTE_FUNCTION_MODE} should be done for the return value of 1073 also define the hook to @code{default_promote_function_mode_always_promote}
1059 functions. 1074 if you would like to apply the same rules given by @code{PROMOTE_MODE}.
1060
1061 If this target hook returns @code{true}, @code{TARGET_FUNCTION_VALUE}
1062 must perform the same promotions done by @code{PROMOTE_FUNCTION_MODE}.
1063 @end deftypefn 1075 @end deftypefn
1064 1076
1065 @defmac PARM_BOUNDARY 1077 @defmac PARM_BOUNDARY
1066 Normal alignment required for function parameters on the stack, in 1078 Normal alignment required for function parameters on the stack, in
1067 bits. All stack parameters receive at least this much alignment 1079 bits. All stack parameters receive at least this much alignment
1429 Defining this macro only affects the way @file{libgcc.a} emulates 1441 Defining this macro only affects the way @file{libgcc.a} emulates
1430 floating-point arithmetic. 1442 floating-point arithmetic.
1431 1443
1432 The default definition of this macro returns false for all sizes. 1444 The default definition of this macro returns false for all sizes.
1433 @end defmac 1445 @end defmac
1434
1435 @deftypefn {Target Hook} bool TARGET_VECTOR_OPAQUE_P (tree @var{type})
1436 This target hook should return @code{true} a vector is opaque. That
1437 is, if no cast is needed when copying a vector value of type
1438 @var{type} into another vector lvalue of the same size. Vector opaque
1439 types cannot be initialized. The default is that there are no such
1440 types.
1441 @end deftypefn
1442 1446
1443 @deftypefn {Target Hook} bool TARGET_MS_BITFIELD_LAYOUT_P (tree @var{record_type}) 1447 @deftypefn {Target Hook} bool TARGET_MS_BITFIELD_LAYOUT_P (tree @var{record_type})
1444 This target hook returns @code{true} if bit-fields in the given 1448 This target hook returns @code{true} if bit-fields in the given
1445 @var{record_type} are to be laid out following the rules of Microsoft 1449 @var{record_type} are to be laid out following the rules of Microsoft
1446 Visual C/C++, namely: (i) a bit-field won't share the same storage 1450 Visual C/C++, namely: (i) a bit-field won't share the same storage
1786 1790
1787 If you don't define this macro, the default is the first of 1791 If you don't define this macro, the default is the first of
1788 @code{"unsigned int"}, @code{"long unsigned int"}, or @code{"long long 1792 @code{"unsigned int"}, @code{"long unsigned int"}, or @code{"long long
1789 unsigned int"} that has as much precision as @code{long long unsigned 1793 unsigned int"} that has as much precision as @code{long long unsigned
1790 int}. 1794 int}.
1795 @end defmac
1796
1797 @defmac SIG_ATOMIC_TYPE
1798 @defmacx INT8_TYPE
1799 @defmacx INT16_TYPE
1800 @defmacx INT32_TYPE
1801 @defmacx INT64_TYPE
1802 @defmacx UINT8_TYPE
1803 @defmacx UINT16_TYPE
1804 @defmacx UINT32_TYPE
1805 @defmacx UINT64_TYPE
1806 @defmacx INT_LEAST8_TYPE
1807 @defmacx INT_LEAST16_TYPE
1808 @defmacx INT_LEAST32_TYPE
1809 @defmacx INT_LEAST64_TYPE
1810 @defmacx UINT_LEAST8_TYPE
1811 @defmacx UINT_LEAST16_TYPE
1812 @defmacx UINT_LEAST32_TYPE
1813 @defmacx UINT_LEAST64_TYPE
1814 @defmacx INT_FAST8_TYPE
1815 @defmacx INT_FAST16_TYPE
1816 @defmacx INT_FAST32_TYPE
1817 @defmacx INT_FAST64_TYPE
1818 @defmacx UINT_FAST8_TYPE
1819 @defmacx UINT_FAST16_TYPE
1820 @defmacx UINT_FAST32_TYPE
1821 @defmacx UINT_FAST64_TYPE
1822 @defmacx INTPTR_TYPE
1823 @defmacx UINTPTR_TYPE
1824 C expressions for the standard types @code{sig_atomic_t},
1825 @code{int8_t}, @code{int16_t}, @code{int32_t}, @code{int64_t},
1826 @code{uint8_t}, @code{uint16_t}, @code{uint32_t}, @code{uint64_t},
1827 @code{int_least8_t}, @code{int_least16_t}, @code{int_least32_t},
1828 @code{int_least64_t}, @code{uint_least8_t}, @code{uint_least16_t},
1829 @code{uint_least32_t}, @code{uint_least64_t}, @code{int_fast8_t},
1830 @code{int_fast16_t}, @code{int_fast32_t}, @code{int_fast64_t},
1831 @code{uint_fast8_t}, @code{uint_fast16_t}, @code{uint_fast32_t},
1832 @code{uint_fast64_t}, @code{intptr_t}, and @code{uintptr_t}. See
1833 @code{SIZE_TYPE} above for more information.
1834
1835 If any of these macros evaluates to a null pointer, the corresponding
1836 type is not supported; if GCC is configured to provide
1837 @code{<stdint.h>} in such a case, the header provided may not conform
1838 to C99, depending on the type in question. The defaults for all of
1839 these macros are null pointers.
1791 @end defmac 1840 @end defmac
1792 1841
1793 @defmac TARGET_PTRMEMFUNC_VBIT_LOCATION 1842 @defmac TARGET_PTRMEMFUNC_VBIT_LOCATION
1794 The C++ compiler represents a pointer-to-member-function with a struct 1843 The C++ compiler represents a pointer-to-member-function with a struct
1795 that looks like: 1844 that looks like:
2313 2362
2314 @defmac STACK_REGS 2363 @defmac STACK_REGS
2315 Define this if the machine has any stack-like registers. 2364 Define this if the machine has any stack-like registers.
2316 @end defmac 2365 @end defmac
2317 2366
2367 @defmac STACK_REG_COVER_CLASS
2368 This is a cover class containing the stack registers. Define this if
2369 the machine has any stack-like registers.
2370 @end defmac
2371
2318 @defmac FIRST_STACK_REG 2372 @defmac FIRST_STACK_REG
2319 The number of the first stack-like register. This one is the top 2373 The number of the first stack-like register. This one is the top
2320 of the stack. 2374 of the stack.
2321 @end defmac 2375 @end defmac
2322 2376
2472 added to another register (as well as added to a displacement). 2526 added to another register (as well as added to a displacement).
2473 @end defmac 2527 @end defmac
2474 2528
2475 @defmac REGNO_OK_FOR_BASE_P (@var{num}) 2529 @defmac REGNO_OK_FOR_BASE_P (@var{num})
2476 A C expression which is nonzero if register number @var{num} is 2530 A C expression which is nonzero if register number @var{num} is
2477 suitable for use as a base register in operand addresses. It may be 2531 suitable for use as a base register in operand addresses.
2478 either a suitable hard register or a pseudo register that has been 2532 Like @code{TARGET_LEGITIMATE_ADDRESS_P}, this macro should also
2479 allocated such a hard register. 2533 define a strict and a non-strict variant. Both variants behave
2534 the same for hard register; for pseudos, the strict variant will
2535 pass only those that have been allocated to a valid hard registers,
2536 while the non-strict variant will pass all pseudos.
2537
2538 @findex REG_OK_STRICT
2539 Compiler source files that want to use the strict variant of this and
2540 other macros define the macro @code{REG_OK_STRICT}. You should use an
2541 @code{#ifdef REG_OK_STRICT} conditional to define the strict variant in
2542 that case and the non-strict variant otherwise.
2480 @end defmac 2543 @end defmac
2481 2544
2482 @defmac REGNO_MODE_OK_FOR_BASE_P (@var{num}, @var{mode}) 2545 @defmac REGNO_MODE_OK_FOR_BASE_P (@var{num}, @var{mode})
2483 A C expression that is just like @code{REGNO_OK_FOR_BASE_P}, except that 2546 A C expression that is just like @code{REGNO_OK_FOR_BASE_P}, except that
2484 that expression may examine the mode of the memory reference in 2547 that expression may examine the mode of the memory reference in
2487 you define this macro, the compiler will use it instead of 2550 you define this macro, the compiler will use it instead of
2488 @code{REGNO_OK_FOR_BASE_P}. The mode may be @code{VOIDmode} for 2551 @code{REGNO_OK_FOR_BASE_P}. The mode may be @code{VOIDmode} for
2489 addresses that appear outside a @code{MEM}, i.e., as an 2552 addresses that appear outside a @code{MEM}, i.e., as an
2490 @code{address_operand}. 2553 @code{address_operand}.
2491 2554
2555 This macro also has strict and non-strict variants.
2492 @end defmac 2556 @end defmac
2493 2557
2494 @defmac REGNO_MODE_OK_FOR_REG_BASE_P (@var{num}, @var{mode}) 2558 @defmac REGNO_MODE_OK_FOR_REG_BASE_P (@var{num}, @var{mode})
2495 A C expression which is nonzero if register number @var{num} is suitable for 2559 A C expression which is nonzero if register number @var{num} is suitable for
2496 use as a base register in base plus index operand addresses, accessing 2560 use as a base register in base plus index operand addresses, accessing
2499 define this macro if base plus index addresses have different requirements 2563 define this macro if base plus index addresses have different requirements
2500 than other base register uses. 2564 than other base register uses.
2501 2565
2502 Use of this macro is deprecated; please use the more general 2566 Use of this macro is deprecated; please use the more general
2503 @code{REGNO_MODE_CODE_OK_FOR_BASE_P}. 2567 @code{REGNO_MODE_CODE_OK_FOR_BASE_P}.
2568
2569 This macro also has strict and non-strict variants.
2504 @end defmac 2570 @end defmac
2505 2571
2506 @defmac REGNO_MODE_CODE_OK_FOR_BASE_P (@var{num}, @var{mode}, @var{outer_code}, @var{index_code}) 2572 @defmac REGNO_MODE_CODE_OK_FOR_BASE_P (@var{num}, @var{mode}, @var{outer_code}, @var{index_code})
2507 A C expression that is just like @code{REGNO_MODE_OK_FOR_BASE_P}, except 2573 A C expression that is just like @code{REGNO_MODE_OK_FOR_BASE_P}, except
2508 that that expression may examine the context in which the register 2574 that that expression may examine the context in which the register
2511 address, @code{ADDRESS} for something that occurs in an 2577 address, @code{ADDRESS} for something that occurs in an
2512 @code{address_operand}). @var{index_code} is the code of the 2578 @code{address_operand}). @var{index_code} is the code of the
2513 corresponding index expression if @var{outer_code} is @code{PLUS}; 2579 corresponding index expression if @var{outer_code} is @code{PLUS};
2514 @code{SCRATCH} otherwise. The mode may be @code{VOIDmode} for addresses 2580 @code{SCRATCH} otherwise. The mode may be @code{VOIDmode} for addresses
2515 that appear outside a @code{MEM}, i.e., as an @code{address_operand}. 2581 that appear outside a @code{MEM}, i.e., as an @code{address_operand}.
2582
2583 This macro also has strict and non-strict variants.
2516 @end defmac 2584 @end defmac
2517 2585
2518 @defmac REGNO_OK_FOR_INDEX_P (@var{num}) 2586 @defmac REGNO_OK_FOR_INDEX_P (@var{num})
2519 A C expression which is nonzero if register number @var{num} is 2587 A C expression which is nonzero if register number @var{num} is
2520 suitable for use as an index register in operand addresses. It may be 2588 suitable for use as an index register in operand addresses. It may be
2527 labeled the ``base'' and the other the ``index''; but whichever 2595 labeled the ``base'' and the other the ``index''; but whichever
2528 labeling is used must fit the machine's constraints of which registers 2596 labeling is used must fit the machine's constraints of which registers
2529 may serve in each capacity. The compiler will try both labelings, 2597 may serve in each capacity. The compiler will try both labelings,
2530 looking for one that is valid, and will reload one or both registers 2598 looking for one that is valid, and will reload one or both registers
2531 only if neither labeling works. 2599 only if neither labeling works.
2600
2601 This macro also has strict and non-strict variants.
2532 @end defmac 2602 @end defmac
2533 2603
2534 @defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class}) 2604 @defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class})
2535 A C expression that places additional restrictions on the register class 2605 A C expression that places additional restrictions on the register class
2536 to use when it is necessary to copy value @var{x} into a register in class 2606 to use when it is necessary to copy value @var{x} into a register in class
2610 Another kind of secondary reload is required on some machines which 2680 Another kind of secondary reload is required on some machines which
2611 allow copying all registers to and from memory, but require a scratch 2681 allow copying all registers to and from memory, but require a scratch
2612 register for stores to some memory locations (e.g., those with symbolic 2682 register for stores to some memory locations (e.g., those with symbolic
2613 address on the RT, and those with certain symbolic address on the SPARC 2683 address on the RT, and those with certain symbolic address on the SPARC
2614 when compiling PIC)@. Scratch registers need not have the same mode 2684 when compiling PIC)@. Scratch registers need not have the same mode
2615 as the value being copied, and usually hold a different value that 2685 as the value being copied, and usually hold a different value than
2616 that being copied. Special patterns in the md file are needed to 2686 that being copied. Special patterns in the md file are needed to
2617 describe how the copy is performed with the help of the scratch register; 2687 describe how the copy is performed with the help of the scratch register;
2618 these patterns also describe the number, register class(es) and mode(s) 2688 these patterns also describe the number, register class(es) and mode(s)
2619 of the scratch register(s). 2689 of the scratch register(s).
2620 2690
2857 (@acronym{IRA}). Cover classes are a set of non-intersecting register 2927 (@acronym{IRA}). Cover classes are a set of non-intersecting register
2858 classes covering all hard registers used for register allocation 2928 classes covering all hard registers used for register allocation
2859 purposes. If a move between two registers in the same cover class is 2929 purposes. If a move between two registers in the same cover class is
2860 possible, it should be cheaper than a load or store of the registers. 2930 possible, it should be cheaper than a load or store of the registers.
2861 The array is terminated by a @code{LIM_REG_CLASSES} element. 2931 The array is terminated by a @code{LIM_REG_CLASSES} element.
2932
2933 The order of cover classes in the array is important. If two classes
2934 have the same cost of usage for a pseudo, the class occurred first in
2935 the array is chosen for the pseudo.
2862 2936
2863 This hook is called once at compiler startup, after the command-line 2937 This hook is called once at compiler startup, after the command-line
2864 options have been processed. It is then re-examined by every call to 2938 options have been processed. It is then re-examined by every call to
2865 @code{target_reinit}. 2939 @code{target_reinit}.
2866 2940
2999 @code{EXTRA_CONSTRAINT} as representing a memory address of this type. 3073 @code{EXTRA_CONSTRAINT} as representing a memory address of this type.
3000 If the letter @samp{Q} is marked as @code{EXTRA_MEMORY_CONSTRAINT}, 3074 If the letter @samp{Q} is marked as @code{EXTRA_MEMORY_CONSTRAINT},
3001 a @samp{Q} constraint can handle any memory operand, because the 3075 a @samp{Q} constraint can handle any memory operand, because the
3002 reload pass knows it can be reloaded by copying the memory address 3076 reload pass knows it can be reloaded by copying the memory address
3003 into a base register if required. This is analogous to the way 3077 into a base register if required. This is analogous to the way
3004 a @samp{o} constraint can handle any memory operand. 3078 an @samp{o} constraint can handle any memory operand.
3005 @end defmac 3079 @end defmac
3006 3080
3007 @defmac EXTRA_ADDRESS_CONSTRAINT (@var{c}, @var{str}) 3081 @defmac EXTRA_ADDRESS_CONSTRAINT (@var{c}, @var{str})
3008 A C expression that defines the optional machine-dependent constraint 3082 A C expression that defines the optional machine-dependent constraint
3009 letters, amongst those accepted by @code{EXTRA_CONSTRAINT} / 3083 letters, amongst those accepted by @code{EXTRA_CONSTRAINT} /
3264 from the argument pointer to the canonical frame address (cfa). The 3338 from the argument pointer to the canonical frame address (cfa). The
3265 final value should coincide with that calculated by 3339 final value should coincide with that calculated by
3266 @code{INCOMING_FRAME_SP_OFFSET}. Which is unfortunately not usable 3340 @code{INCOMING_FRAME_SP_OFFSET}. Which is unfortunately not usable
3267 during virtual register instantiation. 3341 during virtual register instantiation.
3268 3342
3269 The default value for this macro is @code{FIRST_PARM_OFFSET (fundecl)}, 3343 The default value for this macro is
3344 @code{FIRST_PARM_OFFSET (fundecl) + crtl->args.pretend_args_size},
3270 which is correct for most machines; in general, the arguments are found 3345 which is correct for most machines; in general, the arguments are found
3271 immediately before the stack frame. Note that this is not the case on 3346 immediately before the stack frame. Note that this is not the case on
3272 some targets that save registers into the caller's frame, such as SPARC 3347 some targets that save registers into the caller's frame, such as SPARC
3273 and rs6000, and so such targets need to define this macro. 3348 and rs6000, and so such targets need to define this macro.
3274 3349
3468 dynamically if their size exceeds @code{STACK_CHECK_MAX_VAR_SIZE} bytes. 3543 dynamically if their size exceeds @code{STACK_CHECK_MAX_VAR_SIZE} bytes.
3469 3544
3470 @defmac STACK_CHECK_BUILTIN 3545 @defmac STACK_CHECK_BUILTIN
3471 A nonzero value if stack checking is done by the configuration files in a 3546 A nonzero value if stack checking is done by the configuration files in a
3472 machine-dependent manner. You should define this macro if stack checking 3547 machine-dependent manner. You should define this macro if stack checking
3473 is require by the ABI of your machine or if you would like to do stack 3548 is required by the ABI of your machine or if you would like to do stack
3474 checking in some more efficient way than the generic approach. The default 3549 checking in some more efficient way than the generic approach. The default
3475 value of this macro is zero. 3550 value of this macro is zero.
3476 @end defmac 3551 @end defmac
3477 3552
3478 @defmac STACK_CHECK_STATIC_BUILTIN 3553 @defmac STACK_CHECK_STATIC_BUILTIN
3480 in a machine-dependent manner. You should define this macro if you would 3555 in a machine-dependent manner. You should define this macro if you would
3481 like to do static stack checking in some more efficient way than the generic 3556 like to do static stack checking in some more efficient way than the generic
3482 approach. The default value of this macro is zero. 3557 approach. The default value of this macro is zero.
3483 @end defmac 3558 @end defmac
3484 3559
3485 @defmac STACK_CHECK_PROBE_INTERVAL 3560 @defmac STACK_CHECK_PROBE_INTERVAL_EXP
3486 An integer representing the interval at which GCC must generate stack 3561 An integer specifying the interval at which GCC must generate stack probe
3487 probe instructions. You will normally define this macro to be no larger 3562 instructions, defined as 2 raised to this integer. You will normally
3488 than the size of the ``guard pages'' at the end of a stack area. The 3563 define this macro so that the interval be no larger than the size of
3489 default value of 4096 is suitable for most systems. 3564 the ``guard pages'' at the end of a stack area. The default value
3490 @end defmac 3565 of 12 (4096-byte interval) is suitable for most systems.
3491 3566 @end defmac
3492 @defmac STACK_CHECK_PROBE_LOAD 3567
3493 An integer which is nonzero if GCC should perform the stack probe 3568 @defmac STACK_CHECK_MOVING_SP
3494 as a load instruction and zero if GCC should use a store instruction. 3569 An integer which is nonzero if GCC should move the stack pointer page by page
3495 The default is zero, which is the most efficient choice on most systems. 3570 when doing probes. This can be necessary on systems where the stack pointer
3571 contains the bottom address of the memory area accessible to the executing
3572 thread at any point in time. In this situation an alternate signal stack
3573 is required in order to be able to recover from a stack overflow. The
3574 default value of this macro is zero.
3496 @end defmac 3575 @end defmac
3497 3576
3498 @defmac STACK_CHECK_PROTECT 3577 @defmac STACK_CHECK_PROTECT
3499 The number of bytes of stack needed to recover from a stack overflow, 3578 The number of bytes of stack needed to recover from a stack overflow, for
3500 for languages where such a recovery is supported. The default value of 3579 languages where such a recovery is supported. The default value of 75 words
3501 75 words should be adequate for most machines. 3580 with the @code{setjmp}/@code{longjmp}-based exception handling mechanism and
3581 8192 bytes with other exception handling mechanisms should be adequate for
3582 most machines.
3502 @end defmac 3583 @end defmac
3503 3584
3504 The following macros are relevant only if neither STACK_CHECK_BUILTIN 3585 The following macros are relevant only if neither STACK_CHECK_BUILTIN
3505 nor STACK_CHECK_STATIC_BUILTIN is defined; you can omit them altogether 3586 nor STACK_CHECK_STATIC_BUILTIN is defined; you can omit them altogether
3506 in the opposite case. 3587 in the opposite case.
3605 not be defined. 3686 not be defined.
3606 3687
3607 The static chain register need not be a fixed register. 3688 The static chain register need not be a fixed register.
3608 3689
3609 If the static chain is passed in memory, these macros should not be 3690 If the static chain is passed in memory, these macros should not be
3610 defined; instead, the next two macros should be defined. 3691 defined; instead, the @code{TARGET_STATIC_CHAIN} hook should be used.
3611 @end defmac 3692 @end defmac
3612 3693
3613 @defmac STATIC_CHAIN 3694 @deftypefn {Target Hook} rtx TARGET_STATIC_CHAIN (const_tree @var{fndecl}, bool @var{incoming_p})
3614 @defmacx STATIC_CHAIN_INCOMING 3695 This hook replaces the use of @code{STATIC_CHAIN_REGNUM} et al for
3615 If the static chain is passed in memory, these macros provide rtx giving 3696 targets that may use different static chain locations for different
3616 @code{mem} expressions that denote where they are stored. 3697 nested functions. This may be required if the target has function
3617 @code{STATIC_CHAIN} and @code{STATIC_CHAIN_INCOMING} give the locations 3698 attributes that affect the calling conventions of the function and
3618 as seen by the calling and called functions, respectively. Often the former 3699 those calling conventions use different static chain locations.
3619 will be at an offset from the stack pointer and the latter at an offset from 3700
3620 the frame pointer. 3701 The default version of this hook uses @code{STATIC_CHAIN_REGNUM} et al.
3621 3702
3703 If the static chain is passed in memory, this hook should be used to
3704 provide rtx giving @code{mem} expressions that denote where they are stored.
3705 Often the @code{mem} expression as seen by the caller will be at an offset
3706 from the stack pointer and the @code{mem} expression as seen by the callee
3707 will be at an offset from the frame pointer.
3622 @findex stack_pointer_rtx 3708 @findex stack_pointer_rtx
3623 @findex frame_pointer_rtx 3709 @findex frame_pointer_rtx
3624 @findex arg_pointer_rtx 3710 @findex arg_pointer_rtx
3625 The variables @code{stack_pointer_rtx}, @code{frame_pointer_rtx}, and 3711 The variables @code{stack_pointer_rtx}, @code{frame_pointer_rtx}, and
3626 @code{arg_pointer_rtx} will have been initialized prior to the use of these 3712 @code{arg_pointer_rtx} will have been initialized and should be used
3627 macros and should be used to refer to those items. 3713 to refer to those items.
3628 3714 @end deftypefn
3629 If the static chain is passed in a register, the two previous macros should
3630 be defined instead.
3631 @end defmac
3632 3715
3633 @defmac DWARF_FRAME_REGISTERS 3716 @defmac DWARF_FRAME_REGISTERS
3634 This macro specifies the maximum number of hard registers that can be 3717 This macro specifies the maximum number of hard registers that can be
3635 saved in a call frame. This is used to size data structures used in 3718 saved in a call frame. This is used to size data structures used in
3636 DWARF2 exception handling. 3719 DWARF2 exception handling.
3690 @subsection Eliminating Frame Pointer and Arg Pointer 3773 @subsection Eliminating Frame Pointer and Arg Pointer
3691 3774
3692 @c prevent bad page break with this line 3775 @c prevent bad page break with this line
3693 This is about eliminating the frame pointer and arg pointer. 3776 This is about eliminating the frame pointer and arg pointer.
3694 3777
3695 @defmac FRAME_POINTER_REQUIRED 3778 @deftypefn {Target Hook} bool TARGET_FRAME_POINTER_REQUIRED (void)
3696 A C expression which is nonzero if a function must have and use a frame 3779 This target hook should return @code{true} if a function must have and use
3697 pointer. This expression is evaluated in the reload pass. If its value is 3780 a frame pointer. This target hook is called in the reload pass. If its return
3698 nonzero the function will have a frame pointer. 3781 value is @code{true} the function will have a frame pointer.
3699 3782
3700 The expression can in principle examine the current function and decide 3783 This target hook can in principle examine the current function and decide
3701 according to the facts, but on most machines the constant 0 or the 3784 according to the facts, but on most machines the constant @code{false} or the
3702 constant 1 suffices. Use 0 when the machine allows code to be generated 3785 constant @code{true} suffices. Use @code{false} when the machine allows code
3703 with no frame pointer, and doing so saves some time or space. Use 1 3786 to be generated with no frame pointer, and doing so saves some time or space.
3704 when there is no possible advantage to avoiding a frame pointer. 3787 Use @code{true} when there is no possible advantage to avoiding a frame
3788 pointer.
3705 3789
3706 In certain cases, the compiler does not know how to produce valid code 3790 In certain cases, the compiler does not know how to produce valid code
3707 without a frame pointer. The compiler recognizes those cases and 3791 without a frame pointer. The compiler recognizes those cases and
3708 automatically gives the function a frame pointer regardless of what 3792 automatically gives the function a frame pointer regardless of what
3709 @code{FRAME_POINTER_REQUIRED} says. You don't need to worry about 3793 @code{TARGET_FRAME_POINTER_REQUIRED} returns. You don't need to worry about
3710 them. 3794 them.
3711 3795
3712 In a function that does not require a frame pointer, the frame pointer 3796 In a function that does not require a frame pointer, the frame pointer
3713 register can be allocated for ordinary usage, unless you mark it as a 3797 register can be allocated for ordinary usage, unless you mark it as a
3714 fixed register. See @code{FIXED_REGISTERS} for more information. 3798 fixed register. See @code{FIXED_REGISTERS} for more information.
3715 @end defmac 3799
3800 Default return value is @code{false}.
3801 @end deftypefn
3716 3802
3717 @findex get_frame_size 3803 @findex get_frame_size
3718 @defmac INITIAL_FRAME_POINTER_OFFSET (@var{depth-var}) 3804 @defmac INITIAL_FRAME_POINTER_OFFSET (@var{depth-var})
3719 A C statement to store in the variable @var{depth-var} the difference 3805 A C statement to store in the variable @var{depth-var} the difference
3720 between the frame pointer and the stack pointer values immediately after 3806 between the frame pointer and the stack pointer values immediately after
3722 such as the result of @code{get_frame_size ()} and the tables of 3808 such as the result of @code{get_frame_size ()} and the tables of
3723 registers @code{regs_ever_live} and @code{call_used_regs}. 3809 registers @code{regs_ever_live} and @code{call_used_regs}.
3724 3810
3725 If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and 3811 If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and
3726 need not be defined. Otherwise, it must be defined even if 3812 need not be defined. Otherwise, it must be defined even if
3727 @code{FRAME_POINTER_REQUIRED} is defined to always be true; in that 3813 @code{TARGET_FRAME_POINTER_REQUIRED} always returns true; in that
3728 case, you may set @var{depth-var} to anything. 3814 case, you may set @var{depth-var} to anything.
3729 @end defmac 3815 @end defmac
3730 3816
3731 @defmac ELIMINABLE_REGS 3817 @defmac ELIMINABLE_REGS
3732 If defined, this macro specifies a table of register pairs used to 3818 If defined, this macro specifies a table of register pairs used to
3753 3839
3754 Note that the elimination of the argument pointer with the stack pointer is 3840 Note that the elimination of the argument pointer with the stack pointer is
3755 specified first since that is the preferred elimination. 3841 specified first since that is the preferred elimination.
3756 @end defmac 3842 @end defmac
3757 3843
3758 @defmac CAN_ELIMINATE (@var{from-reg}, @var{to-reg}) 3844 @deftypefn {Target Hook} bool TARGET_CAN_ELIMINATE (const int @var{from-reg}, const int @var{to-reg})
3759 A C expression that returns nonzero if the compiler is allowed to try 3845 This target hook should returns @code{true} if the compiler is allowed to
3760 to replace register number @var{from-reg} with register number 3846 try to replace register number @var{from-reg} with register number
3761 @var{to-reg}. This macro need only be defined if @code{ELIMINABLE_REGS} 3847 @var{to-reg}. This target hook need only be defined if @code{ELIMINABLE_REGS}
3762 is defined, and will usually be the constant 1, since most of the cases 3848 is defined, and will usually be @code{true}, since most of the cases
3763 preventing register elimination are things that the compiler already 3849 preventing register elimination are things that the compiler already
3764 knows about. 3850 knows about.
3765 @end defmac 3851
3852 Default return value is @code{true}.
3853 @end deftypefn
3766 3854
3767 @defmac INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var}) 3855 @defmac INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var})
3768 This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}. It 3856 This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}. It
3769 specifies the initial difference between the specified pair of 3857 specifies the initial difference between the specified pair of
3770 registers. This macro must be defined if @code{ELIMINABLE_REGS} is 3858 registers. This macro must be defined if @code{ELIMINABLE_REGS} is
4137 This macro need not do anything if the argument in question was passed 4225 This macro need not do anything if the argument in question was passed
4138 on the stack. The compiler knows how to track the amount of stack space 4226 on the stack. The compiler knows how to track the amount of stack space
4139 used for arguments without any special help. 4227 used for arguments without any special help.
4140 @end defmac 4228 @end defmac
4141 4229
4142
4143 @defmac FUNCTION_ARG_OFFSET (@var{mode}, @var{type}) 4230 @defmac FUNCTION_ARG_OFFSET (@var{mode}, @var{type})
4144 If defined, a C expression that is the number of bytes to add to the 4231 If defined, a C expression that is the number of bytes to add to the
4145 offset of the argument passed in memory. This is needed for the SPU, 4232 offset of the argument passed in memory. This is needed for the SPU,
4146 which passes @code{char} and @code{short} arguments in the preferred 4233 which passes @code{char} and @code{short} arguments in the preferred
4147 slot that is in the middle of the quad word instead of starting at the 4234 slot that is in the middle of the quad word instead of starting at the
4270 4357
4271 @deftypefn {Target Hook} rtx TARGET_FUNCTION_VALUE (tree @var{ret_type}, tree @var{fn_decl_or_type}, bool @var{outgoing}) 4358 @deftypefn {Target Hook} rtx TARGET_FUNCTION_VALUE (tree @var{ret_type}, tree @var{fn_decl_or_type}, bool @var{outgoing})
4272 4359
4273 Define this to return an RTX representing the place where a function 4360 Define this to return an RTX representing the place where a function
4274 returns or receives a value of data type @var{ret_type}, a tree node 4361 returns or receives a value of data type @var{ret_type}, a tree node
4275 node representing a data type. @var{fn_decl_or_type} is a tree node 4362 representing a data type. @var{fn_decl_or_type} is a tree node
4276 representing @code{FUNCTION_DECL} or @code{FUNCTION_TYPE} of a 4363 representing @code{FUNCTION_DECL} or @code{FUNCTION_TYPE} of a
4277 function being called. If @var{outgoing} is false, the hook should 4364 function being called. If @var{outgoing} is false, the hook should
4278 compute the register in which the caller will see the return value. 4365 compute the register in which the caller will see the return value.
4279 Otherwise, the hook should return an RTX representing the place where 4366 Otherwise, the hook should return an RTX representing the place where
4280 a function returns a value. 4367 a function returns a value.
4330 support routine, used to perform arithmetic, whose name is known 4417 support routine, used to perform arithmetic, whose name is known
4331 specially by the compiler and was not mentioned in the C code being 4418 specially by the compiler and was not mentioned in the C code being
4332 compiled. 4419 compiled.
4333 @end defmac 4420 @end defmac
4334 4421
4422 @deftypefn {Target Hook} rtx TARGET_LIBCALL_VALUE (enum machine_mode
4423 @var{mode}, const_rtx @var{fun})
4424 Define this hook if the back-end needs to know the name of the libcall
4425 function in order to determine where the result should be returned.
4426
4427 The mode of the result is given by @var{mode} and the name of the called
4428 library function is given by @var{fun}. The hook should return an RTX
4429 representing the place where the library function result will be returned.
4430
4431 If this hook is not defined, then LIBCALL_VALUE will be used.
4432 @end deftypefn
4433
4335 @defmac FUNCTION_VALUE_REGNO_P (@var{regno}) 4434 @defmac FUNCTION_VALUE_REGNO_P (@var{regno})
4336 A C expression that is nonzero if @var{regno} is the number of a hard 4435 A C expression that is nonzero if @var{regno} is the number of a hard
4337 register in which the values of called function may come back. 4436 register in which the values of called function may come back.
4338 4437
4339 A register whose use for returning values is limited to serving as the 4438 A register whose use for returning values is limited to serving as the
5026 simply a matter of copying each address to a memory reference at the 5125 simply a matter of copying each address to a memory reference at the
5027 proper offset from the start of the trampoline. On a RISC machine, it 5126 proper offset from the start of the trampoline. On a RISC machine, it
5028 may be necessary to take out pieces of the address and store them 5127 may be necessary to take out pieces of the address and store them
5029 separately. 5128 separately.
5030 5129
5031 @defmac TRAMPOLINE_TEMPLATE (@var{file}) 5130 @deftypefn {Target Hook} void TARGET_ASM_TRAMPOLINE_TEMPLATE (FILE *@var{f})
5032 A C statement to output, on the stream @var{file}, assembler code for a 5131 This hook is called by @code{assemble_trampoline_template} to output,
5033 block of data that contains the constant parts of a trampoline. This 5132 on the stream @var{f}, assembler code for a block of data that contains
5034 code should not include a label---the label is taken care of 5133 the constant parts of a trampoline. This code should not include a
5035 automatically. 5134 label---the label is taken care of automatically.
5036 5135
5037 If you do not define this macro, it means no template is needed 5136 If you do not define this hook, it means no template is needed
5038 for the target. Do not define this macro on systems where the block move 5137 for the target. Do not define this hook on systems where the block move
5039 code to copy the trampoline into place would be larger than the code 5138 code to copy the trampoline into place would be larger than the code
5040 to generate it on the spot. 5139 to generate it on the spot.
5041 @end defmac 5140 @end deftypefn
5042 5141
5043 @defmac TRAMPOLINE_SECTION 5142 @defmac TRAMPOLINE_SECTION
5044 Return the section into which the trampoline template is to be placed 5143 Return the section into which the trampoline template is to be placed
5045 (@pxref{Sections}). The default value is @code{readonly_data_section}. 5144 (@pxref{Sections}). The default value is @code{readonly_data_section}.
5046 @end defmac 5145 @end defmac
5050 @end defmac 5149 @end defmac
5051 5150
5052 @defmac TRAMPOLINE_ALIGNMENT 5151 @defmac TRAMPOLINE_ALIGNMENT
5053 Alignment required for trampolines, in bits. 5152 Alignment required for trampolines, in bits.
5054 5153
5055 If you don't define this macro, the value of @code{BIGGEST_ALIGNMENT} 5154 If you don't define this macro, the value of @code{FUNCTION_ALIGNMENT}
5056 is used for aligning trampolines. 5155 is used for aligning trampolines.
5057 @end defmac 5156 @end defmac
5058 5157
5059 @defmac INITIALIZE_TRAMPOLINE (@var{addr}, @var{fnaddr}, @var{static_chain}) 5158 @deftypefn {Target Hook} void TARGET_TRAMPOLINE_INIT (rtx @var{m_tramp}, tree @var{fndecl}, rtx @var{static_chain})
5060 A C statement to initialize the variable parts of a trampoline. 5159 This hook is called to initialize a trampoline.
5061 @var{addr} is an RTX for the address of the trampoline; @var{fnaddr} is 5160 @var{m_tramp} is an RTX for the memory block for the trampoline; @var{fndecl}
5062 an RTX for the address of the nested function; @var{static_chain} is an 5161 is the @code{FUNCTION_DECL} for the nested function; @var{static_chain} is an
5063 RTX for the static chain value that should be passed to the function 5162 RTX for the static chain value that should be passed to the function
5064 when it is called. 5163 when it is called.
5065 @end defmac 5164
5066 5165 If the target defines @code{TARGET_ASM_TRAMPOLINE_TEMPLATE}, then the
5067 @defmac TRAMPOLINE_ADJUST_ADDRESS (@var{addr}) 5166 first thing this hook should do is emit a block move into @var{m_tramp}
5068 A C statement that should perform any machine-specific adjustment in 5167 from the memory block returned by @code{assemble_trampoline_template}.
5069 the address of the trampoline. Its argument contains the address that 5168 Note that the block move need only cover the constant parts of the
5070 was passed to @code{INITIALIZE_TRAMPOLINE}. In case the address to be 5169 trampoline. If the target isolates the variable parts of the trampoline
5071 used for a function call should be different from the address in which 5170 to the end, not all @code{TRAMPOLINE_SIZE} bytes need be copied.
5072 the template was stored, the different address should be assigned to 5171
5073 @var{addr}. If this macro is not defined, @var{addr} will be used for 5172 If the target requires any other actions, such as flushing caches or
5074 function calls. 5173 enabling stack execution, these actions should be performed after
5075 5174 initializing the trampoline proper.
5076 @cindex @code{TARGET_ASM_FUNCTION_EPILOGUE} and trampolines 5175 @end deftypefn
5077 @cindex @code{TARGET_ASM_FUNCTION_PROLOGUE} and trampolines 5176
5078 If this macro is not defined, by default the trampoline is allocated as 5177 @deftypefn {Target Hook} rtx TARGET_TRAMPOLINE_ADJUST_ADDRESS (rtx @var{addr})
5079 a stack slot. This default is right for most machines. The exceptions 5178 This hook should perform any machine-specific adjustment in
5080 are machines where it is impossible to execute instructions in the stack 5179 the address of the trampoline. Its argument contains the address of the
5081 area. On such machines, you may have to implement a separate stack, 5180 memory block that was passed to @code{TARGET_TRAMPOLINE_INIT}. In case
5082 using this macro in conjunction with @code{TARGET_ASM_FUNCTION_PROLOGUE} 5181 the address to be used for a function call should be different from the
5083 and @code{TARGET_ASM_FUNCTION_EPILOGUE}. 5182 address at which the template was stored, the different address should
5084 5183 be returned; otherwise @var{addr} should be returned unchanged.
5085 @var{fp} points to a data structure, a @code{struct function}, which 5184 If this hook is not defined, @var{addr} will be used for function calls.
5086 describes the compilation status of the immediate containing function of 5185 @end deftypefn
5087 the function which the trampoline is for. The stack slot for the
5088 trampoline is in the stack frame of this containing function. Other
5089 allocation strategies probably must do something analogous with this
5090 information.
5091 @end defmac
5092 5186
5093 Implementing trampolines is difficult on many machines because they have 5187 Implementing trampolines is difficult on many machines because they have
5094 separate instruction and data caches. Writing into a stack location 5188 separate instruction and data caches. Writing into a stack location
5095 fails to clear the memory in the instruction cache, so when the program 5189 fails to clear the memory in the instruction cache, so when the program
5096 jumps to that location, it executes the old contents. 5190 jumps to that location, it executes the old contents.
5119 Define this macro if certain operations must be performed before executing 5213 Define this macro if certain operations must be performed before executing
5120 code located on the stack. The macro should expand to a series of C 5214 code located on the stack. The macro should expand to a series of C
5121 file-scope constructs (e.g.@: functions) and provide a unique entry point 5215 file-scope constructs (e.g.@: functions) and provide a unique entry point
5122 named @code{__enable_execute_stack}. The target is responsible for 5216 named @code{__enable_execute_stack}. The target is responsible for
5123 emitting calls to the entry point in the code, for example from the 5217 emitting calls to the entry point in the code, for example from the
5124 @code{INITIALIZE_TRAMPOLINE} macro. 5218 @code{TARGET_TRAMPOLINE_INIT} hook.
5125 @end defmac 5219 @end defmac
5126 5220
5127 To use a standard subroutine, define the following macro. In addition, 5221 To use a standard subroutine, define the following macro. In addition,
5128 you must make sure that the instructions in a trampoline fill an entire 5222 you must make sure that the instructions in a trampoline fill an entire
5129 cache line with identical instructions, or else ensure that the 5223 cache line with identical instructions, or else ensure that the
5295 post-address side-effect generation involving a register displacement. 5389 post-address side-effect generation involving a register displacement.
5296 @end defmac 5390 @end defmac
5297 5391
5298 @defmac CONSTANT_ADDRESS_P (@var{x}) 5392 @defmac CONSTANT_ADDRESS_P (@var{x})
5299 A C expression that is 1 if the RTX @var{x} is a constant which 5393 A C expression that is 1 if the RTX @var{x} is a constant which
5300 is a valid address. On most machines, this can be defined as 5394 is a valid address. On most machines the default definition of
5301 @code{CONSTANT_P (@var{x})}, but a few machines are more restrictive 5395 @code{(CONSTANT_P (@var{x}) && GET_CODE (@var{x}) != CONST_DOUBLE)}
5302 in which constant addresses are supported. 5396 is acceptable, but a few machines are more restrictive as to which
5397 constant addresses are supported.
5303 @end defmac 5398 @end defmac
5304 5399
5305 @defmac CONSTANT_P (@var{x}) 5400 @defmac CONSTANT_P (@var{x})
5306 @code{CONSTANT_P}, which is defined by target-independent code, 5401 @code{CONSTANT_P}, which is defined by target-independent code,
5307 accepts integer-values expressions whose values are not explicitly 5402 accepts integer-values expressions whose values are not explicitly
5311 @end defmac 5406 @end defmac
5312 5407
5313 @defmac MAX_REGS_PER_ADDRESS 5408 @defmac MAX_REGS_PER_ADDRESS
5314 A number, the maximum number of registers that can appear in a valid 5409 A number, the maximum number of registers that can appear in a valid
5315 memory address. Note that it is up to you to specify a value equal to 5410 memory address. Note that it is up to you to specify a value equal to
5316 the maximum number that @code{GO_IF_LEGITIMATE_ADDRESS} would ever 5411 the maximum number that @code{TARGET_LEGITIMATE_ADDRESS_P} would ever
5317 accept. 5412 accept.
5318 @end defmac 5413 @end defmac
5319 5414
5320 @defmac GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label}) 5415 @deftypefn {Target Hook} TARGET_LEGITIMATE_ADDRESS_P (enum machine_mode @var{mode}, rtx @var{x}, bool @var{strict})
5321 A C compound statement with a conditional @code{goto @var{label};} 5416 A function that returns whether @var{x} (an RTX) is a legitimate memory
5322 executed if @var{x} (an RTX) is a legitimate memory address on the 5417 address on the target machine for a memory operand of mode @var{mode}.
5323 target machine for a memory operand of mode @var{mode}. 5418
5324 5419 Legitimate addresses are defined in two variants: a strict variant and a
5325 It usually pays to define several simpler macros to serve as 5420 non-strict one. The @code{strict} parameter chooses which variant is
5326 subroutines for this one. Otherwise it may be too complicated to 5421 desired by the caller.
5327 understand. 5422
5328 5423 The strict variant is used in the reload pass. It must be defined so
5329 This macro must exist in two variants: a strict variant and a 5424 that any pseudo-register that has not been allocated a hard register is
5330 non-strict one. The strict variant is used in the reload pass. It 5425 considered a memory reference. This is because in contexts where some
5331 must be defined so that any pseudo-register that has not been 5426 kind of register is required, a pseudo-register with no hard register
5332 allocated a hard register is considered a memory reference. In 5427 must be rejected. For non-hard registers, the strict variant should look
5333 contexts where some kind of register is required, a pseudo-register 5428 up the @code{reg_renumber} array; it should then proceed using the hard
5334 with no hard register must be rejected. 5429 register number in the array, or treat the pseudo as a memory reference
5430 if the array holds @code{-1}.
5335 5431
5336 The non-strict variant is used in other passes. It must be defined to 5432 The non-strict variant is used in other passes. It must be defined to
5337 accept all pseudo-registers in every context where some kind of 5433 accept all pseudo-registers in every context where some kind of
5338 register is required. 5434 register is required.
5339
5340 @findex REG_OK_STRICT
5341 Compiler source files that want to use the strict variant of this
5342 macro define the macro @code{REG_OK_STRICT}. You should use an
5343 @code{#ifdef REG_OK_STRICT} conditional to define the strict variant
5344 in that case and the non-strict variant otherwise.
5345
5346 Subroutines to check for acceptable registers for various purposes (one
5347 for base registers, one for index registers, and so on) are typically
5348 among the subroutines used to define @code{GO_IF_LEGITIMATE_ADDRESS}.
5349 Then only these subroutine macros need have two variants; the higher
5350 levels of macros may be the same whether strict or not.
5351 5435
5352 Normally, constant addresses which are the sum of a @code{symbol_ref} 5436 Normally, constant addresses which are the sum of a @code{symbol_ref}
5353 and an integer are stored inside a @code{const} RTX to mark them as 5437 and an integer are stored inside a @code{const} RTX to mark them as
5354 constant. Therefore, there is no need to recognize such sums 5438 constant. Therefore, there is no need to recognize such sums
5355 specifically as legitimate addresses. Normally you would simply 5439 specifically as legitimate addresses. Normally you would simply
5367 target hook @code{TARGET_ENCODE_SECTION_INFO} to store the information 5451 target hook @code{TARGET_ENCODE_SECTION_INFO} to store the information
5368 into the @code{symbol_ref}, and then check for it here. When you see a 5452 into the @code{symbol_ref}, and then check for it here. When you see a
5369 @code{const}, you will have to look inside it to find the 5453 @code{const}, you will have to look inside it to find the
5370 @code{symbol_ref} in order to determine the section. @xref{Assembler 5454 @code{symbol_ref} in order to determine the section. @xref{Assembler
5371 Format}. 5455 Format}.
5372 @end defmac 5456
5457 @cindex @code{GO_IF_LEGITIMATE_ADDRESS}
5458 Some ports are still using a deprecated legacy substitute for
5459 this hook, the @code{GO_IF_LEGITIMATE_ADDRESS} macro. This macro
5460 has this syntax:
5461
5462 @example
5463 #define GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label})
5464 @end example
5465
5466 @noindent
5467 and should @code{goto @var{label}} if the address @var{x} is a valid
5468 address on the target machine for a memory operand of mode @var{mode}.
5469 Whether the strict or non-strict variants are desired is defined by
5470 the @code{REG_OK_STRICT} macro introduced earlier in this section.
5471 Using the hook is usually simpler because it limits the number of
5472 files that are recompiled when changes are made.
5473 @end deftypefn
5373 5474
5374 @defmac TARGET_MEM_CONSTRAINT 5475 @defmac TARGET_MEM_CONSTRAINT
5375 A single character to be used instead of the default @code{'m'} 5476 A single character to be used instead of the default @code{'m'}
5376 character for general memory addresses. This defines the constraint 5477 character for general memory addresses. This defines the constraint
5377 letter which matches the memory addresses accepted by 5478 letter which matches the memory addresses accepted by
5378 @code{GO_IF_LEGITIMATE_ADDRESS_P}. Define this macro if you want to 5479 @code{TARGET_LEGITIMATE_ADDRESS_P}. Define this macro if you want to
5379 support new address formats in your back end without changing the 5480 support new address formats in your back end without changing the
5380 semantics of the @code{'m'} constraint. This is necessary in order to 5481 semantics of the @code{'m'} constraint. This is necessary in order to
5381 preserve functionality of inline assembly constructs using the 5482 preserve functionality of inline assembly constructs using the
5382 @code{'m'} constraint. 5483 @code{'m'} constraint.
5383 @end defmac 5484 @end defmac
5393 5494
5394 The typical use of this macro is to handle addresses containing 5495 The typical use of this macro is to handle addresses containing
5395 a label_ref or symbol_ref within an UNSPEC@. 5496 a label_ref or symbol_ref within an UNSPEC@.
5396 @end defmac 5497 @end defmac
5397 5498
5398 @defmac LEGITIMIZE_ADDRESS (@var{x}, @var{oldx}, @var{mode}, @var{win}) 5499 @deftypefn {Target Hook} rtx TARGET_LEGITIMIZE_ADDRESS (rtx @var{x}, rtx @var{oldx}, enum machine_mode @var{mode})
5399 A C compound statement that attempts to replace @var{x} with a valid 5500 This hook is given an invalid memory address @var{x} for an
5400 memory address for an operand of mode @var{mode}. @var{win} will be a 5501 operand of mode @var{mode} and should try to return a valid memory
5401 C statement label elsewhere in the code; the macro definition may use 5502 address.
5402
5403 @smallexample
5404 GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{win});
5405 @end smallexample
5406
5407 @noindent
5408 to avoid further processing if the address has become legitimate.
5409 5503
5410 @findex break_out_memory_refs 5504 @findex break_out_memory_refs
5411 @var{x} will always be the result of a call to @code{break_out_memory_refs}, 5505 @var{x} will always be the result of a call to @code{break_out_memory_refs},
5412 and @var{oldx} will be the operand that was given to that function to produce 5506 and @var{oldx} will be the operand that was given to that function to produce
5413 @var{x}. 5507 @var{x}.
5414 5508
5415 The code generated by this macro should not alter the substructure of 5509 The code of the hook should not alter the substructure of
5416 @var{x}. If it transforms @var{x} into a more legitimate form, it 5510 @var{x}. If it transforms @var{x} into a more legitimate form, it
5417 should assign @var{x} (which will always be a C variable) a new value. 5511 should return the new @var{x}.
5418 5512
5419 It is not necessary for this macro to come up with a legitimate 5513 It is not necessary for this hook to come up with a legitimate address.
5420 address. The compiler has standard ways of doing so in all cases. In 5514 The compiler has standard ways of doing so in all cases. In fact, it
5421 fact, it is safe to omit this macro. But often a 5515 is safe to omit this hook or make it return @var{x} if it cannot find
5422 machine-dependent strategy can generate better code. 5516 a valid way to legitimize the address. But often a machine-dependent
5423 @end defmac 5517 strategy can generate better code.
5518 @end deftypefn
5424 5519
5425 @defmac LEGITIMIZE_RELOAD_ADDRESS (@var{x}, @var{mode}, @var{opnum}, @var{type}, @var{ind_levels}, @var{win}) 5520 @defmac LEGITIMIZE_RELOAD_ADDRESS (@var{x}, @var{mode}, @var{opnum}, @var{type}, @var{ind_levels}, @var{win})
5426 A C compound statement that attempts to replace @var{x}, which is an address 5521 A C compound statement that attempts to replace @var{x}, which is an address
5427 that needs reloading, with a valid memory address for an operand of mode 5522 that needs reloading, with a valid memory address for an operand of mode
5428 @var{mode}. @var{win} will be a C statement label elsewhere in the code. 5523 @var{mode}. @var{win} will be a C statement label elsewhere in the code.
5558 @code{REALIGN_LOAD}. Therefore, the mask @var{m} returned by @var{f} 5653 @code{REALIGN_LOAD}. Therefore, the mask @var{m} returned by @var{f}
5559 should comply with the semantics expected by @code{REALIGN_LOAD} 5654 should comply with the semantics expected by @code{REALIGN_LOAD}
5560 described above. 5655 described above.
5561 If this hook is not defined, then @var{addr} will be used as 5656 If this hook is not defined, then @var{addr} will be used as
5562 the argument @var{OFF} to @code{REALIGN_LOAD}, in which case the low 5657 the argument @var{OFF} to @code{REALIGN_LOAD}, in which case the low
5563 log2(@var{VS})-1 bits of @var{addr} will be considered. 5658 log2(@var{VS}) @minus{} 1 bits of @var{addr} will be considered.
5564 @end deftypefn 5659 @end deftypefn
5565 5660
5566 @deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN (tree @var{x}) 5661 @deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN (tree @var{x})
5567 This hook should return the DECL of a function @var{f} that implements 5662 This hook should return the DECL of a function @var{f} that implements
5568 widening multiplication of the even elements of two input vectors of type @var{x}. 5663 widening multiplication of the even elements of two input vectors of type @var{x}.
5606 @code{NULL_TREE} if such a function is not available. The return type of 5701 @code{NULL_TREE} if such a function is not available. The return type of
5607 the vectorized function shall be of vector type @var{vec_type_out} and the 5702 the vectorized function shall be of vector type @var{vec_type_out} and the
5608 argument types should be @var{vec_type_in}. 5703 argument types should be @var{vec_type_in}.
5609 @end deftypefn 5704 @end deftypefn
5610 5705
5706 @deftypefn {Target Hook} bool TARGET_SUPPORT_VECTOR_MISALIGNMENT (enum machine_mode @var{mode}, tree @var{type}, int @var{misalignment}, bool @var{is_packed})
5707 This hook should return true if the target supports misaligned vector
5708 store/load of a specific factor denoted in the @var{misalignment}
5709 parameter. The vector store/load should be of machine mode @var{mode} and
5710 the elements in the vectors should be of type @var{type}. @var{is_packed}
5711 parameter is true if the memory access is defined in a packed struct.
5712 @end deftypefn
5713
5611 @node Anchored Addresses 5714 @node Anchored Addresses
5612 @section Anchored Addresses 5715 @section Anchored Addresses
5613 @cindex anchored addresses 5716 @cindex anchored addresses
5614 @cindex @option{-fsection-anchors} 5717 @cindex @option{-fsection-anchors}
5615 5718
5641 The hooks below describe the target properties that GCC needs to know 5744 The hooks below describe the target properties that GCC needs to know
5642 in order to make effective use of section anchors. It won't use 5745 in order to make effective use of section anchors. It won't use
5643 section anchors at all unless either @code{TARGET_MIN_ANCHOR_OFFSET} 5746 section anchors at all unless either @code{TARGET_MIN_ANCHOR_OFFSET}
5644 or @code{TARGET_MAX_ANCHOR_OFFSET} is set to a nonzero value. 5747 or @code{TARGET_MAX_ANCHOR_OFFSET} is set to a nonzero value.
5645 5748
5646 @deftypevar {Target Hook} HOST_WIDE_INT TARGET_MIN_ANCHOR_OFFSET 5749 @deftypevr {Target Hook} HOST_WIDE_INT TARGET_MIN_ANCHOR_OFFSET
5647 The minimum offset that should be applied to a section anchor. 5750 The minimum offset that should be applied to a section anchor.
5648 On most targets, it should be the smallest offset that can be 5751 On most targets, it should be the smallest offset that can be
5649 applied to a base register while still giving a legitimate address 5752 applied to a base register while still giving a legitimate address
5650 for every mode. The default value is 0. 5753 for every mode. The default value is 0.
5651 @end deftypevar 5754 @end deftypevr
5652 5755
5653 @deftypevar {Target Hook} HOST_WIDE_INT TARGET_MAX_ANCHOR_OFFSET 5756 @deftypevr {Target Hook} HOST_WIDE_INT TARGET_MAX_ANCHOR_OFFSET
5654 Like @code{TARGET_MIN_ANCHOR_OFFSET}, but the maximum (inclusive) 5757 Like @code{TARGET_MIN_ANCHOR_OFFSET}, but the maximum (inclusive)
5655 offset that should be applied to section anchors. The default 5758 offset that should be applied to section anchors. The default
5656 value is 0. 5759 value is 0.
5657 @end deftypevar 5760 @end deftypevr
5658 5761
5659 @deftypefn {Target Hook} void TARGET_ASM_OUTPUT_ANCHOR (rtx @var{x}) 5762 @deftypefn {Target Hook} void TARGET_ASM_OUTPUT_ANCHOR (rtx @var{x})
5660 Write the assembly code to define section anchor @var{x}, which is a 5763 Write the assembly code to define section anchor @var{x}, which is a
5661 @code{SYMBOL_REF} for which @samp{SYMBOL_REF_ANCHOR_P (@var{x})} is true. 5764 @code{SYMBOL_REF} for which @samp{SYMBOL_REF_ANCHOR_P (@var{x})} is true.
5662 The hook is called with the assembly output position set to the beginning 5765 The hook is called with the assembly output position set to the beginning
5680 5783
5681 @node Condition Code 5784 @node Condition Code
5682 @section Condition Code Status 5785 @section Condition Code Status
5683 @cindex condition code status 5786 @cindex condition code status
5684 5787
5685 @c prevent bad page break with this line 5788 The macros in this section can be split in two families, according to the
5686 This describes the condition code status. 5789 two ways of representing condition codes in GCC.
5790
5791 The first representation is the so called @code{(cc0)} representation
5792 (@pxref{Jump Patterns}), where all instructions can have an implicit
5793 clobber of the condition codes. The second is the condition code
5794 register representation, which provides better schedulability for
5795 architectures that do have a condition code register, but on which
5796 most instructions do not affect it. The latter category includes
5797 most RISC machines.
5798
5799 The implicit clobbering poses a strong restriction on the placement of
5800 the definition and use of the condition code, which need to be in adjacent
5801 insns for machines using @code{(cc0)}. This can prevent important
5802 optimizations on some machines. For example, on the IBM RS/6000, there
5803 is a delay for taken branches unless the condition code register is set
5804 three instructions earlier than the conditional branch. The instruction
5805 scheduler cannot perform this optimization if it is not permitted to
5806 separate the definition and use of the condition code register.
5807
5808 For this reason, it is possible and suggested to use a register to
5809 represent the condition code for new ports. If there is a specific
5810 condition code register in the machine, use a hard register. If the
5811 condition code or comparison result can be placed in any general register,
5812 or if there are multiple condition registers, use a pseudo register.
5813 Registers used to store the condition code value will usually have a mode
5814 that is in class @code{MODE_CC}.
5815
5816 Alternatively, you can use @code{BImode} if the comparison operator is
5817 specified already in the compare instruction. In this case, you are not
5818 interested in most macros in this section.
5819
5820 @menu
5821 * CC0 Condition Codes:: Old style representation of condition codes.
5822 * MODE_CC Condition Codes:: Modern representation of condition codes.
5823 * Cond. Exec. Macros:: Macros to control conditional execution.
5824 @end menu
5825
5826 @node CC0 Condition Codes
5827 @subsection Representation of condition codes using @code{(cc0)}
5828 @findex cc0
5687 5829
5688 @findex cc_status 5830 @findex cc_status
5689 The file @file{conditions.h} defines a variable @code{cc_status} to 5831 The file @file{conditions.h} defines a variable @code{cc_status} to
5690 describe how the condition code was computed (in case the interpretation of 5832 describe how the condition code was computed (in case the interpretation of
5691 the condition code depends on the instruction that it was set by). This 5833 the condition code depends on the instruction that it was set by). This
5747 that looks at an attribute (@pxref{Insn Attributes}) named, for example, 5889 that looks at an attribute (@pxref{Insn Attributes}) named, for example,
5748 @samp{cc}. This avoids having detailed information about patterns in 5890 @samp{cc}. This avoids having detailed information about patterns in
5749 two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}. 5891 two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}.
5750 @end defmac 5892 @end defmac
5751 5893
5894 @node MODE_CC Condition Codes
5895 @subsection Representation of condition codes using registers
5896 @findex CCmode
5897 @findex MODE_CC
5898
5752 @defmac SELECT_CC_MODE (@var{op}, @var{x}, @var{y}) 5899 @defmac SELECT_CC_MODE (@var{op}, @var{x}, @var{y})
5753 Returns a mode from class @code{MODE_CC} to be used when comparison 5900 On many machines, the condition code may be produced by other instructions
5754 operation code @var{op} is applied to rtx @var{x} and @var{y}. For 5901 than compares, for example the branch can use directly the condition
5755 example, on the SPARC, @code{SELECT_CC_MODE} is defined as (see 5902 code set by a subtract instruction. However, on some machines
5756 @pxref{Jump Patterns} for a description of the reason for this 5903 when the condition code is set this way some bits (such as the overflow
5757 definition) 5904 bit) are not set in the same way as a test instruction, so that a different
5905 branch instruction must be used for some conditional branches. When
5906 this happens, use the machine mode of the condition code register to
5907 record different formats of the condition code register. Modes can
5908 also be used to record which compare instruction (e.g. a signed or an
5909 unsigned comparison) produced the condition codes.
5910
5911 If other modes than @code{CCmode} are required, add them to
5912 @file{@var{machine}-modes.def} and define @code{SELECT_CC_MODE} to choose
5913 a mode given an operand of a compare. This is needed because the modes
5914 have to be chosen not only during RTL generation but also, for example,
5915 by instruction combination. The result of @code{SELECT_CC_MODE} should
5916 be consistent with the mode used in the patterns; for example to support
5917 the case of the add on the SPARC discussed above, we have the pattern
5918
5919 @smallexample
5920 (define_insn ""
5921 [(set (reg:CC_NOOV 0)
5922 (compare:CC_NOOV
5923 (plus:SI (match_operand:SI 0 "register_operand" "%r")
5924 (match_operand:SI 1 "arith_operand" "rI"))
5925 (const_int 0)))]
5926 ""
5927 "@dots{}")
5928 @end smallexample
5929
5930 @noindent
5931 together with a @code{SELECT_CC_MODE} that returns @code{CC_NOOVmode}
5932 for comparisons whose argument is a @code{plus}:
5758 5933
5759 @smallexample 5934 @smallexample
5760 #define SELECT_CC_MODE(OP,X,Y) \ 5935 #define SELECT_CC_MODE(OP,X,Y) \
5761 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ 5936 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
5762 ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \ 5937 ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
5763 : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \ 5938 : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
5764 || GET_CODE (X) == NEG) \ 5939 || GET_CODE (X) == NEG) \
5765 ? CC_NOOVmode : CCmode)) 5940 ? CC_NOOVmode : CCmode))
5766 @end smallexample 5941 @end smallexample
5767 5942
5943 Another reason to use modes is to retain information on which operands
5944 were used by the comparison; see @code{REVERSIBLE_CC_MODE} later in
5945 this section.
5946
5768 You should define this macro if and only if you define extra CC modes 5947 You should define this macro if and only if you define extra CC modes
5769 in @file{@var{machine}-modes.def}. 5948 in @file{@var{machine}-modes.def}.
5770 @end defmac 5949 @end defmac
5771 5950
5772 @defmac CANONICALIZE_COMPARISON (@var{code}, @var{op0}, @var{op1}) 5951 @defmac CANONICALIZE_COMPARISON (@var{code}, @var{op0}, @var{op1})
5816 5995
5817 @smallexample 5996 @smallexample
5818 #define REVERSE_CONDITION(CODE, MODE) \ 5997 #define REVERSE_CONDITION(CODE, MODE) \
5819 ((MODE) != CCFPmode ? reverse_condition (CODE) \ 5998 ((MODE) != CCFPmode ? reverse_condition (CODE) \
5820 : reverse_condition_maybe_unordered (CODE)) 5999 : reverse_condition_maybe_unordered (CODE))
5821 @end smallexample
5822 @end defmac
5823
5824 @defmac REVERSE_CONDEXEC_PREDICATES_P (@var{op1}, @var{op2})
5825 A C expression that returns true if the conditional execution predicate
5826 @var{op1}, a comparison operation, is the inverse of @var{op2} and vice
5827 versa. Define this to return 0 if the target has conditional execution
5828 predicates that cannot be reversed safely. There is no need to validate
5829 that the arguments of op1 and op2 are the same, this is done separately.
5830 If no expansion is specified, this macro is defined as follows:
5831
5832 @smallexample
5833 #define REVERSE_CONDEXEC_PREDICATES_P (x, y) \
5834 (GET_CODE ((x)) == reversed_comparison_code ((y), NULL))
5835 @end smallexample 6000 @end smallexample
5836 @end defmac 6001 @end defmac
5837 6002
5838 @deftypefn {Target Hook} bool TARGET_FIXED_CONDITION_CODE_REGS (unsigned int *, unsigned int *) 6003 @deftypefn {Target Hook} bool TARGET_FIXED_CONDITION_CODE_REGS (unsigned int *, unsigned int *)
5839 On targets which do not use @code{(cc0)}, and which use a hard 6004 On targets which do not use @code{(cc0)}, and which use a hard
5861 The default version of this hook checks whether the modes are the 6026 The default version of this hook checks whether the modes are the
5862 same. If they are, it returns that mode. If they are different, it 6027 same. If they are, it returns that mode. If they are different, it
5863 returns @code{VOIDmode}. 6028 returns @code{VOIDmode}.
5864 @end deftypefn 6029 @end deftypefn
5865 6030
6031 @node Cond. Exec. Macros
6032 @subsection Macros to control conditional execution
6033 @findex conditional execution
6034 @findex predication
6035
6036 There is one macro that may need to be defined for targets
6037 supporting conditional execution, independent of how they
6038 represent conditional branches.
6039
6040 @defmac REVERSE_CONDEXEC_PREDICATES_P (@var{op1}, @var{op2})
6041 A C expression that returns true if the conditional execution predicate
6042 @var{op1}, a comparison operation, is the inverse of @var{op2} and vice
6043 versa. Define this to return 0 if the target has conditional execution
6044 predicates that cannot be reversed safely. There is no need to validate
6045 that the arguments of op1 and op2 are the same, this is done separately.
6046 If no expansion is specified, this macro is defined as follows:
6047
6048 @smallexample
6049 #define REVERSE_CONDEXEC_PREDICATES_P (x, y) \
6050 (GET_CODE ((x)) == reversed_comparison_code ((y), NULL))
6051 @end smallexample
6052 @end defmac
6053
5866 @node Costs 6054 @node Costs
5867 @section Describing Relative Costs of Operations 6055 @section Describing Relative Costs of Operations
5868 @cindex costs of instructions 6056 @cindex costs of instructions
5869 @cindex relative costs 6057 @cindex relative costs
5870 @cindex speed of instructions 6058 @cindex speed of instructions
5959 If the value of this macro is always zero, it need not be defined. If 6147 If the value of this macro is always zero, it need not be defined. If
5960 this macro is defined, it should produce a nonzero value when 6148 this macro is defined, it should produce a nonzero value when
5961 @code{STRICT_ALIGNMENT} is nonzero. 6149 @code{STRICT_ALIGNMENT} is nonzero.
5962 @end defmac 6150 @end defmac
5963 6151
5964 @defmac MOVE_RATIO 6152 @defmac MOVE_RATIO (@var{speed})
5965 The threshold of number of scalar memory-to-memory move insns, @emph{below} 6153 The threshold of number of scalar memory-to-memory move insns, @emph{below}
5966 which a sequence of insns should be generated instead of a 6154 which a sequence of insns should be generated instead of a
5967 string move insn or a library call. Increasing the value will always 6155 string move insn or a library call. Increasing the value will always
5968 make code faster, but eventually incurs high cost in increased code size. 6156 make code faster, but eventually incurs high cost in increased code size.
5969 6157
5970 Note that on machines where the corresponding move insn is a 6158 Note that on machines where the corresponding move insn is a
5971 @code{define_expand} that emits a sequence of insns, this macro counts 6159 @code{define_expand} that emits a sequence of insns, this macro counts
5972 the number of such sequences. 6160 the number of such sequences.
6161
6162 The parameter @var{speed} is true if the code is currently being
6163 optimized for speed rather than size.
5973 6164
5974 If you don't define this, a reasonable default is used. 6165 If you don't define this, a reasonable default is used.
5975 @end defmac 6166 @end defmac
5976 6167
5977 @defmac MOVE_BY_PIECES_P (@var{size}, @var{alignment}) 6168 @defmac MOVE_BY_PIECES_P (@var{size}, @var{alignment})
5984 @defmac MOVE_MAX_PIECES 6175 @defmac MOVE_MAX_PIECES
5985 A C expression used by @code{move_by_pieces} to determine the largest unit 6176 A C expression used by @code{move_by_pieces} to determine the largest unit
5986 a load or store used to copy memory is. Defaults to @code{MOVE_MAX}. 6177 a load or store used to copy memory is. Defaults to @code{MOVE_MAX}.
5987 @end defmac 6178 @end defmac
5988 6179
5989 @defmac CLEAR_RATIO 6180 @defmac CLEAR_RATIO (@var{speed})
5990 The threshold of number of scalar move insns, @emph{below} which a sequence 6181 The threshold of number of scalar move insns, @emph{below} which a sequence
5991 of insns should be generated to clear memory instead of a string clear insn 6182 of insns should be generated to clear memory instead of a string clear insn
5992 or a library call. Increasing the value will always make code faster, but 6183 or a library call. Increasing the value will always make code faster, but
5993 eventually incurs high cost in increased code size. 6184 eventually incurs high cost in increased code size.
6185
6186 The parameter @var{speed} is true if the code is currently being
6187 optimized for speed rather than size.
5994 6188
5995 If you don't define this, a reasonable default is used. 6189 If you don't define this, a reasonable default is used.
5996 @end defmac 6190 @end defmac
5997 6191
5998 @defmac CLEAR_BY_PIECES_P (@var{size}, @var{alignment}) 6192 @defmac CLEAR_BY_PIECES_P (@var{size}, @var{alignment})
6000 to clear a chunk of memory, or whether some other block clear mechanism 6194 to clear a chunk of memory, or whether some other block clear mechanism
6001 will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less 6195 will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less
6002 than @code{CLEAR_RATIO}. 6196 than @code{CLEAR_RATIO}.
6003 @end defmac 6197 @end defmac
6004 6198
6005 @defmac SET_RATIO 6199 @defmac SET_RATIO (@var{speed})
6006 The threshold of number of scalar move insns, @emph{below} which a sequence 6200 The threshold of number of scalar move insns, @emph{below} which a sequence
6007 of insns should be generated to set memory to a constant value, instead of 6201 of insns should be generated to set memory to a constant value, instead of
6008 a block set insn or a library call. 6202 a block set insn or a library call.
6009 Increasing the value will always make code faster, but 6203 Increasing the value will always make code faster, but
6010 eventually incurs high cost in increased code size. 6204 eventually incurs high cost in increased code size.
6205
6206 The parameter @var{speed} is true if the code is currently being
6207 optimized for speed rather than size.
6011 6208
6012 If you don't define this, it defaults to the value of @code{MOVE_RATIO}. 6209 If you don't define this, it defaults to the value of @code{MOVE_RATIO}.
6013 @end defmac 6210 @end defmac
6014 6211
6015 @defmac SET_BY_PIECES_P (@var{size}, @var{alignment}) 6212 @defmac SET_BY_PIECES_P (@var{size}, @var{alignment})
6021 than @code{SET_RATIO}. 6218 than @code{SET_RATIO}.
6022 @end defmac 6219 @end defmac
6023 6220
6024 @defmac STORE_BY_PIECES_P (@var{size}, @var{alignment}) 6221 @defmac STORE_BY_PIECES_P (@var{size}, @var{alignment})
6025 A C expression used to determine whether @code{store_by_pieces} will be 6222 A C expression used to determine whether @code{store_by_pieces} will be
6026 used to set a chunk of memory to a constant string value, or whether some 6223 used to set a chunk of memory to a constant string value, or whether some
6027 other mechanism will be used. Used by @code{__builtin_strcpy} when 6224 other mechanism will be used. Used by @code{__builtin_strcpy} when
6028 called with a constant source string. 6225 called with a constant source string.
6029 Defaults to 1 if @code{move_by_pieces_ninsns} returns less 6226 Defaults to 1 if @code{move_by_pieces_ninsns} returns less
6030 than @code{MOVE_RATIO}. 6227 than @code{MOVE_RATIO}.
6031 @end defmac 6228 @end defmac
6087 Define this macro if a non-short-circuit operation produced by 6284 Define this macro if a non-short-circuit operation produced by
6088 @samp{fold_range_test ()} is optimal. This macro defaults to true if 6285 @samp{fold_range_test ()} is optimal. This macro defaults to true if
6089 @code{BRANCH_COST} is greater than or equal to the value 2. 6286 @code{BRANCH_COST} is greater than or equal to the value 2.
6090 @end defmac 6287 @end defmac
6091 6288
6092 @deftypefn {Target Hook} bool TARGET_RTX_COSTS (rtx @var{x}, int @var{code}, int @var{outer_code}, int *@var{total}) 6289 @deftypefn {Target Hook} bool TARGET_RTX_COSTS (rtx @var{x}, int @var{code}, int @var{outer_code}, int *@var{total}, bool @var{speed})
6093 This target hook describes the relative costs of RTL expressions. 6290 This target hook describes the relative costs of RTL expressions.
6094 6291
6095 The cost may depend on the precise form of the expression, which is 6292 The cost may depend on the precise form of the expression, which is
6096 available for examination in @var{x}, and the rtx code of the expression 6293 available for examination in @var{x}, and the rtx code of the expression
6097 in which it is contained, found in @var{outer_code}. @var{code} is the 6294 in which it is contained, found in @var{outer_code}. @var{code} is the
6106 for the cost of the expression. The hook should modify this value as 6303 for the cost of the expression. The hook should modify this value as
6107 necessary. Traditionally, the default costs are @code{COSTS_N_INSNS (5)} 6304 necessary. Traditionally, the default costs are @code{COSTS_N_INSNS (5)}
6108 for multiplications, @code{COSTS_N_INSNS (7)} for division and modulus 6305 for multiplications, @code{COSTS_N_INSNS (7)} for division and modulus
6109 operations, and @code{COSTS_N_INSNS (1)} for all other operations. 6306 operations, and @code{COSTS_N_INSNS (1)} for all other operations.
6110 6307
6111 When optimizing for code size, i.e.@: when @code{optimize_size} is 6308 When optimizing for code size, i.e.@: when @code{speed} is
6112 nonzero, this target hook should be used to estimate the relative 6309 false, this target hook should be used to estimate the relative
6113 size cost of an expression, again relative to @code{COSTS_N_INSNS}. 6310 size cost of an expression, again relative to @code{COSTS_N_INSNS}.
6114 6311
6115 The hook returns true when all subexpressions of @var{x} have been 6312 The hook returns true when all subexpressions of @var{x} have been
6116 processed, and false when @code{rtx_cost} should recurse. 6313 processed, and false when @code{rtx_cost} should recurse.
6117 @end deftypefn 6314 @end deftypefn
6118 6315
6119 @deftypefn {Target Hook} int TARGET_ADDRESS_COST (rtx @var{address}) 6316 @deftypefn {Target Hook} int TARGET_ADDRESS_COST (rtx @var{address}, bool @var{speed})
6120 This hook computes the cost of an addressing mode that contains 6317 This hook computes the cost of an addressing mode that contains
6121 @var{address}. If not defined, the cost is computed from 6318 @var{address}. If not defined, the cost is computed from
6122 the @var{address} expression and the @code{TARGET_RTX_COST} hook. 6319 the @var{address} expression and the @code{TARGET_RTX_COST} hook.
6123 6320
6124 For most CISC machines, the default cost is a good approximation of the 6321 For most CISC machines, the default cost is a good approximation of the
6216 debug output to. @var{verbose} is the verbose level provided by 6413 debug output to. @var{verbose} is the verbose level provided by
6217 @option{-fsched-verbose-@var{n}}. @var{ready} is a pointer to the ready 6414 @option{-fsched-verbose-@var{n}}. @var{ready} is a pointer to the ready
6218 list of instructions that are ready to be scheduled. @var{n_readyp} is 6415 list of instructions that are ready to be scheduled. @var{n_readyp} is
6219 a pointer to the number of elements in the ready list. The scheduler 6416 a pointer to the number of elements in the ready list. The scheduler
6220 reads the ready list in reverse order, starting with 6417 reads the ready list in reverse order, starting with
6221 @var{ready}[@var{*n_readyp}-1] and going to @var{ready}[0]. @var{clock} 6418 @var{ready}[@var{*n_readyp} @minus{} 1] and going to @var{ready}[0]. @var{clock}
6222 is the timer tick of the scheduler. You may modify the ready list and 6419 is the timer tick of the scheduler. You may modify the ready list and
6223 the number of ready insns. The return value is the number of insns that 6420 the number of ready insns. The return value is the number of insns that
6224 can issue this cycle; normally this is just @code{issue_rate}. See also 6421 can issue this cycle; normally this is just @code{issue_rate}. See also
6225 @samp{TARGET_SCHED_REORDER2}. 6422 @samp{TARGET_SCHED_REORDER2}.
6226 @end deftypefn 6423 @end deftypefn
6447 This hook is called by the insn scheduler when @var{insn} has only 6644 This hook is called by the insn scheduler when @var{insn} has only
6448 speculative dependencies and therefore can be scheduled speculatively. 6645 speculative dependencies and therefore can be scheduled speculatively.
6449 The hook is used to check if the pattern of @var{insn} has a speculative 6646 The hook is used to check if the pattern of @var{insn} has a speculative
6450 version and, in case of successful check, to generate that speculative 6647 version and, in case of successful check, to generate that speculative
6451 pattern. The hook should return 1, if the instruction has a speculative form, 6648 pattern. The hook should return 1, if the instruction has a speculative form,
6452 or -1, if it doesn't. @var{request} describes the type of requested 6649 or @minus{}1, if it doesn't. @var{request} describes the type of requested
6453 speculation. If the return value equals 1 then @var{new_pat} is assigned 6650 speculation. If the return value equals 1 then @var{new_pat} is assigned
6454 the generated speculative pattern. 6651 the generated speculative pattern.
6455 @end deftypefn 6652 @end deftypefn
6456 6653
6457 @deftypefn {Target Hook} int TARGET_SCHED_NEEDS_BLOCK_P (rtx @var{insn}) 6654 @deftypefn {Target Hook} int TARGET_SCHED_NEEDS_BLOCK_P (rtx @var{insn})
6800 @deftypefn {Target Hook} bool TARGET_IN_SMALL_DATA_P (tree @var{exp}) 6997 @deftypefn {Target Hook} bool TARGET_IN_SMALL_DATA_P (tree @var{exp})
6801 Returns true if @var{exp} should be placed into a ``small data'' section. 6998 Returns true if @var{exp} should be placed into a ``small data'' section.
6802 The default version of this hook always returns false. 6999 The default version of this hook always returns false.
6803 @end deftypefn 7000 @end deftypefn
6804 7001
6805 @deftypevar {Target Hook} bool TARGET_HAVE_SRODATA_SECTION 7002 @deftypevr {Target Hook} bool TARGET_HAVE_SRODATA_SECTION
6806 Contains the value true if the target places read-only 7003 Contains the value true if the target places read-only
6807 ``small data'' into a separate section. The default value is false. 7004 ``small data'' into a separate section. The default value is false.
6808 @end deftypevar 7005 @end deftypevr
6809 7006
6810 @deftypefn {Target Hook} bool TARGET_BINDS_LOCAL_P (tree @var{exp}) 7007 @deftypefn {Target Hook} bool TARGET_BINDS_LOCAL_P (tree @var{exp})
6811 Returns true if @var{exp} names an object for which name resolution 7008 Returns true if @var{exp} names an object for which name resolution
6812 rules must resolve to the current ``module'' (dynamic shared library 7009 rules must resolve to the current ``module'' (dynamic shared library
6813 or executable image). 7010 or executable image).
6815 The default version of this hook implements the name resolution rules 7012 The default version of this hook implements the name resolution rules
6816 for ELF, which has a looser model of global name binding than other 7013 for ELF, which has a looser model of global name binding than other
6817 currently supported object file formats. 7014 currently supported object file formats.
6818 @end deftypefn 7015 @end deftypefn
6819 7016
6820 @deftypevar {Target Hook} bool TARGET_HAVE_TLS 7017 @deftypevr {Target Hook} bool TARGET_HAVE_TLS
6821 Contains the value true if the target supports thread-local storage. 7018 Contains the value true if the target supports thread-local storage.
6822 The default value is false. 7019 The default value is false.
6823 @end deftypevar 7020 @end deftypevr
6824 7021
6825 7022
6826 @node PIC 7023 @node PIC
6827 @section Position Independent Code 7024 @section Position Independent Code
6828 @cindex position independent code 7025 @cindex position independent code
6829 @cindex PIC 7026 @cindex PIC
6830 7027
6831 This section describes macros that help implement generation of position 7028 This section describes macros that help implement generation of position
6832 independent code. Simply defining these macros is not enough to 7029 independent code. Simply defining these macros is not enough to
6833 generate valid PIC; you must also add support to the macros 7030 generate valid PIC; you must also add support to the hook
6834 @code{GO_IF_LEGITIMATE_ADDRESS} and @code{PRINT_OPERAND_ADDRESS}, as 7031 @code{TARGET_LEGITIMATE_ADDRESS_P} and to the macro
6835 well as @code{LEGITIMIZE_ADDRESS}. You must modify the definition of 7032 @code{PRINT_OPERAND_ADDRESS}, as well as @code{LEGITIMIZE_ADDRESS}. You
6836 @samp{movsi} to do something appropriate when the source operand 7033 must modify the definition of @samp{movsi} to do something appropriate
6837 contains a symbolic address. You may also need to alter the handling of 7034 when the source operand contains a symbolic address. You may also
6838 switch statements so that they use relative addresses. 7035 need to alter the handling of switch statements so that they use
6839 @c i rearranged the order of the macros above to try to force one of 7036 relative addresses.
7037 @c i rearranged the order of the macros above to try to force one of
6840 @c them to the next line, to eliminate an overfull hbox. --mew 10feb93 7038 @c them to the next line, to eliminate an overfull hbox. --mew 10feb93
6841 7039
6842 @defmac PIC_OFFSET_TABLE_REGNUM 7040 @defmac PIC_OFFSET_TABLE_REGNUM
6843 The register number of the register used to address a table of static 7041 The register number of the register used to address a table of static
6844 data addresses in memory. In some cases this register is defined by a 7042 data addresses in memory. In some cases this register is defined by a
7248 7446
7249 @defmac ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded}) 7447 @defmac ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
7250 A C statement (sans semicolon) to output to the stdio stream 7448 A C statement (sans semicolon) to output to the stdio stream
7251 @var{stream} the assembler definition of a common-label named 7449 @var{stream} the assembler definition of a common-label named
7252 @var{name} whose size is @var{size} bytes. The variable @var{rounded} 7450 @var{name} whose size is @var{size} bytes. The variable @var{rounded}
7253 is the size rounded up to whatever alignment the caller wants. 7451 is the size rounded up to whatever alignment the caller wants. It is
7452 possible that @var{size} may be zero, for instance if a struct with no
7453 other member than a zero-length array is defined. In this case, the
7454 backend must output a symbol definition that allocates at least one
7455 byte, both so that the address of the resulting object does not compare
7456 equal to any other, and because some object formats cannot even express
7457 the concept of a zero-sized common symbol, as that is how they represent
7458 an ordinary undefined external.
7254 7459
7255 Use the expression @code{assemble_name (@var{stream}, @var{name})} to 7460 Use the expression @code{assemble_name (@var{stream}, @var{name})} to
7256 output the name itself; before and after that, output the additional 7461 output the name itself; before and after that, output the additional
7257 assembler syntax for defining the name, and a newline. 7462 assembler syntax for defining the name, and a newline.
7258 7463
8154 writing conditional output routines in those patterns. 8359 writing conditional output routines in those patterns.
8155 8360
8156 If this macro is not defined, it is equivalent to a null statement. 8361 If this macro is not defined, it is equivalent to a null statement.
8157 @end defmac 8362 @end defmac
8158 8363
8364 @deftypefn {Target Hook} void TARGET_ASM_FINAL_POSTSCAN_INSN (FILE *@var{FILE}, rtx @var{insn}, rtx *@var{opvec}, int @var{noperands})
8365 If defined, this target hook is a function which is executed just after the
8366 output of assembler code for @var{insn}, to change the mode of the assembler
8367 if necessary.
8368
8369 Here the argument @var{opvec} is the vector containing the operands
8370 extracted from @var{insn}, and @var{noperands} is the number of
8371 elements of the vector which contain meaningful data for this insn.
8372 The contents of this vector are what was used to convert the insn
8373 template into assembler code, so you can change the assembler mode
8374 by checking the contents of the vector.
8375 @end deftypefn
8376
8159 @defmac PRINT_OPERAND (@var{stream}, @var{x}, @var{code}) 8377 @defmac PRINT_OPERAND (@var{stream}, @var{x}, @var{code})
8160 A C compound statement to output to stdio stream @var{stream} the 8378 A C compound statement to output to stdio stream @var{stream} the
8161 assembler syntax for an instruction operand @var{x}. @var{x} is an 8379 assembler syntax for an instruction operand @var{x}. @var{x} is an
8162 RTL expression. 8380 RTL expression.
8163 8381
8446 @defmac TARGET_UNWIND_INFO 8664 @defmac TARGET_UNWIND_INFO
8447 Define this macro if your target has ABI specified unwind tables. Usually 8665 Define this macro if your target has ABI specified unwind tables. Usually
8448 these will be output by @code{TARGET_UNWIND_EMIT}. 8666 these will be output by @code{TARGET_UNWIND_EMIT}.
8449 @end defmac 8667 @end defmac
8450 8668
8451 @deftypevar {Target Hook} bool TARGET_UNWIND_TABLES_DEFAULT 8669 @deftypevr {Target Hook} bool TARGET_UNWIND_TABLES_DEFAULT
8452 This variable should be set to @code{true} if the target ABI requires unwinding 8670 This variable should be set to @code{true} if the target ABI requires unwinding
8453 tables even when exceptions are not used. 8671 tables even when exceptions are not used.
8454 @end deftypevar 8672 @end deftypevr
8455 8673
8456 @defmac MUST_USE_SJLJ_EXCEPTIONS 8674 @defmac MUST_USE_SJLJ_EXCEPTIONS
8457 This macro need only be defined if @code{DWARF2_UNWIND_INFO} is 8675 This macro need only be defined if @code{DWARF2_UNWIND_INFO} is
8458 runtime-variable. In that case, @file{except.h} cannot correctly 8676 runtime-variable. In that case, @file{except.h} cannot correctly
8459 determine the corresponding definition of @code{MUST_USE_SJLJ_EXCEPTIONS}, 8677 determine the corresponding definition of @code{MUST_USE_SJLJ_EXCEPTIONS},
8473 alignment if @code{STACK_GROWS_DOWNWARD} is defined, and the positive 8691 alignment if @code{STACK_GROWS_DOWNWARD} is defined, and the positive
8474 minimum alignment otherwise. @xref{SDB and DWARF}. Only applicable if 8692 minimum alignment otherwise. @xref{SDB and DWARF}. Only applicable if
8475 the target supports DWARF 2 frame unwind information. 8693 the target supports DWARF 2 frame unwind information.
8476 @end defmac 8694 @end defmac
8477 8695
8478 @deftypevar {Target Hook} bool TARGET_TERMINATE_DW2_EH_FRAME_INFO 8696 @deftypevr {Target Hook} bool TARGET_TERMINATE_DW2_EH_FRAME_INFO
8479 Contains the value true if the target should add a zero word onto the 8697 Contains the value true if the target should add a zero word onto the
8480 end of a Dwarf-2 frame info section when used for exception handling. 8698 end of a Dwarf-2 frame info section when used for exception handling.
8481 Default value is false if @code{EH_FRAME_SECTION_NAME} is defined, and 8699 Default value is false if @code{EH_FRAME_SECTION_NAME} is defined, and
8482 true otherwise. 8700 true otherwise.
8483 @end deftypevar 8701 @end deftypevr
8484 8702
8485 @deftypefn {Target Hook} rtx TARGET_DWARF_REGISTER_SPAN (rtx @var{reg}) 8703 @deftypefn {Target Hook} rtx TARGET_DWARF_REGISTER_SPAN (rtx @var{reg})
8486 Given a register, this hook should return a parallel of registers to 8704 Given a register, this hook should return a parallel of registers to
8487 represent where to find the register pieces. Define this hook if the 8705 represent where to find the register pieces. Define this hook if the
8488 register and its mode are represented in Dwarf in non-contiguous 8706 register and its mode are represented in Dwarf in non-contiguous
8918 @end defmac 9136 @end defmac
8919 9137
8920 @defmac DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END 9138 @defmac DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
8921 Define this macro @emph{instead of} defining 9139 Define this macro @emph{instead of} defining
8922 @code{DBX_OUTPUT_MAIN_SOURCE_FILE_END}, if what needs to be output at 9140 @code{DBX_OUTPUT_MAIN_SOURCE_FILE_END}, if what needs to be output at
8923 the end of compilation is a @code{N_SO} stab with an empty string, 9141 the end of compilation is an @code{N_SO} stab with an empty string,
8924 whose value is the highest absolute text address in the file. 9142 whose value is the highest absolute text address in the file.
8925 @end defmac 9143 @end defmac
8926 9144
8927 @need 2000 9145 @need 2000
8928 @node SDB and DWARF 9146 @node SDB and DWARF
8978 @end defmac 9196 @end defmac
8979 9197
8980 @defmac ASM_OUTPUT_DWARF_PCREL (@var{stream}, @var{size}, @var{label}) 9198 @defmac ASM_OUTPUT_DWARF_PCREL (@var{stream}, @var{size}, @var{label})
8981 A C statement to issue assembly directives that create a self-relative 9199 A C statement to issue assembly directives that create a self-relative
8982 reference to the given @var{label}, using an integer of the given @var{size}. 9200 reference to the given @var{label}, using an integer of the given @var{size}.
9201 @end defmac
9202
9203 @defmac ASM_OUTPUT_DWARF_TABLE_REF (@var{label})
9204 A C statement to issue assembly directives that create a reference to
9205 the DWARF table identifier @var{label} from the current section. This
9206 is used on some systems to avoid garbage collecting a DWARF table which
9207 is referenced by a function.
8983 @end defmac 9208 @end defmac
8984 9209
8985 @deftypefn {Target Hook} void TARGET_ASM_OUTPUT_DWARF_DTPREL (FILE *@var{FILE}, int @var{size}, rtx @var{x}) 9210 @deftypefn {Target Hook} void TARGET_ASM_OUTPUT_DWARF_DTPREL (FILE *@var{FILE}, int @var{size}, rtx @var{x})
8986 If defined, this target hook is a function which outputs a DTP-relative 9211 If defined, this target hook is a function which outputs a DTP-relative
8987 reference to the given TLS symbol of the specified size. 9212 reference to the given TLS symbol of the specified size.
9320 the list and @code{*@var{attr_ptr}} modified to point to the new 9545 the list and @code{*@var{attr_ptr}} modified to point to the new
9321 attributes, or a copy of the list may be made if further changes are 9546 attributes, or a copy of the list may be made if further changes are
9322 needed. 9547 needed.
9323 @end deftypefn 9548 @end deftypefn
9324 9549
9325 @deftypefn {Target Hook} bool TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P (tree @var{fndecl}) 9550 @deftypefn {Target Hook} bool TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P (const_tree @var{fndecl})
9326 @cindex inlining 9551 @cindex inlining
9327 This target hook returns @code{true} if it is ok to inline @var{fndecl} 9552 This target hook returns @code{true} if it is ok to inline @var{fndecl}
9328 into the current function, despite its having target-specific 9553 into the current function, despite its having target-specific
9329 attributes, @code{false} otherwise. By default, if a function has a 9554 attributes, @code{false} otherwise. By default, if a function has a
9330 target specific attribute attached to it, it will not be inlined. 9555 target specific attribute attached to it, it will not be inlined.
9620 @var{type} is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that has just been 9845 @var{type} is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that has just been
9621 defined. Use this hook to make adjustments to the class (eg, tweak 9846 defined. Use this hook to make adjustments to the class (eg, tweak
9622 visibility or perform any other required target modifications). 9847 visibility or perform any other required target modifications).
9623 @end deftypefn 9848 @end deftypefn
9624 9849
9850 @node Named Address Spaces
9851 @section Adding support for named address spaces
9852 @cindex named address spaces
9853
9854 The draft technical report of the ISO/IEC JTC1 S22 WG14 N1275
9855 standards committee, @cite{Programming Languages - C - Extensions to
9856 support embedded processors}, specifies a syntax for embedded
9857 processors to specify alternate address spaces. You can configure a
9858 GCC port to support section 5.1 of the draft report to add support for
9859 address spaces other than the default address space. These address
9860 spaces are new keywords that are similar to the @code{volatile} and
9861 @code{const} type attributes.
9862
9863 Pointers to named address spaces can a a different size than
9864 pointers to the generic address space.
9865
9866 For example, the SPU port uses the @code{__ea} address space to refer
9867 to memory in the host processor, rather than memory local to the SPU
9868 processor. Access to memory in the @code{__ea} address space involves
9869 issuing DMA operations to move data between the host processor and the
9870 local processor memory address space. Pointers in the @code{__ea}
9871 address space are either 32 bits or 64 bits based on the
9872 @option{-mea32} or @option{-mea64} switches (native SPU pointers are
9873 always 32 bits).
9874
9875 Internally, address spaces are represented as a small integer in the
9876 range 0 to 15 with address space 0 being reserved for the generic
9877 address space.
9878
9879 @defmac TARGET_ADDR_SPACE_KEYWORDS
9880 A list of @code{ADDR_SPACE_KEYWORD} macros to define each named
9881 address keyword. The @code{ADDR_SPACE_KEYWORD} macro takes two
9882 arguments, the keyword string and the number of the named address
9883 space. For example, the SPU port uses the following to declare
9884 @code{__ea} as the keyword for named address space #1:
9885 @smallexample
9886 #define ADDR_SPACE_EA 1
9887 #define TARGET_ADDR_SPACE_KEYWORDS ADDR_SPACE_KEYWORD ("__ea", ADDR_SPACE_EA)
9888 @end smallexample
9889 @end defmac
9890
9891 @deftypefn {Target Hook} {enum machine_mode} TARGET_ADDR_SPACE_POINTER_MODE (addr_space_t @var{address_space})
9892 Define this to return the machine mode to use for pointers to
9893 @var{address_space} if the target supports named address spaces.
9894 The default version of this hook returns @code{ptr_mode} for the
9895 generic address space only.
9896 @end deftypefn
9897
9898 @deftypefn {Target Hook} {enum machine_mode} TARGET_ADDR_SPACE_ADDRESS_MODE (addr_space_t @var{address_space})
9899 Define this to return the machine mode to use for addresses in
9900 @var{address_space} if the target supports named address spaces.
9901 The default version of this hook returns @code{Pmode} for the
9902 generic address space only.
9903 @end deftypefn
9904
9905 @deftypefn {Target Hook} bool TARGET_ADDR_SPACE_VALID_POINTER_MODE (enum machine_mode @var{mode}, addr_space_t @var{as})
9906 Define this to return nonzero if the port can handle pointers
9907 with machine mode @var{mode} to address space @var{as}. This target
9908 hook is the same as the @code{TARGET_VALID_POINTER_MODE} target hook,
9909 except that it includes explicit named address space support. The default
9910 version of this hook returns true for the modes returned by either the
9911 @code{TARGET_ADDR_SPACE_POINTER_MODE} or @code{TARGET_ADDR_SPACE_ADDRESS_MODE}
9912 target hooks for the given address space.
9913 @end deftypefn
9914
9915 @deftypefn {Target Hook} {bool} TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P (enum machine_mode @var{mode}, rtx @var{exp}, bool @var{strict}, addr_space_t @var{as})
9916 Define this to return true if @var{exp} is a valid address for mode
9917 @var{mode} in the named address space @var{as}. The @var{strict}
9918 parameter says whether strict addressing is in effect after reload has
9919 finished. This target hook is the same as the
9920 @code{TARGET_LEGITIMATE_ADDRESS_P} target hook, except that it includes
9921 explicit named address space support.
9922 @end deftypefn
9923
9924 @deftypefn {Target Hook} {rtx} TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS (rtx @var{x}, rtx @var{oldx}, enum machine_mode @var{mode}, addr_space_t @var{as})
9925 Define this to modify an invalid address @var{x} to be a valid address
9926 with mode @var{mode} in the named address space @var{as}. This target
9927 hook is the same as the @code{TARGET_LEGITIMIZE_ADDRESS} target hook,
9928 except that it includes explicit named address space support.
9929 @end deftypefn
9930
9931 @deftypefn {Target Hook} {bool} TARGET_ADDR_SPACE_SUBSET_P (addr_space_t @var{superset}, addr_space_t @var{subset})
9932 Define this to return whether the @var{subset} named address space is
9933 contained within the @var{superset} named address space. Pointers to
9934 a named address space that is a subset of another named address space
9935 will be converted automatically without a cast if used together in
9936 arithmetic operations. Pointers to a superset address space can be
9937 converted to pointers to a subset address space via explicit casts.
9938 @end deftypefn
9939
9940 @deftypefn {Target Hook} {rtx} TARGET_ADDR_SPACE_CONVERT (rtx @var{op}, tree @var{from_type}, tree @var{to_type})
9941 Define this to convert the pointer expression represented by the RTL
9942 @var{op} with type @var{from_type} that points to a named address
9943 space to a new pointer expression with type @var{to_type} that points
9944 to a different named address space. When this hook it called, it is
9945 guaranteed that one of the two address spaces is a subset of the other,
9946 as determined by the @code{TARGET_ADDR_SPACE_SUBSET_P} target hook.
9947 @end deftypefn
9948
9625 @node Misc 9949 @node Misc
9626 @section Miscellaneous Parameters 9950 @section Miscellaneous Parameters
9627 @cindex parameters, miscellaneous 9951 @cindex parameters, miscellaneous
9628 9952
9629 @c prevent bad page break with this line 9953 @c prevent bad page break with this line
9668 jump-tables never contain relative addresses, or jump-tables should 9992 jump-tables never contain relative addresses, or jump-tables should
9669 contain relative addresses only when @option{-fPIC} or @option{-fPIC} 9993 contain relative addresses only when @option{-fPIC} or @option{-fPIC}
9670 is in effect. 9994 is in effect.
9671 @end defmac 9995 @end defmac
9672 9996
9673 @defmac CASE_VALUES_THRESHOLD 9997 @deftypefn {Target Hook} unsigned int TARGET_CASE_VALUES_THRESHOLD (void)
9674 Define this to be the smallest number of different values for which it 9998 This function return the smallest number of different values for which it
9675 is best to use a jump-table instead of a tree of conditional branches. 9999 is best to use a jump-table instead of a tree of conditional branches.
9676 The default is four for machines with a @code{casesi} instruction and 10000 The default is four for machines with a @code{casesi} instruction and
9677 five otherwise. This is best for most machines. 10001 five otherwise. This is best for most machines.
9678 @end defmac 10002 @end deftypefn
9679 10003
9680 @defmac CASE_USE_BIT_TESTS 10004 @defmac CASE_USE_BIT_TESTS
9681 Define this macro to be a C expression to indicate whether C switch 10005 Define this macro to be a C expression to indicate whether C switch
9682 statements may be implemented by a sequence of bit tests. This is 10006 statements may be implemented by a sequence of bit tests. This is
9683 advantageous on processors that can efficiently implement left shift 10007 advantageous on processors that can efficiently implement left shift
10327 @code{lang_hooks.builtin_function} 10651 @code{lang_hooks.builtin_function}
10328 which is defined by the language front end. You can use any type nodes set 10652 which is defined by the language front end. You can use any type nodes set
10329 up by @code{build_common_tree_nodes} and @code{build_common_tree_nodes_2}; 10653 up by @code{build_common_tree_nodes} and @code{build_common_tree_nodes_2};
10330 only language front ends that use those two functions will call 10654 only language front ends that use those two functions will call
10331 @samp{TARGET_INIT_BUILTINS}. 10655 @samp{TARGET_INIT_BUILTINS}.
10656 @end deftypefn
10657
10658 @deftypefn {Target Hook} tree TARGET_BUILTIN_FUNCTION (unsigned @var{code}, bool @var{initialize_p})
10659 Define this hook if you have any machine-specific built-in functions
10660 that need to be defined. It should be a function that returns the
10661 builtin function declaration for the builtin function code @var{code}.
10662 If there is no such builtin and it cannot be initialized at this time
10663 if @var{initialize_p} is true the function should return @code{NULL_TREE}.
10664 If @var{code} is out of range the function should return
10665 @code{error_mark_node}.
10332 @end deftypefn 10666 @end deftypefn
10333 10667
10334 @deftypefn {Target Hook} rtx TARGET_EXPAND_BUILTIN (tree @var{exp}, rtx @var{target}, rtx @var{subtarget}, enum machine_mode @var{mode}, int @var{ignore}) 10668 @deftypefn {Target Hook} rtx TARGET_EXPAND_BUILTIN (tree @var{exp}, rtx @var{target}, rtx @var{subtarget}, enum machine_mode @var{mode}, int @var{ignore})
10335 10669
10336 Expand a call to a machine specific built-in function that was set up by 10670 Expand a call to a machine specific built-in function that was set up by
10515 true when @var{after_prologue_epilogue_gen} is false, you still are likely 10849 true when @var{after_prologue_epilogue_gen} is false, you still are likely
10516 to have to make special provisions in @code{INITIAL_ELIMINATION_OFFSET} 10850 to have to make special provisions in @code{INITIAL_ELIMINATION_OFFSET}
10517 to reserve space for caller-saved target registers. 10851 to reserve space for caller-saved target registers.
10518 @end deftypefn 10852 @end deftypefn
10519 10853
10854 @deftypefn {Target Hook} bool TARGET_HAVE_CONDITIONAL_EXECUTION (void)
10855 This target hook returns true if the target supports conditional execution.
10856 This target hook is required only when the target has several different
10857 modes and they have different conditional execution capability, such as ARM.
10858 @end deftypefn
10859
10520 @defmac POWI_MAX_MULTS 10860 @defmac POWI_MAX_MULTS
10521 If defined, this macro is interpreted as a signed integer C expression 10861 If defined, this macro is interpreted as a signed integer C expression
10522 that specifies the maximum number of floating point multiplications 10862 that specifies the maximum number of floating point multiplications
10523 that should be emitted when expanding exponentiation by an integer 10863 that should be emitted when expanding exponentiation by an integer
10524 constant inline. When this value is defined, exponentiation requiring 10864 constant inline. When this value is defined, exponentiation requiring
10618 @deftypefn {Target Hook} {const char *} TARGET_INVALID_BINARY_OP (int @var{op}, tree @var{type1}, tree @var{type2}) 10958 @deftypefn {Target Hook} {const char *} TARGET_INVALID_BINARY_OP (int @var{op}, tree @var{type1}, tree @var{type2})
10619 If defined, this macro returns the diagnostic message when it is 10959 If defined, this macro returns the diagnostic message when it is
10620 invalid to apply operation @var{op} to operands of types @var{type1} 10960 invalid to apply operation @var{op} to operands of types @var{type1}
10621 and @var{type2}, or @code{NULL} if validity should be determined by 10961 and @var{type2}, or @code{NULL} if validity should be determined by
10622 the front end. 10962 the front end.
10963 @end deftypefn
10964
10965 @deftypefn {Target Hook} {const char *} TARGET_INVALID_PARAMETER_TYPE (tree @var{type})
10966 If defined, this macro returns the diagnostic message when it is
10967 invalid for functions to include parameters of type @var{type},
10968 or @code{NULL} if validity should be determined by
10969 the front end. This is currently used only by the C and C++ front ends.
10970 @end deftypefn
10971
10972 @deftypefn {Target Hook} {const char *} TARGET_INVALID_RETURN_TYPE (tree @var{type})
10973 If defined, this macro returns the diagnostic message when it is
10974 invalid for functions to have return type @var{type},
10975 or @code{NULL} if validity should be determined by
10976 the front end. This is currently used only by the C and C++ front ends.
10977 @end deftypefn
10978
10979 @deftypefn {Target Hook} {tree} TARGET_PROMOTED_TYPE (tree @var{type})
10980 If defined, this target hook returns the type to which values of
10981 @var{type} should be promoted when they appear in expressions,
10982 analogous to the integer promotions, or @code{NULL_TREE} to use the
10983 front end's normal promotion rules. This hook is useful when there are
10984 target-specific types with special promotion rules.
10985 This is currently used only by the C and C++ front ends.
10986 @end deftypefn
10987
10988 @deftypefn {Target Hook} {tree} TARGET_CONVERT_TO_TYPE (tree @var{type}, tree @var{expr})
10989 If defined, this hook returns the result of converting @var{expr} to
10990 @var{type}. It should return the converted expression,
10991 or @code{NULL_TREE} to apply the front end's normal conversion rules.
10992 This hook is useful when there are target-specific types with special
10993 conversion rules.
10994 This is currently used only by the C and C++ front ends.
10623 @end deftypefn 10995 @end deftypefn
10624 10996
10625 @defmac TARGET_USE_JCR_SECTION 10997 @defmac TARGET_USE_JCR_SECTION
10626 This macro determines whether to use the JCR section to register Java 10998 This macro determines whether to use the JCR section to register Java
10627 classes. By default, TARGET_USE_JCR_SECTION is defined to 1 if both 10999 classes. By default, TARGET_USE_JCR_SECTION is defined to 1 if both
10659 @code{__attribute__((naked))}, there is no stack frame, and the compiler 11031 @code{__attribute__((naked))}, there is no stack frame, and the compiler
10660 cannot safely move arguments from the registers in which they are passed 11032 cannot safely move arguments from the registers in which they are passed
10661 to the stack. Therefore, this hook should return true in general, but 11033 to the stack. Therefore, this hook should return true in general, but
10662 false for naked functions. The default implementation always returns true. 11034 false for naked functions. The default implementation always returns true.
10663 @end deftypefn 11035 @end deftypefn
11036
11037 @deftypevr {Target Hook} {unsigned HOST_WIDE_INT} TARGET_CONST_ANCHOR
11038 On some architectures it can take multiple instructions to synthesize
11039 a constant. If there is another constant already in a register that
11040 is close enough in value then it is preferable that the new constant
11041 is computed from this register using immediate addition or
11042 subtraction. We accomplish this through CSE. Besides the value of
11043 the constant we also add a lower and an upper constant anchor to the
11044 available expressions. These are then queried when encountering new
11045 constants. The anchors are computed by rounding the constant up and
11046 down to a multiple of the value of @code{TARGET_CONST_ANCHOR}.
11047 @code{TARGET_CONST_ANCHOR} should be the maximum positive value
11048 accepted by immediate-add plus one. We currently assume that the
11049 value of @code{TARGET_CONST_ANCHOR} is a power of 2. For example, on
11050 MIPS, where add-immediate takes a 16-bit signed value,
11051 @code{TARGET_CONST_ANCHOR} is set to @samp{0x8000}. The default value
11052 is zero, which disables this optimization. @end deftypevr