blob: 87feeec2ea1259d446bc64459ca4a498a8e07ab8 [file] [log] [blame]
/* Target hook definitions.
Copyright (C) 2001-2021 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_PSI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PDI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PTI_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_PSI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PDI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PTI_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)
/* 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)
/* Assembly strings required after the .cfi_startproc label. */
DEFHOOK
(post_cfi_startproc,
"This target hook is used to emit assembly strings required by the target\n\
after the .cfi_startproc directive. The first argument is the file stream to\n\
write the strings to and the second argument is the function\'s declaration. The\n\
expected use is to add more .cfi_* directives.\n\
\n\
The default is to not output any assembly strings.",
void, (FILE *, tree),
hook_void_FILEptr_tree)
/* Notify the backend that we have completed emitting the data for a
decl. */
DEFHOOK
(decl_end,
"Define this hook if the target assembler requires a special marker to\n\
terminate an initialized variable declaration.",
void, (void),
hook_void_void)
/* 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 declare an external variable. */
DEFHOOK
(assemble_undefined_decl,
"This target hook is a function to output to the stdio stream\n\
@var{stream} some commands that will declare the name associated with\n\
@var{decl} which is not defined in the current translation unit. Most\n\
assemblers do not require anything to be output in this case.",
void, (FILE *stream, const char *name, const_tree decl),
hook_void_FILEptr_constcharptr_const_tree)
/* 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\n\
used to emit a directive to install a personality hook into the unwind\n\
info. This hook should not be used if dwarf2 unwind info is used.",
void, (rtx personality),
NULL)
/* If necessary, modify personality and LSDA references to handle
indirection. This is used when the assembler supports CFI directives. */
DEFHOOK
(make_eh_symbol_indirect,
"If necessary, modify personality and LSDA references to handle indirection.\n\
The original symbol is in @code{origsymbol} and if @code{pubvis} is true\n\
the symbol is visible outside the TU.",
rtx, (rtx origsymbol, bool pubvis),
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 *insn),
NULL)
DEFHOOKPOD
(unwind_emit_before_insn,
"True if the @code{TARGET_ASM_UNWIND_EMIT} hook should be called before\n\
the assembly for @var{insn} has been emitted, false if the hook should\n\
be called afterward.",
bool, true)
/* Return true if the target needs extra instructions to restore the current
frame address after a DW_CFA_restore_state opcode. */
DEFHOOK
(should_restore_cfa_state,
"For DWARF-based unwind frames, two CFI instructions provide for save and\n\
restore of register state. GCC maintains the current frame address (CFA)\n\
separately from the register bank but the unwinder in libgcc preserves this\n\
state along with the registers (and this is expected by the code that writes\n\
the unwind frames). This hook allows the target to specify that the CFA data\n\
is not saved/restored along with the registers by the target unwinder so that\n\
suitable additional instructions should be emitted to restore it.",
bool, (void),
hook_bool_void_false)
/* 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)
DEFHOOK
(print_patchable_function_entry,
"Generate a patchable area at the function start, consisting of\n\
@var{patch_area_size} NOP instructions. If the target supports named\n\
sections and if @var{record_p} is true, insert a pointer to the current\n\
location in the table of patchable functions. The default implementation\n\
of the hook places the table of pointers in the special section named\n\
@code{__patchable_function_entries}.",
void, (FILE *file, unsigned HOST_WIDE_INT patch_area_size, bool record_p),
default_print_patchable_function_entry)
/* 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{file} is a stdio stream to which the assembler\n\
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),
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 argument 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),
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)
/* Tell assembler what section attributes to assign this elf section
declaration, using their numerical value. */
DEFHOOK
(elf_flags_numeric,
"This hook can be used to encode ELF section flags for which no letter\n\
code has been defined in the assembler. It is called by\n\
@code{default_asm_named_section} whenever the section flags need to be\n\
emitted in the assembler output. If the hook returns true, then the\n\
numerical value for ELF section flags should be calculated from\n\
@var{flags} and saved in @var{*num}; the value is printed out instead of the\n\
normal sequence of letter codes. If the hook is not defined, or if it\n\
returns false, then @var{num} is ignored and the traditional letter sequence\n\
is emitted.",
bool, (unsigned int flags, unsigned int *num),
hook_bool_uint_uintp_false)
/* 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\n\
labels needed when a function is partitioned between different\n\
sections. Output should be written to @var{file}. The function\n\
decl is available as @var{decl} and the new section is `cold' if\n\
@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 flag for either generating ADDR_DIF_VEC table
or ADDR_VEC table for jumps in case of -fPIC/-fPIE. */
DEFHOOK
(generate_pic_addr_diff_vec,
"Return true to generate ADDR_DIF_VEC table\n\
or false to generate ADDR_VEC table for jumps in case of -fPIC.\n\
\n\
The default version of this function returns true if flag_pic\n\
equals true and false otherwise",
bool, (void),
default_generate_pic_addr_diff_vec)
/* 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 *, (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 or relocated readonly data section
associated with function DECL. */
DEFHOOK
(function_rodata_section,
"Return the readonly data or reloc readonly data section associated with\n\
@samp{DECL_SECTION_NAME (@var{decl})}. @var{relocatable} selects the latter\n\
over the former.\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\
or @code{.data.rel.ro.name} if function is in @code{.text.name}, and\n\
the normal readonly-data or reloc readonly data section otherwise.",
section *, (tree decl, bool relocatable),
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\n\
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 provided as argument.\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.",
void, (const char *),
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}\n\
directive, or the equivalent directive or pragma in non-C-family languages.\n\
If this hook is not defined, nothing is output for the @samp{#ident}\n\
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 *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 DWARF debugging information which indicates that filename\n\
@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\n\
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, machine_mode mode, 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\n\
@code{assemble_name}, but in memory rather than to a file stream, returning\n\
result as an @code{IDENTIFIER_NODE}. Required for correct LTO symtabs. The\n\
default implementation calls the @code{TARGET_STRIP_NAME_ENCODING} hook and\n\
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 a\n\
dependence of type dep_type, and strength @var{dw}. It should return the new\n\
value. The default is to make no adjustment to @var{cost}. This can be\n\
used for example to specify to the scheduler using the traditional pipeline\n\
description that an output- or anti-dependence does not incur the same cost\n\
as a 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 *insn, int dep_type1, rtx_insn *dep_insn, int cost,
unsigned int dw),
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 *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 *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_insn **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_insn **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 should be macro fused for\n\
a target microarchitecture. If this hook returns true for the given insn pair\n\
(@var{prev} and @var{curr}), the scheduler will put them into a sched\n\
group, and they will not be scheduled apart. The two insns will be either\n\
two SET insns or a compare and a conditional jump and this hook should\n\
validate any dependencies needed to fuse the two insns together.",
bool, (rtx_insn *prev, rtx_insn *curr), 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_insn *head, rtx_insn *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_insn *, (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 considered in multipass scheduling.\n\
Positive return values will remove @var{insn} from consideration on\n\
the current round of multipass scheduling.\n\
Negative return values will remove @var{insn} from consideration for given\n\
number of cycles.\n\
Backends should be careful about returning non-zero for highest priority\n\
instruction at position 0 in the ready list. @var{ready_index} is passed\n\
to allow backends make correct judgements.\n\
\n\
The default is that any ready insns can be chosen to be issued.",
int, (rtx_insn *insn, int ready_index), 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, signed 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, signed char *ready_try, int n_ready, rtx_insn *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, signed 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 *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)
/* 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 *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 *insn, rtx_insn *label, unsigned int ds), 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 *insn), NULL)
DEFHOOK_UNDOC
(get_insn_checked_ds,
"Return speculation types that are checked for instruction @var{insn}",
unsigned int, (rtx_insn *insn), NULL)
DEFHOOK
(can_speculate_insn,
"Some instructions should never be speculated by the schedulers, usually\n\
because the instruction is too expensive to get this wrong. Often such\n\
instructions have long latency, and often they are not fully modeled in the\n\
pipeline descriptions. This hook should return @code{false} if @var{insn}\n\
should not be speculated.",
bool, (rtx_insn *insn), hook_bool_rtx_insn_true)
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 *insn, int x),
hook_void_rtx_insn_int)
/* The following member value is 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 *insn, int x),
hook_bool_rtx_insn_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, machine_mode mode),
hook_int_uint_mode_1)
/* The following member value is a function that returns priority for
fusion of each instruction via pointer parameters. */
DEFHOOK
(fusion_priority,
"This hook is called by scheduling fusion pass. It calculates fusion\n\
priorities for each instruction passed in by parameter. The priorities\n\
are returned via pointer parameters.\n\
\n\
@var{insn} is the instruction whose priorities need to be calculated.\n\
@var{max_pri} is the maximum priority can be returned in any cases.\n\
@var{fusion_pri} is the pointer parameter through which @var{insn}'s\n\
fusion priority should be calculated and returned.\n\
@var{pri} is the pointer parameter through which @var{insn}'s priority\n\
should be calculated and returned.\n\
\n\
Same @var{fusion_pri} should be returned for instructions which should\n\
be scheduled together. Different @var{pri} should be returned for\n\
instructions with same @var{fusion_pri}. @var{fusion_pri} is the major\n\
sort key, @var{pri} is the minor sort key. All instructions will be\n\
scheduled according to the two priorities. All priorities calculated\n\
should be between 0 (exclusive) and @var{max_pri} (inclusive). To avoid\n\
false dependencies, @var{fusion_pri} of instructions which need to be\n\
scheduled together should be smaller than @var{fusion_pri} of irrelevant\n\
instructions.\n\
\n\
Given below example:\n\
\n\
@smallexample\n\
ldr r10, [r1, 4]\n\
add r4, r4, r10\n\
ldr r15, [r2, 8]\n\
sub r5, r5, r15\n\
ldr r11, [r1, 0]\n\
add r4, r4, r11\n\
ldr r16, [r2, 12]\n\
sub r5, r5, r16\n\
@end smallexample\n\
\n\
On targets like ARM/AArch64, the two pairs of consecutive loads should be\n\
merged. Since peephole2 pass can't help in this case unless consecutive\n\
loads are actually next to each other in instruction flow. That's where\n\
this scheduling fusion pass works. This hook calculates priority for each\n\
instruction based on its fustion type, like:\n\
\n\
@smallexample\n\
ldr r10, [r1, 4] ; fusion_pri=99, pri=96\n\
add r4, r4, r10 ; fusion_pri=100, pri=100\n\
ldr r15, [r2, 8] ; fusion_pri=98, pri=92\n\
sub r5, r5, r15 ; fusion_pri=100, pri=100\n\
ldr r11, [r1, 0] ; fusion_pri=99, pri=100\n\
add r4, r4, r11 ; fusion_pri=100, pri=100\n\
ldr r16, [r2, 12] ; fusion_pri=98, pri=88\n\
sub r5, r5, r16 ; fusion_pri=100, pri=100\n\
@end smallexample\n\
\n\
Scheduling fusion pass then sorts all ready to issue instructions according\n\
to the priorities. As a result, instructions of same fusion type will be\n\
pushed together in instruction flow, like:\n\
\n\
@smallexample\n\
ldr r11, [r1, 0]\n\
ldr r10, [r1, 4]\n\
ldr r15, [r2, 8]\n\
ldr r16, [r2, 12]\n\
add r4, r4, r10\n\
sub r5, r5, r15\n\
add r4, r4, r11\n\
sub r5, r5, r16\n\
@end smallexample\n\
\n\
Now peephole2 pass can simply merge the two pairs of loads.\n\
\n\
Since scheduling fusion pass relies on peephole2 to do real fusion\n\
work, it is only enabled by default when peephole2 is in effect.\n\
\n\
This is firstly introduced on ARM/AArch64 targets, please refer to\n\
the hook implementation for how different fusion types are supported.",
void, (rtx_insn *insn, int max_pri, int *fusion_pri, int *pri), NULL)
HOOK_VECTOR_END (sched)
/* Functions relating to OpenMP SIMD and __attribute__((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 OpenMP SIMT vectorization transform. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_SIMT_"
HOOK_VECTOR (TARGET_SIMT, simt)
DEFHOOK
(vf,
"Return number of threads in SIMT thread group on the target.",
int, (void), NULL)
HOOK_VECTOR_END (simt)
/* Functions relating to OpenMP. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_OMP_"
HOOK_VECTOR (TARGET_OMP, omp)
DEFHOOK
(device_kind_arch_isa,
"Return 1 if @var{trait} @var{name} is present in the OpenMP context's\n\
device trait set, return 0 if not present in any OpenMP context in the\n\
whole translation unit, or -1 if not present in the current OpenMP context\n\
but might be present in another OpenMP context in the same TU.",
int, (enum omp_device_kind_arch_isa trait, const char *name), NULL)
HOOK_VECTOR_END (omp)
/* Functions relating to openacc. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_GOACC_"
HOOK_VECTOR (TARGET_GOACC, goacc)
DEFHOOK
(validate_dims,
"This hook should check the launch dimensions provided for an OpenACC\n\
compute region, or routine. Defaulted values are represented as -1\n\
and non-constant values as 0. The @var{fn_level} is negative for the\n\
function corresponding to the compute region. For a routine it is the\n\
outermost level at which partitioned execution may be spawned. The hook\n\
should verify non-default values. If DECL is NULL, global defaults\n\
are being validated and unspecified defaults should be filled in.\n\
Diagnostics should be issued as appropriate. Return\n\
true, if changes have been made. You must override this hook to\n\
provide dimensions larger than 1.",
bool, (tree decl, int *dims, int fn_level, unsigned used),
default_goacc_validate_dims)
DEFHOOK
(dim_limit,
"This hook should return the maximum size of a particular dimension,\n\
or zero if unbounded.",
int, (int axis),
default_goacc_dim_limit)
DEFHOOK
(fork_join,
"This hook can be used to convert IFN_GOACC_FORK and IFN_GOACC_JOIN\n\
function calls to target-specific gimple, or indicate whether they\n\
should be retained. It is executed during the oacc_device_lower pass.\n\
It should return true, if the call should be retained. It should\n\
return false, if it is to be deleted (either because target-specific\n\
gimple has been inserted before it, or there is no need for it).\n\
The default hook returns false, if there are no RTL expanders for them.",
bool, (gcall *call, const int *dims, bool is_fork),
default_goacc_fork_join)
DEFHOOK
(reduction,
"This hook is used by the oacc_transform pass to expand calls to the\n\
@var{GOACC_REDUCTION} internal function, into a sequence of gimple\n\
instructions. @var{call} is gimple statement containing the call to\n\
the function. This hook removes statement @var{call} after the\n\
expanded sequence has been inserted. This hook is also responsible\n\
for allocating any storage for reductions when necessary.",
void, (gcall *call),
default_goacc_reduction)
DEFHOOK
(adjust_private_decl,
"This hook, if defined, is used by accelerator target back-ends to adjust\n\
OpenACC variable declarations that should be made private to the given\n\
parallelism level (i.e. @code{GOMP_DIM_GANG}, @code{GOMP_DIM_WORKER} or\n\
@code{GOMP_DIM_VECTOR}). A typical use for this hook is to force variable\n\
declarations at the @code{gang} level to reside in GPU shared memory.\n\
@var{loc} may be used for diagnostic purposes.\n\
\n\
You may also use the @code{TARGET_GOACC_EXPAND_VAR_DECL} hook if the\n\
adjusted variable declaration needs to be expanded to RTL in a non-standard\n\
way.",
tree, (location_t loc, tree var, int level),
NULL)
DEFHOOK
(expand_var_decl,
"This hook, if defined, is used by accelerator target back-ends to expand\n\
specially handled kinds of @code{VAR_DECL} expressions. A particular use is\n\
to place variables with specific attributes inside special accelarator\n\
memories. A return value of @code{NULL} indicates that the target does not\n\
handle this @code{VAR_DECL}, and normal RTL expanding is resumed.\n\
\n\
Only define this hook if your accelerator target needs to expand certain\n\
@code{VAR_DECL} nodes in a way that differs from the default. You can also adjust\n\
private variables at OpenACC device-lowering time using the\n\
@code{TARGET_GOACC_ADJUST_PRIVATE_DECL} target hook.",
rtx, (tree var),
NULL)
DEFHOOK
(create_worker_broadcast_record,
"Create a record used to propagate local-variable state from an active\n\
worker to other workers. A possible implementation might adjust the type\n\
of REC to place the new variable in shared GPU memory.\n\
\n\
Presence of this target hook indicates that middle end neutering/broadcasting\n\
be used.",
tree, (tree rec, bool sender, const char *name, unsigned HOST_WIDE_INT offset),
NULL)
DEFHOOK
(shared_mem_layout,
"Lay out a fixed shared-memory region on the target. The LO and HI\n\
arguments should be set to a range of addresses that can be used for worker\n\
broadcasting. The dimensions, reduction size and gang-private size\n\
arguments are for the current offload region.",
void, (unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *, int[],
unsigned HOST_WIDE_INT[], unsigned HOST_WIDE_INT[]),
NULL)
HOOK_VECTOR_END (goacc)
/* 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 built-in function that realizes the vectorized version of
a target-independent 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 function with the @code{combined_fn} code\n\
@var{code} or @code{NULL_TREE} if such a function is not available.\n\
The 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, (unsigned code, tree vec_type_out, tree vec_type_in),
default_builtin_vectorized_function)
/* Returns a built-in function that realizes the vectorized version of
a target-specific function, or NULL_TREE if not available. */
DEFHOOK
(builtin_md_vectorized_function,
"This hook should return the decl of a function that implements the\n\
vectorized variant of target built-in function @code{fndecl}. 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_md_vectorized_function)
/* 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)
DEFHOOK
(preferred_vector_alignment,
"This hook returns the preferred alignment in bits for accesses to\n\
vectors of type @var{type} in vectorized code. This might be less than\n\
or greater than the ABI-defined value returned by\n\
@code{TARGET_VECTOR_ALIGNMENT}. It can be equal to the alignment of\n\
a single element, in which case the vectorizer will not try to optimize\n\
for alignment.\n\
\n\
The default hook returns @code{TYPE_ALIGN (@var{type})}, which is\n\
correct for most targets.",
poly_uint64, (const_tree type),
default_preferred_vector_alignment)
/* Return true if vector alignment is reachable (by peeling N
iterations) for the given scalar type. */
DEFHOOK
(vector_alignment_reachable,
"Return true if vector alignment is reachable (by peeling N iterations)\n\
for the given scalar type @var{type}. @var{is_packed} is false if the scalar\n\
access using @var{type} is known to be naturally aligned.",
bool, (const_tree type, bool is_packed),
default_builtin_vector_alignment_reachable)
DEFHOOK
(vec_perm_const,
"This hook is used to test whether the target can permute up to two\n\
vectors of mode @var{mode} using the permutation vector @code{sel}, and\n\
also to emit such a permutation. In the former case @var{in0}, @var{in1}\n\
and @var{out} are all null. In the latter case @var{in0} and @var{in1} are\n\
the source vectors and @var{out} is the destination vector; all three are\n\
operands of mode @var{mode}. @var{in1} is the same as @var{in0} if\n\
@var{sel} describes a permutation on one vector instead of two.\n\
\n\
Return true if the operation is possible, emitting instructions for it\n\
if rtxes are provided.\n\
\n\
@cindex @code{vec_perm@var{m}} instruction pattern\n\
If the hook returns false for a mode with multibyte elements, GCC will\n\
try the equivalent byte operation. If that also fails, it will try forcing\n\
the selector into a register and using the @var{vec_perm@var{mode}}\n\
instruction pattern. There is no need for the hook to handle these two\n\
implementation approaches itself.",
bool, (machine_mode mode, rtx output, rtx in0, rtx in1,
const vec_perm_indices &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,
(machine_mode mode, const_tree type, int misalignment, bool is_packed),
default_builtin_support_vector_misalignment)
/* 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.",
machine_mode,
(scalar_mode mode),
default_preferred_simd_mode)
/* Returns the preferred mode for splitting SIMD reductions to. */
DEFHOOK
(split_reduction,
"This hook should return the preferred mode to split the final reduction\n\
step on @var{mode} to. The reduction is then carried out reducing upper\n\
against lower halves of vectors recursively until the specified mode is\n\
reached. The default is @var{mode} which means no splitting.",
machine_mode,
(machine_mode),
default_split_reduction)
/* 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_modes,
"If using the mode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}\n\
is not the only approach worth considering, this hook should add one mode to\n\
@var{modes} for each useful alternative approach. These modes are then\n\
passed to @code{TARGET_VECTORIZE_RELATED_MODE} to obtain the vector mode\n\
for a given element mode.\n\
\n\
The modes returned in @var{modes} should use the smallest element mode\n\
possible for the vectorization approach that they represent, preferring\n\
integer modes over floating-poing modes in the event of a tie. The first\n\
mode should be the @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE} for its\n\
element mode.\n\
\n\
If @var{all} is true, add suitable vector modes even when they are generally\n\
not expected to be worthwhile.\n\
\n\
The hook returns a bitmask of flags that control how the modes in\n\
@var{modes} are used. The flags are:\n\
@table @code\n\
@item VECT_COMPARE_COSTS\n\
Tells the loop vectorizer to try all the provided modes and pick the one\n\
with the lowest cost. By default the vectorizer will choose the first\n\
mode that works.\n\
@end table\n\
\n\
The hook does not need to do anything if the vector returned by\n\
@code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE} is the only one relevant\n\
for autovectorization. The default implementation adds no modes and\n\
returns 0.",
unsigned int,
(vector_modes *modes, bool all),
default_autovectorize_vector_modes)
DEFHOOK
(related_mode,
"If a piece of code is using vector mode @var{vector_mode} and also wants\n\
to operate on elements of mode @var{element_mode}, return the vector mode\n\
it should use for those elements. If @var{nunits} is nonzero, ensure that\n\
the mode has exactly @var{nunits} elements, otherwise pick whichever vector\n\
size pairs the most naturally with @var{vector_mode}. Return an empty\n\
@code{opt_machine_mode} if there is no supported vector mode with the\n\
required properties.\n\
\n\
There is no prescribed way of handling the case in which @var{nunits}\n\
is zero. One common choice is to pick a vector mode with the same size\n\
as @var{vector_mode}; this is the natural choice if the target has a\n\
fixed vector size. Another option is to choose a vector mode with the\n\
same number of elements as @var{vector_mode}; this is the natural choice\n\
if the target has a fixed number of elements. Alternatively, the hook\n\
might choose a middle ground, such as trying to keep the number of\n\
elements as similar as possible while applying maximum and minimum\n\
vector sizes.\n\
\n\
The default implementation uses @code{mode_for_vector} to find the\n\
requested mode, returning a mode with the same size as @var{vector_mode}\n\
when @var{nunits} is zero. This is the correct behavior for most targets.",
opt_machine_mode,
(machine_mode vector_mode, scalar_mode element_mode, poly_uint64 nunits),
default_vectorize_related_mode)
/* Function to get a target mode for a vector mask. */
DEFHOOK
(get_mask_mode,
"Return the mode to use for a vector mask that holds one boolean\n\
result for each element of vector mode @var{mode}. The returned mask mode\n\
can be a vector of integers (class @code{MODE_VECTOR_INT}), a vector of\n\
booleans (class @code{MODE_VECTOR_BOOL}) or a scalar integer (class\n\
@code{MODE_INT}). Return an empty @code{opt_machine_mode} if no such\n\
mask mode exists.\n\
\n\
The default implementation returns a @code{MODE_VECTOR_INT} with the\n\
same size and number of elements as @var{mode}, if such a mode exists.",
opt_machine_mode,
(machine_mode mode),
default_get_mask_mode)
/* Function to say whether a masked operation is expensive when the
mask is all zeros. */
DEFHOOK
(empty_mask_is_expensive,
"This hook returns true if masked internal function @var{ifn} (really of\n\
type @code{internal_fn}) should be considered expensive when the mask is\n\
all zeros. GCC can then try to branch around the instruction instead.",
bool,
(unsigned ifn),
default_empty_mask_is_expensive)
/* 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 builtin that implements vector scatter operation. */
DEFHOOK
(builtin_scatter,
"Target builtin that implements vector scatter operation. @var{vectype}\n\
is the vector type of the store 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 scatter\n\
stores.",
tree,
(const_tree 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\n\
for modeling the costs of vectorizing a loop or basic block. The default\n\
allocates three unsigned integers for accumulating costs for the prologue,\n\
body, and epilogue of the loop or basic block. If @var{loop_info} is\n\
non-NULL, it identifies the loop being vectorized; otherwise a single block\n\
is being vectorized. If @var{costing_for_scalar} is true, it indicates the\n\
current cost model is for the scalar version of a loop or block; otherwise\n\
it is for the vector version.",
void *,
(class loop *loop_info, bool costing_for_scalar),
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\n\
adding @var{count} copies of the given @var{kind} of statement to a\n\
loop or basic block. The default adds the builtin vectorizer cost for\n\
the copies of the statement to the accumulator specified by @var{where},\n\
(the prologue, body, or epilogue) and returns the amount added. The\n\
return value should be viewed as a tentative cost that may later be\n\
revised.",
unsigned,
(class vec_info *, void *data, int count, enum vect_cost_for_stmt kind,
class _stmt_vec_info *stmt_info, tree vectype, 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\n\
or basic block based on @var{data}, and return the prologue, body, and\n\
epilogue costs as unsigned integers. The default returns the value of\n\
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\n\
allocated by TARGET_VECTORIZE_INIT_COST. The default releases the\n\
accumulator.",
void,
(void *data),
default_destroy_cost_data)
HOOK_VECTOR_END (vectorize)
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_"
DEFHOOK
(preferred_else_value,
"This hook returns the target's preferred final argument for a call\n\
to conditional internal function @var{ifn} (really of type\n\
@code{internal_fn}). @var{type} specifies the return type of the\n\
function and @var{ops} are the operands to the conditional operation,\n\
of which there are @var{nops}.\n\
\n\
For example, if @var{ifn} is @code{IFN_COND_ADD}, the hook returns\n\
a value of type @var{type} that should be used when @samp{@var{ops}[0]}\n\
and @samp{@var{ops}[1]} are conditionally added together.\n\
\n\
This hook is only relevant if the target supports conditional patterns\n\
like @code{cond_add@var{m}}. The default implementation returns a zero\n\
constant of type @var{type}.",
tree,
(unsigned ifn, tree type, unsigned nops, tree *ops),
default_preferred_else_value)
DEFHOOK
(record_offload_symbol,
"Used when offloaded functions are seen in the compilation unit and no named\n\
sections are available. It is called once for each symbol that must be\n\
recorded in the offload function and variable table.",
void, (tree),
hook_void_tree)
DEFHOOKPOD
(absolute_biggest_alignment,
"If defined, this target hook specifies the absolute biggest alignment\n\
that a type or variable can have on this machine, otherwise,\n\
@code{BIGGEST_ALIGNMENT} is used.",
HOST_WIDE_INT, BIGGEST_ALIGNMENT)
/* 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
(offload_options,
"Used when writing out the list of options into an LTO file. It should\n\
translate any relevant target-specific options (such as the ABI in use)\n\
into one of the @option{-foffload} options that exist as a common interface\n\
to express such options. It should return a string containing these options,\n\
separated by spaces, which the caller will free.\n",
char *, (void), hook_charptr_void_null)
DEFHOOK_UNDOC
(eh_return_filter_mode,
"Return machine mode for filter value.",
scalar_int_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.",
scalar_int_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.",
scalar_int_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}.",
scalar_int_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-core.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)
/* Perform additional target-specific processing of generic attributes. */
DEFHOOK
(handle_generic_attribute,
"Define this target hook if you want to be able to perform additional\n\
target-specific processing of an attribute which is handled generically\n\
by a front end. The arguments are the same as those which are passed to\n\
attribute handlers. So far this only affects the @var{noinit} and\n\
@var{section} attribute.",
tree, (tree *node, tree name, tree args, int flags, bool *no_add_attrs),
hook_tree_treeptr_tree_tree_int_boolptr_null)
/* 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\n\
and rounding modes, false otherwise. This is intended to relate to the\n\
@code{float} and @code{double} types, but not necessarily @code{long double}.\n\
By default, returns true if the @code{adddf3} instruction pattern is\n\
available and false otherwise, on the assumption that hardware floating\n\
point supports exceptions and rounding modes but software floating point\n\
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, 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)
DEFHOOK
(check_builtin_call,
"Perform semantic checking on a call to a machine-specific built-in\n\
function after its arguments have been constrained to the function\n\
signature. Return true if the call is valid, otherwise report an error\n\
and return false.\n\
\n\
This hook is called after @code{TARGET_RESOLVE_OVERLOADED_BUILTIN}.\n\
The call was originally to built-in function @var{orig_fndecl},\n\
but after the optional @code{TARGET_RESOLVE_OVERLOADED_BUILTIN}\n\
step is now to built-in function @var{fndecl}. @var{loc} is the\n\
location of the call and @var{args} is an array of function arguments,\n\
of which there are @var{nargs}. @var{arg_loc} specifies the location\n\
of each argument.",
bool, (location_t loc, vec<location_t> arg_loc, tree fndecl,
tree orig_fndecl, unsigned int nargs, tree *args),
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 a target-specific function, or NULL_TREE if not available. */
DEFHOOK
(builtin_reciprocal,
"This hook should return the DECL of a function that implements the\n\
reciprocal of the machine-specific builtin function @var{fndecl}, or\n\
@code{NULL_TREE} if such a function is not available.",
tree, (tree fndecl),
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 in the target C library. If @var{type} is NULL,\n\
the caller asks for support for all standard (float, double, long double)\n\
types. If @var{type} is non-NULL, the caller asks for support for a\n\
specific type.",
bool, (enum function_class fn_class, tree type),
default_libc_has_function)
DEFHOOK
(libc_has_fast_function,
"This hook determines whether a function from a class of functions\n\
@code{(enum function_class)}@var{fcode} has a fast implementation.",
bool, (int fcode),
default_libc_has_fast_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;\n\
return true if FOLLOWER may be modified to follow FOLLOWEE;\n\
false, if it can't.\n\
For example, on some targets, certain kinds of branches can't be made to\n\
follow through a hot/cold partitioning.",
bool, (const rtx_insn *follower, const rtx_insn *followee),
hook_bool_const_rtx_insn_const_rtx_insn_true)
/* 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)
DEFHOOK
(gen_ccmp_first,
"This function prepares to emit a comparison insn for the first compare in a\n\
sequence of conditional comparisions. It returns an appropriate comparison\n\
with @code{CC} for passing to @code{gen_ccmp_next} or @code{cbranch_optab}.\n\
The insns to prepare the compare are saved in @var{prep_seq} and the compare\n\
insns are saved in @var{gen_seq}. They will be emitted when all the\n\
compares in the conditional comparision are generated without error.\n\
@var{code} is the @code{rtx_code} of the compare for @var{op0} and @var{op1}.",
rtx, (rtx_insn **prep_seq, rtx_insn **gen_seq, int code, tree op0, tree op1),
NULL)
DEFHOOK
(gen_ccmp_next,
"This function prepares to emit a conditional comparison within a sequence\n\
of conditional comparisons. It returns an appropriate comparison with\n\
@code{CC} for passing to @code{gen_ccmp_next} or @code{cbranch_optab}.\n\
The insns to prepare the compare are saved in @var{prep_seq} and the compare\n\
insns are saved in @var{gen_seq}. They will be emitted when all the\n\
compares in the conditional comparision are generated without error. The\n\
@var{prev} expression is the result of a prior call to @code{gen_ccmp_first}\n\
or @code{gen_ccmp_next}. It may return @code{NULL} if the combination of\n\
@var{prev} and this comparison is not supported, otherwise the result must\n\
be appropriate for passing to @code{gen_ccmp_next} or @code{cbranch_optab}.\n\
@var{code} is the @code{rtx_code} of the compare for @var{op0} and @var{op1}.\n\
@var{bit_code} is @code{AND} or @code{IOR}, which is the op on the compares.",
rtx, (rtx_insn **prep_seq, rtx_insn **gen_seq, rtx prev, int cmp_code, tree op0, tree op1, int bit_code),
NULL)
DEFHOOK
(gen_memset_scratch_rtx,
"This hook should return an rtx for a scratch register in @var{mode} to\n\
be used when expanding memset calls. The backend can use a hard scratch\n\
register to avoid stack realignment when expanding memset. The default\n\
is @code{gen_reg_rtx}.",
rtx, (machine_mode mode),
gen_reg_rtx)
/* 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, class 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, (machine_mode mode, rtx x),
hook_bool_mode_rtx_true)
/* True if X is a TLS operand whose value should be pre-computed. */
DEFHOOK
(precompute_tls_p,
"This hook returns true if @var{x} is a TLS operand on the target\n\
machine that should be pre-computed when used as the argument in a call.\n\
You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need not \n\
check this.\n\
\n\
The default definition returns false.",
bool, (machine_mode mode, rtx x),
hook_bool_mode_rtx_false)
/* 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, (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_insn *), 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, 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),
default_const_not_ok_for_debug_p)
/* 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, (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, (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 cannot 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)
/* Return true if a leaf function should stay leaf even with profiling
enabled. */
DEFHOOK
(keep_leaf_when_profiled,
"This target hook returns true if the target wants the leaf flag for\n\
the current function to stay true even if it calls mcount. This might\n\
make sense for targets using the leaf flag only to determine whether a\n\
stack frame needs to be generated or not and for which the call to\n\
mcount is generated before the function prologue.",
bool, (void),
default_keep_leaf_when_profiled)
/* 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, (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, (machine_mode mode),
default_min_divisions_for_recip_mul)
DEFHOOK
(truly_noop_truncation,
"This hook returns true if it is safe to ``convert'' a value of\n\
@var{inprec} bits to one of @var{outprec} bits (where @var{outprec} is\n\
smaller than @var{inprec}) by merely operating on it as if it had only\n\
@var{outprec} bits. The default returns true unconditionally, which\n\
is correct for most machines. When @code{TARGET_TRULY_NOOP_TRUNCATION}\n\
returns false, the machine description should provide a @code{trunc}\n\
optab to specify the RTL that performs the required truncation.\n\
\n\
If @code{TARGET_MODES_TIEABLE_P} returns false for a pair of modes,\n\
suboptimal code can result if this hook returns true for the corresponding\n\
mode sizes. Making this hook return false in such cases may improve things.",
bool, (poly_uint64 outprec, poly_uint64 inprec),
hook_bool_puint64_puint64_true)
/* 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{TARGET_CAN_CHANGE_MODE_CLASS} returns false.\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{TARGET_TRULY_NOOP_TRUNCATION} should return false when truncating to\n\
@code{mode}.",
int, (scalar_int_mode mode, scalar_int_mode rep_mode),
default_mode_rep_extended)
DEFHOOK
(setjmp_preserves_nonvolatile_regs_p,
"On some targets, it is assumed that the compiler will spill all pseudos\n\
that are live across a call to @code{setjmp}, while other targets treat\n\
@code{setjmp} calls as normal function calls.\n\
\n\
This hook returns false if @code{setjmp} calls do not preserve all\n\
non-volatile registers so that gcc that must spill all pseudos that are\n\
live across @code{setjmp} calls. Define this to return true if the\n\
target does not need to spill all pseudos live across @code{setjmp} calls.\n\
The default implementation conservatively assumes all pseudos must be\n\
spilled across @code{setjmp} calls.",
bool, (void),
hook_bool_void_false)
/* 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, (scalar_int_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}\n\
may alias with the system C library errno location. The default\n\
version of this hook assumes the system C library errno location\n\
is either a declaration of type int or accessed by dereferencing\n\
a pointer to int.",
bool, (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}.",
scalar_int_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}.",
scalar_int_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, (scalar_int_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, (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, 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)
/* True if 0 is a valid address in the address space, or false if
0 is a NULL in the address space. */
DEFHOOK
(zero_address_valid,
"Define this to modify the default handling of address 0 for the\n\
address space. Return true if 0 should be considered a valid address.",
bool, (addr_space_t as),
default_addr_space_zero_address_valid)
/* 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)
/* Function to encode an address space into dwarf. */
DEFHOOK
(debug,
"Define this to define how the address space is encoded in dwarf.\n\
The result is the value to be used with @code{DW_AT_address_class}.",
int, (addr_space_t as),
default_addr_space_debug)
/* Function to emit custom diagnostic if an address space is used. */
DEFHOOK
(diagnose_usage,
"Define this hook if the availability of an address space depends on\n\
command line options and some diagnostics should be printed when the\n\
address space is used. This hook is called during parsing and allows\n\
to emit a better diagnostic compared to the case where the address space\n\
was not registered with @code{c_register_addr_space}. @var{as} is\n\
the address space as registered with @code{c_register_addr_space}.\n\
@var{loc} is the location of the address space qualifier token.\n\
The default implementation does nothing.",
void, (addr_space_t as, location_t loc),
default_addr_space_diagnose_usage)
HOOK_VECTOR_END (addr_space)
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_"
DEFHOOK
(lower_local_decl_alignment,
"Define this hook to lower alignment of local, parm or result\n\
decl @samp{(@var{decl})}.",
void, (tree decl),
hook_void_tree)
DEFHOOK
(static_rtx_alignment,
"This hook returns the preferred alignment in bits for a\n\
statically-allocated rtx, such as a constant pool entry. @var{mode}\n\
is the mode of the rtx. The default implementation returns\n\
@samp{GET_MODE_ALIGNMENT (@var{mode})}.",
HOST_WIDE_INT, (machine_mode mode),
default_static_rtx_alignment)
DEFHOOK
(constant_alignment,
"This hook returns the alignment in bits of a constant that is being\n\
placed in memory. @var{constant} is the constant and @var{basic_align}\n\
is the alignment that the object would ordinarily have.\n\
\n\
The default definition just returns @var{basic_align}.\n\
\n\
The typical use of this hook is to increase alignment for string\n\
constants to be word aligned so that @code{strcpy} calls that copy\n\
constants can be done inline. The function\n\
@code{constant_alignment_word_strings} provides such a definition.",
HOST_WIDE_INT, (const_tree constant, HOST_WIDE_INT basic_align),
default_constant_alignment)
DEFHOOK
(translate_mode_attribute,
"Define this hook if during mode attribute processing, the port should\n\
translate machine_mode @var{mode} to another mode. For example, rs6000's\n\
@code{KFmode}, when it is the same as @code{TFmode}.\n\
\n\
The default version of the hook returns that mode that was passed in.",
machine_mode, (machine_mode mode),
default_translate_mode_attribute)
/* 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, (scalar_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, (machine_mode mode),
hook_bool_mode_false)
DEFHOOK
(compatible_vector_types_p,
"Return true if there is no target-specific reason for treating\n\
vector types @var{type1} and @var{type2} as distinct types. The caller\n\
has already checked for target-independent reasons, meaning that the\n\
types are known to have the same mode, to have the same number of elements,\n\
and to have what the caller considers to be compatible element types.\n\
\n\
The main reason for defining this hook is to reject pairs of types\n\
that are handled differently by the target's calling convention.\n\
For example, when a new @var{N}-bit vector architecture is added\n\
to a target, the target may want to handle normal @var{N}-bit\n\
@code{VECTOR_TYPE} arguments and return values in the same way as\n\
before, to maintain backwards compatibility. However, it may also\n\
provide new, architecture-specific @code{VECTOR_TYPE}s that are passed\n\
and returned in a more efficient way. It is then important to maintain\n\
a distinction between the ``normal'' @code{VECTOR_TYPE}s and the new\n\
architecture-specific ones.\n\
\n\
The default implementation returns true, which is correct for most targets.",
bool, (const_tree type1, const_tree type2),
hook_bool_const_tree_const_tree_true)
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)
DEFHOOK
(array_mode,
"Return the mode that GCC should use for an array that has\n\
@var{nelems} elements, with each element having mode @var{mode}.\n\
Return no mode if the target has no special requirements. In the\n\
latter case, GCC looks for an integer mode of the appropriate size\n\
if available and uses BLKmode otherwise. Usually the search for the\n\
integer mode is limited to @code{MAX_FIXED_MODE_SIZE}, but the\n\
@code{TARGET_ARRAY_MODE_SUPPORTED_P} hook allows a larger mode to be\n\
used in specific cases.\n\
\n\
The main use of this hook is to specify that an array of vectors should\n\
also have a vector mode. The default implementation returns no mode.",
opt_machine_mode, (machine_mode mode, unsigned HOST_WIDE_INT nelems),
hook_optmode_mode_uhwi_none)
/* 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, (machine_mode mode, unsigned HOST_WIDE_INT nelems),
hook_bool_mode_uhwi_false)
DEFHOOK
(libgcc_floating_mode_supported_p,
"Define this to return nonzero if libgcc provides support for the \n\
floating-point mode @var{mode}, which is known to pass \n\
@code{TARGET_SCALAR_MODE_SUPPORTED_P}. The default version of this \n\
hook returns true for all of @code{SFmode}, @code{DFmode}, \n\
@code{XFmode} and @code{TFmode}, if such modes exist.",
bool, (scalar_float_mode mode),
default_libgcc_floating_mode_supported_p)
DEFHOOK
(floatn_mode,
"Define this to return the machine mode to use for the type \n\
@code{_Float@var{n}}, if @var{extended} is false, or the type \n\
@code{_Float@var{n}x}, if @var{extended} is true. If such a type is not\n\
supported, return @code{opt_scalar_float_mode ()}. The default version of\n\
this hook returns @code{SFmode} for @code{_Float32}, @code{DFmode} for\n\
@code{_Float64} and @code{_Float32x} and @code{TFmode} for \n\
@code{_Float128}, if those modes exist and satisfy the requirements for \n\
those types and pass @code{TARGET_SCALAR_MODE_SUPPORTED_P} and \n\
@code{TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P}; for @code{_Float64x}, it \n\
returns the first of @code{XFmode} and @code{TFmode} that exists and \n\
satisfies the same requirements; for other types, it returns \n\
@code{opt_scalar_float_mode ()}. The hook is only called for values\n\
of @var{n} and @var{extended} that are valid according to\n\
ISO/IEC TS 18661-3:2015; that is, @var{n} is one of 32, 64, 128, or,\n\
if @var{extended} is false, 16 or greater than 128 and a multiple of 32.",
opt_scalar_float_mode, (int n, bool extended),
default_floatn_mode)
DEFHOOK
(floatn_builtin_p,
"Define this to return true if the @code{_Float@var{n}} and\n\
@code{_Float@var{n}x} built-in functions should implicitly enable the\n\
built-in function without the @code{__builtin_} prefix in addition to the\n\
normal built-in function with the @code{__builtin_} prefix. The default is\n\
to only enable built-in functions without the @code{__builtin_} prefix for\n\
the GNU C langauge. In strict ANSI/ISO mode, the built-in function without\n\
the @code{__builtin_} prefix is not enabled. The argument @code{FUNC} is the\n\
@code{enum built_in_function} id of the function to be enabled.",
bool, (int func),
default_floatn_builtin_p)
/* 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, (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, (machine_mode mode, reg_class_t rclass, bool in),
default_memory_move_cost)
DEFHOOK
(use_by_pieces_infrastructure_p,
"GCC will attempt several strategies when asked to copy between\n\
two areas of memory, or to set, clear or store to memory, for example\n\
when copying a @code{struct}. The @code{by_pieces} infrastructure\n\
implements such memory operations as a sequence of load, store or move\n\
insns. Alternate strategies are to expand the\n\
@code{cpymem} or @code{setmem} optabs, to emit a library call, or to emit\n\
unit-by-unit, loop-based operations.\n\
\n\
This target hook should return true if, for a memory operation with a\n\
given @var{size} and @var{alignment}, using the @code{by_pieces}\n\
infrastructure is expected to result in better code generation.\n\
Both @var{size} and @var{alignment} are measured in terms of storage\n\
units.\n\
\n\
The parameter @var{op} is one of: @code{CLEAR_BY_PIECES},\n\
@code{MOVE_BY_PIECES}, @code{SET_BY_PIECES}, @code{STORE_BY_PIECES} or\n\
@code{COMPARE_BY_PIECES}. These describe the type of memory operation\n\
under consideration.\n\
\n\
The parameter @var{speed_p} is true if the code is currently being\n\
optimized for speed rather than size.\n\
\n\
Returning true for higher values of @var{size} can improve code generation\n\
for speed if the target does not provide an implementation of the\n\
@code{cpymem} or @code{setmem} standard names, if the @code{cpymem} or\n\
@code{setmem} implementation would be more expensive than a sequence of\n\
insns, or if the overhead of a library call would dominate that of\n\
the body of the memory operation.\n\
\n\
Returning true for higher values of @code{size} may also cause an increase\n\
in code size, for example where the number of insns emitted to perform a\n\
move would be greater than that of a library call.",
bool, (unsigned HOST_WIDE_INT size, unsigned int alignment,
enum by_pieces_operation op, bool speed_p),
default_use_by_pieces_infrastructure_p)
DEFHOOK
(overlap_op_by_pieces_p,
"This target hook should return true if when the @code{by_pieces}\n\
infrastructure is used, an offset adjusted unaligned memory operation\n\
in the smallest integer mode for the last piece operation of a memory\n\
region can be generated to avoid doing more than one smaller operations.",
bool, (void),
hook_bool_void_false)
DEFHOOK
(compare_by_pieces_branch_ratio,
"When expanding a block comparison in MODE, gcc can try to reduce the\n\
number of branches at the expense of more memory operations. This hook\n\
allows the target to override the default choice. It should return the\n\
factor by which branches should be reduced over the plain expansion with\n\
one comparison per @var{mode}-sized piece. A port can also prevent a\n\
particular mode from being used for block comparisons by returning a\n\
negative number from this hook.",
int, (machine_mode mode),
default_compare_by_pieces_branch_ratio)
DEFHOOK
(slow_unaligned_access,
"This hook returns true if memory accesses described by the\n\
@var{mode} and @var{alignment} parameters have a cost many times greater\n\
than aligned accesses, for example if they are emulated in a trap handler.\n\
This hook is invoked only for unaligned accesses, i.e.@: when\n\
@code{@var{alignment} < GET_MODE_ALIGNMENT (@var{mode})}.\n\
\n\
When this hook returns true, the compiler will act as if\n\
@code{STRICT_ALIGNMENT} were true when generating code for block\n\
moves. This can cause significantly more instructions to be produced.\n\
Therefore, do not make this hook return true if unaligned accesses only\n\
add a cycle or two to the time for a memory access.\n\
\n\
The hook must return true whenever @code{STRICT_ALIGNMENT} is true.\n\
The default implementation returns @code{STRICT_ALIGNMENT}.",
bool, (machine_mode mode, unsigned int align),
default_slow_unaligned_access)
DEFHOOK
(optab_supported_p,
"Return true if the optimizers should use optab @var{op} with\n\
modes @var{mode1} and @var{mode2} for optimization type @var{opt_type}.\n\
The optab is known to have an associated @file{.md} instruction\n\
whose C condition is true. @var{mode2} is only meaningful for conversion\n\
optabs; for direct optabs it is a copy of @var{mode1}.\n\
\n\
For example, when called with @var{op} equal to @code{rint_optab} and\n\
@var{mode1} equal to @code{DFmode}, the hook should say whether the\n\
optimizers should use optab @code{rintdf2}.\n\
\n\
The default hook returns true for all inputs.",
bool, (int op, machine_mode mode1, machine_mode mode2,
optimization_type opt_type),
default_optab_supported_p)
/* 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, (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\n\
post-reload comparison elimination pass, or the delay slot filler pass,\n\
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 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{mode} is @var{x}'s machine mode, or for cases like @code{const_int} that\n\
do not have a mode, the mode in which @var{x} is used.\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, machine_mode mode, int outer_code, int opno, int *total, bool speed),
hook_bool_rtx_mode_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, machine_mode mode, addr_space_t as, bool speed),
default_address_cost)
/* Compute a cost for INSN. */
DEFHOOK
(insn_cost,
"This target hook describes the relative costs of RTL instructions.\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\
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}.",
int, (rtx_insn *insn, bool speed), NULL)
/* Give a cost, in RTX Costs units, for an edge. Like BRANCH_COST, but with
well defined units. */
DEFHOOK
(max_noce_ifcvt_seq_cost,
"This hook returns a value in the same units as @code{TARGET_RTX_COSTS},\n\
giving the maximum acceptable cost for a sequence generated by the RTL\n\
if-conversion pass when conditional execution is not available.\n\
The RTL if-conversion pass attempts to convert conditional operations\n\
that would require a branch to a series of unconditional operations and\n\
@code{mov@var{mode}cc} insns. This hook returns the maximum cost of the\n\
unconditional instructions and the @code{mov@var{mode}cc} insns.\n\
RTL if-conversion is cancelled if the cost of the converted sequence\n\
is greater than the value returned by this hook.\n\
\n\
@code{e} is the edge between the basic block containing the conditional\n\
branch to the basic block which would be executed if the condition\n\
were true.\n\
\n\
The default implementation of this hook uses the\n\
@code{max-rtl-if-conversion-[un]predictable} parameters if they are set,\n\
and uses a multiple of @code{BRANCH_COST} otherwise.",
unsigned int, (edge e),
default_max_noce_ifcvt_seq_cost)
/* Return true if the given instruction sequence is a good candidate
as a replacement for the if-convertible sequence. */
DEFHOOK
(noce_conversion_profitable_p,
"This hook returns true if the instruction sequence @code{seq} is a good\n\
candidate as a replacement for the if-convertible sequence described in\n\
@code{if_info}.",
bool, (rtx_insn *seq, struct noce_if_info *if_info),
default_noce_conversion_profitable_p)
/* Return true if new_addr should be preferred over the existing address used by
memref in insn. */
DEFHOOK
(new_address_profitable_p,
"Return @code{true} if it is profitable to replace the address in\n\
@var{memref} with @var{new_addr}. This allows targets to prevent the\n\
scheduler from undoing address optimizations. The instruction containing the\n\
memref is @var{insn}. The default implementation returns @code{true}.",
bool, (rtx memref, rtx_insn * insn, rtx new_addr),
default_new_address_profitable_p)
DEFHOOK
(estimated_poly_value,
"Return an estimate of the runtime value of @var{val}, for use in\n\
things like cost calculations or profiling frequencies. @var{kind} is used\n\
to ask for the minimum, maximum, and likely estimates of the value through\n\
the @code{POLY_VALUE_MIN}, @code{POLY_VALUE_MAX} and\n\
@code{POLY_VALUE_LIKELY} values. The default\n\
implementation returns the lowest possible value of @var{val}.",
HOST_WIDE_INT, (poly_int64 val, poly_value_estimate_kind kind),
default_estimated_poly_value)
/* Permit speculative instructions in delay slots during delayed-branch
scheduling. */
DEFHOOK
(no_speculation_in_delay_slots_p,
"This predicate controls the use of the eager delay slot filler to disallow\n\
speculatively executed instructions being placed in delay slots. Targets\n\
such as certain MIPS architectures possess both branches with and without\n\
delay slots. As the eager delay slot filler can decrease performance,\n\
disabling it is beneficial when ordinary branches are available. Use of\n\
delay slot branches filled using the basic filler is often still desirable\n\
as the delay slot can hide a pipeline bubble.",
bool, (void),
hook_bool_void_false)
/* 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)
/* Given a register return the mode of the corresponding DWARF frame
register. */
DEFHOOK
(dwarf_frame_reg_mode,
"Given a register, this hook should return the mode which the\n\
corresponding Dwarf frame register should have. This is normally\n\
used to return a smaller mode than the raw mode to prevent call\n\
clobbered parts of a register altering the frame register size",
machine_mode, (int regno),
default_dwarf_frame_reg_mode)
/* 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 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\