OSDN Git Service

* target.h (invalid_conversion, invalid_unary_op,
[pf3gnuchains/gcc-fork.git] / gcc / doc / tm.texi
index a82d353..dca9ad6 100644 (file)
@@ -728,11 +728,11 @@ any target-specific headers.
 @deftypevar {Target Hook} int TARGET_DEFAULT_TARGET_FLAGS
 This variable specifies the initial value of @code{target_flags}.
 Its default setting is 0.
-
-If the target defines @code{TARGET_SWITCHES}, the null
-@code{TARGET_SWITCHES} entry will override this value.
 @end deftypevar
 
+@cindex optional hardware or system features
+@cindex features, optional, in system conventions
+
 @deftypefn {Target Hook} bool TARGET_HANDLE_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value})
 This hook is called whenever the user specifies one of the
 target-specific options described by the @file{.opt} definition files
@@ -750,153 +750,6 @@ argument.  Otherwise @var{value} is 1 if the positive form of the
 option was used and 0 if the ``no-'' form was.
 @end deftypefn
 
-@cindex optional hardware or system features
-@cindex features, optional, in system conventions
-
-@defmac TARGET_@var{featurename}
-This series of macros is to allow compiler command arguments to
-enable or disable the use of optional features of the target machine.
-For example, one machine description serves both the 68000 and
-the 68020; a command argument tells the compiler whether it should
-use 68020-only instructions or not.  This command argument works
-by means of a macro @code{TARGET_68020} that tests a bit in
-@code{target_flags}.
-
-Define a macro @code{TARGET_@var{featurename}} for each such option.
-Its definition should test a bit in @code{target_flags}.  It is
-recommended that a helper macro @code{MASK_@var{featurename}}
-is defined for each bit-value to test, and used in
-@code{TARGET_@var{featurename}} and @code{TARGET_SWITCHES}.  For
-example:
-
-@smallexample
-#define TARGET_MASK_68020 1
-#define TARGET_68020 (target_flags & MASK_68020)
-@end smallexample
-
-One place where these macros are used is in the condition-expressions
-of instruction patterns.  Note how @code{TARGET_68020} appears
-frequently in the 68000 machine description file, @file{m68k.md}.
-Another place they are used is in the definitions of the other
-macros in the @file{@var{machine}.h} file.
-@end defmac
-
-@defmac TARGET_SWITCHES
-This macro defines names of command options to set and clear
-bits in @code{target_flags}.  Its definition is an initializer
-with a subgrouping for each command option.
-
-Each subgrouping contains a string constant, that defines the option
-name, a number, which contains the bits to set in
-@code{target_flags}, and a second string which is the description
-displayed by @option{--help}.  If the number is negative then the bits specified
-by the number are cleared instead of being set.  If the description
-string is present but empty, then no help information will be displayed
-for that option, but it will not count as an undocumented option.  The
-actual option name is made by appending @samp{-m} to the specified name.
-Non-empty description strings should be marked with @code{N_(@dots{})} for
-@command{xgettext}.  Please do not mark empty strings because the empty
-string is reserved by GNU gettext.  @code{gettext("")} returns the header entry
-of the message catalog with meta information, not the empty string.
-
-In addition to the description for @option{--help},
-more detailed documentation for each option should be added to
-@file{invoke.texi}.
-
-One of the subgroupings should have a null string.  The number in
-this grouping is the default value for @code{target_flags}.  Any
-target options act starting with that value.
-
-Here is an example which defines @option{-m68000} and @option{-m68020}
-with opposite meanings, and picks the latter as the default:
-
-@smallexample
-#define TARGET_SWITCHES \
-  @{ @{ "68020", MASK_68020, "" @},     \
-    @{ "68000", -MASK_68020,          \
-      N_("Compile for the 68000") @}, \
-    @{ "", MASK_68020, "" @},          \
-  @}
-@end smallexample
-
-This macro is being kept for compatibility with older backends.
-New targets should use option definition files instead.
-@xref{Back End}.
-@end defmac
-
-@defmac TARGET_OPTIONS
-This macro is similar to @code{TARGET_SWITCHES} but defines names of command
-options that have values.  Its definition is an initializer with a
-subgrouping for each command option.
-
-Each subgrouping contains a string constant, that defines the option
-name, the address of a variable, a description string, and a value.
-Non-empty description strings should be marked with @code{N_(@dots{})}
-for @command{xgettext}.  Please do not mark empty strings because the
-empty string is reserved by GNU gettext.  @code{gettext("")} returns the
-header entry of the message catalog with meta information, not the empty
-string.
-
-If the value listed in the table is @code{NULL}, then the variable, type
-@code{char *}, is set to the variable part of the given option if the
-fixed part matches.  In other words, if the first part of the option
-matches what's in the table, the variable will be set to point to the
-rest of the option.  This allows the user to specify a value for that
-option.  The actual option name is made by appending @samp{-m} to the
-specified name.  Again, each option should also be documented in
-@file{invoke.texi}.
-
-If the value listed in the table is non-@code{NULL}, then the option
-must match the option in the table exactly (with @samp{-m}), and the
-variable is set to point to the value listed in the table.
-
-Here is an example which defines @option{-mshort-data-@var{number}}.  If the
-given option is @option{-mshort-data-512}, the variable @code{m88k_short_data}
-will be set to the string @code{"512"}.
-
-@smallexample
-extern char *m88k_short_data;
-#define TARGET_OPTIONS \
- @{ @{ "short-data-", &m88k_short_data, \
-     N_("Specify the size of the short data section"), 0 @} @}
-@end smallexample
-
-Here is a variant of the above that allows the user to also specify
-just @option{-mshort-data} where a default of @code{"64"} is used.
-
-@smallexample
-extern char *m88k_short_data;
-#define TARGET_OPTIONS \
- @{ @{ "short-data-", &m88k_short_data, \
-     N_("Specify the size of the short data section"), 0 @} \
-    @{ "short-data", &m88k_short_data, "", "64" @},
-    @}
-@end smallexample
-
-Here is an example which defines @option{-mno-alu}, @option{-malu1}, and
-@option{-malu2} as a three-state switch, along with suitable macros for
-checking the state of the option (documentation is elided for brevity).
-
-@smallexample
-[chip.c]
-char *chip_alu = ""; /* @r{Specify default here.}  */
-
-[chip.h]
-extern char *chip_alu;
-#define TARGET_OPTIONS \
-  @{ @{ "no-alu", &chip_alu, "", "" @}, \
-     @{ "alu1", &chip_alu, "", "1" @}, \
-     @{ "alu2", &chip_alu, "", "2" @}, @}
-#define TARGET_ALU (chip_alu[0] != '\0')
-#define TARGET_ALU1 (chip_alu[0] == '1')
-#define TARGET_ALU2 (chip_alu[0] == '2')
-@end smallexample
-
-This macro is being kept for compatibility with older backends.
-New targets should use option definition files instead.
-@xref{Back End}.
-@end defmac
-
 @defmac TARGET_VERSION
 This macro is a C statement to print on @code{stderr} a string
 describing the particular machine description choice.  Every machine
@@ -2863,6 +2716,7 @@ This describes the stack layout and calling conventions.
 * Function Entry::
 * Profiling::
 * Tail Calls::
+* Stack Smashing Protection::
 @end menu
 
 @node Frame Layout
@@ -2899,8 +2753,8 @@ which is often wrong.
 @end defmac
 
 @defmac FRAME_GROWS_DOWNWARD
-Define this macro if the addresses of local variable slots are at negative
-offsets from the frame pointer.
+Define this macro to non-zero value if the addresses of local variable slots
+are at negative offsets from the frame pointer.
 @end defmac
 
 @defmac ARGS_GROW_DOWNWARD
@@ -4526,6 +4380,31 @@ as the @code{sibcall} md pattern can not fail, or fall over to a
 may vary greatly between different architectures.
 @end deftypefn
 
+@node Stack Smashing Protection
+@subsection Stack smashing protection
+@cindex stack smashing protection
+
+@deftypefn {Target Hook} tree TARGET_STACK_PROTECT_GUARD (void)
+This hook returns a @code{DECL} node for the external variable to use
+for the stack protection guard.  This variable is initialized by the 
+runtime to some random value and is used to initialize the guard value
+that is placed at the top of the local stack frame.  The type of this
+variable must be @code{ptr_type_node}.
+
+The default version of this hook creates a variable called
+@samp{__stack_chk_guard}, which is normally defined in @file{libgcc2.c}.
+@end deftypefn
+
+@deftypefn {Target Hook} tree TARGET_STACK_PROTECT_FAIL (void)
+This hook returns a tree expression that alerts the runtime that the
+stack protect guard variable has been modified.  This expression should
+involve a call to a @code{noreturn} function.
+
+The default version of this hook invokes a function called
+@samp{__stack_chk_fail}, taking no arguments.  This function is 
+normally defined in @file{libgcc2.c}.
+@end deftypefn
+
 @node Varargs
 @section Implementing the Varargs Macros
 @cindex varargs implementation
@@ -7769,6 +7648,11 @@ Define this macro if your target has ABI specified unwind tables.  Usually
 these will be output by @code{TARGET_UNWIND_EMIT}.
 @end defmac
 
+@deftypevar {Target Hook} bool TARGET_UNWID_TABLES_DEFAULT
+This variable should be set to @code{true} if the target ABI requires unwinding
+tables even when exceptions are not used.
+@end deftypevar
+
 @defmac MUST_USE_SJLJ_EXCEPTIONS
 This macro need only be defined if @code{DWARF2_UNWIND_INFO} is
 runtime-variable.  In that case, @file{except.h} cannot correctly
@@ -7819,6 +7703,20 @@ register in Dwarf.  Otherwise, this hook should return @code{NULL_RTX}.
 If not defined, the default is to return @code{NULL_RTX}.
 @end deftypefn
 
+@deftypefn {Target Hook} bool TARGET_ASM_TTYPE (rtx @var{sym})
+This hook is used to output a reference from a frame unwinding table to
+the type_info object identified by @var{sym}.  It should return @code{true}
+if the reference was output.  Returning @code{false} will cause the
+reference to be output using the normal Dwarf2 routines.
+@end deftypefn
+
+@deftypefn {Target Hook} bool TARGET_ARM_EABI_UNWINDER
+This hook should be set to @code{true} on targets that use an ARM EABI
+based unwinding library, and @code{false} on other targets.  This effects
+the format of unwinding tables, and how the unwinder in entered after
+running a cleanup.  The default is @code{false}.
+@end deftypefn
+
 @node Alignment Output
 @subsection Assembler Commands for Alignment
 
@@ -8287,6 +8185,11 @@ A C statement to issue assembly directives that create a self-relative
 reference to the given label, using an integer of the given size.
 @end defmac
 
+@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_DWARF_DTPREL (FILE *@var{FILE}, int @var{size}, rtx @var{x})
+If defined, this target hook is a function which outputs a DTP-relative
+reference to the given TLS symbol of the specified size.
+@end deftypefn
+
 @defmac PUT_SDB_@dots{}
 Define these macros to override the assembler syntax for the special
 SDB assembler directives.  See @file{sdbout.c} for a list of these
@@ -8668,24 +8571,32 @@ Default: empty.
 @section Parameters for Precompiled Header Validity Checking
 @cindex parameters, precompiled headers
 
-@deftypefn {Target Hook} void * TARGET_GET_PCH_VALIDITY (size_t * @var{sz})
-Define this hook if your target needs to check a different collection
-of flags than the default, which is every flag defined by
-@code{TARGET_SWITCHES} and @code{TARGET_OPTIONS}.  It should return
-some data which will be saved in the PCH file and presented to
-@code{TARGET_PCH_VALID_P} later; it should set @code{SZ} to the size
-of the data.
+@deftypefn {Target Hook} void *TARGET_GET_PCH_VALIDITY (size_t *@var{sz})
+This hook returns the data needed by @code{TARGET_PCH_VALID_P} and sets
+@samp{*@var{sz}} to the size of the data in bytes.
+@end deftypefn
+
+@deftypefn {Target Hook} const char *TARGET_PCH_VALID_P (const void *@var{data}, size_t @var{sz})
+This hook checks whether the options used to create a PCH file are
+compatible with the current settings.  It returns @code{NULL}
+if so and a suitable error message if not.  Error messages will
+be presented to the user and must be localized using @samp{_(@var{msg})}.
+
+@var{data} is the data that was returned by @code{TARGET_GET_PCH_VALIDITY}
+when the PCH file was created and @var{sz} is the size of that data in bytes.
+It's safe to assume that the data was created by the same version of the
+compiler, so no format checking is needed.
+
+The default definition of @code{default_pch_valid_p} should be
+suitable for most targets.
 @end deftypefn
 
-@deftypefn {Target Hook} const char * TARGET_PCH_VALID_P (const void * @var{data}, size_t @var{sz})
-Define this hook if your target needs to check a different collection of
-flags than the default, which is every flag defined by @code{TARGET_SWITCHES}
-and @code{TARGET_OPTIONS}.  It is given data which came from
-@code{TARGET_GET_PCH_VALIDITY} (in this version of this compiler, so there
-is no need for extensive validity checking).  It returns @code{NULL} if
-it is safe to load a PCH file with this data, or a suitable error message
-if not.  The error message will be presented to the user, so it should
-be localized.
+@deftypefn {Target Hook} const char *TARGET_CHECK_PCH_TARGET_FLAGS (int @var{pch_flags})
+If this hook is nonnull, the default implementation of
+@code{TARGET_PCH_VALID_P} will use it to check for compatible values
+of @code{target_flags}.  @var{pch_flags} specifies the value that
+@code{target_flags} had when the PCH file was created.  The return
+value is the same as for @code{TARGET_PCH_VALID_P}.
 @end deftypefn
 
 @node C++ ABI
@@ -9511,13 +9422,14 @@ simplified expression for the call's result.  If @var{ignore} is true
 the value will be ignored.
 @end deftypefn
 
-@deftypefn {Target Hook} bool TARGET_INSN_VALID_WITHIN_DOLOOP (rtx @var{insn})
+@deftypefn {Target Hook} const char * TARGET_INVALID_WITHIN_DOLOOP (rtx @var{insn})
 
-Take an instruction in @var{insn} and return true if it is valid within a
-low-overhead loop.
+Take an instruction in @var{insn} and return NULL if it is valid within a
+low-overhead loop, otherwise return a string why doloop could not be applied.
 
-Many targets use special registers for low-overhead looping. This function
-should return false for any instruction that clobbers these. 
+Many targets use special registers for low-overhead looping. For any
+instruction that clobbers these this function should return a string indicating
+the reason why the doloop could not be applied. 
 By default, the RTL loop optimizer does not use a present doloop pattern for
 loops containing function calls or branch on table instructions.  
 @end deftypefn
@@ -9694,6 +9606,26 @@ illegal to pass argument @var{val} to function @var{funcdecl}
 with prototype @var{typelist}.
 @end deftypefn
 
+@deftypefn {Target Hook} {const char *} TARGET_INVALID_CONVERSION (tree @var{fromtype}, tree @var{totype})
+If defined, this macro returns the diagnostic message when it is
+invalid to convert from @var{fromtype} to @var{totype}, or @code{NULL}
+if validity should be determined by the front end.
+@end deftypefn
+
+@deftypefn {Target Hook} {const char *} TARGET_INVALID_UNARY_OP (int @var{op}, tree @var{type})
+If defined, this macro returns the diagnostic message when it is
+invalid to apply operation @var{op} (where unary plus is denoted by
+@code{CONVERT_EXPR}) to an operand of type @var{type}, or @code{NULL}
+if validity should be determined by the front end.
+@end deftypefn
+
+@deftypefn {Target Hook} {const char *} TARGET_INVALID_BINARY_OP (int @var{op}, tree @var{type1}, tree @var{type2})
+If defined, this macro returns the diagnostic message when it is
+invalid to apply operation @var{op} to operands of types @var{type1}
+and @var{type2}, or @code{NULL} if validity should be determined by
+the front end.
+@end deftypefn
+
 @defmac TARGET_USE_JCR_SECTION
 This macro determines whether to use the JCR section to register Java
 classes. By default, TARGET_USE_JCR_SECTION is defined to 1 if both