blob: 3a64cd143022d3b5f546734f004ffb2882461b43 [file] [log] [blame]
/* Target hook definitions.
Copyright (C) 2001-2014 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
/* See target-hooks-macros.h for details of macros that should be
provided by the including file, and how to use them here. */
#include "target-hooks-macros.h"
#undef HOOK_TYPE
#define HOOK_TYPE "Target Hook"
HOOK_VECTOR (TARGET_INITIALIZER, gcc_target)
/* Functions that output assembler for the target. */
#define HOOK_PREFIX "TARGET_ASM_"
HOOK_VECTOR (TARGET_ASM_OUT, asm_out)
/* Opening and closing parentheses for asm expression grouping. */
DEFHOOKPOD
(open_paren,
"These target hooks are C string constants, describing the syntax in the\n\
assembler for grouping arithmetic expressions. If not overridden, they\n\
default to normal parentheses, which is correct for most assemblers.",
const char *, "(")
DEFHOOKPODX (close_paren, const char *, ")")
/* Assembler instructions for creating various kinds of integer object. */
DEFHOOKPOD
(byte_op,
"@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_HI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_TI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_HI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_TI_OP\n\
These hooks specify assembly directives for creating certain kinds\n\
of integer object. The @code{TARGET_ASM_BYTE_OP} directive creates a\n\
byte-sized object, the @code{TARGET_ASM_ALIGNED_HI_OP} one creates an\n\
aligned two-byte object, and so on. Any of the hooks may be\n\
@code{NULL}, indicating that no suitable directive is available.\n\
\n\
The compiler will print these strings at the start of a new line,\n\
followed immediately by the object's initial value. In most cases,\n\
the string should contain a tab, a pseudo-op, and then another tab.",
const char *, "\t.byte\t")
DEFHOOKPOD (aligned_op, "*", struct asm_int_op, TARGET_ASM_ALIGNED_INT_OP)
DEFHOOKPOD (unaligned_op, "*", struct asm_int_op, TARGET_ASM_UNALIGNED_INT_OP)
/* The maximum number of bytes to skip when applying
LABEL_ALIGN_AFTER_BARRIER. */
DEFHOOK
(label_align_after_barrier_max_skip,
"The maximum number of bytes to skip before @var{label} when applying\n\
@code{LABEL_ALIGN_AFTER_BARRIER}. This works only if\n\
@code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.",
int, (rtx label),
default_label_align_after_barrier_max_skip)
/* The maximum number of bytes to skip when applying
LOOP_ALIGN. */
DEFHOOK
(loop_align_max_skip,
"The maximum number of bytes to skip when applying @code{LOOP_ALIGN} to\n\
@var{label}. This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is\n\
defined.",
int, (rtx label),
default_loop_align_max_skip)
/* The maximum number of bytes to skip when applying
LABEL_ALIGN. */
DEFHOOK
(label_align_max_skip,
"The maximum number of bytes to skip when applying @code{LABEL_ALIGN}\n\
to @var{label}. This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN}\n\
is defined.",
int, (rtx label),
default_label_align_max_skip)
/* The maximum number of bytes to skip when applying
JUMP_ALIGN. */
DEFHOOK
(jump_align_max_skip,
"The maximum number of bytes to skip before @var{label} when applying\n\
@code{JUMP_ALIGN}. This works only if\n\
@code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.",
int, (rtx label),
default_jump_align_max_skip)
/* Try to output the assembler code for an integer object whose
value is given by X. SIZE is the size of the object in bytes and
ALIGNED_P indicates whether it is aligned. Return true if
successful. Only handles cases for which BYTE_OP, ALIGNED_OP
and UNALIGNED_OP are NULL. */
DEFHOOK
(integer,
"The @code{assemble_integer} function uses this hook to output an\n\
integer object. @var{x} is the object's value, @var{size} is its size\n\
in bytes and @var{aligned_p} indicates whether it is aligned. The\n\
function should return @code{true} if it was able to output the\n\
object. If it returns false, @code{assemble_integer} will try to\n\
split the object into smaller parts.\n\
\n\
The default implementation of this hook will use the\n\
@code{TARGET_ASM_BYTE_OP} family of strings, returning @code{false}\n\
when the relevant string is @code{NULL}.",
/* Only handles cases for which BYTE_OP, ALIGNED_OP and UNALIGNED_OP are
NULL. */
bool, (rtx x, unsigned int size, int aligned_p),
default_assemble_integer)
/* Output code that will globalize a label. */
DEFHOOK
(globalize_label,
"This target hook is a function to output to the stdio stream\n\
@var{stream} some commands that will make the label @var{name} global;\n\
that is, available for reference from other files.\n\
\n\
The default implementation relies on a proper definition of\n\
@code{GLOBAL_ASM_OP}.",
void, (FILE *stream, const char *name),
default_globalize_label)
/* Output code that will globalize a declaration. */
DEFHOOK
(globalize_decl_name,
"This target hook is a function to output to the stdio stream\n\
@var{stream} some commands that will make the name associated with @var{decl}\n\
global; that is, available for reference from other files.\n\
\n\
The default implementation uses the TARGET_ASM_GLOBALIZE_LABEL target hook.",
void, (FILE *stream, tree decl), default_globalize_decl_name)
/* Output code that will emit a label for unwind info, if this
target requires such labels. Second argument is the decl the
unwind info is associated with, third is a boolean: true if
this is for exception handling, fourth is a boolean: true if
this is only a placeholder for an omitted FDE. */
DEFHOOK
(emit_unwind_label,
"This target hook emits a label at the beginning of each FDE@. It\n\
should be defined on targets where FDEs need special labels, and it\n\
should write the appropriate label, for the FDE associated with the\n\
function declaration @var{decl}, to the stdio stream @var{stream}.\n\
The third argument, @var{for_eh}, is a boolean: true if this is for an\n\
exception table. The fourth argument, @var{empty}, is a boolean:\n\
true if this is a placeholder label for an omitted FDE@.\n\
\n\
The default is that FDEs are not given nonlocal labels.",
void, (FILE *stream, tree decl, int for_eh, int empty),
default_emit_unwind_label)
/* Output code that will emit a label to divide up the exception table. */
DEFHOOK
(emit_except_table_label,
"This target hook emits a label at the beginning of the exception table.\n\
It should be defined on targets where it is desirable for the table\n\
to be broken up according to function.\n\
\n\
The default is that no label is emitted.",
void, (FILE *stream),
default_emit_except_table_label)
/* Emit a directive for setting the personality for the function. */
DEFHOOK
(emit_except_personality,
"If the target implements @code{TARGET_ASM_UNWIND_EMIT}, this hook may be\
used to emit a directive to install a personality hook into the unwind\
info. This hook should not be used if dwarf2 unwind info is used.",
void, (rtx personality),
NULL)
/* Emit any directives required to unwind this instruction. */
DEFHOOK
(unwind_emit,
"This target hook emits assembly directives required to unwind the\n\
given instruction. This is only used when @code{TARGET_EXCEPT_UNWIND_INFO}\n\
returns @code{UI_TARGET}.",
void, (FILE *stream, rtx insn),
NULL)
DEFHOOKPOD
(unwind_emit_before_insn,
"True if the @code{TARGET_ASM_UNWIND_EMIT} hook should be called before\
the assembly for @var{insn} has been emitted, false if the hook should\
be called afterward.",
bool, true)
/* Generate an internal label.
For now this is just a wrapper for ASM_GENERATE_INTERNAL_LABEL. */
DEFHOOK_UNDOC
(generate_internal_label,
"",
void, (char *buf, const char *prefix, unsigned long labelno),
default_generate_internal_label)
/* Output an internal label. */
DEFHOOK
(internal_label,
"A function to output to the stdio stream @var{stream} a label whose\n\
name is made from the string @var{prefix} and the number @var{labelno}.\n\
\n\
It is absolutely essential that these labels be distinct from the labels\n\
used for user-level functions and variables. Otherwise, certain programs\n\
will have name conflicts with internal labels.\n\
\n\
It is desirable to exclude internal labels from the symbol table of the\n\
object file. Most assemblers have a naming convention for labels that\n\
should be excluded; on many systems, the letter @samp{L} at the\n\
beginning of a label has this effect. You should find out what\n\
convention your system uses, and follow it.\n\
\n\
The default version of this function utilizes @code{ASM_GENERATE_INTERNAL_LABEL}.",
void, (FILE *stream, const char *prefix, unsigned long labelno),
default_internal_label)
/* Output label for the constant. */
DEFHOOK
(declare_constant_name,
"A target hook to output to the stdio stream @var{file} any text necessary\n\
for declaring the name @var{name} of a constant which is being defined. This\n\
target hook is responsible for outputting the label definition (perhaps using\n\
@code{assemble_label}). The argument @var{exp} is the value of the constant,\n\
and @var{size} is the size of the constant in bytes. The @var{name}\n\
will be an internal label.\n\
\n\
The default version of this target hook, define the @var{name} in the\n\
usual manner as a label (by means of @code{assemble_label}).\n\
\n\
You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in this target hook.",
void, (FILE *file, const char *name, const_tree expr, HOST_WIDE_INT size),
default_asm_declare_constant_name)
/* Emit a ttype table reference to a typeinfo object. */
DEFHOOK
(ttype,
"This hook is used to output a reference from a frame unwinding table to\n\
the type_info object identified by @var{sym}. It should return @code{true}\n\
if the reference was output. Returning @code{false} will cause the\n\
reference to be output using the normal Dwarf2 routines.",
bool, (rtx sym),
hook_bool_rtx_false)
/* Emit an assembler directive to set visibility for the symbol
associated with the tree decl. */
DEFHOOK
(assemble_visibility,
"This target hook is a function to output to @var{asm_out_file} some\n\
commands that will make the symbol(s) associated with @var{decl} have\n\
hidden, protected or internal visibility as specified by @var{visibility}.",
void, (tree decl, int visibility),
default_assemble_visibility)
/* Output the assembler code for entry to a function. */
DEFHOOK
(function_prologue,
"If defined, a function that outputs the assembler code for entry to a\n\
function. The prologue is responsible for setting up the stack frame,\n\
initializing the frame pointer register, saving registers that must be\n\
saved, and allocating @var{size} additional bytes of storage for the\n\
local variables. @var{size} is an integer. @var{file} is a stdio\n\
stream to which the assembler code should be output.\n\
\n\
The label for the beginning of the function need not be output by this\n\
macro. That has already been done when the macro is run.\n\
\n\
@findex regs_ever_live\n\
To determine which registers to save, the macro can refer to the array\n\
@code{regs_ever_live}: element @var{r} is nonzero if hard register\n\
@var{r} is used anywhere within the function. This implies the function\n\
prologue should save register @var{r}, provided it is not one of the\n\
call-used registers. (@code{TARGET_ASM_FUNCTION_EPILOGUE} must likewise use\n\
@code{regs_ever_live}.)\n\
\n\
On machines that have ``register windows'', the function entry code does\n\
not save on the stack the registers that are in the windows, even if\n\
they are supposed to be preserved by function calls; instead it takes\n\
appropriate steps to ``push'' the register stack, if any non-call-used\n\
registers are used in the function.\n\
\n\
@findex frame_pointer_needed\n\
On machines where functions may or may not have frame-pointers, the\n\
function entry code must vary accordingly; it must set up the frame\n\
pointer if one is wanted, and not otherwise. To determine whether a\n\
frame pointer is in wanted, the macro can refer to the variable\n\
@code{frame_pointer_needed}. The variable's value will be 1 at run\n\
time in a function that needs a frame pointer. @xref{Elimination}.\n\
\n\
The function entry code is responsible for allocating any stack space\n\
required for the function. This stack space consists of the regions\n\
listed below. In most cases, these regions are allocated in the\n\
order listed, with the last listed region closest to the top of the\n\
stack (the lowest address if @code{STACK_GROWS_DOWNWARD} is defined, and\n\
the highest address if it is not defined). You can use a different order\n\
for a machine if doing so is more convenient or required for\n\
compatibility reasons. Except in cases where required by standard\n\
or by a debugger, there is no reason why the stack layout used by GCC\n\
need agree with that used by other compilers for a machine.",
void, (FILE *file, HOST_WIDE_INT size),
default_function_pro_epilogue)
/* Output the assembler code for end of prologue. */
DEFHOOK
(function_end_prologue,
"If defined, a function that outputs assembler code at the end of a\n\
prologue. This should be used when the function prologue is being\n\
emitted as RTL, and you have some extra assembler that needs to be\n\
emitted. @xref{prologue instruction pattern}.",
void, (FILE *file),
no_asm_to_stream)
/* Output the assembler code for start of epilogue. */
DEFHOOK
(function_begin_epilogue,
"If defined, a function that outputs assembler code at the start of an\n\
epilogue. This should be used when the function epilogue is being\n\
emitted as RTL, and you have some extra assembler that needs to be\n\
emitted. @xref{epilogue instruction pattern}.",
void, (FILE *file),
no_asm_to_stream)
/* Output the assembler code for function exit. */
DEFHOOK
(function_epilogue,
"If defined, a function that outputs the assembler code for exit from a\n\
function. The epilogue is responsible for restoring the saved\n\
registers and stack pointer to their values when the function was\n\
called, and returning control to the caller. This macro takes the\n\
same arguments as the macro @code{TARGET_ASM_FUNCTION_PROLOGUE}, and the\n\
registers to restore are determined from @code{regs_ever_live} and\n\
@code{CALL_USED_REGISTERS} in the same way.\n\
\n\
On some machines, there is a single instruction that does all the work\n\
of returning from the function. On these machines, give that\n\
instruction the name @samp{return} and do not define the macro\n\
@code{TARGET_ASM_FUNCTION_EPILOGUE} at all.\n\
\n\
Do not define a pattern named @samp{return} if you want the\n\
@code{TARGET_ASM_FUNCTION_EPILOGUE} to be used. If you want the target\n\
switches to control whether return instructions or epilogues are used,\n\
define a @samp{return} pattern with a validity condition that tests the\n\
target switches appropriately. If the @samp{return} pattern's validity\n\
condition is false, epilogues will be used.\n\
\n\
On machines where functions may or may not have frame-pointers, the\n\
function exit code must vary accordingly. Sometimes the code for these\n\
two cases is completely different. To determine whether a frame pointer\n\
is wanted, the macro can refer to the variable\n\
@code{frame_pointer_needed}. The variable's value will be 1 when compiling\n\
a function that needs a frame pointer.\n\
\n\
Normally, @code{TARGET_ASM_FUNCTION_PROLOGUE} and\n\
@code{TARGET_ASM_FUNCTION_EPILOGUE} must treat leaf functions specially.\n\
The C variable @code{current_function_is_leaf} is nonzero for such a\n\
function. @xref{Leaf Functions}.\n\
\n\
On some machines, some functions pop their arguments on exit while\n\
others leave that for the caller to do. For example, the 68020 when\n\
given @option{-mrtd} pops arguments in functions that take a fixed\n\
number of arguments.\n\
\n\
@findex pops_args\n\
@findex crtl->args.pops_args\n\
Your definition of the macro @code{RETURN_POPS_ARGS} decides which\n\
functions pop their own arguments. @code{TARGET_ASM_FUNCTION_EPILOGUE}\n\
needs to know what was decided. The number of bytes of the current\n\
function's arguments that this function should pop is available in\n\
@code{crtl->args.pops_args}. @xref{Scalar Return}.",
void, (FILE *file, HOST_WIDE_INT size),
default_function_pro_epilogue)
/* Initialize target-specific sections. */
DEFHOOK
(init_sections,
"Define this hook if you need to do something special to set up the\n\
@file{varasm.c} sections, or if your target has some special sections\n\
of its own that you need to create.\n\
\n\
GCC calls this hook after processing the command line, but before writing\n\
any assembly code, and before calling any of the section-returning hooks\n\
described below.",
void, (void),
hook_void_void)
/* Tell assembler to change to section NAME with attributes FLAGS.
If DECL is non-NULL, it is the VAR_DECL or FUNCTION_DECL with
which this section is associated. */
DEFHOOK
(named_section,
"Output assembly directives to switch to section @var{name}. The section\n\
should have attributes as specified by @var{flags}, which is a bit mask\n\
of the @code{SECTION_*} flags defined in @file{output.h}. If @var{decl}\n\
is non-NULL, it is the @code{VAR_DECL} or @code{FUNCTION_DECL} with which\n\
this section is associated.",
void, (const char *name, unsigned int flags, tree decl),
default_no_named_section)
/* Return preferred text (sub)section for function DECL.
Main purpose of this function is to separate cold, normal and hot
functions. STARTUP is true when function is known to be used only
at startup (from static constructors or it is main()).
EXIT is true when function is known to be used only at exit
(from static destructors).
Return NULL if function should go to default text section. */
DEFHOOK
(function_section,
"Return preferred text (sub)section for function @var{decl}.\n\
Main purpose of this function is to separate cold, normal and hot\n\
functions. @var{startup} is true when function is known to be used only\n\
at startup (from static constructors or it is @code{main()}).\n\
@var{exit} is true when function is known to be used only at exit\n\
(from static destructors).\n\
Return NULL if function should go to default text section.",
section *, (tree decl, enum node_frequency freq, bool startup, bool exit),
default_function_section)
/* Output the assembler code for function exit. */
DEFHOOK
(function_switched_text_sections,
"Used by the target to emit any assembler directives or additional\
labels needed when a function is partitioned between different\
sections. Output should be written to @var{file}. The function\
decl is available as @var{decl} and the new section is `cold' if\
@var{new_is_cold} is @code{true}.",
void, (FILE *file, tree decl, bool new_is_cold),
default_function_switched_text_sections)
/* Return a mask describing how relocations should be treated when
selecting sections. Bit 1 should be set if global relocations
should be placed in a read-write section; bit 0 should be set if
local relocations should be placed in a read-write section. */
DEFHOOK
(reloc_rw_mask,
"Return a mask describing how relocations should be treated when\n\
selecting sections. Bit 1 should be set if global relocations\n\
should be placed in a read-write section; bit 0 should be set if\n\
local relocations should be placed in a read-write section.\n\
\n\
The default version of this function returns 3 when @option{-fpic}\n\
is in effect, and 0 otherwise. The hook is typically redefined\n\
when the target cannot support (some kinds of) dynamic relocations\n\
in read-only sections even in executables.",
int, (void),
default_reloc_rw_mask)
/* Return a section for EXP. It may be a DECL or a constant. RELOC
is nonzero if runtime relocations must be applied; bit 1 will be
set if the runtime relocations require non-local name resolution.
ALIGN is the required alignment of the data. */
DEFHOOK
(select_section,
"Return the section into which @var{exp} should be placed. You can\n\
assume that @var{exp} is either a @code{VAR_DECL} node or a constant of\n\
some sort. @var{reloc} indicates whether the initial value of @var{exp}\n\
requires link-time relocations. Bit 0 is set when variable contains\n\
local relocations only, while bit 1 is set for global relocations.\n\
@var{align} is the constant alignment in bits.\n\
\n\
The default version of this function takes care of putting read-only\n\
variables in @code{readonly_data_section}.\n\
\n\
See also @var{USE_SELECT_SECTION_FOR_FUNCTIONS}.",
section *, (tree exp, int reloc, unsigned HOST_WIDE_INT align),
default_select_section)
/* Return a section for X. MODE is X's mode and ALIGN is its
alignment in bits. */
DEFHOOK
(select_rtx_section,
"Return the section into which a constant @var{x}, of mode @var{mode},\n\
should be placed. You can assume that @var{x} is some kind of\n\
constant in RTL@. The argument @var{mode} is redundant except in the\n\
case of a @code{const_int} rtx. @var{align} is the constant alignment\n\
in bits.\n\
\n\
The default version of this function takes care of putting symbolic\n\
constants in @code{flag_pic} mode in @code{data_section} and everything\n\
else in @code{readonly_data_section}.",
section *, (enum machine_mode mode, rtx x, unsigned HOST_WIDE_INT align),
default_select_rtx_section)
/* Select a unique section name for DECL. RELOC is the same as
for SELECT_SECTION. */
DEFHOOK
(unique_section,
"Build up a unique section name, expressed as a @code{STRING_CST} node,\n\
and assign it to @samp{DECL_SECTION_NAME (@var{decl})}.\n\
As with @code{TARGET_ASM_SELECT_SECTION}, @var{reloc} indicates whether\n\
the initial value of @var{exp} requires link-time relocations.\n\
\n\
The default version of this function appends the symbol name to the\n\
ELF section name that would normally be used for the symbol. For\n\
example, the function @code{foo} would be placed in @code{.text.foo}.\n\
Whatever the actual target object format, this is often good enough.",
void, (tree decl, int reloc),
default_unique_section)
/* Return the readonly data section associated with function DECL. */
DEFHOOK
(function_rodata_section,
"Return the readonly data section associated with\n\
@samp{DECL_SECTION_NAME (@var{decl})}.\n\
The default version of this function selects @code{.gnu.linkonce.r.name} if\n\
the function's section is @code{.gnu.linkonce.t.name}, @code{.rodata.name}\n\
if function is in @code{.text.name}, and the normal readonly-data section\n\
otherwise.",
section *, (tree decl),
default_function_rodata_section)
/* Nonnull if the target wants to override the default ".rodata" prefix
for mergeable data sections. */
DEFHOOKPOD
(mergeable_rodata_prefix,
"Usually, the compiler uses the prefix @code{\".rodata\"} to construct\n\
section names for mergeable constant data. Define this macro to override\n\
the string if a different section name should be used.",
const char *, ".rodata")
/* Return the section to be used for transactional memory clone tables. */
DEFHOOK
(tm_clone_table_section,
"Return the section that should be used for transactional memory clone\
tables.",
section *, (void), default_clone_table_section)
/* Output a constructor for a symbol with a given priority. */
DEFHOOK
(constructor,
"If defined, a function that outputs assembler code to arrange to call\n\
the function referenced by @var{symbol} at initialization time.\n\
\n\
Assume that @var{symbol} is a @code{SYMBOL_REF} for a function taking\n\
no arguments and with no return value. If the target supports initialization\n\
priorities, @var{priority} is a value between 0 and @code{MAX_INIT_PRIORITY};\n\
otherwise it must be @code{DEFAULT_INIT_PRIORITY}.\n\
\n\
If this macro is not defined by the target, a suitable default will\n\
be chosen if (1) the target supports arbitrary section names, (2) the\n\
target defines @code{CTORS_SECTION_ASM_OP}, or (3) @code{USE_COLLECT2}\n\
is not defined.",
void, (rtx symbol, int priority), NULL)
/* Output a destructor for a symbol with a given priority. */
DEFHOOK
(destructor,
"This is like @code{TARGET_ASM_CONSTRUCTOR} but used for termination\n\
functions rather than initialization functions.",
void, (rtx symbol, int priority), NULL)
/* Output the assembler code for a thunk function. THUNK_DECL is the
declaration for the thunk function itself, FUNCTION is the decl for
the target function. DELTA is an immediate constant offset to be
added to THIS. If VCALL_OFFSET is nonzero, the word at
*(*this + vcall_offset) should be added to THIS. */
DEFHOOK
(output_mi_thunk,
"A function that outputs the assembler code for a thunk\n\
function, used to implement C++ virtual function calls with multiple\n\
inheritance. The thunk acts as a wrapper around a virtual function,\n\
adjusting the implicit object parameter before handing control off to\n\
the real function.\n\
\n\
First, emit code to add the integer @var{delta} to the location that\n\
contains the incoming first argument. Assume that this argument\n\
contains a pointer, and is the one used to pass the @code{this} pointer\n\
in C++. This is the incoming argument @emph{before} the function prologue,\n\
e.g.@: @samp{%o0} on a sparc. The addition must preserve the values of\n\
all other incoming arguments.\n\
\n\
Then, if @var{vcall_offset} is nonzero, an additional adjustment should be\n\
made after adding @code{delta}. In particular, if @var{p} is the\n\
adjusted pointer, the following adjustment should be made:\n\
\n\
@smallexample\n\
p += (*((ptrdiff_t **)p))[vcall_offset/sizeof(ptrdiff_t)]\n\
@end smallexample\n\
\n\
After the additions, emit code to jump to @var{function}, which is a\n\
@code{FUNCTION_DECL}. This is a direct pure jump, not a call, and does\n\
not touch the return address. Hence returning from @var{FUNCTION} will\n\
return to whoever called the current @samp{thunk}.\n\
\n\
The effect must be as if @var{function} had been called directly with\n\
the adjusted first argument. This macro is responsible for emitting all\n\
of the code for a thunk function; @code{TARGET_ASM_FUNCTION_PROLOGUE}\n\
and @code{TARGET_ASM_FUNCTION_EPILOGUE} are not invoked.\n\
\n\
The @var{thunk_fndecl} is redundant. (@var{delta} and @var{function}\n\
have already been extracted from it.) It might possibly be useful on\n\
some targets, but probably not.\n\
\n\
If you do not define this macro, the target-independent code in the C++\n\
front end will generate a less efficient heavyweight thunk that calls\n\
@var{function} instead of jumping to it. The generic approach does\n\
not support varargs.",
void, (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta,
HOST_WIDE_INT vcall_offset, tree function),
NULL)
/* Determine whether output_mi_thunk would succeed. */
/* ??? Ideally, this hook would not exist, and success or failure
would be returned from output_mi_thunk directly. But there's
too much undo-able setup involved in invoking output_mi_thunk.
Could be fixed by making output_mi_thunk emit rtl instead of
text to the output file. */
DEFHOOK
(can_output_mi_thunk,
"A function that returns true if TARGET_ASM_OUTPUT_MI_THUNK would be able\n\
to output the assembler code for the thunk function specified by the\n\
arguments it is passed, and false otherwise. In the latter case, the\n\
generic approach will be used by the C++ front end, with the limitations\n\
previously exposed.",
bool, (const_tree thunk_fndecl, HOST_WIDE_INT delta,
HOST_WIDE_INT vcall_offset, const_tree function),
hook_bool_const_tree_hwi_hwi_const_tree_false)
/* Output any boilerplate text needed at the beginning of a
translation unit. */
DEFHOOK
(file_start,
"Output to @code{asm_out_file} any text which the assembler expects to\n\
find at the beginning of a file. The default behavior is controlled\n\
by two flags, documented below. Unless your target's assembler is\n\
quite unusual, if you override the default, you should call\n\
@code{default_file_start} at some point in your target hook. This\n\
lets other target files rely on these variables.",
void, (void),
default_file_start)
/* Output any boilerplate text needed at the end of a translation unit. */
DEFHOOK
(file_end,
"Output to @code{asm_out_file} any text which the assembler expects\n\
to find at the end of a file. The default is to output nothing.",
void, (void),
hook_void_void)
/* Output any boilerplate text needed at the beginning of an
LTO output stream. */
DEFHOOK
(lto_start,
"Output to @code{asm_out_file} any text which the assembler expects\n\
to find at the start of an LTO section. The default is to output\n\
nothing.",
void, (void),
hook_void_void)
/* Output any boilerplate text needed at the end of an
LTO output stream. */
DEFHOOK
(lto_end,
"Output to @code{asm_out_file} any text which the assembler expects\n\
to find at the end of an LTO section. The default is to output\n\
nothing.",
void, (void),
hook_void_void)
/* Output any boilerplace text needed at the end of a
translation unit before debug and unwind info is emitted. */
DEFHOOK
(code_end,
"Output to @code{asm_out_file} any text which is needed before emitting\n\
unwind info and debug info at the end of a file. Some targets emit\n\
here PIC setup thunks that cannot be emitted at the end of file,\n\
because they couldn't have unwind info then. The default is to output\n\
nothing.",
void, (void),
hook_void_void)
/* Output an assembler pseudo-op to declare a library function name
external. */
DEFHOOK
(external_libcall,
"This target hook is a function to output to @var{asm_out_file} an assembler\n\
pseudo-op to declare a library function name external. The name of the\n\
library function is given by @var{symref}, which is a @code{symbol_ref}.",
void, (rtx symref),
default_external_libcall)
/* Output an assembler directive to mark decl live. This instructs
linker to not dead code strip this symbol. */
DEFHOOK
(mark_decl_preserved,
"This target hook is a function to output to @var{asm_out_file} an assembler\n\
directive to annotate @var{symbol} as used. The Darwin target uses the\n\
.no_dead_code_strip directive.",
void, (const char *symbol),
hook_void_constcharptr)
/* Output a record of the command line switches that have been passed. */
DEFHOOK
(record_gcc_switches,
"Provides the target with the ability to record the gcc command line\n\
switches that have been passed to the compiler, and options that are\n\
enabled. The @var{type} argument specifies what is being recorded.\n\
It can take the following values:\n\
\n\
@table @gcctabopt\n\
@item SWITCH_TYPE_PASSED\n\
@var{text} is a command line switch that has been set by the user.\n\
\n\
@item SWITCH_TYPE_ENABLED\n\
@var{text} is an option which has been enabled. This might be as a\n\
direct result of a command line switch, or because it is enabled by\n\
default or because it has been enabled as a side effect of a different\n\
command line switch. For example, the @option{-O2} switch enables\n\
various different individual optimization passes.\n\
\n\
@item SWITCH_TYPE_DESCRIPTIVE\n\
@var{text} is either NULL or some descriptive text which should be\n\
ignored. If @var{text} is NULL then it is being used to warn the\n\
target hook that either recording is starting or ending. The first\n\
time @var{type} is SWITCH_TYPE_DESCRIPTIVE and @var{text} is NULL, the\n\
warning is for start up and the second time the warning is for\n\
wind down. This feature is to allow the target hook to make any\n\
necessary preparations before it starts to record switches and to\n\
perform any necessary tidying up after it has finished recording\n\
switches.\n\
\n\
@item SWITCH_TYPE_LINE_START\n\
This option can be ignored by this target hook.\n\
\n\
@item SWITCH_TYPE_LINE_END\n\
This option can be ignored by this target hook.\n\
@end table\n\
\n\
The hook's return value must be zero. Other return values may be\n\
supported in the future.\n\
\n\
By default this hook is set to NULL, but an example implementation is\n\
provided for ELF based targets. Called @var{elf_record_gcc_switches},\n\
it records the switches as ASCII text inside a new, string mergeable\n\
section in the assembler output file. The name of the new section is\n\
provided by the @code{TARGET_ASM_RECORD_GCC_SWITCHES_SECTION} target\n\
hook.",
int, (print_switch_type type, const char *text),
NULL)
/* The name of the section that the example ELF implementation of
record_gcc_switches will use to store the information. Target
specific versions of record_gcc_switches may or may not use
this information. */
DEFHOOKPOD
(record_gcc_switches_section,
"This is the name of the section that will be created by the example\n\
ELF implementation of the @code{TARGET_ASM_RECORD_GCC_SWITCHES} target\n\
hook.",
const char *, ".GCC.command.line")
/* Output the definition of a section anchor. */
DEFHOOK
(output_anchor,
"Write the assembly code to define section anchor @var{x}, which is a\n\
@code{SYMBOL_REF} for which @samp{SYMBOL_REF_ANCHOR_P (@var{x})} is true.\n\
The hook is called with the assembly output position set to the beginning\n\
of @code{SYMBOL_REF_BLOCK (@var{x})}.\n\
\n\
If @code{ASM_OUTPUT_DEF} is available, the hook's default definition uses\n\
it to define the symbol as @samp{. + SYMBOL_REF_BLOCK_OFFSET (@var{x})}.\n\
If @code{ASM_OUTPUT_DEF} is not available, the hook's default definition\n\
is @code{NULL}, which disables the use of section anchors altogether.",
void, (rtx x),
default_asm_output_anchor)
DEFHOOK
(output_ident,
"Output a string based on @var{name}, suitable for the @samp{#ident} \
directive, or the equivalent directive or pragma in non-C-family languages. \
If this hook is not defined, nothing is output for the @samp{#ident} \
directive.",
void, (const char *name),
hook_void_constcharptr)
/* Output a DTP-relative reference to a TLS symbol. */
DEFHOOK
(output_dwarf_dtprel,
"If defined, this target hook is a function which outputs a DTP-relative\n\
reference to the given TLS symbol of the specified size.",
void, (FILE *file, int size, rtx x),
NULL)
/* Some target machines need to postscan each insn after it is output. */
DEFHOOK
(final_postscan_insn,
"If defined, this target hook is a function which is executed just after the\n\
output of assembler code for @var{insn}, to change the mode of the assembler\n\
if necessary.\n\
\n\
Here the argument @var{opvec} is the vector containing the operands\n\
extracted from @var{insn}, and @var{noperands} is the number of\n\
elements of the vector which contain meaningful data for this insn.\n\
The contents of this vector are what was used to convert the insn\n\
template into assembler code, so you can change the assembler mode\n\
by checking the contents of the vector.",
void, (FILE *file, rtx insn, rtx *opvec, int noperands),
NULL)
/* Emit the trampoline template. This hook may be NULL. */
DEFHOOK
(trampoline_template,
"This hook is called by @code{assemble_trampoline_template} to output,\n\
on the stream @var{f}, assembler code for a block of data that contains\n\
the constant parts of a trampoline. This code should not include a\n\
label---the label is taken care of automatically.\n\
\n\
If you do not define this hook, it means no template is needed\n\
for the target. Do not define this hook on systems where the block move\n\
code to copy the trampoline into place would be larger than the code\n\
to generate it on the spot.",
void, (FILE *f),
NULL)
DEFHOOK
(output_source_filename,
"Output COFF information or DWARF debugging information which indicates\
that filename @var{name} is the current source file to the stdio\
stream @var{file}.\n\
\n\
This target hook need not be defined if the standard form of output\
for the file format in use is appropriate.",
void ,(FILE *file, const char *name),
default_asm_output_source_filename)
DEFHOOK
(output_addr_const_extra,
"A target hook to recognize @var{rtx} patterns that @code{output_addr_const}\n\
can't deal with, and output assembly code to @var{file} corresponding to\n\
the pattern @var{x}. This may be used to allow machine-dependent\n\
@code{UNSPEC}s to appear within constants.\n\
\n\
If target hook fails to recognize a pattern, it must return @code{false},\n\
so that a standard error message is printed. If it prints an error message\n\
itself, by calling, for example, @code{output_operand_lossage}, it may just\n\
return @code{true}.",
bool, (FILE *file, rtx x),
hook_bool_FILEptr_rtx_false)
/* ??? The TARGET_PRINT_OPERAND* hooks are part of the asm_out struct,
even though that is not reflected in the macro name to override their
initializers. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_"
/* Emit a machine-specific insn operand. */
/* ??? tm.texi only documents the old macro PRINT_OPERAND,
not this hook, and uses a different name for the argument FILE. */
DEFHOOK_UNDOC
(print_operand,
"",
void, (FILE *file, rtx x, int code),
default_print_operand)
/* Emit a machine-specific memory address. */
/* ??? tm.texi only documents the old macro PRINT_OPERAND_ADDRESS,
not this hook, and uses different argument names. */
DEFHOOK_UNDOC
(print_operand_address,
"",
void, (FILE *file, rtx addr),
default_print_operand_address)
/* Determine whether CODE is a valid punctuation character for the
`print_operand' hook. */
/* ??? tm.texi only documents the old macro PRINT_OPERAND_PUNCT_VALID_P,
not this hook. */
DEFHOOK_UNDOC
(print_operand_punct_valid_p,
"",
bool ,(unsigned char code),
default_print_operand_punct_valid_p)
/* Given a symbol name, perform same mangling as assemble_name and
ASM_OUTPUT_LABELREF, returning result as an IDENTIFIER_NODE. */
DEFHOOK
(mangle_assembler_name,
"Given a symbol @var{name}, perform same mangling as @code{varasm.c}'s\
@code{assemble_name}, but in memory rather than to a file stream, returning\
result as an @code{IDENTIFIER_NODE}. Required for correct LTO symtabs. The\
default implementation calls the @code{TARGET_STRIP_NAME_ENCODING} hook and\
then prepends the @code{USER_LABEL_PREFIX}, if any.",
tree, (const char *name),
default_mangle_assembler_name)
HOOK_VECTOR_END (asm_out)
/* Functions relating to instruction scheduling. All of these
default to null pointers, which haifa-sched.c looks for and handles. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_SCHED_"
HOOK_VECTOR (TARGET_SCHED, sched)
/* Given the current cost, COST, of an insn, INSN, calculate and
return a new cost based on its relationship to DEP_INSN through
the dependence LINK. The default is to make no adjustment. */
DEFHOOK
(adjust_cost,
"This function corrects the value of @var{cost} based on the\n\
relationship between @var{insn} and @var{dep_insn} through the\n\
dependence @var{link}. It should return the new value. The default\n\
is to make no adjustment to @var{cost}. This can be used for example\n\
to specify to the scheduler using the traditional pipeline description\n\
that an output- or anti-dependence does not incur the same cost as a\n\
data-dependence. If the scheduler using the automaton based pipeline\n\
description, the cost of anti-dependence is zero and the cost of\n\
output-dependence is maximum of one and the difference of latency\n\
times of the first and the second insns. If these values are not\n\
acceptable, you could use the hook to modify them too. See also\n\
@pxref{Processor pipeline description}.",
int, (rtx insn, rtx link, rtx dep_insn, int cost), NULL)
/* Adjust the priority of an insn as you see fit. Returns the new priority. */
DEFHOOK
(adjust_priority,
"This hook adjusts the integer scheduling priority @var{priority} of\n\
@var{insn}. It should return the new priority. Increase the priority to\n\
execute @var{insn} earlier, reduce the priority to execute @var{insn}\n\
later. Do not define this hook if you do not need to adjust the\n\
scheduling priorities of insns.",
int, (rtx insn, int priority), NULL)
/* Function which returns the maximum number of insns that can be
scheduled in the same machine cycle. This must be constant
over an entire compilation. The default is 1. */
DEFHOOK
(issue_rate,
"This hook returns the maximum number of instructions that can ever\n\
issue at the same time on the target machine. The default is one.\n\
Although the insn scheduler can define itself the possibility of issue\n\
an insn on the same cycle, the value can serve as an additional\n\
constraint to issue insns on the same simulated processor cycle (see\n\
hooks @samp{TARGET_SCHED_REORDER} and @samp{TARGET_SCHED_REORDER2}).\n\
This value must be constant over the entire compilation. If you need\n\
it to vary depending on what the instructions are, you must use\n\
@samp{TARGET_SCHED_VARIABLE_ISSUE}.",
int, (void), NULL)
/* Calculate how much this insn affects how many more insns we
can emit this cycle. Default is they all cost the same. */
DEFHOOK
(variable_issue,
"This hook is executed by the scheduler after it has scheduled an insn\n\
from the ready list. It should return the number of insns which can\n\
still be issued in the current cycle. The default is\n\
@samp{@w{@var{more} - 1}} for insns other than @code{CLOBBER} and\n\
@code{USE}, which normally are not counted against the issue rate.\n\
You should define this hook if some insns take more machine resources\n\
than others, so that fewer insns can follow them in the same cycle.\n\
@var{file} is either a null pointer, or a stdio stream to write any\n\
debug output to. @var{verbose} is the verbose level provided by\n\
@option{-fsched-verbose-@var{n}}. @var{insn} is the instruction that\n\
was scheduled.",
int, (FILE *file, int verbose, rtx insn, int more), NULL)
/* Initialize machine-dependent scheduling code. */
DEFHOOK
(init,
"This hook is executed by the scheduler at the beginning of each block of\n\
instructions that are to be scheduled. @var{file} is either a null\n\
pointer, or a stdio stream to write any debug output to. @var{verbose}\n\
is the verbose level provided by @option{-fsched-verbose-@var{n}}.\n\
@var{max_ready} is the maximum number of insns in the current scheduling\n\
region that can be live at the same time. This can be used to allocate\n\
scratch space if it is needed, e.g.@: by @samp{TARGET_SCHED_REORDER}.",
void, (FILE *file, int verbose, int max_ready), NULL)
/* Finalize machine-dependent scheduling code. */
DEFHOOK
(finish,
"This hook is executed by the scheduler at the end of each block of\n\
instructions that are to be scheduled. It can be used to perform\n\
cleanup of any actions done by the other scheduling hooks. @var{file}\n\
is either a null pointer, or a stdio stream to write any debug output\n\
to. @var{verbose} is the verbose level provided by\n\
@option{-fsched-verbose-@var{n}}.",
void, (FILE *file, int verbose), NULL)
/* Initialize machine-dependent function wide scheduling code. */
DEFHOOK
(init_global,
"This hook is executed by the scheduler after function level initializations.\n\
@var{file} is either a null pointer, or a stdio stream to write any debug output to.\n\
@var{verbose} is the verbose level provided by @option{-fsched-verbose-@var{n}}.\n\
@var{old_max_uid} is the maximum insn uid when scheduling begins.",
void, (FILE *file, int verbose, int old_max_uid), NULL)
/* Finalize machine-dependent function wide scheduling code. */
DEFHOOK
(finish_global,
"This is the cleanup hook corresponding to @code{TARGET_SCHED_INIT_GLOBAL}.\n\
@var{file} is either a null pointer, or a stdio stream to write any debug output to.\n\
@var{verbose} is the verbose level provided by @option{-fsched-verbose-@var{n}}.",
void, (FILE *file, int verbose), NULL)
/* Reorder insns in a machine-dependent fashion, in two different
places. Default does nothing. */
DEFHOOK
(reorder,
"This hook is executed by the scheduler after it has scheduled the ready\n\
list, to allow the machine description to reorder it (for example to\n\
combine two small instructions together on @samp{VLIW} machines).\n\
@var{file} is either a null pointer, or a stdio stream to write any\n\
debug output to. @var{verbose} is the verbose level provided by\n\
@option{-fsched-verbose-@var{n}}. @var{ready} is a pointer to the ready\n\
list of instructions that are ready to be scheduled. @var{n_readyp} is\n\
a pointer to the number of elements in the ready list. The scheduler\n\
reads the ready list in reverse order, starting with\n\
@var{ready}[@var{*n_readyp} @minus{} 1] and going to @var{ready}[0]. @var{clock}\n\
is the timer tick of the scheduler. You may modify the ready list and\n\
the number of ready insns. The return value is the number of insns that\n\
can issue this cycle; normally this is just @code{issue_rate}. See also\n\
@samp{TARGET_SCHED_REORDER2}.",
int, (FILE *file, int verbose, rtx *ready, int *n_readyp, int clock), NULL)
DEFHOOK
(reorder2,
"Like @samp{TARGET_SCHED_REORDER}, but called at a different time. That\n\
function is called whenever the scheduler starts a new cycle. This one\n\
is called once per iteration over a cycle, immediately after\n\
@samp{TARGET_SCHED_VARIABLE_ISSUE}; it can reorder the ready list and\n\
return the number of insns to be scheduled in the same cycle. Defining\n\
this hook can be useful if there are frequent situations where\n\
scheduling one insn causes other insns to become ready in the same\n\
cycle. These other insns can then be taken into account properly.",
int, (FILE *file, int verbose, rtx *ready, int *n_readyp, int clock), NULL)
DEFHOOK
(macro_fusion_p,
"This hook is used to check whether target platform supports macro fusion.",
bool, (void), NULL)
DEFHOOK
(macro_fusion_pair_p,
"This hook is used to check whether two insns could be macro fused for\n\
target microarchitecture. If this hook returns true for the given insn pair\n\
(@var{condgen} and @var{condjmp}), scheduler will put them into a sched\n\
group, and they will not be scheduled apart.",
bool, (rtx condgen, rtx condjmp), NULL)
/* The following member value is a pointer to a function called
after evaluation forward dependencies of insns in chain given
by two parameter values (head and tail correspondingly). */
DEFHOOK
(dependencies_evaluation_hook,
"This hook is called after evaluation forward dependencies of insns in\n\
chain given by two parameter values (@var{head} and @var{tail}\n\
correspondingly) but before insns scheduling of the insn chain. For\n\
example, it can be used for better insn classification if it requires\n\
analysis of dependencies. This hook can use backward and forward\n\
dependencies of the insn scheduler because they are already\n\
calculated.",
void, (rtx head, rtx tail), NULL)
/* The values of the following four members are pointers to functions
used to simplify the automaton descriptions. dfa_pre_cycle_insn and
dfa_post_cycle_insn give functions returning insns which are used to
change the pipeline hazard recognizer state when the new simulated
processor cycle correspondingly starts and finishes. The function
defined by init_dfa_pre_cycle_insn and init_dfa_post_cycle_insn are
used to initialize the corresponding insns. The default values of
the members result in not changing the automaton state when the
new simulated processor cycle correspondingly starts and finishes. */
DEFHOOK
(init_dfa_pre_cycle_insn,
"The hook can be used to initialize data used by the previous hook.",
void, (void), NULL)
DEFHOOK
(dfa_pre_cycle_insn,
"The hook returns an RTL insn. The automaton state used in the\n\
pipeline hazard recognizer is changed as if the insn were scheduled\n\
when the new simulated processor cycle starts. Usage of the hook may\n\
simplify the automaton pipeline description for some @acronym{VLIW}\n\
processors. If the hook is defined, it is used only for the automaton\n\
based pipeline description. The default is not to change the state\n\
when the new simulated processor cycle starts.",
rtx, (void), NULL)
DEFHOOK
(init_dfa_post_cycle_insn,
"The hook is analogous to @samp{TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN} but\n\
used to initialize data used by the previous hook.",
void, (void), NULL)
DEFHOOK
(dfa_post_cycle_insn,
"The hook is analogous to @samp{TARGET_SCHED_DFA_PRE_CYCLE_INSN} but used\n\
to changed the state as if the insn were scheduled when the new\n\
simulated processor cycle finishes.",
rtx, (void), NULL)
/* The values of the following two members are pointers to
functions used to simplify the automaton descriptions.
dfa_pre_advance_cycle and dfa_post_advance_cycle are getting called
immediately before and after cycle is advanced. */
DEFHOOK
(dfa_pre_advance_cycle,
"The hook to notify target that the current simulated cycle is about to finish.\n\
The hook is analogous to @samp{TARGET_SCHED_DFA_PRE_CYCLE_INSN} but used\n\
to change the state in more complicated situations - e.g., when advancing\n\
state on a single insn is not enough.",
void, (void), NULL)
DEFHOOK
(dfa_post_advance_cycle,
"The hook to notify target that new simulated cycle has just started.\n\
The hook is analogous to @samp{TARGET_SCHED_DFA_POST_CYCLE_INSN} but used\n\
to change the state in more complicated situations - e.g., when advancing\n\
state on a single insn is not enough.",
void, (void), NULL)
/* The following member value is a pointer to a function returning value
which defines how many insns in queue `ready' will we try for
multi-pass scheduling. If the member value is nonzero and the
function returns positive value, the DFA based scheduler will make
multi-pass scheduling for the first cycle. In other words, we will
try to choose ready insn which permits to start maximum number of
insns on the same cycle. */
DEFHOOK
(first_cycle_multipass_dfa_lookahead,
"This hook controls better choosing an insn from the ready insn queue\n\
for the @acronym{DFA}-based insn scheduler. Usually the scheduler\n\
chooses the first insn from the queue. If the hook returns a positive\n\
value, an additional scheduler code tries all permutations of\n\
@samp{TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD ()}\n\
subsequent ready insns to choose an insn whose issue will result in\n\
maximal number of issued insns on the same cycle. For the\n\
@acronym{VLIW} processor, the code could actually solve the problem of\n\
packing simple insns into the @acronym{VLIW} insn. Of course, if the\n\
rules of @acronym{VLIW} packing are described in the automaton.\n\
\n\
This code also could be used for superscalar @acronym{RISC}\n\
processors. Let us consider a superscalar @acronym{RISC} processor\n\
with 3 pipelines. Some insns can be executed in pipelines @var{A} or\n\
@var{B}, some insns can be executed only in pipelines @var{B} or\n\
@var{C}, and one insn can be executed in pipeline @var{B}. The\n\
processor may issue the 1st insn into @var{A} and the 2nd one into\n\
@var{B}. In this case, the 3rd insn will wait for freeing @var{B}\n\
until the next cycle. If the scheduler issues the 3rd insn the first,\n\
the processor could issue all 3 insns per cycle.\n\
\n\
Actually this code demonstrates advantages of the automaton based\n\
pipeline hazard recognizer. We try quickly and easy many insn\n\
schedules to choose the best one.\n\
\n\
The default is no multipass scheduling.",
int, (void), NULL)
/* The following member value is pointer to a function controlling
what insns from the ready insn queue will be considered for the
multipass insn scheduling. If the hook returns zero for insn
passed as the parameter, the insn will be not chosen to be issued. */
DEFHOOK
(first_cycle_multipass_dfa_lookahead_guard,
"\n\
This hook controls what insns from the ready insn queue will be\n\
considered for the multipass insn scheduling. If the hook returns\n\
zero for @var{insn}, the insn will be not chosen to\n\
be issued.\n\
\n\
The default is that any ready insns can be chosen to be issued.",
int, (rtx insn), NULL)
/* This hook prepares the target for a new round of multipass
scheduling.
DATA is a pointer to target-specific data used for multipass scheduling.
READY_TRY and N_READY represent the current state of search in the
optimization space. The target can filter out instructions that
should not be tried during current round by setting corresponding
elements in READY_TRY to non-zero.
FIRST_CYCLE_INSN_P is true if this is the first round of multipass
scheduling on current cycle. */
DEFHOOK
(first_cycle_multipass_begin,
"This hook prepares the target backend for a new round of multipass\n\
scheduling.",
void, (void *data, char *ready_try, int n_ready, bool first_cycle_insn_p),
NULL)
/* This hook is called when multipass scheduling evaluates instruction INSN.
DATA is a pointer to target-specific data that can be used to record effects
of INSN on CPU that are not described in DFA.
READY_TRY and N_READY represent the current state of search in the
optimization space. The target can filter out instructions that
should not be tried after issuing INSN by setting corresponding
elements in READY_TRY to non-zero.
INSN is the instruction being evaluated.
PREV_DATA is a pointer to target-specific data corresponding
to a state before issuing INSN. */
DEFHOOK
(first_cycle_multipass_issue,
"This hook is called when multipass scheduling evaluates instruction INSN.",
void, (void *data, char *ready_try, int n_ready, rtx insn,
const void *prev_data), NULL)
/* This hook is called when multipass scheduling backtracks from evaluation of
instruction corresponding to DATA.
DATA is a pointer to target-specific data that stores the effects
of instruction from which the algorithm backtracks on CPU that are not
described in DFA.
READY_TRY and N_READY represent the current state of search in the
optimization space. The target can filter out instructions that
should not be tried after issuing INSN by setting corresponding
elements in READY_TRY to non-zero. */
DEFHOOK
(first_cycle_multipass_backtrack,
"This is called when multipass scheduling backtracks from evaluation of\n\
an instruction.",
void, (const void *data, char *ready_try, int n_ready), NULL)
/* This hook notifies the target about the result of the concluded current
round of multipass scheduling.
DATA is a pointer.
If DATA is non-NULL it points to target-specific data used for multipass
scheduling which corresponds to instruction at the start of the chain of
the winning solution. DATA is NULL when multipass scheduling cannot find
a good enough solution on current cycle and decides to retry later,
usually after advancing the cycle count. */
DEFHOOK
(first_cycle_multipass_end,
"This hook notifies the target about the result of the concluded current\n\
round of multipass scheduling.",
void, (const void *data), NULL)
/* This hook is called to initialize target-specific data for multipass
scheduling after it has been allocated.
DATA is a pointer to target-specific data that stores the effects
of instruction from which the algorithm backtracks on CPU that are not
described in DFA. */
DEFHOOK
(first_cycle_multipass_init,
"This hook initializes target-specific data used in multipass scheduling.",
void, (void *data), NULL)
/* This hook is called to finalize target-specific data for multipass
scheduling before it is deallocated.
DATA is a pointer to target-specific data that stores the effects
of instruction from which the algorithm backtracks on CPU that are not
described in DFA. */
DEFHOOK
(first_cycle_multipass_fini,
"This hook finalizes target-specific data used in multipass scheduling.",
void, (void *data), NULL)
/* The following member value is pointer to a function called by
the insn scheduler before issuing insn passed as the third
parameter on given cycle. If the hook returns nonzero, the
insn is not issued on given processors cycle. Instead of that,
the processor cycle is advanced. If the value passed through
the last parameter is zero, the insn ready queue is not sorted
on the new cycle start as usually. The first parameter passes
file for debugging output. The second one passes the scheduler
verbose level of the debugging output. The forth and the fifth
parameter values are correspondingly processor cycle on which
the previous insn has been issued and the current processor cycle. */
DEFHOOK
(dfa_new_cycle,
"This hook is called by the insn scheduler before issuing @var{insn}\n\
on cycle @var{clock}. If the hook returns nonzero,\n\
@var{insn} is not issued on this processor cycle. Instead,\n\
the processor cycle is advanced. If *@var{sort_p}\n\
is zero, the insn ready queue is not sorted on the new cycle\n\
start as usually. @var{dump} and @var{verbose} specify the file and\n\
verbosity level to use for debugging output.\n\
@var{last_clock} and @var{clock} are, respectively, the\n\
processor cycle on which the previous insn has been issued,\n\
and the current processor cycle.",
int, (FILE *dump, int verbose, rtx insn, int last_clock,
int clock, int *sort_p),
NULL)
/* The following member value is a pointer to a function called by the
insn scheduler. It should return true if there exists a dependence
which is considered costly by the target, between the insn
DEP_PRO (&_DEP), and the insn DEP_CON (&_DEP). The first parameter is
the dep that represents the dependence between the two insns. The
second argument is the cost of the dependence as estimated by
the scheduler. The last argument is the distance in cycles
between the already scheduled insn (first parameter) and the
second insn (second parameter). */
DEFHOOK
(is_costly_dependence,
"This hook is used to define which dependences are considered costly by\n\
the target, so costly that it is not advisable to schedule the insns that\n\
are involved in the dependence too close to one another. The parameters\n\
to this hook are as follows: The first parameter @var{_dep} is the dependence\n\
being evaluated. The second parameter @var{cost} is the cost of the\n\
dependence as estimated by the scheduler, and the third\n\
parameter @var{distance} is the distance in cycles between the two insns.\n\
The hook returns @code{true} if considering the distance between the two\n\
insns the dependence between them is considered costly by the target,\n\
and @code{false} otherwise.\n\
\n\
Defining this hook can be useful in multiple-issue out-of-order machines,\n\
where (a) it's practically hopeless to predict the actual data/resource\n\
delays, however: (b) there's a better chance to predict the actual grouping\n\
that will be formed, and (c) correctly emulating the grouping can be very\n\
important. In such targets one may want to allow issuing dependent insns\n\
closer to one another---i.e., closer than the dependence distance; however,\n\
not in cases of ``costly dependences'', which this hooks allows to define.",
bool, (struct _dep *_dep, int cost, int distance), NULL)
DEFHOOK_UNDOC
(adjust_cost_2,
"Given the current cost, @var{cost}, of an insn, @var{insn}, calculate and\
return a new cost based on its relationship to @var{dep_insn} through the\
dependence of weakness @var{dw}. The default is to make no adjustment.",
int, (rtx insn, int dep_type1, rtx dep_insn, int cost, unsigned int dw), NULL)
/* The following member value is a pointer to a function called
by the insn scheduler. This hook is called to notify the backend
that new instructions were emitted. */
DEFHOOK
(h_i_d_extended,
"This hook is called by the insn scheduler after emitting a new instruction to\n\
the instruction stream. The hook notifies a target backend to extend its\n\
per instruction data structures.",
void, (void), NULL)
/* Next 5 functions are for multi-point scheduling. */
/* Allocate memory for scheduler context. */
DEFHOOK
(alloc_sched_context,
"Return a pointer to a store large enough to hold target scheduling context.",
void *, (void), NULL)
/* Fills the context from the local machine scheduler context. */
DEFHOOK
(init_sched_context,
"Initialize store pointed to by @var{tc} to hold target scheduling context.\n\
It @var{clean_p} is true then initialize @var{tc} as if scheduler is at the\n\
beginning of the block. Otherwise, copy the current context into @var{tc}.",
void, (void *tc, bool clean_p), NULL)
/* Sets local machine scheduler context to a saved value. */
DEFHOOK
(set_sched_context,
"Copy target scheduling context pointed to by @var{tc} to the current context.",
void, (void *tc), NULL)
/* Clears a scheduler context so it becomes like after init. */
DEFHOOK
(clear_sched_context,
"Deallocate internal data in target scheduling context pointed to by @var{tc}.",
void, (void *tc), NULL)
/* Frees the scheduler context. */
DEFHOOK
(free_sched_context,
"Deallocate a store for target scheduling context pointed to by @var{tc}.",
void, (void *tc), NULL)
/* The following member value is a pointer to a function called
by the insn scheduler.
The first parameter is an instruction, the second parameter is the type
of the requested speculation, and the third parameter is a pointer to the
speculative pattern of the corresponding type (set if return value == 1).
It should return
-1, if there is no pattern, that will satisfy the requested speculation type,
0, if current pattern satisfies the requested speculation type,
1, if pattern of the instruction should be changed to the newly
generated one. */
DEFHOOK
(speculate_insn,
"This hook is called by the insn scheduler when @var{insn} has only\n\
speculative dependencies and therefore can be scheduled speculatively.\n\
The hook is used to check if the pattern of @var{insn} has a speculative\n\
version and, in case of successful check, to generate that speculative\n\
pattern. The hook should return 1, if the instruction has a speculative form,\n\
or @minus{}1, if it doesn't. @var{request} describes the type of requested\n\
speculation. If the return value equals 1 then @var{new_pat} is assigned\n\
the generated speculative pattern.",
int, (rtx insn, unsigned int dep_status, rtx *new_pat), NULL)
/* The following member value is a pointer to a function called
by the insn scheduler. It should return true if the check instruction
passed as the parameter needs a recovery block. */
DEFHOOK
(needs_block_p,
"This hook is called by the insn scheduler during generation of recovery code\n\
for @var{insn}. It should return @code{true}, if the corresponding check\n\
instruction should branch to recovery code, or @code{false} otherwise.",
bool, (unsigned int dep_status), NULL)
/* The following member value is a pointer to a function called
by the insn scheduler. It should return a pattern for the check
instruction.
The first parameter is a speculative instruction, the second parameter
is the label of the corresponding recovery block (or null, if it is a
simple check). The third parameter is the kind of speculation that
is being performed. */
DEFHOOK
(gen_spec_check,
"This hook is called by the insn scheduler to generate a pattern for recovery\n\
check instruction. If @var{mutate_p} is zero, then @var{insn} is a\n\
speculative instruction for which the check should be generated.\n\
@var{label} is either a label of a basic block, where recovery code should\n\
be emitted, or a null pointer, when requested check doesn't branch to\n\
recovery code (a simple check). If @var{mutate_p} is nonzero, then\n\
a pattern for a branchy check corresponding to a simple check denoted by\n\
@var{insn} should be generated. In this case @var{label} can't be null.",
rtx, (rtx insn, rtx label, unsigned int ds), NULL)
/* The following member value is a pointer to a function controlling
what insns from the ready insn queue will be considered for the
multipass insn scheduling. If the hook returns zero for the insn
passed as the parameter, the insn will not be chosen to be
issued. This hook is used to discard speculative instructions,
that stand at the first position of the ready list. */
DEFHOOK
(first_cycle_multipass_dfa_lookahead_guard_spec,
"This hook is used as a workaround for\n\
@samp{TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD} not being\n\
called on the first instruction of the ready list. The hook is used to\n\
discard speculative instructions that stand first in the ready list from\n\
being scheduled on the current cycle. If the hook returns @code{false},\n\
@var{insn} will not be chosen to be issued.\n\
For non-speculative instructions,\n\
the hook should always return @code{true}. For example, in the ia64 backend\n\
the hook is used to cancel data speculative insns when the ALAT table\n\
is nearly full.",
bool, (const_rtx insn), NULL)
/* The following member value is a pointer to a function that provides
information about the speculation capabilities of the target.
The parameter is a pointer to spec_info variable. */
DEFHOOK
(set_sched_flags,
"This hook is used by the insn scheduler to find out what features should be\n\
enabled/used.\n\
The structure *@var{spec_info} should be filled in by the target.\n\
The structure describes speculation types that can be used in the scheduler.",
void, (struct spec_info_def *spec_info), NULL)
DEFHOOK_UNDOC
(get_insn_spec_ds,
"Return speculation types of instruction @var{insn}.",
unsigned int, (rtx insn), NULL)
DEFHOOK_UNDOC
(get_insn_checked_ds,
"Return speculation types that are checked for instruction @var{insn}",
unsigned int, (rtx insn), NULL)
DEFHOOK_UNDOC
(skip_rtx_p,
"Return bool if rtx scanning should just skip current layer and\
advance to the inner rtxes.",
bool, (const_rtx x), NULL)
/* The following member value is a pointer to a function that provides
information about the target resource-based lower bound which is
used by the swing modulo scheduler. The parameter is a pointer
to ddg variable. */
DEFHOOK
(sms_res_mii,
"This hook is called by the swing modulo scheduler to calculate a\n\
resource-based lower bound which is based on the resources available in\n\
the machine and the resources required by each instruction. The target\n\
backend can use @var{g} to calculate such bound. A very simple lower\n\
bound will be used in case this hook is not implemented: the total number\n\
of instructions divided by the issue rate.",
int, (struct ddg *g), NULL)
/* The following member value is a function that initializes dispatch
schedling and adds instructions to dispatch window according to its
parameters. */
DEFHOOK
(dispatch_do,
"This hook is called by Haifa Scheduler. It performs the operation specified\n\
in its second parameter.",
void, (rtx insn, int x),
hook_void_rtx_int)
/* The following member value is a a function that returns true is
dispatch schedling is supported in hardware and condition passed
as the second parameter is true. */
DEFHOOK
(dispatch,
"This hook is called by Haifa Scheduler. It returns true if dispatch scheduling\n\
is supported in hardware and the condition specified in the parameter is true.",
bool, (rtx insn, int x),
hook_bool_rtx_int_false)
DEFHOOKPOD
(exposed_pipeline,
"True if the processor has an exposed pipeline, which means that not just\n\
the order of instructions is important for correctness when scheduling, but\n\
also the latencies of operations.",
bool, false)
/* The following member value is a function that returns number
of operations reassociator should try to put in parallel for
statements of the given type. By default 1 is used. */
DEFHOOK
(reassociation_width,
"This hook is called by tree reassociator to determine a level of\n\
parallelism required in output calculations chain.",
int, (unsigned int opc, enum machine_mode mode),
hook_int_uint_mode_1)
HOOK_VECTOR_END (sched)
/* Functions relating to OpenMP and Cilk Plus SIMD clones. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_SIMD_CLONE_"
HOOK_VECTOR (TARGET_SIMD_CLONE, simd_clone)
DEFHOOK
(compute_vecsize_and_simdlen,
"This hook should set @var{vecsize_mangle}, @var{vecsize_int}, @var{vecsize_float}\n\
fields in @var{simd_clone} structure pointed by @var{clone_info} argument and also\n\
@var{simdlen} field if it was previously 0.\n\
The hook should return 0 if SIMD clones shouldn't be emitted,\n\
or number of @var{vecsize_mangle} variants that should be emitted.",
int, (struct cgraph_node *, struct cgraph_simd_clone *, tree, int), NULL)
DEFHOOK
(adjust,
"This hook should add implicit @code{attribute(target(\"...\"))} attribute\n\
to SIMD clone @var{node} if needed.",
void, (struct cgraph_node *), NULL)
DEFHOOK
(usable,
"This hook should return -1 if SIMD clone @var{node} shouldn't be used\n\
in vectorized loops in current function, or non-negative number if it is\n\
usable. In that case, the smaller the number is, the more desirable it is\n\
to use it.",
int, (struct cgraph_node *), NULL)
HOOK_VECTOR_END (simd_clone)
/* Functions relating to vectorization. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_VECTORIZE_"
HOOK_VECTOR (TARGET_VECTORIZE, vectorize)
/* The following member value is a pointer to a function called
by the vectorizer, and return the decl of the target builtin
function. */
DEFHOOK
(builtin_mask_for_load,
"This hook should return the DECL of a function @var{f} that given an\n\
address @var{addr} as an argument returns a mask @var{m} that can be\n\
used to extract from two vectors the relevant data that resides in\n\
@var{addr} in case @var{addr} is not properly aligned.\n\
\n\
The autovectorizer, when vectorizing a load operation from an address\n\
@var{addr} that may be unaligned, will generate two vector loads from\n\
the two aligned addresses around @var{addr}. It then generates a\n\
@code{REALIGN_LOAD} operation to extract the relevant data from the\n\
two loaded vectors. The first two arguments to @code{REALIGN_LOAD},\n\
@var{v1} and @var{v2}, are the two vectors, each of size @var{VS}, and\n\
the third argument, @var{OFF}, defines how the data will be extracted\n\
from these two vectors: if @var{OFF} is 0, then the returned vector is\n\
@var{v2}; otherwise, the returned vector is composed from the last\n\
@var{VS}-@var{OFF} elements of @var{v1} concatenated to the first\n\
@var{OFF} elements of @var{v2}.\n\
\n\
If this hook is defined, the autovectorizer will generate a call\n\
to @var{f} (using the DECL tree that this hook returns) and will\n\
use the return value of @var{f} as the argument @var{OFF} to\n\
@code{REALIGN_LOAD}. Therefore, the mask @var{m} returned by @var{f}\n\
should comply with the semantics expected by @code{REALIGN_LOAD}\n\
described above.\n\
If this hook is not defined, then @var{addr} will be used as\n\
the argument @var{OFF} to @code{REALIGN_LOAD}, in which case the low\n\
log2(@var{VS}) @minus{} 1 bits of @var{addr} will be considered.",
tree, (void), NULL)
/* Returns a code for builtin that realizes vectorized version of
function, or NULL_TREE if not available. */
DEFHOOK
(builtin_vectorized_function,
"This hook should return the decl of a function that implements the\n\
vectorized variant of the builtin function with builtin function code\n\
@var{code} or @code{NULL_TREE} if such a function is not available.\n\
The value of @var{fndecl} is the builtin function declaration. The\n\
return type of the vectorized function shall be of vector type\n\
@var{vec_type_out} and the argument types should be @var{vec_type_in}.",
tree, (tree fndecl, tree vec_type_out, tree vec_type_in),
default_builtin_vectorized_function)
/* Returns a function declaration for a builtin that realizes the
vector conversion, or NULL_TREE if not available. */
DEFHOOK
(builtin_conversion,
"This hook should return the DECL of a function that implements conversion of the\n\
input vector of type @var{src_type} to type @var{dest_type}.\n\
The value of @var{code} is one of the enumerators in @code{enum tree_code} and\n\
specifies how the conversion is to be applied\n\
(truncation, rounding, etc.).\n\
\n\
If this hook is defined, the autovectorizer will use the\n\
@code{TARGET_VECTORIZE_BUILTIN_CONVERSION} target hook when vectorizing\n\
conversion. Otherwise, it will return @code{NULL_TREE}.",
tree, (unsigned code, tree dest_type, tree src_type),
default_builtin_vectorized_conversion)
/* Cost of different vector/scalar statements in vectorization cost
model. In case of misaligned vector loads and stores the cost depends
on the data type and misalignment value. */
DEFHOOK
(builtin_vectorization_cost,
"Returns cost of different scalar or vector statements for vectorization cost model.\n\
For vector memory operations the cost may depend on type (@var{vectype}) and\n\
misalignment value (@var{misalign}).",
int, (enum vect_cost_for_stmt type_of_cost, tree vectype, int misalign),
default_builtin_vectorization_cost)
/* Return true if vector alignment is reachable (by peeling N
iterations) for the given type. */
DEFHOOK
(vector_alignment_reachable,
"Return true if vector alignment is reachable (by peeling N iterations) for the given type.",
bool, (const_tree type, bool is_packed),
default_builtin_vector_alignment_reachable)
/* Return true if a vector created for vec_perm_const is valid.
A NULL indicates that all constants are valid permutations. */
DEFHOOK
(vec_perm_const_ok,
"Return true if a vector created for @code{vec_perm_const} is valid.",
bool, (enum machine_mode, const unsigned char *sel),
NULL)
/* Return true if the target supports misaligned store/load of a
specific factor denoted in the third parameter. The last parameter
is true if the access is defined in a packed struct. */
DEFHOOK
(support_vector_misalignment,
"This hook should return true if the target supports misaligned vector\n\
store/load of a specific factor denoted in the @var{misalignment}\n\
parameter. The vector store/load should be of machine mode @var{mode} and\n\
the elements in the vectors should be of type @var{type}. @var{is_packed}\n\
parameter is true if the memory access is defined in a packed struct.",
bool,
(enum machine_mode mode, const_tree type, int misalignment, bool is_packed),
default_builtin_support_vector_misalignment)
/* Return the builtin decl needed to load a vector of TYPE. */
DEFHOOK
(builtin_tm_load,
"This hook should return the built-in decl needed to load a vector of the "
"given type within a transaction.",
tree,
(tree),
default_builtin_tm_load_store)
/* Return the builtin decl needed to store a vector of TYPE. */
DEFHOOK
(builtin_tm_store,
"This hook should return the built-in decl needed to store a vector of the "
"given type within a transaction.",
tree,
(tree),
default_builtin_tm_load_store)
/* Returns the preferred mode for SIMD operations for the specified
scalar mode. */
DEFHOOK
(preferred_simd_mode,
"This hook should return the preferred mode for vectorizing scalar\n\
mode @var{mode}. The default is\n\
equal to @code{word_mode}, because the vectorizer can do some\n\
transformations even in absence of specialized @acronym{SIMD} hardware.",
enum machine_mode,
(enum machine_mode mode),
default_preferred_simd_mode)
/* Returns a mask of vector sizes to iterate over when auto-vectorizing
after processing the preferred one derived from preferred_simd_mode. */
DEFHOOK
(autovectorize_vector_sizes,
"This hook should return a mask of sizes that should be iterated over\n\
after trying to autovectorize using the vector size derived from the\n\
mode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}.\n\
The default is zero which means to not iterate over other vector sizes.",
unsigned int,
(void),
default_autovectorize_vector_sizes)
/* Target builtin that implements vector gather operation. */
DEFHOOK
(builtin_gather,
"Target builtin that implements vector gather operation. @var{mem_vectype}\n\
is the vector type of the load and @var{index_type} is scalar type of\n\
the index, scaled by @var{scale}.\n\
The default is @code{NULL_TREE} which means to not vectorize gather\n\
loads.",
tree,
(const_tree mem_vectype, const_tree index_type, int scale),
NULL)
/* Target function to initialize the cost model for a loop or block. */
DEFHOOK
(init_cost,
"This hook should initialize target-specific data structures in preparation "
"for modeling the costs of vectorizing a loop or basic block. The default "
"allocates three unsigned integers for accumulating costs for the prologue, "
"body, and epilogue of the loop or basic block. If @var{loop_info} is "
"non-NULL, it identifies the loop being vectorized; otherwise a single block "
"is being vectorized.",
void *,
(struct loop *loop_info),
default_init_cost)
/* Target function to record N statements of the given kind using the
given vector type within the cost model data for the current loop or
block. */
DEFHOOK
(add_stmt_cost,
"This hook should update the target-specific @var{data} in response to "
"adding @var{count} copies of the given @var{kind} of statement to a "
"loop or basic block. The default adds the builtin vectorizer cost for "
"the copies of the statement to the accumulator specified by @var{where}, "
"(the prologue, body, or epilogue) and returns the amount added. The "
"return value should be viewed as a tentative cost that may later be "
"revised.",
unsigned,
(void *data, int count, enum vect_cost_for_stmt kind,
struct _stmt_vec_info *stmt_info, int misalign,
enum vect_cost_model_location where),
default_add_stmt_cost)
/* Target function to calculate the total cost of the current vectorized
loop or block. */
DEFHOOK
(finish_cost,
"This hook should complete calculations of the cost of vectorizing a loop "
"or basic block based on @var{data}, and return the prologue, body, and "
"epilogue costs as unsigned integers. The default returns the value of "
"the three accumulators.",
void,
(void *data, unsigned *prologue_cost, unsigned *body_cost,
unsigned *epilogue_cost),
default_finish_cost)
/* Function to delete target-specific cost modeling data. */
DEFHOOK
(destroy_cost_data,
"This hook should release @var{data} and any related data structures "
"allocated by TARGET_VECTORIZE_INIT_COST. The default releases the "
"accumulator.",
void,
(void *data),
default_destroy_cost_data)
HOOK_VECTOR_END (vectorize)
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_"
/* Allow target specific overriding of option settings after options have
been changed by an attribute or pragma or when it is reset at the
end of the code affected by an attribute or pragma. */
DEFHOOK
(override_options_after_change,
"This target function is similar to the hook @code{TARGET_OPTION_OVERRIDE}\n\
but is called when the optimize level is changed via an attribute or\n\
pragma or when it is reset at the end of the code affected by the\n\
attribute or pragma. It is not called at the beginning of compilation\n\
when @code{TARGET_OPTION_OVERRIDE} is called so if you want to perform these\n\
actions then, you should have @code{TARGET_OPTION_OVERRIDE} call\n\
@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}.",
void, (void),
hook_void_void)
DEFHOOK_UNDOC
(eh_return_filter_mode,
"Return machine mode for filter value.",
enum machine_mode, (void),
default_eh_return_filter_mode)
/* Return machine mode for libgcc expanded cmp instructions. */
DEFHOOK
(libgcc_cmp_return_mode,
"This target hook should return the mode to be used for the return value\n\
of compare instructions expanded to libgcc calls. If not defined\n\
@code{word_mode} is returned which is the right choice for a majority of\n\
targets.",
enum machine_mode, (void),
default_libgcc_cmp_return_mode)
/* Return machine mode for libgcc expanded shift instructions. */
DEFHOOK
(libgcc_shift_count_mode,
"This target hook should return the mode to be used for the shift count operand\n\
of shift instructions expanded to libgcc calls. If not defined\n\
@code{word_mode} is returned which is the right choice for a majority of\n\
targets.",
enum machine_mode, (void),
default_libgcc_shift_count_mode)
/* Return machine mode to be used for _Unwind_Word type. */
DEFHOOK
(unwind_word_mode,
"Return machine mode to be used for @code{_Unwind_Word} type.\n\
The default is to use @code{word_mode}.",
enum machine_mode, (void),
default_unwind_word_mode)
/* Given two decls, merge their attributes and return the result. */
DEFHOOK
(merge_decl_attributes,
"Define this target hook if the merging of decl attributes needs special\n\
handling. If defined, the result is a list of the combined\n\
@code{DECL_ATTRIBUTES} of @var{olddecl} and @var{newdecl}.\n\
@var{newdecl} is a duplicate declaration of @var{olddecl}. Examples of\n\
when this is needed are when one attribute overrides another, or when an\n\
attribute is nullified by a subsequent definition. This function may\n\
call @code{merge_attributes} to handle machine-independent merging.\n\
\n\
@findex TARGET_DLLIMPORT_DECL_ATTRIBUTES\n\
If the only target-specific handling you require is @samp{dllimport}\n\
for Microsoft Windows targets, you should define the macro\n\
@code{TARGET_DLLIMPORT_DECL_ATTRIBUTES} to @code{1}. The compiler\n\
will then define a function called\n\
@code{merge_dllimport_decl_attributes} which can then be defined as\n\
the expansion of @code{TARGET_MERGE_DECL_ATTRIBUTES}. You can also\n\
add @code{handle_dll_attribute} in the attribute table for your port\n\
to perform initial processing of the @samp{dllimport} and\n\
@samp{dllexport} attributes. This is done in @file{i386/cygwin.h} and\n\
@file{i386/i386.c}, for example.",
tree, (tree olddecl, tree newdecl),
merge_decl_attributes)
/* Given two types, merge their attributes and return the result. */
DEFHOOK
(merge_type_attributes,
"Define this target hook if the merging of type attributes needs special\n\
handling. If defined, the result is a list of the combined\n\
@code{TYPE_ATTRIBUTES} of @var{type1} and @var{type2}. It is assumed\n\
that @code{comptypes} has already been called and returned 1. This\n\
function may call @code{merge_attributes} to handle machine-independent\n\
merging.",
tree, (tree type1, tree type2),
merge_type_attributes)
/* Table of machine attributes and functions to handle them.
Ignored if NULL. */
DEFHOOKPOD
(attribute_table,
"If defined, this target hook points to an array of @samp{struct\n\
attribute_spec} (defined in @file{tree.h}) specifying the machine\n\
specific attributes for this target and some of the restrictions on the\n\
entities to which these attributes are applied and the arguments they\n\
take.",
const struct attribute_spec *, NULL)
/* Return true iff attribute NAME expects a plain identifier as its first
argument. */
DEFHOOK
(attribute_takes_identifier_p,
"If defined, this target hook is a function which returns true if the\n\
machine-specific attribute named @var{name} expects an identifier\n\
given as its first argument to be passed on as a plain identifier, not\n\
subjected to name lookup. If this is not defined, the default is\n\
false for all machine-specific attributes.",
bool, (const_tree name),
hook_bool_const_tree_false)
/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
one if they are compatible and two if they are nearly compatible
(which causes a warning to be generated). */
DEFHOOK
(comp_type_attributes,
"If defined, this target hook is a function which returns zero if the attributes on\n\
@var{type1} and @var{type2} are incompatible, one if they are compatible,\n\
and two if they are nearly compatible (which causes a warning to be\n\
generated). If this is not defined, machine-specific attributes are\n\
supposed always to be compatible.",
int, (const_tree type1, const_tree type2),
hook_int_const_tree_const_tree_1)
/* Assign default attributes to the newly defined TYPE. */
DEFHOOK
(set_default_type_attributes,
"If defined, this target hook is a function which assigns default attributes to\n\
the newly defined @var{type}.",
void, (tree type),
hook_void_tree)
/* Insert attributes on the newly created DECL. */
DEFHOOK
(insert_attributes,
"Define this target hook if you want to be able to add attributes to a decl\n\
when it is being created. This is normally useful for back ends which\n\
wish to implement a pragma by using the attributes which correspond to\n\
the pragma's effect. The @var{node} argument is the decl which is being\n\
created. The @var{attr_ptr} argument is a pointer to the attribute list\n\
for this decl. The list itself should not be modified, since it may be\n\
shared with other decls, but attributes may be chained on the head of\n\
the list and @code{*@var{attr_ptr}} modified to point to the new\n\
attributes, or a copy of the list may be made if further changes are\n\
needed.",
void, (tree node, tree *attr_ptr),
hook_void_tree_treeptr)
/* Return true if FNDECL (which has at least one machine attribute)
can be inlined despite its machine attributes, false otherwise. */
DEFHOOK
(function_attribute_inlinable_p,
"@cindex inlining\n\
This target hook returns @code{true} if it is OK to inline @var{fndecl}\n\
into the current function, despite its having target-specific\n\
attributes, @code{false} otherwise. By default, if a function has a\n\
target specific attribute attached to it, it will not be inlined.",
bool, (const_tree fndecl),
hook_bool_const_tree_false)
/* Return true if bitfields in RECORD_TYPE should follow the
Microsoft Visual C++ bitfield layout rules. */
DEFHOOK
(ms_bitfield_layout_p,
"This target hook returns @code{true} if bit-fields in the given\n\
@var{record_type} are to be laid out following the rules of Microsoft\n\
Visual C/C++, namely: (i) a bit-field won't share the same storage\n\
unit with the previous bit-field if their underlying types have\n\
different sizes, and the bit-field will be aligned to the highest\n\
alignment of the underlying types of itself and of the previous\n\
bit-field; (ii) a zero-sized bit-field will affect the alignment of\n\
the whole enclosing structure, even if it is unnamed; except that\n\
(iii) a zero-sized bit-field will be disregarded unless it follows\n\
another bit-field of nonzero size. If this hook returns @code{true},\n\
other macros that control bit-field layout are ignored.\n\
\n\
When a bit-field is inserted into a packed record, the whole size\n\
of the underlying type is used by one or more same-size adjacent\n\
bit-fields (that is, if its long:3, 32 bits is used in the record,\n\
and any additional adjacent long bit-fields are packed into the same\n\
chunk of 32 bits. However, if the size changes, a new field of that\n\
size is allocated). In an unpacked record, this is the same as using\n\
alignment, but not equivalent when packing.\n\
\n\
If both MS bit-fields and @samp{__attribute__((packed))} are used,\n\
the latter will take precedence. If @samp{__attribute__((packed))} is\n\
used on a single field when MS bit-fields are in use, it will take\n\
precedence for that field, but the alignment of the rest of the structure\n\
may affect its placement.",
bool, (const_tree record_type),
hook_bool_const_tree_false)
/* For now this is only an interface to WORDS_BIG_ENDIAN for
target-independent code like the front ends, need performance testing
before switching completely to the target hook. */
DEFHOOK_UNDOC
(words_big_endian,
"",
bool, (void),
targhook_words_big_endian)
/* Likewise for FLOAT_WORDS_BIG_ENDIAN. */
DEFHOOK_UNDOC
(float_words_big_endian,
"",
bool, (void),
targhook_float_words_big_endian)
DEFHOOK
(float_exceptions_rounding_supported_p,
"Returns true if the target supports IEEE 754 floating-point exceptions\
and rounding modes, false otherwise. This is intended to relate to the\
@code{float} and @code{double} types, but not necessarily @code{long double}.\
By default, returns true if the @code{adddf3} instruction pattern is\
available and false otherwise, on the assumption that hardware floating\
point supports exceptions and rounding modes but software floating point\
does not.",
bool, (void),
default_float_exceptions_rounding_supported_p)
/* True if the target supports decimal floating point. */
DEFHOOK
(decimal_float_supported_p,
"Returns true if the target supports decimal floating point.",
bool, (void),
default_decimal_float_supported_p)
/* True if the target supports fixed-point. */
DEFHOOK
(fixed_point_supported_p,
"Returns true if the target supports fixed-point arithmetic.",
bool, (void),
default_fixed_point_supported_p)
/* Return true if anonymous bitfields affect structure alignment. */
DEFHOOK
(align_anon_bitfield,
"When @code{PCC_BITFIELD_TYPE_MATTERS} is true this hook will determine\n\
whether unnamed bitfields affect the alignment of the containing\n\
structure. The hook should return true if the structure should inherit\n\
the alignment requirements of an unnamed bitfield's type.",
bool, (void),
hook_bool_void_false)
/* Return true if volatile bitfields should use the narrowest type possible.
Return false if they should use the container type. */
DEFHOOK
(narrow_volatile_bitfield,
"This target hook should return @code{true} if accesses to volatile bitfields\n\
should use the narrowest mode possible. It should return @code{false} if\n\
these accesses should use the bitfield container type.\n\
\n\
The default is @code{false}.",
bool, (void),
hook_bool_void_false)
/* Set up target-specific built-in functions. */
DEFHOOK
(init_builtins,
"Define this hook if you have any machine-specific built-in functions\n\
that need to be defined. It should be a function that performs the\n\
necessary setup.\n\
\n\
Machine specific built-in functions can be useful to expand special machine\n\
instructions that would otherwise not normally be generated because\n\
they have no equivalent in the source language (for example, SIMD vector\n\
instructions or prefetch instructions).\n\
\n\
To create a built-in function, call the function\n\
@code{lang_hooks.builtin_function}\n\
which is defined by the language front end. You can use any type nodes set\n\
up by @code{build_common_tree_nodes};\n\
only language front ends that use those two functions will call\n\
@samp{TARGET_INIT_BUILTINS}.",
void, (void),
hook_void_void)
/* Initialize (if INITIALIZE_P is true) and return the target-specific
built-in function decl for CODE.
Return NULL if that is not possible. Return error_mark_node if CODE
is outside of the range of valid target builtin function codes. */
DEFHOOK
(builtin_decl,
"Define this hook if you have any machine-specific built-in functions\n\
that need to be defined. It should be a function that returns the\n\
builtin function declaration for the builtin function code @var{code}.\n\
If there is no such builtin and it cannot be initialized at this time\n\
if @var{initialize_p} is true the function should return @code{NULL_TREE}.\n\
If @var{code} is out of range the function should return\n\
@code{error_mark_node}.",
tree, (unsigned code, bool initialize_p), NULL)
/* Expand a target-specific builtin. */
DEFHOOK
(expand_builtin,
"\n\
Expand a call to a machine specific built-in function that was set up by\n\
@samp{TARGET_INIT_BUILTINS}. @var{exp} is the expression for the\n\
function call; the result should go to @var{target} if that is\n\
convenient, and have mode @var{mode} if that is convenient.\n\
@var{subtarget} may be used as the target for computing one of\n\
@var{exp}'s operands. @var{ignore} is nonzero if the value is to be\n\
ignored. This function should return the result of the call to the\n\
built-in function.",
rtx,
(tree exp, rtx target, rtx subtarget, enum machine_mode mode, int ignore),
default_expand_builtin)
/* Select a replacement for a target-specific builtin. This is done
*before* regular type checking, and so allows the target to
implement a crude form of function overloading. The result is a
complete expression that implements the operation. PARAMS really
has type VEC(tree,gc)*, but we don't want to include tree.h here. */
DEFHOOK
(resolve_overloaded_builtin,
"Select a replacement for a machine specific built-in function that\n\
was set up by @samp{TARGET_INIT_BUILTINS}. This is done\n\
@emph{before} regular type checking, and so allows the target to\n\
implement a crude form of function overloading. @var{fndecl} is the\n\
declaration of the built-in function. @var{arglist} is the list of\n\
arguments passed to the built-in function. The result is a\n\
complete expression that implements the operation, usually\n\
another @code{CALL_EXPR}.\n\
@var{arglist} really has type @samp{VEC(tree,gc)*}",
tree, (unsigned int /*location_t*/ loc, tree fndecl, void *arglist), NULL)
/* Fold a target-specific builtin to a tree valid for both GIMPLE
and GENERIC. */
DEFHOOK
(fold_builtin,
"Fold a call to a machine specific built-in function that was set up by\n\
@samp{TARGET_INIT_BUILTINS}. @var{fndecl} is the declaration of the\n\
built-in function. @var{n_args} is the number of arguments passed to\n\
the function; the arguments themselves are pointed to by @var{argp}.\n\
The result is another tree, valid for both GIMPLE and GENERIC,\n\
containing a simplified expression for the call's result. If\n\
@var{ignore} is true the value will be ignored.",
tree, (tree fndecl, int n_args, tree *argp, bool ignore),
hook_tree_tree_int_treep_bool_null)
/* Fold a target-specific builtin to a valid GIMPLE tree. */
DEFHOOK
(gimple_fold_builtin,
"Fold a call to a machine specific built-in function that was set up\n\
by @samp{TARGET_INIT_BUILTINS}. @var{gsi} points to the gimple\n\
statement holding the function call. Returns true if any change\n\
was made to the GIMPLE stream.",
bool, (gimple_stmt_iterator *gsi),
hook_bool_gsiptr_false)
/* Target hook is used to compare the target attributes in two functions to
determine which function's features get higher priority. This is used
during function multi-versioning to figure out the order in which two
versions must be dispatched. A function version with a higher priority
is checked for dispatching earlier. DECL1 and DECL2 are
the two function decls that will be compared. It returns positive value
if DECL1 is higher priority, negative value if DECL2 is higher priority
and 0 if they are the same. */
DEFHOOK
(compare_version_priority,
"This hook is used to compare the target attributes in two functions to\n\
determine which function's features get higher priority. This is used\n\
during function multi-versioning to figure out the order in which two\n\
versions must be dispatched. A function version with a higher priority\n\
is checked for dispatching earlier. @var{decl1} and @var{decl2} are\n\
the two function decls that will be compared.",
int, (tree decl1, tree decl2), NULL)
/* Target hook is used to generate the dispatcher logic to invoke the right
function version at run-time for a given set of function versions.
ARG points to the callgraph node of the dispatcher function whose body
must be generated. */
DEFHOOK
(generate_version_dispatcher_body,
"This hook is used to generate the dispatcher logic to invoke the right\n\
function version at run-time for a given set of function versions.\n\
@var{arg} points to the callgraph node of the dispatcher function whose\n\
body must be generated.",
tree, (void *arg), NULL)
/* Target hook is used to get the dispatcher function for a set of function
versions. The dispatcher function is called to invoke the right function
version at run-time. DECL is one version from a set of semantically
identical versions. */
DEFHOOK
(get_function_versions_dispatcher,
"This hook is used to get the dispatcher function for a set of function\n\
versions. The dispatcher function is called to invoke the right function\n\
version at run-time. @var{decl} is one version from a set of semantically\n\
identical versions.",
tree, (void *decl), NULL)
/* Returns a code for a target-specific builtin that implements
reciprocal of the function, or NULL_TREE if not available. */
DEFHOOK
(builtin_reciprocal,
"This hook should return the DECL of a function that implements reciprocal of\n\
the builtin function with builtin function code @var{fn}, or\n\
@code{NULL_TREE} if such a function is not available. @var{md_fn} is true\n\
when @var{fn} is a code of a machine-dependent builtin function. When\n\
@var{sqrt} is true, additional optimizations that apply only to the reciprocal\n\
of a square root function are performed, and only reciprocals of @code{sqrt}\n\
function are valid.",
tree, (unsigned fn, bool md_fn, bool sqrt),
default_builtin_reciprocal)
/* For a vendor-specific TYPE, return a pointer to a statically-allocated
string containing the C++ mangling for TYPE. In all other cases, return
NULL. */
DEFHOOK
(mangle_type,
"If your target defines any fundamental types, or any types your target\n\
uses should be mangled differently from the default, define this hook\n\
to return the appropriate encoding for these types as part of a C++\n\
mangled name. The @var{type} argument is the tree structure representing\n\
the type to be mangled. The hook may be applied to trees which are\n\
not target-specific fundamental types; it should return @code{NULL}\n\
for all such types, as well as arguments it does not recognize. If the\n\
return value is not @code{NULL}, it must point to a statically-allocated\n\
string constant.\n\
\n\
Target-specific fundamental types might be new fundamental types or\n\
qualified versions of ordinary fundamental types. Encode new\n\
fundamental types as @samp{@w{u @var{n} @var{name}}}, where @var{name}\n\
is the name used for the type in source code, and @var{n} is the\n\
length of @var{name} in decimal. Encode qualified versions of\n\
ordinary types as @samp{@w{U @var{n} @var{name} @var{code}}}, where\n\
@var{name} is the name used for the type qualifier in source code,\n\
@var{n} is the length of @var{name} as above, and @var{code} is the\n\
code used to represent the unqualified version of this type. (See\n\
@code{write_builtin_type} in @file{cp/mangle.c} for the list of\n\
codes.) In both cases the spaces are for clarity; do not include any\n\
spaces in your string.\n\
\n\
This hook is applied to types prior to typedef resolution. If the mangled\n\
name for a particular type depends only on that type's main variant, you\n\
can perform typedef resolution yourself using @code{TYPE_MAIN_VARIANT}\n\
before mangling.\n\
\n\
The default version of this hook always returns @code{NULL}, which is\n\
appropriate for a target that does not define any new fundamental\n\
types.",
const char *, (const_tree type),
hook_constcharptr_const_tree_null)
/* Make any adjustments to libfunc names needed for this target. */
DEFHOOK
(init_libfuncs,
"This hook should declare additional library routines or rename\n\
existing ones, using the functions @code{set_optab_libfunc} and\n\
@code{init_one_libfunc} defined in @file{optabs.c}.\n\
@code{init_optabs} calls this macro after initializing all the normal\n\
library routines.\n\
\n\
The default is to do nothing. Most ports don't need to define this hook.",
void, (void),
hook_void_void)
/* Add a __gnu_ prefix to library functions rather than just __. */
DEFHOOKPOD
(libfunc_gnu_prefix,
"If false (the default), internal library routines start with two\n\
underscores. If set to true, these routines start with @code{__gnu_}\n\
instead. E.g., @code{__muldi3} changes to @code{__gnu_muldi3}. This\n\
currently only affects functions defined in @file{libgcc2.c}. If this\n\
is set to true, the @file{tm.h} file must also\n\
@code{#define LIBGCC2_GNU_PREFIX}.",
bool, false)
/* Given a decl, a section name, and whether the decl initializer
has relocs, choose attributes for the section. */
/* ??? Should be merged with SELECT_SECTION and UNIQUE_SECTION. */
DEFHOOK
(section_type_flags,
"Choose a set of section attributes for use by @code{TARGET_ASM_NAMED_SECTION}\n\
based on a variable or function decl, a section name, and whether or not the\n\
declaration's initializer may contain runtime relocations. @var{decl} may be\n\
null, in which case read-write data should be assumed.\n\
\n\
The default version of this function handles choosing code vs data,\n\
read-only vs read-write data, and @code{flag_pic}. You should only\n\
need to override this if your target has special flags that might be\n\
set via @code{__attribute__}.",
unsigned int, (tree decl, const char *name, int reloc),
default_section_type_flags)
DEFHOOK
(libc_has_function,
"This hook determines whether a function from a class of functions\n\
@var{fn_class} is present at the runtime.",
bool, (enum function_class fn_class),
default_libc_has_function)
/* True if new jumps cannot be created, to replace existing ones or
not, at the current point in the compilation. */
DEFHOOK
(cannot_modify_jumps_p,
"This target hook returns @code{true} past the point in which new jump\n\
instructions could be created. On machines that require a register for\n\
every jump such as the SHmedia ISA of SH5, this point would typically be\n\
reload, so this target hook should be defined to a function such as:\n\
\n\
@smallexample\n\
static bool\n\
cannot_modify_jumps_past_reload_p ()\n\
@{\n\
return (reload_completed || reload_in_progress);\n\
@}\n\
@end smallexample",
bool, (void),
hook_bool_void_false)
/* True if FOLLOWER may be modified to follow FOLLOWEE. */
DEFHOOK
(can_follow_jump,
"FOLLOWER and FOLLOWEE are JUMP_INSN instructions;\
return true if FOLLOWER may be modified to follow FOLLOWEE;\
false, if it can't.\
For example, on some targets, certain kinds of branches can't be made to\
follow through a hot/cold partitioning.",
bool, (const_rtx follower, const_rtx followee),
hook_bool_const_rtx_const_rtx_true)
/* Return a register class for which branch target register
optimizations should be applied. */
DEFHOOK
(branch_target_register_class,
"This target hook returns a register class for which branch target register\n\
optimizations should be applied. All registers in this class should be\n\
usable interchangeably. After reload, registers in this class will be\n\
re-allocated and loads will be hoisted out of loops and be subjected\n\
to inter-block scheduling.",
reg_class_t, (void),
default_branch_target_register_class)
/* Return true if branch target register optimizations should include
callee-saved registers that are not already live during the current
function. AFTER_PE_GEN is true if prologues and epilogues have
already been generated. */
DEFHOOK
(branch_target_register_callee_saved,
"Branch target register optimization will by default exclude callee-saved\n\
registers\n\
that are not already live during the current function; if this target hook\n\
returns true, they will be included. The target code must than make sure\n\
that all target registers in the class returned by\n\
@samp{TARGET_BRANCH_TARGET_REGISTER_CLASS} that might need saving are\n\
saved. @var{after_prologue_epilogue_gen} indicates if prologues and\n\
epilogues have already been generated. Note, even if you only return\n\
true when @var{after_prologue_epilogue_gen} is false, you still are likely\n\
to have to make special provisions in @code{INITIAL_ELIMINATION_OFFSET}\n\
to reserve space for caller-saved target registers.",
bool, (bool after_prologue_epilogue_gen),
hook_bool_bool_false)
/* Return true if the target supports conditional execution. */
DEFHOOK
(have_conditional_execution,
"This target hook returns true if the target supports conditional execution.\n\
This target hook is required only when the target has several different\n\
modes and they have different conditional execution capability, such as ARM.",
bool, (void),
default_have_conditional_execution)
/* Return a new value for loop unroll size. */
DEFHOOK
(loop_unroll_adjust,
"This target hook returns a new value for the number of times @var{loop}\n\
should be unrolled. The parameter @var{nunroll} is the number of times\n\
the loop is to be unrolled. The parameter @var{loop} is a pointer to\n\
the loop, which is going to be checked for unrolling. This target hook\n\
is required only when the target has special constraints like maximum\n\
number of memory accesses.",
unsigned, (unsigned nunroll, struct loop *loop),
NULL)
/* True if X is a legitimate MODE-mode immediate operand. */
DEFHOOK
(legitimate_constant_p,
"This hook returns true if @var{x} is a legitimate constant for a\n\
@var{mode}-mode immediate operand on the target machine. You can assume that\n\
@var{x} satisfies @code{CONSTANT_P}, so you need not check this.\n\
\n\
The default definition returns true.",
bool, (enum machine_mode mode, rtx x),
hook_bool_mode_rtx_true)
/* True if the constant X cannot be placed in the constant pool. */
DEFHOOK
(cannot_force_const_mem,
"This hook should return true if @var{x} is of a form that cannot (or\n\
should not) be spilled to the constant pool. @var{mode} is the mode\n\
of @var{x}.\n\
\n\
The default version of this hook returns false.\n\
\n\
The primary reason to define this hook is to prevent reload from\n\
deciding that a non-legitimate constant would be better reloaded\n\
from the constant pool instead of spilling and reloading a register\n\
holding the constant. This restriction is often true of addresses\n\
of TLS symbols for various targets.",
bool, (enum machine_mode mode, rtx x),
hook_bool_mode_rtx_false)
DEFHOOK_UNDOC
(cannot_copy_insn_p,
"True if the insn @var{x} cannot be duplicated.",
bool, (rtx), NULL)
/* True if X is considered to be commutative. */
DEFHOOK
(commutative_p,
"This target hook returns @code{true} if @var{x} is considered to be commutative.\n\
Usually, this is just COMMUTATIVE_P (@var{x}), but the HP PA doesn't consider\n\
PLUS to be commutative inside a MEM@. @var{outer_code} is the rtx code\n\
of the enclosing rtl, if known, otherwise it is UNKNOWN.",
bool, (const_rtx x, int outer_code),
hook_bool_const_rtx_commutative_p)
/* True if ADDR is an address-expression whose effect depends
on the mode of the memory reference it is used in. */
DEFHOOK
(mode_dependent_address_p,
"This hook returns @code{true} if memory address @var{addr} in address\n\
space @var{addrspace} can have\n\
different meanings depending on the machine mode of the memory\n\
reference it is used for or if the address is valid for some modes\n\
but not others.\n\
\n\
Autoincrement and autodecrement addresses typically have mode-dependent\n\
effects because the amount of the increment or decrement is the size\n\
of the operand being addressed. Some machines have other mode-dependent\n\
addresses. Many RISC machines have no mode-dependent addresses.\n\
\n\
You may assume that @var{addr} is a valid address for the machine.\n\
\n\
The default version of this hook returns @code{false}.",
bool, (const_rtx addr, addr_space_t addrspace),
default_mode_dependent_address_p)
/* Given an invalid address X for a given machine mode, try machine-specific
ways to make it legitimate. Return X or an invalid address on failure. */
DEFHOOK
(legitimize_address,
"This hook is given an invalid memory address @var{x} for an\n\
operand of mode @var{mode} and should try to return a valid memory\n\
address.\n\
\n\
@findex break_out_memory_refs\n\
@var{x} will always be the result of a call to @code{break_out_memory_refs},\n\
and @var{oldx} will be the operand that was given to that function to produce\n\
@var{x}.\n\
\n\
The code of the hook should not alter the substructure of\n\
@var{x}. If it transforms @var{x} into a more legitimate form, it\n\
should return the new @var{x}.\n\
\n\
It is not necessary for this hook to come up with a legitimate address,\n\
with the exception of native TLS addresses (@pxref{Emulated TLS}).\n\
The compiler has standard ways of doing so in all cases. In fact, if\n\
the target supports only emulated TLS, it\n\
is safe to omit this hook or make it return @var{x} if it cannot find\n\
a valid way to legitimize the address. But often a machine-dependent\n\
strategy can generate better code.",
rtx, (rtx x, rtx oldx, enum machine_mode mode),
default_legitimize_address)
/* Given an address RTX, undo the effects of LEGITIMIZE_ADDRESS. */
DEFHOOK
(delegitimize_address,
"This hook is used to undo the possibly obfuscating effects of the\n\
@code{LEGITIMIZE_ADDRESS} and @code{LEGITIMIZE_RELOAD_ADDRESS} target\n\
macros. Some backend implementations of these macros wrap symbol\n\
references inside an @code{UNSPEC} rtx to represent PIC or similar\n\
addressing modes. This target hook allows GCC's optimizers to understand\n\
the semantics of these opaque @code{UNSPEC}s by converting them back\n\
into their original form.",
rtx, (rtx x),
delegitimize_mem_from_attrs)
/* Given an RTX, return true if it is not ok to emit it into debug info
section. */
DEFHOOK
(const_not_ok_for_debug_p,
"This hook should return true if @var{x} should not be emitted into\n\
debug sections.",
bool, (rtx x),
hook_bool_rtx_false)
/* Given an address RTX, say whether it is valid. */
DEFHOOK
(legitimate_address_p,
"A function that returns whether @var{x} (an RTX) is a legitimate memory\n\
address on the target machine for a memory operand of mode @var{mode}.\n\
\n\
Legitimate addresses are defined in two variants: a strict variant and a\n\
non-strict one. The @var{strict} parameter chooses which variant is\n\
desired by the caller.\n\
\n\
The strict variant is used in the reload pass. It must be defined so\n\
that any pseudo-register that has not been allocated a hard register is\n\
considered a memory reference. This is because in contexts where some\n\
kind of register is required, a pseudo-register with no hard register\n\
must be rejected. For non-hard registers, the strict variant should look\n\
up the @code{reg_renumber} array; it should then proceed using the hard\n\
register number in the array, or treat the pseudo as a memory reference\n\
if the array holds @code{-1}.\n\
\n\
The non-strict variant is used in other passes. It must be defined to\n\
accept all pseudo-registers in every context where some kind of\n\
register is required.\n\
\n\
Normally, constant addresses which are the sum of a @code{symbol_ref}\n\
and an integer are stored inside a @code{const} RTX to mark them as\n\
constant. Therefore, there is no need to recognize such sums\n\
specifically as legitimate addresses. Normally you would simply\n\
recognize any @code{const} as legitimate.\n\
\n\
Usually @code{PRINT_OPERAND_ADDRESS} is not prepared to handle constant\n\
sums that are not marked with @code{const}. It assumes that a naked\n\
@code{plus} indicates indexing. If so, then you @emph{must} reject such\n\
naked constant sums as illegitimate addresses, so that none of them will\n\
be given to @code{PRINT_OPERAND_ADDRESS}.\n\
\n\
@cindex @code{TARGET_ENCODE_SECTION_INFO} and address validation\n\
On some machines, whether a symbolic address is legitimate depends on\n\
the section that the address refers to. On these machines, define the\n\
target hook @code{TARGET_ENCODE_SECTION_INFO} to store the information\n\
into the @code{symbol_ref}, and then check for it here. When you see a\n\
@code{const}, you will have to look inside it to find the\n\
@code{symbol_ref} in order to determine the section. @xref{Assembler\n\
Format}.\n\
\n\
@cindex @code{GO_IF_LEGITIMATE_ADDRESS}\n\
Some ports are still using a deprecated legacy substitute for\n\
this hook, the @code{GO_IF_LEGITIMATE_ADDRESS} macro. This macro\n\
has this syntax:\n\
\n\
@example\n\
#define GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label})\n\
@end example\n\
\n\
@noindent\n\
and should @code{goto @var{label}} if the address @var{x} is a valid\n\
address on the target machine for a memory operand of mode @var{mode}.\n\
\n\
@findex REG_OK_STRICT\n\
Compiler source files that want to use the strict variant of this\n\
macro define the macro @code{REG_OK_STRICT}. You should use an\n\
@code{#ifdef REG_OK_STRICT} conditional to define the strict variant in\n\
that case and the non-strict variant otherwise.\n\
\n\
Using the hook is usually simpler because it limits the number of\n\
files that are recompiled when changes are made.",
bool, (enum machine_mode mode, rtx x, bool strict),
default_legitimate_address_p)
/* True if the given constant can be put into an object_block. */
DEFHOOK
(use_blocks_for_constant_p,
"This hook should return true if pool entries for constant @var{x} can\n\
be placed in an @code{object_block} structure. @var{mode} is the mode\n\
of @var{x}.\n\
\n\
The default version returns false for all constants.",
bool, (enum machine_mode mode, const_rtx x),
hook_bool_mode_const_rtx_false)
/* True if the given decl can be put into an object_block. */
DEFHOOK
(use_blocks_for_decl_p,
"This hook should return true if pool entries for @var{decl} should\n\
be placed in an @code{object_block} structure.\n\
\n\
The default version returns true for all decls.",
bool, (const_tree decl),
hook_bool_const_tree_true)
/* The minimum and maximum byte offsets for anchored addresses. */
DEFHOOKPOD
(min_anchor_offset,
"The minimum offset that should be applied to a section anchor.\n\
On most targets, it should be the smallest offset that can be\n\
applied to a base register while still giving a legitimate address\n\
for every mode. The default value is 0.",
HOST_WIDE_INT, 0)
DEFHOOKPOD
(max_anchor_offset,
"Like @code{TARGET_MIN_ANCHOR_OFFSET}, but the maximum (inclusive)\n\
offset that should be applied to section anchors. The default\n\
value is 0.",
HOST_WIDE_INT, 0)
/* True if section anchors can be used to access the given symbol. */
DEFHOOK
(use_anchors_for_symbol_p,
"Return true if GCC should attempt to use anchors to access @code{SYMBOL_REF}\n\
@var{x}. You can assume @samp{SYMBOL_REF_HAS_BLOCK_INFO_P (@var{x})} and\n\
@samp{!SYMBOL_REF_ANCHOR_P (@var{x})}.\n\
\n\
The default version is correct for most targets, but you might need to\n\
intercept this hook to handle things like target-specific attributes\n\
or target-specific sections.",
bool, (const_rtx x),
default_use_anchors_for_symbol_p)
/* True if target supports indirect functions. */
DEFHOOK
(has_ifunc_p,
"It returns true if the target supports GNU indirect functions.\n\
The support includes the assembler, linker and dynamic linker.\n\
The default value of this hook is based on target's libc.",
bool, (void),
default_has_ifunc_p)
/* True if it is OK to do sibling call optimization for the specified
call expression EXP. DECL will be the called function, or NULL if
this is an indirect call. */
DEFHOOK
(function_ok_for_sibcall,
"True if it is OK to do sibling call optimization for the specified\n\
call expression @var{exp}. @var{decl} will be the called function,\n\
or @code{NULL} if this is an indirect call.\n\
\n\
It is not uncommon for limitations of calling conventions to prevent\n\
tail calls to functions outside the current unit of translation, or\n\
during PIC compilation. The hook is used to enforce these restrictions,\n\
as the @code{sibcall} md pattern can not fail, or fall over to a\n\
``normal'' call. The criteria for successful sibling call optimization\n\
may vary greatly between different architectures.",
bool, (tree decl, tree exp),
hook_bool_tree_tree_false)
/* Establish appropriate back-end context for processing the function
FNDECL. The argument might be NULL to indicate processing at top
level, outside of any function scope. */
DEFHOOK
(set_current_function,
"The compiler invokes this hook whenever it changes its current function\n\
context (@code{cfun}). You can define this function if\n\
the back end needs to perform any initialization or reset actions on a\n\
per-function basis. For example, it may be used to implement function\n\
attributes that affect register usage or code generation patterns.\n\
The argument @var{decl} is the declaration for the new function context,\n\
and may be null to indicate that the compiler has left a function context\n\
and is returning to processing at the top level.\n\
The default hook function does nothing.\n\
\n\
GCC sets @code{cfun} to a dummy function context during initialization of\n\
some parts of the back end. The hook function is not invoked in this\n\
situation; you need not worry about the hook being invoked recursively,\n\
or when the back end is in a partially-initialized state.\n\
@code{cfun} might be @code{NULL} to indicate processing at top level,\n\
outside of any function scope.",
void, (tree decl), hook_void_tree)
/* True if EXP should be placed in a "small data" section. */
DEFHOOK
(in_small_data_p,
"Returns true if @var{exp} should be placed into a ``small data'' section.\n\
The default version of this hook always returns false.",
bool, (const_tree exp),
hook_bool_const_tree_false)
/* True if EXP names an object for which name resolution must resolve
to the current executable or shared library. */
DEFHOOK
(binds_local_p,
"Returns true if @var{exp} names an object for which name resolution\n\
rules must resolve to the current ``module'' (dynamic shared library\n\
or executable image).\n\
\n\
The default version of this hook implements the name resolution rules\n\
for ELF, which has a looser model of global name binding than other\n\
currently supported object file formats.",
bool, (const_tree exp),
default_binds_local_p)
/* Check if profiling code is before or after prologue. */
DEFHOOK
(profile_before_prologue,
"It returns true if target wants profile code emitted before prologue.\n\n\
The default version of this hook use the target macro\n\
@code{PROFILE_BEFORE_PROLOGUE}.",
bool, (void),
default_profile_before_prologue)
/* Modify and return the identifier of a DECL's external name,
originally identified by ID, as required by the target,
(eg, append @nn to windows32 stdcall function names).
The default is to return ID without modification. */
DEFHOOK
(mangle_decl_assembler_name,
"Define this hook if you need to postprocess the assembler name generated\n\
by target-independent code. The @var{id} provided to this hook will be\n\
the computed name (e.g., the macro @code{DECL_NAME} of the @var{decl} in C,\n\
or the mangled name of the @var{decl} in C++). The return value of the\n\
hook is an @code{IDENTIFIER_NODE} for the appropriate mangled name on\n\
your target system. The default implementation of this hook just\n\
returns the @var{id} provided.",
tree, (tree decl, tree id),
default_mangle_decl_assembler_name)
/* Do something target-specific to record properties of the DECL into
the associated SYMBOL_REF. */
DEFHOOK
(encode_section_info,
"Define this hook if references to a symbol or a constant must be\n\
treated differently depending on something about the variable or\n\
function named by the symbol (such as what section it is in).\n\
\n\
The hook is executed immediately after rtl has been created for\n\
@var{decl}, which may be a variable or function declaration or\n\
an entry in the constant pool. In either case, @var{rtl} is the\n\
rtl in question. Do @emph{not} use @code{DECL_RTL (@var{decl})}\n\
in this hook; that field may not have been initialized yet.\n\
\n\
In the case of a constant, it is safe to assume that the rtl is\n\
a @code{mem} whose address is a @code{symbol_ref}. Most decls\n\
will also have this form, but that is not guaranteed. Global\n\
register variables, for instance, will have a @code{reg} for their\n\
rtl. (Normally the right thing to do with such unusual rtl is\n\
leave it alone.)\n\
\n\
The @var{new_decl_p} argument will be true if this is the first time\n\
that @code{TARGET_ENCODE_SECTION_INFO} has been invoked on this decl. It will\n\
be false for subsequent invocations, which will happen for duplicate\n\
declarations. Whether or not anything must be done for the duplicate\n\
declaration depends on whether the hook examines @code{DECL_ATTRIBUTES}.\n\
@var{new_decl_p} is always true when the hook is called for a constant.\n\
\n\
@cindex @code{SYMBOL_REF_FLAG}, in @code{TARGET_ENCODE_SECTION_INFO}\n\
The usual thing for this hook to do is to record flags in the\n\
@code{symbol_ref}, using @code{SYMBOL_REF_FLAG} or @code{SYMBOL_REF_FLAGS}.\n\
Historically, the name string was modified if it was necessary to\n\
encode more than one bit of information, but this practice is now\n\
discouraged; use @code{SYMBOL_REF_FLAGS}.\n\
\n\
The default definition of this hook, @code{default_encode_section_info}\n\
in @file{varasm.c}, sets a number of commonly-useful bits in\n\
@code{SYMBOL_REF_FLAGS}. Check whether the default does what you need\n\
before overriding it.",
void, (tree decl, rtx rtl, int new_decl_p),
default_encode_section_info)
/* Undo the effects of encode_section_info on the symbol string. */
DEFHOOK
(strip_name_encoding,
"Decode @var{name} and return the real name part, sans\n\
the characters that @code{TARGET_ENCODE_SECTION_INFO}\n\
may have added.",
const char *, (const char *name),
default_strip_name_encoding)
/* If shift optabs for MODE are known to always truncate the shift count,
return the mask that they apply. Return 0 otherwise. */
DEFHOOK
(shift_truncation_mask,
"This function describes how the standard shift patterns for @var{mode}\n\
deal with shifts by negative amounts or by more than the width of the mode.\n\
@xref{shift patterns}.\n\
\n\
On many machines, the shift patterns will apply a mask @var{m} to the\n\
shift count, meaning that a fixed-width shift of @var{x} by @var{y} is\n\
equivalent to an arbitrary-width shift of @var{x} by @var{y & m}. If\n\
this is true for mode @var{mode}, the function should return @var{m},\n\
otherwise it should return 0. A return value of 0 indicates that no\n\
particular behavior is guaranteed.\n\
\n\
Note that, unlike @code{SHIFT_COUNT_TRUNCATED}, this function does\n\
@emph{not} apply to general shift rtxes; it applies only to instructions\n\
that are generated by the named shift patterns.\n\
\n\
The default implementation of this function returns\n\
@code{GET_MODE_BITSIZE (@var{mode}) - 1} if @code{SHIFT_COUNT_TRUNCATED}\n\
and 0 otherwise. This definition is always safe, but if\n\
@code{SHIFT_COUNT_TRUNCATED} is false, and some shift patterns\n\
nevertheless truncate the shift count, you may get better code\n\
by overriding it.",
unsigned HOST_WIDE_INT, (enum machine_mode mode),
default_shift_truncation_mask)
/* Return the number of divisions in the given MODE that should be present,
so that it is profitable to turn the division into a multiplication by
the reciprocal. */
DEFHOOK
(min_divisions_for_recip_mul,
"When @option{-ffast-math} is in effect, GCC tries to optimize\n\
divisions by the same divisor, by turning them into multiplications by\n\
the reciprocal. This target hook specifies the minimum number of divisions\n\
that should be there for GCC to perform the optimization for a variable\n\
of mode @var{mode}. The default implementation returns 3 if the machine\n\
has an instruction for the division, and 2 if it does not.",
unsigned int, (enum machine_mode mode),
default_min_divisions_for_recip_mul)
/* If the representation of integral MODE is such that values are
always sign-extended to a wider mode MODE_REP then return
SIGN_EXTEND. Return UNKNOWN otherwise. */
/* Note that the return type ought to be RTX_CODE, but that's not
necessarily defined at this point. */
DEFHOOK
(mode_rep_extended,
"The representation of an integral mode can be such that the values\n\
are always extended to a wider integral mode. Return\n\
@code{SIGN_EXTEND} if values of @var{mode} are represented in\n\
sign-extended form to @var{rep_mode}. Return @code{UNKNOWN}\n\
otherwise. (Currently, none of the targets use zero-extended\n\
representation this way so unlike @code{LOAD_EXTEND_OP},\n\
@code{TARGET_MODE_REP_EXTENDED} is expected to return either\n\
@code{SIGN_EXTEND} or @code{UNKNOWN}. Also no target extends\n\
@var{mode} to @var{rep_mode} so that @var{rep_mode} is not the next\n\
widest integral mode and currently we take advantage of this fact.)\n\
\n\
Similarly to @code{LOAD_EXTEND_OP} you may return a non-@code{UNKNOWN}\n\
value even if the extension is not performed on certain hard registers\n\
as long as for the @code{REGNO_REG_CLASS} of these hard registers\n\
@code{CANNOT_CHANGE_MODE_CLASS} returns nonzero.\n\
\n\
Note that @code{TARGET_MODE_REP_EXTENDED} and @code{LOAD_EXTEND_OP}\n\
describe two related properties. If you define\n\
@code{TARGET_MODE_REP_EXTENDED (mode, word_mode)} you probably also want\n\
to define @code{LOAD_EXTEND_OP (mode)} to return the same type of\n\
extension.\n\
\n\
In order to enforce the representation of @code{mode},\n\
@code{TRULY_NOOP_TRUNCATION} should return false when truncating to\n\
@code{mode}.",
int, (enum machine_mode mode, enum machine_mode rep_mode),
default_mode_rep_extended)
/* True if MODE is valid for a pointer in __attribute__((mode("MODE"))). */
DEFHOOK
(valid_pointer_mode,
"Define this to return nonzero if the port can handle pointers\n\
with machine mode @var{mode}. The default version of this\n\
hook returns true for both @code{ptr_mode} and @code{Pmode}.",
bool, (enum machine_mode mode),
default_valid_pointer_mode)
/* Disambiguate with errno. */
DEFHOOK
(ref_may_alias_errno,
"Define this to return nonzero if the memory reference @var{ref}\
may alias with the system C library errno location. The default\
version of this hook assumes the system C library errno location\
is either a declaration of type int or accessed by dereferencing\
a pointer to int.",
bool, (struct ao_ref *ref),
default_ref_may_alias_errno)
/* Support for named address spaces. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_ADDR_SPACE_"
HOOK_VECTOR (TARGET_ADDR_SPACE_HOOKS, addr_space)
/* MODE to use for a pointer into another address space. */
DEFHOOK
(pointer_mode,
"Define this to return the machine mode to use for pointers to\n\
@var{address_space} if the target supports named address spaces.\n\
The default version of this hook returns @code{ptr_mode} for the\n\
generic address space only.",
enum machine_mode, (addr_space_t address_space),
default_addr_space_pointer_mode)
/* MODE to use for an address in another address space. */
DEFHOOK
(address_mode,
"Define this to return the machine mode to use for addresses in\n\
@var{address_space} if the target supports named address spaces.\n\
The default version of this hook returns @code{Pmode} for the\n\
generic address space only.",
enum machine_mode, (addr_space_t address_space),
default_addr_space_address_mode)
/* True if MODE is valid for a pointer in __attribute__((mode("MODE")))
in another address space. */
DEFHOOK
(valid_pointer_mode,
"Define this to return nonzero if the port can handle pointers\n\
with machine mode @var{mode} to address space @var{as}. This target\n\
hook is the same as the @code{TARGET_VALID_POINTER_MODE} target hook,\n\
except that it includes explicit named address space support. The default\n\
version of this hook returns true for the modes returned by either the\n\
@code{TARGET_ADDR_SPACE_POINTER_MODE} or @code{TARGET_ADDR_SPACE_ADDRESS_MODE}\n\
target hooks for the given address space.",
bool, (enum machine_mode mode, addr_space_t as),
default_addr_space_valid_pointer_mode)
/* True if an address is a valid memory address to a given named address
space for a given mode. */
DEFHOOK
(legitimate_address_p,
"Define this to return true if @var{exp} is a valid address for mode\n\
@var{mode} in the named address space @var{as}. The @var{strict}\n\
parameter says whether strict addressing is in effect after reload has\n\
finished. This target hook is the same as the\n\
@code{TARGET_LEGITIMATE_ADDRESS_P} target hook, except that it includes\n\
explicit named address space support.",
bool, (enum machine_mode mode, rtx exp, bool strict, addr_space_t as),
default_addr_space_legitimate_address_p)
/* Return an updated address to convert an invalid pointer to a named
address space to a valid one. If NULL_RTX is returned use machine
independent methods to make the address valid. */
DEFHOOK
(legitimize_address,
"Define this to modify an invalid address @var{x} to be a valid address\n\
with mode @var{mode} in the named address space @var{as}. This target\n\
hook is the same as the @code{TARGET_LEGITIMIZE_ADDRESS} target hook,\n\
except that it includes explicit named address space support.",
rtx, (rtx x, rtx oldx, enum machine_mode mode, addr_space_t as),
default_addr_space_legitimize_address)
/* True if one named address space is a subset of another named address. */
DEFHOOK
(subset_p,
"Define this to return whether the @var{subset} named address space is\n\
contained within the @var{superset} named address space. Pointers to\n\
a named address space that is a subset of another named address space\n\
will be converted automatically without a cast if used together in\n\
arithmetic operations. Pointers to a superset address space can be\n\
converted to pointers to a subset address space via explicit casts.",
bool, (addr_space_t subset, addr_space_t superset),
default_addr_space_subset_p)
/* Function to convert an rtl expression from one address space to another. */
DEFHOOK
(convert,
"Define this to convert the pointer expression represented by the RTL\n\
@var{op} with type @var{from_type} that points to a named address\n\
space to a new pointer expression with type @var{to_type} that points\n\
to a different named address space. When this hook it called, it is\n\
guaranteed that one of the two address spaces is a subset of the other,\n\
as determined by the @code{TARGET_ADDR_SPACE_SUBSET_P} target hook.",
rtx, (rtx op, tree from_type, tree to_type),
default_addr_space_convert)
HOOK_VECTOR_END (addr_space)
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_"
/* True if MODE is valid for the target. By "valid", we mean able to
be manipulated in non-trivial ways. In particular, this means all
the arithmetic is supported. */
DEFHOOK
(scalar_mode_supported_p,
"Define this to return nonzero if the port is prepared to handle\n\
insns involving scalar mode @var{mode}. For a scalar mode to be\n\
considered supported, all the basic arithmetic and comparisons\n\
must work.\n\
\n\
The default version of this hook returns true for any mode\n\
required to handle the basic C types (as defined by the port).\n\
Included here are the double-word arithmetic supported by the\n\
code in @file{optabs.c}.",
bool, (enum machine_mode mode),
default_scalar_mode_supported_p)
/* Similarly for vector modes. "Supported" here is less strict. At
least some operations are supported; need to check optabs or builtins
for further details. */
DEFHOOK
(vector_mode_supported_p,
"Define this to return nonzero if the port is prepared to handle\n\
insns involving vector mode @var{mode}. At the very least, it\n\
must have move patterns for this mode.",
bool, (enum machine_mode mode),
hook_bool_mode_false)
DEFHOOK
(vector_alignment,
"This hook can be used to define the alignment for a vector of type\n\
@var{type}, in order to comply with a platform ABI. The default is to\n\
require natural alignment for vector types. The alignment returned by\n\
this hook must be a power-of-two multiple of the default alignment of\n\
the vector element type.",
HOST_WIDE_INT, (const_tree type),
default_vector_alignment)
/* True if we should try to use a scalar mode to represent an array,
overriding the usual MAX_FIXED_MODE limit. */
DEFHOOK
(array_mode_supported_p,
"Return true if GCC should try to use a scalar mode to store an array\n\
of @var{nelems} elements, given that each element has mode @var{mode}.\n\
Returning true here overrides the usual @code{MAX_FIXED_MODE} limit\n\
and allows GCC to use any defined integer mode.\n\
\n\
One use of this hook is to support vector load and store operations\n\
that operate on several homogeneous vectors. For example, ARM NEON\n\
has operations like:\n\
\n\
@smallexample\n\
int8x8x3_t vld3_s8 (const int8_t *)\n\
@end smallexample\n\
\n\
where the return type is defined as:\n\
\n\
@smallexample\n\
typedef struct int8x8x3_t\n\
@{\n\
int8x8_t val[3];\n\
@} int8x8x3_t;\n\
@end smallexample\n\
\n\
If this hook allows @code{val} to have a scalar mode, then\n\
@code{int8x8x3_t} can have the same mode. GCC can then store\n\
@code{int8x8x3_t}s in registers rather than forcing them onto the stack.",
bool, (enum machine_mode mode, unsigned HOST_WIDE_INT nelems),
hook_bool_mode_uhwi_false)
/* Compute cost of moving data from a register of class FROM to one of
TO, using MODE. */
DEFHOOK
(register_move_cost,
"This target hook should return the cost of moving data of mode @var{mode}\n\
from a register in class @var{from} to one in class @var{to}. The classes\n\
are expressed using the enumeration values such as @code{GENERAL_REGS}.\n\
A value of 2 is the default; other values are interpreted relative to\n\
that.\n\
\n\
It is not required that the cost always equal 2 when @var{from} is the\n\
same as @var{to}; on some machines it is expensive to move between\n\
registers if they are not general registers.\n\
\n\
If reload sees an insn consisting of a single @code{set} between two\n\
hard registers, and if @code{TARGET_REGISTER_MOVE_COST} applied to their\n\
classes returns a value of 2, reload does not check to ensure that the\n\
constraints of the insn are met. Setting a cost of other than 2 will\n\
allow reload to verify that the constraints are met. You should do this\n\
if the @samp{mov@var{m}} pattern's constraints do not allow such copying.\n\
\n\
The default version of this function returns 2.",
int, (enum machine_mode mode, reg_class_t from, reg_class_t to),
default_register_move_cost)
/* Compute cost of moving registers to/from memory. */
/* ??? Documenting the argument types for this hook requires a GFDL
license grant. Also, the documentation uses a different name for RCLASS. */
DEFHOOK
(memory_move_cost,
"This target hook should return the cost of moving data of mode @var{mode}\n\
between a register of class @var{rclass} and memory; @var{in} is @code{false}\n\
if the value is to be written to memory, @code{true} if it is to be read in.\n\
This cost is relative to those in @code{TARGET_REGISTER_MOVE_COST}.\n\
If moving between registers and memory is more expensive than between two\n\
registers, you should add this target hook to express the relative cost.\n\
\n\
If you do not add this target hook, GCC uses a default cost of 4 plus\n\
the cost of copying via a secondary reload register, if one is\n\
needed. If your machine requires a secondary reload register to copy\n\
between memory and a register of @var{rclass} but the reload mechanism is\n\
more complex than copying via an intermediate, use this target hook to\n\
reflect the actual cost of the move.\n\
\n\
GCC defines the function @code{memory_move_secondary_cost} if\n\
secondary reloads are needed. It computes the costs due to copying via\n\
a secondary register. If your machine copies from memory using a\n\
secondary register in the conventional way but the default base value of\n\
4 is not correct for your machine, use this target hook to add some other\n\
value to the result of that function. The arguments to that function\n\
are the same as to this target hook.",
int, (enum machine_mode mode, reg_class_t rclass, bool in),
default_memory_move_cost)
/* True for MODE if the target expects that registers in this mode will
be allocated to registers in a small register class. The compiler is
allowed to use registers explicitly used in the rtl as spill registers
but it should prevent extending the lifetime of these registers. */
DEFHOOK
(small_register_classes_for_mode_p,
"Define this to return nonzero for machine modes for which the port has\n\
small register classes. If this target hook returns nonzero for a given\n\
@var{mode}, the compiler will try to minimize the lifetime of registers\n\
in @var{mode}. The hook may be called with @code{VOIDmode} as argument.\n\
In this case, the hook is expected to return nonzero if it returns nonzero\n\
for any mode.\n\
\n\
On some machines, it is risky to let hard registers live across arbitrary\n\
insns. Typically, these machines have instructions that require values\n\
to be in specific registers (like an accumulator), and reload will fail\n\
if the required hard register is used for another purpose across such an\n\
insn.\n\
\n\
Passes before reload do not know which hard registers will be used\n\
in an instruction, but the machine modes of the registers set or used in\n\
the instruction are already known. And for some machines, register\n\
classes are small for, say, integer registers but not for floating point\n\
registers. For example, the AMD x86-64 architecture requires specific\n\
registers for the legacy x86 integer instructions, but there are many\n\
SSE registers for floating point operations. On such targets, a good\n\
strategy may be to return nonzero from this hook for @code{INTEGRAL_MODE_P}\n\
machine modes but zero for the SSE register classes.\n\
\n\
The default version of this hook returns false for any mode. It is always\n\
safe to redefine this hook to return with a nonzero value. But if you\n\
unnecessarily define it, you will reduce the amount of optimizations\n\
that can be performed in some cases. If you do not define this hook\n\
to return a nonzero value when it is required, the compiler will run out\n\
of spill registers and print a fatal error message.",
bool, (enum machine_mode mode),
hook_bool_mode_false)
/* Register number for a flags register. Only needs to be defined if the
target is constrainted to use post-reload comparison elimination. */
DEFHOOKPOD
(flags_regnum,
"If the target has a dedicated flags register, and it needs to use the\
post-reload comparison elimination pass, then this value should be set\
appropriately.",
unsigned int, INVALID_REGNUM)
/* Compute a (partial) cost for rtx X. Return true if the complete
cost has been computed, and false if subexpressions should be
scanned. In either case, *TOTAL contains the cost result. */
/* Note that CODE and OUTER_CODE ought to be RTX_CODE, but that's
not necessarily defined at this point. */
DEFHOOK
(rtx_costs,
"This target hook describes the relative costs of RTL expressions.\n\
\n\
The cost may depend on the precise form of the expression, which is\n\
available for examination in @var{x}, and the fact that @var{x} appears\n\
as operand @var{opno} of an expression with rtx code @var{outer_code}.\n\
That is, the hook can assume that there is some rtx @var{y} such\n\
that @samp{GET_CODE (@var{y}) == @var{outer_code}} and such that\n\
either (a) @samp{XEXP (@var{y}, @var{opno}) == @var{x}} or\n\
(b) @samp{XVEC (@var{y}, @var{opno})} contains @var{x}.\n\
\n\
@var{code} is @var{x}'s expression code---redundant, since it can be\n\
obtained with @code{GET_CODE (@var{x})}.\n\
\n\
In implementing this hook, you can use the construct\n\
@code{COSTS_N_INSNS (@var{n})} to specify a cost equal to @var{n} fast\n\
instructions.\n\
\n\
On entry to the hook, @code{*@var{total}} contains a default estimate\n\
for the cost of the expression. The hook should modify this value as\n\
necessary. Traditionally, the default costs are @code{COSTS_N_INSNS (5)}\n\
for multiplications, @code{COSTS_N_INSNS (7)} for division and modulus\n\
operations, and @code{COSTS_N_INSNS (1)} for all other operations.\n\
\n\
When optimizing for code size, i.e.@: when @code{speed} is\n\
false, this target hook should be used to estimate the relative\n\
size cost of an expression, again relative to @code{COSTS_N_INSNS}.\n\
\n\
The hook returns true when all subexpressions of @var{x} have been\n\
processed, and false when @code{rtx_cost} should recurse.",
bool, (rtx x, int code, int outer_code, int opno, int *total, bool speed),
hook_bool_rtx_int_int_int_intp_bool_false)
/* Compute the cost of X, used as an address. Never called with
invalid addresses. */
DEFHOOK
(address_cost,
"This hook computes the cost of an addressing mode that contains\n\
@var{address}. If not defined, the cost is computed from\n\
the @var{address} expression and the @code{TARGET_RTX_COST} hook.\n\
\n\
For most CISC machines, the default cost is a good approximation of the\n\
true cost of the addressing mode. However, on RISC machines, all\n\
instructions normally have the same length and execution time. Hence\n\
all addresses will have equal costs.\n\
\n\
In cases where more than one form of an address is known, the form with\n\
the lowest cost will be used. If multiple forms have the same, lowest,\n\
cost, the one that is the most complex will be used.\n\
\n\
For example, suppose an address that is equal to the sum of a register\n\
and a constant is used twice in the same basic block. When this macro\n\
is not defined, the address will be computed in a register and memory\n\
references will be indirect through that register. On machines where\n\
the cost of the addressing mode containing the sum is no higher than\n\
that of a simple indirect reference, this will produce an additional\n\
instruction and possibly require an additional register. Proper\n\
specification of this macro eliminates this overhead for such machines.\n\
\n\
This hook is never called with an invalid address.\n\
\n\
On machines where an address involving more than one register is as\n\
cheap as an address computation involving only one register, defining\n\
@code{TARGET_ADDRESS_COST} to reflect this can cause two registers to\n\
be live over a region of code where only one would have been if\n\
@code{TARGET_ADDRESS_COST} were not defined in that manner. This effect\n\
should be considered in the definition of this macro. Equivalent costs\n\
should probably only be given to addresses with different numbers of\n\
registers on machines with lots of registers.",
int, (rtx address, enum machine_mode mode, addr_space_t as, bool speed),
default_address_cost)
/* Return where to allocate pseudo for a given hard register initial value. */
DEFHOOK
(allocate_initial_value,
"\n\
When the initial value of a hard register has been copied in a pseudo\n\
register, it is often not necessary to actually allocate another register\n\
to this pseudo register, because the original hard register or a stack slot\n\
it has been saved into can be used. @code{TARGET_ALLOCATE_INITIAL_VALUE}\n\
is called at the start of register allocation once for each hard register\n\
that had its initial value copied by using\n\
@code{get_func_hard_reg_initial_val} or @code{get_hard_reg_initial_val}.\n\
Possible values are @code{NULL_RTX}, if you don't want\n\
to do any special allocation, a @code{REG} rtx---that would typically be\n\
the hard register itself, if it is known not to be clobbered---or a\n\
@code{MEM}.\n\
If you are returning a @code{MEM}, this is only a hint for the allocator;\n\
it might decide to use another register anyways.\n\
You may use @code{current_function_is_leaf} or \n\
@code{REG_N_SETS} in the hook to determine if the hard\n\
register in question will not be clobbered.\n\
The default value of this hook is @code{NULL}, which disables any special\n\
allocation.",
rtx, (rtx hard_reg), NULL)
/* Return nonzero if evaluating UNSPEC X might cause a trap.
FLAGS has the same meaning as in rtlanal.c: may_trap_p_1. */
DEFHOOK
(unspec_may_trap_p,
"This target hook returns nonzero if @var{x}, an @code{unspec} or\n\
@code{unspec_volatile} operation, might cause a trap. Targets can use\n\
this hook to enhance precision of analysis for @code{unspec} and\n\
@code{unspec_volatile} operations. You may call @code{may_trap_p_1}\n\
to analyze inner elements of @var{x} in which case @var{flags} should be\n\
passed along.",
int, (const_rtx x, unsigned flags),
default_unspec_may_trap_p)
/* Given a register, this hook should return a parallel of registers
to represent where to find the register pieces. Define this hook
if the register and its mode are represented in Dwarf in
non-contiguous locations, or if the register should be
represented in more than one register in Dwarf. Otherwise, this
hook should return NULL_RTX. */
DEFHOOK
(dwarf_register_span,
"Given a register, this hook should return a parallel of registers to\n\
represent where to find the register pieces. Define this hook if the\n\
register and its mode are represented in Dwarf in non-contiguous\n\
locations, or if the register should be represented in more than one\n\
register in Dwarf. Otherwise, this hook should return @code{NULL_RTX}.\n\
If not defined, the default is to return @code{NULL_RTX}.",
rtx, (rtx reg),
hook_rtx_rtx_null)
/* If expand_builtin_init_dwarf_reg_sizes needs to fill in table
entries not corresponding directly to registers below
FIRST_PSEUDO_REGISTER, this hook should generate the necessary
code, given the address of the table. */
DEFHOOK
(init_dwarf_reg_sizes_extra,
"If some registers are represented in Dwarf-2 unwind information in\n\
multiple pieces, define this hook to fill in information about the\n\
sizes of those pieces in the table used by the unwinder at runtime.\n\
It will be called by @code{expand_builtin_init_dwarf_reg_sizes} after\n\
filling in a single size corresponding to each hard register;\n\
@var{address} is the address of the table.",
void, (tree address),
hook_void_tree)
/* Fetch the fixed register(s) which hold condition codes, for
targets where it makes sense to look for duplicate assignments to
the condition codes. This should return true if there is such a
register, false otherwise. The arguments should be set to the
fixed register numbers. Up to two condition code registers are
supported. If there is only one for this target, the int pointed
at by the second argument should be set to -1. */
DEFHOOK
(fixed_condition_code_regs,
"On targets which do not use @code{(cc0)}, and which use a hard\n\
register rather than a pseudo-register to hold condition codes, the\n\
regular CSE passes are often not able to identify cases in which the\n\
hard register is set to a common value. Use this hook to enable a\n\
small pass which optimizes such cases. This hook should return true\n\
to enable this pass, and it should set the integers to which its\n\
arguments point to the hard register numbers used for condition codes.\n\
When there is only one such register, as is true on most systems, the\n\
integer pointed to by @var{p2} should be set to\n\
@code{INVALID_REGNUM}.\n\
\n\
The default version of this hook returns false.",
bool, (unsigned int *p1, unsigned int *p2),
hook_bool_uintp_uintp_false)
/* If two condition code modes are compatible, return a condition
code mode which is compatible with both, such that a comparison
done in the returned mode will work for both of the original
modes. If the condition code modes are not compatible, return
VOIDmode. */
DEFHOOK
(cc_modes_compatible,
"On targets which use multiple condition code modes in class\n\
@code{MODE_CC}, it is sometimes the case that a comparison can be\n\
validly done in more than one mode. On such a system, define this\n\
target hook to take two mode arguments and to return a mode in which\n\
both comparisons may be validly done. If there is no such mode,\n\
return @code{VOIDmode}.\n\
\n\
The default version of this hook checks whether the modes are the\n\
same. If they are, it returns that mode. If they are different, it\n\
returns @code{VOIDmode}.",
enum machine_mode, (enum machine_mode m1, enum machine_mode m2),
default_cc_modes_compatible)
/* Do machine-dependent code transformations. Called just before
delayed-branch scheduling. */
DEFHOOK
(machine_dependent_reorg,
"If non-null, this hook performs a target-specific pass over the\n\
instruction stream. The compiler will run it at all optimization levels,\n\
just before the point at which it normally does delayed-branch scheduling.\n\
\n\
The exact purpose of the hook varies from target to target. Some use\n\
it to do transformations that are necessary for correctness, such as\n\
laying out in-function constant pools or avoiding hardware hazards.\n\
Others use it as an opportunity to do some machine-dependent optimizations.\n\
\n\
You need not implement the hook if it has nothing to do. The default\n\
definition is null.",
void, (void), NULL)
/* Create the __builtin_va_list type. */
DEFHOOK
(build_builtin_va_list,
"This hook returns a type node for @code{va_list} for the target.\n\
The default version of the hook returns @code{void*}.",
tree, (void),
std_build_builtin_va_list)
/* Enumerate the va list variants. */
DEFHOOK
(enum_va_list_p,
"This target hook is used in function @code{c_common_nodes_and_builtins}\n\
to iterate through the target specific builtin types for va_list. The\n\
variable @var{idx} is used as iterator. @var{pname} has to be a pointer\n\
to a @code{const char *} and @var{ptree} a pointer to a @code{tree} typed\n\
variable.\n\
The arguments @var{pname} and @var{ptree} are used to store the result of\n\
this macro and are set to the name of the va_list builtin type and its\n\
internal type.\n\
If the return value of this macro is zero, then there is no more element.\n\
Otherwise the @var{IDX} should be increased for the next call of this\n\
macro to iterate through all types.",
int, (int idx, const char **pname, tree *ptree),
NULL)
/* Get the cfun/fndecl calling abi __builtin_va_list type. */
DEFHOOK
(fn_abi_va_list,
"This hook returns the va_list type of the calling convention specified by\n\
@var{fndecl}.\n\
The default version of this hook returns @code{va_list_type_node}.",
tree, (tree fndecl),
std_fn_abi_va_list)
/* Get the __builtin_va_list type dependent on input type. */
DEFHOOK
(canonical_va_list_type,
"This hook returns the va_list type of the calling convention specified by the\n\
type of @var{type}. If @var{type} is not a valid va_list type, it returns\n\
@code{NULL_TREE}.",
tree, (tree type),
std_canonical_va_list_type)
/* ??? Documenting this hook requires a GFDL license grant. */
DEFHOOK_UNDOC
(expand_builtin_va_start,
"Expand the @code{__builtin_va_start} builtin.",
void, (tree valist, rtx nextarg), NULL)
/* Gimplifies a VA_ARG_EXPR. */
DEFHOOK
(gimplify_va_arg_expr,
"This hook performs target-specific gimplification of\n\
@code{VA_ARG_EXPR}. The first two parameters correspond to the\n\
arguments to @code{va_arg}; the latter two are as in\n\
@code{gimplify.c:gimplify_expr}.",
tree, (tree valist, tree type, gimple_seq *pre_p, gimple_seq *post_p),
std_gimplify_va_arg_expr)
/* Validity-checking routines for PCH files, target-specific.
get_pch_validity returns a pointer to the data to be stored,
and stores the size in its argument. pch_valid_p gets the same
information back and returns NULL if the PCH is valid,
or an error message if not. */
DEFHOOK
(get_pch_validity,
"This hook returns a pointer to the data needed by\n\
@code{TARGET_PCH_VALID_P} and sets\n\
@samp{*@var{sz}} to the size of the data in bytes.",
void *, (size_t *sz),
default_get_pch_validity)
DEFHOOK
(pch_valid_p,
"This hook checks whether the options used to create a PCH file are\n\
compatible with the current settings. It returns @code{NULL}\n\
if so and a suitable error message if not. Error messages will\n\
be presented to the user and must be localized using @samp{_(@var{msg})}.\n\
\n\
@var{data} is the data that was returned by @code{TARGET_GET_PCH_VALIDITY}\n\
when the PCH file was created and @var{sz} is the size of that data in bytes.\n\
It's safe to assume that the data was created by the same version of the\n\
compiler, so no format checking is needed.\n\
\n\
The default definition of @code{default_pch_valid_p} should be\n\
suitable for most targets.",
const char *, (const void *data, size_t sz),
default_pch_valid_p)
DEFHOOK
(prepare_pch_save,
"Called before writing out a PCH file. If the target has some\n\
garbage-collected data that needs to be in a particular state on PCH loads,\n\
it can use this hook to enforce that state. Very few targets need\n\
to do anything here.",
void, (void),
hook_void_void)
/* If nonnull, this function checks whether a PCH file with the
given set of target flags can be used. It returns NULL if so,
otherwise it returns an error message. */
DEFHOOK
(check_pch_target_flags,
"If this hook is nonnull, the default implementation of\n\
@code{TARGET_PCH_VALID_P} will use it to check for compatible values\n\
of @code{target_flags}. @var{pch_flags} specifies the value that\n\
@code{target_flags} had when the PCH file was created. The return\n\
value is the same as for @code{TARGET_PCH_VALID_P}.",
const char *, (int pch_flags), NULL)
/* True if the compiler should give an enum type only as many
bytes as it takes to represent the range of possible values of
that type. */
DEFHOOK
(default_short_enums,
"This target hook should return true if the compiler should give an\n\
@code{enum} type only as many bytes as it takes to represent the range\n\
of possible values of that type. It should return false if all\n\
@code{enum} types should be allocated like @code{int}.\n\
\n\
The default is to return false.",
bool, (void),
hook_bool_void_false)
/* This target hook returns an rtx that is used to store the address
of the current frame into the built-in setjmp buffer. */
DEFHOOK
(builtin_setjmp_frame_value,
"This target hook should return an rtx that is used to store\n\
the address of the current frame into the built in @code{setjmp} buffer.\n\
The default value, @code{virtual_stack_vars_rtx}, is correct for most\n\
machines. One reason you may need to define this target hook is if\n\
@code{hard_frame_pointer_rtx} is the appropriate value on your machine.",
rtx, (void),
default_builtin_setjmp_frame_value)
/* This target hook should add STRING_CST trees for any hard regs
the port wishes to automatically clobber for an asm. */
DEFHOOK
(md_asm_clobbers,
"This target hook should add to @var{clobbers} @code{STRING_CST} trees for\n\
any hard regs the port wishes to automatically clobber for an asm.\n\
It should return the result of the last @code{tree_cons} used to add a\n\
clobber. The @var{outputs}, @var{inputs} and @var{clobber} lists are the\n\
corresponding parameters to the asm and may be inspected to avoid\n\
clobbering a register that is an input or output of the asm. You can use\n\
@code{tree_overlaps_hard_reg_set}, declared in @file{tree.h}, to test\n\
for overlap with regards to asm-declared registers.",
tree, (tree outputs, tree inputs, tree clobbers),
hook_tree_tree_tree_tree_3rd_identity)
/* This target hook allows the backend to specify a calling convention
in the debug information. This function actually returns an
enum dwarf_calling_convention, but because of forward declarations
and not wanting to include dwarf2.h everywhere target.h is included
the function is being declared as an int. */
DEFHOOK
(dwarf_calling_convention,
"Define this to enable the dwarf attribute @code{DW_AT_calling_convention} to\n\
be emitted for each function. Instead of an integer return the enum\n\
value for the @code{DW_CC_} tag.",
int, (const_tree function),
hook_int_const_tree_0)
/* This target hook allows the backend to emit frame-related insns that
contain UNSPECs or UNSPEC_VOLATILEs. The call frame debugging info
engine will invoke it on insns of the form
(set (reg) (unspec [...] UNSPEC_INDEX))
and
(set (reg) (unspec_volatile [...] UNSPECV_INDEX))
to let the backend emit the call frame instructions. */
DEFHOOK
(dwarf_handle_frame_unspec,
"This target hook allows the backend to emit frame-related insns that\n\
contain UNSPECs or UNSPEC_VOLATILEs. The DWARF 2 call frame debugging\n\
info engine will invoke it on insns of the form\n\
@smallexample\n\
(set (reg) (unspec [@dots{}] UNSPEC_INDEX))\n\
@end smallexample\n\
and\n\
@smallexample\n\
(set (reg) (unspec_volatile [@dots{}] UNSPECV_INDEX)).\n\
@end smallexample\n\
to let the backend emit the call frame instructions. @var{label} is\n\
the CFI label attached to the insn, @var{pattern} is the pattern of\n\
the insn and @var{index} is @code{UNSPEC_INDEX} or @code{UNSPECV_INDEX}.",
void, (const char *label, rtx pattern, int index), NULL)
/* ??? Documenting this hook requires a GFDL license grant. */
DEFHOOK_UNDOC
(stdarg_optimize_hook,
"Perform architecture specific checking of statements gimplified\
from @code{VA_ARG_EXPR}. @var{stmt} is the statement. Returns true if\
the statement doesn't need to be checked for @code{va_list} references.",
bool, (struct stdarg_info *ai, const_gimple stmt), NULL)
/* This target hook allows the operating system to override the DECL
that represents the external variable that contains the stack
protection guard variable. The type of this DECL is ptr_type_node. */
DEFHOOK
(stack_protect_guard,
"This hook returns a @code{DECL} node for the external variable to use\n\
for the stack protection guard. This variable is initialized by the\n\
runtime to some random value and is used to initialize the guard value\n\
that is placed at the top of the local stack frame. The type of this\n\
variable must be @code{ptr_type_node}.\n\
\n\
The default version of this hook creates a variable called\n\
@samp{__stack_chk_guard}, which is normally defined in @file{libgcc2.c}.",
tree, (void),
default_stack_protect_guard)
/* This target hook allows the operating system to override the CALL_EXPR
that is invoked when a check vs the guard variable fails. */
DEFHOOK
(stack_protect_fail,
"This hook returns a @code{CALL_EXPR} that alerts the runtime that the\n\
stack protect guard variable has been modified. This expression should\n\
involve a call to a @code{noreturn} function.\n\
\n\
The default version of this hook invokes a function called\n\
@samp{__stack_chk_fail}, taking no arguments. This function is\n\
normally defined in @file{libgcc2.c}.",
tree, (void),
default_external_stack_protect_fail)
DEFHOOK
(can_use_doloop_p,
"Return true if it is possible to use low-overhead loops (@code{doloop_end}\n\
and @code{doloop_begin}) for a particular loop. @var{iterations} gives the\n\
exact number of iterations, or 0 if not known. @var{iterations_max} gives\n\
the maximum number of iterations, or 0 if not known. @var{loop_depth} is\n\
the nesting depth of the loop, with 1 for innermost loops, 2 for loops that\n\
contain innermost loops, and so on. @var{entered_at_top} is true if the\n\
loop is only entered from the top.\n\
\n\
This hook is only used if @code{doloop_end} is available. The default\n\
implementation returns true. You can use @code{can_use_doloop_if_innermost}\n\
if the loop must be the innermost, and if there are no other restrictions.",
bool, (double_int iterations, double_int iterations_max,
unsigned int loop_depth, bool entered_at_top),