/* Target hook definitions.
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+ 2011, 2012
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
-/* The following macros should be provided by the including file:
-
- DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT): Define a function-valued hook.
- DEFHOOKPOD(DOC, TYPE, NAME, INIT): Define a piece-of-data 'hook'. */
-
-/* Defaults for optional macros:
- DEFHOOKPODX(NAME, TYPE, INIT): Like DEFHOOKPOD, but share documentation
- with the previous 'hook'. */
-#ifndef DEFHOOKPODX
-#define DEFHOOKPODX(NAME, TYPE, INIT) DEFHOOKPOD (NAME, 0, TYPE, INIT)
-#endif
-
-/* HOOKSTRUCT(FRAGMENT): Declarator fragments to encapsulate all the
- members into a struct gcc_target, which in turn contains several
- sub-structs. */
-#ifndef HOOKSTRUCT
-#define HOOKSTRUCT(FRAGMENT)
-#endif
-/* HOOK_VECTOR: Start a struct declaration, which then gets its own initializer.
- HOOK_VECTOR_END: Close a struct declaration, providing a member declarator
- name for nested use. */
-#ifndef HOOK_VECTOR_1
-#define HOOK_VECTOR_1(NAME, FRAGMENT) HOOKSTRUCT(FRAGMENT)
-#endif
-#define HOOK_VECTOR(INIT_NAME, SNAME) HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)
-#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
+/* 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"
-HOOK_VECTOR (TARGET_INITIALIZER, gcc_target)
+#undef HOOK_TYPE
+#define HOOK_TYPE "Target Hook"
-/* FIXME: For pre-existing hooks, we can't place the documentation in the
- documentation field here till we get permission from the FSF to include
- it in GPLed software - the target hook documentation is so far only
- available under the GFDL. */
-
-/* A hook should generally be documented by a string in the DOC parameter,
- which should contain texinfo markup. If the documentation is only available
- under the GPL, but not under the GFDL, put it in a comment above the hook
- definition. If the function declaration is available both under GPL and
- GFDL, but the documentation is only available under the GFDL, put the
- documentaton in tm.texi.in, heading with @hook <hookname> and closing
- the paragraph with @end deftypefn / deftypevr as appropriate, and marking
- the next autogenerated hook with @hook <hookname>.
- In both these cases, leave the DOC string empty, i.e. "".
- Sometimes, for some historic reason the function declaration
- has to be documented differently
- than what it is. In that case, use DEFHOOK_UNDOC to supress auto-generation
- of documentation. DEFHOOK_UNDOC takes a DOC string which it ignores, so
- you can put GPLed documentation string there if you have hopes that you
- can clear the declaration & documentation for GFDL distribution later,
- in which case you can then simply change the DEFHOOK_UNDOC to DEFHOOK
- to turn on the autogeneration of the documentation.
-
- A documentation string of "*" means not to emit any documentation at all,
- and is mainly used internally for DEFHOOK_UNDOC. It should generally not
- be used otherwise, but it has its use for exceptional cases where automatic
- documentation is not wanted, and the real documentation is elsewere, like
- for TARGET_ASM_{,UN}ALIGNED_INT_OP, which are hooks only for implementation
- purposes; they refer to structs, the components of which are documented as
- separate hooks TARGET_ASM_{,UN}ALIGNED_[HSDT]I_OP.
- A DOC string of 0 is for internal use of DEFHOOKPODX and special table
- entries only. */
+HOOK_VECTOR (TARGET_INITIALIZER, gcc_target)
/* Functions that output assembler for the target. */
#define HOOK_PREFIX "TARGET_ASM_"
DEFHOOKPOD (aligned_op, "*", struct asm_int_op, TARGET_ASM_ALIGNED_INT_OP)
DEFHOOKPOD (unaligned_op, "*", struct asm_int_op, TARGET_ASM_UNALIGNED_INT_OP)
+/* The maximum number of bytes to skip when applying
+ LABEL_ALIGN_AFTER_BARRIER. */
+DEFHOOK
+(label_align_after_barrier_max_skip,
+ "",
+ int, (rtx label),
+ default_label_align_after_barrier_max_skip)
+
+/* The maximum number of bytes to skip when applying
+ LOOP_ALIGN. */
+DEFHOOK
+(loop_align_max_skip,
+ "",
+ int, (rtx label),
+ default_loop_align_max_skip)
+
+/* The maximum number of bytes to skip when applying
+ LABEL_ALIGN. */
+DEFHOOK
+(label_align_max_skip,
+ "",
+ int, (rtx label),
+ default_label_align_max_skip)
+
+/* The maximum number of bytes to skip when applying
+ JUMP_ALIGN. */
+DEFHOOK
+(jump_align_max_skip,
+ "",
+ int, (rtx label),
+ default_jump_align_max_skip)
+
/* Try to output the assembler code for an integer object whose
value is given by X. SIZE is the size of the object in bytes and
ALIGNED_P indicates whether it is aligned. Return true if
void, (FILE *stream),
default_emit_except_table_label)
+/* Emit a directive for setting the personality for the function. */
+DEFHOOK
+(emit_except_personality,
+ "If the target implements @code{TARGET_ASM_UNWIND_EMIT}, this hook may be\
+ used to emit a directive to install a personality hook into the unwind\
+ info. This hook should not be used if dwarf2 unwind info is used.",
+ void, (rtx personality),
+ NULL)
+
/* Emit any directives required to unwind this instruction. */
DEFHOOK
(unwind_emit,
"",
void, (FILE *stream, rtx insn),
- default_unwind_emit)
+ NULL)
+
+DEFHOOKPOD
+(unwind_emit_before_insn,
+ "True if the @code{TARGET_ASM_UNWIND_EMIT} hook should be called before\
+ the assembly for @var{insn} has been emitted, false if the hook should\
+ be called afterward.",
+ bool, true)
+
+/* Generate an internal label.
+ For now this is just a wrapper for ASM_GENERATE_INTERNAL_LABEL. */
+DEFHOOK_UNDOC
+(generate_internal_label,
+ "",
+ void, (char *buf, const char *prefix, unsigned long labelno),
+ default_generate_internal_label)
/* Output an internal label. */
DEFHOOK
void, (const char *name, unsigned int flags, tree decl),
default_no_named_section)
+/* Return preferred text (sub)section for function DECL.
+ Main purpose of this function is to separate cold, normal and hot
+ functions. STARTUP is true when function is known to be used only
+ at startup (from static constructors or it is main()).
+ EXIT is true when function is known to be used only at exit
+ (from static destructors).
+ Return NULL if function should go to default text section. */
+DEFHOOK
+(function_section,
+ "",
+ section *, (tree decl, enum node_frequency freq, bool startup, bool exit),
+ default_function_section)
+
+/* Output the assembler code for function exit. */
+DEFHOOK
+(function_switched_text_sections,
+ "Used by the target to emit any assembler directives or additional\
+ labels needed when a function is partitioned between different\
+ sections. Output should be written to @var{file}. The function\
+ decl is available as @var{decl} and the new section is `cold' if\
+ @var{new_is_cold} is @code{true}.",
+ void, (FILE *file, tree decl, bool new_is_cold),
+ default_function_switched_text_sections)
+
/* Return a mask describing how relocations should be treated when
selecting sections. Bit 1 should be set if global relocations
should be placed in a read-write section; bit 0 should be set if
section *, (tree decl),
default_function_rodata_section)
+/* Nonnull if the target wants to override the default ".rodata" prefix
+ for mergeable data sections. */
+DEFHOOKPOD
+(mergeable_rodata_prefix,
+ "Usually, the compiler uses the prefix @code{\".rodata\"} to construct\n\
+section names for mergeable constant data. Define this macro to override\n\
+the string if a different section name should be used.",
+ const char *, ".rodata")
+
+/* Return the section to be used for transactional memory clone tables. */
+DEFHOOK
+(tm_clone_table_section,
+ "Return the section that should be used for transactional memory clone\
+ tables.",
+ section *, (void), default_clone_table_section)
+
/* Output a constructor for a symbol with a given priority. */
DEFHOOK
(constructor,
void, (FILE *f),
NULL)
+DEFHOOK
+(output_source_filename,
+ "Output COFF information or DWARF debugging information which indicates\
+ that filename @var{name} is the current source file to the stdio\
+ stream @var{file}.\n\
+ \n\
+ This target hook need not be defined if the standard form of output\
+ for the file format in use is appropriate.",
+ void ,(FILE *file, const char *name),
+ default_asm_output_source_filename)
+
+DEFHOOK
+(output_addr_const_extra,
+ "",
+ 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. */
bool ,(unsigned char code),
default_print_operand_punct_valid_p)
+/* Given a symbol name, perform same mangling as assemble_name and
+ ASM_OUTPUT_LABELREF, returning result as an IDENTIFIER_NODE. */
+DEFHOOK
+(mangle_assembler_name,
+ "Given a symbol @var{name}, perform same mangling as @code{varasm.c}'s\
+ @code{assemble_name}, but in memory rather than to a file stream, returning\
+ result as an @code{IDENTIFIER_NODE}. Required for correct LTO symtabs. The\
+ default implementation calls the @code{TARGET_STRIP_NAME_ENCODING} hook and\
+ then prepends the @code{USER_LABEL_PREFIX}, if any.",
+ tree, (const char *name),
+ default_mangle_assembler_name)
+
HOOK_VECTOR_END (asm_out)
/* Functions relating to instruction scheduling. All of these
"",
int, (rtx insn), NULL)
+/* This hook prepares the target for a new round of multipass
+ scheduling.
+ DATA is a pointer to target-specific data used for multipass scheduling.
+ READY_TRY and N_READY represent the current state of search in the
+ optimization space. The target can filter out instructions that
+ should not be tried during current round by setting corresponding
+ elements in READY_TRY to non-zero.
+ FIRST_CYCLE_INSN_P is true if this is the first round of multipass
+ scheduling on current cycle. */
+DEFHOOK
+(first_cycle_multipass_begin,
+ "",
+ void, (void *data, char *ready_try, int n_ready, bool first_cycle_insn_p),
+ NULL)
+
+/* This hook is called when multipass scheduling evaluates instruction INSN.
+ DATA is a pointer to target-specific data that can be used to record effects
+ of INSN on CPU that are not described in DFA.
+ READY_TRY and N_READY represent the current state of search in the
+ optimization space. The target can filter out instructions that
+ should not be tried after issueing 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 issueing INSN. */
+DEFHOOK
+(first_cycle_multipass_issue,
+ "",
+ void, (void *data, char *ready_try, int n_ready, rtx insn,
+ const void *prev_data), NULL)
+
+/* This hook is called when multipass scheduling backtracks from evaluation of
+ instruction corresponding to DATA.
+ DATA is a pointer to target-specific data that stores the effects
+ of instruction from which the algorithm backtracks on CPU that are not
+ described in DFA.
+ READY_TRY and N_READY represent the current state of search in the
+ optimization space. The target can filter out instructions that
+ should not be tried after issueing INSN by setting corresponding
+ elements in READY_TRY to non-zero. */
+DEFHOOK
+(first_cycle_multipass_backtrack,
+ "",
+ void, (const void *data, char *ready_try, int n_ready), NULL)
+
+/* This hook notifies the target about the result of the concluded current
+ round of multipass scheduling.
+ DATA is a pointer.
+ If DATA is non-NULL it points to target-specific data used for multipass
+ scheduling which corresponds to instruction at the start of the chain of
+ the winning solution. DATA is NULL when multipass scheduling cannot find
+ a good enough solution on current cycle and decides to retry later,
+ usually after advancing the cycle count. */
+DEFHOOK
+(first_cycle_multipass_end,
+ "",
+ 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,
+ "",
+ 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,
+ "",
+ 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
"",
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,
+"",
+void, (rtx insn, int x),
+hook_void_rtx_int)
+
+/* The following member value is a a function that returns true is
+ dispatch schedling is supported in hardware and condition passed
+ as the second parameter is true. */
+DEFHOOK
+(dispatch,
+"",
+bool, (rtx insn, int x),
+hook_bool_rtx_int_false)
+
+DEFHOOKPOD
+(exposed_pipeline,
+"True if the processor has an exposed pipeline, which means that not just\n\
+the order of instructions is important for correctness when scheduling, but\n\
+also the latencies of operations.",
+bool, false)
+
+/* The following member value is a function that returns number
+ of operations reassociator should try to put in parallel for
+ statements of the given type. By default 1 is used. */
+DEFHOOK
+(reassociation_width,
+"This hook is called by tree reassociator to determine a level of\n\
+parallelism required in output calculations chain.",
+int, (unsigned int opc, enum machine_mode mode),
+hook_int_uint_mode_1)
+
HOOK_VECTOR_END (sched)
/* Functions relating to vectorization. */
"",
tree, (tree x), NULL)
-/* Cost of different vector/scalar statements in vectorization cost model. */
+/* 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,
"",
- int, (enum vect_cost_for_stmt type_of_cost),
+ int, (enum vect_cost_for_stmt type_of_cost, tree vectype, int misalign),
default_builtin_vectorization_cost)
/* Return true if vector alignment is reachable (by peeling N
bool, (const_tree type, bool is_packed),
default_builtin_vector_alignment_reachable)
-/* Target builtin that implements vector permute. */
-DEFHOOK
-(builtin_vec_perm,
- "",
- tree, (tree type, tree *mask_element_type), NULL)
-
-/* Return true if a vector created for builtin_vec_perm is valid. */
+/* Return true if a vector created for vec_perm_const is valid.
+ A NULL indicates that all constants are valid permutations. */
DEFHOOK
-(builtin_vec_perm_ok,
+(vec_perm_const_ok,
"",
- bool, (tree vec_type, tree mask),
- hook_bool_tree_tree_true)
+ bool, (enum machine_mode, const unsigned char *sel),
+ NULL)
/* Return true if the target supports misaligned store/load of a
specific factor denoted in the third parameter. The last parameter
(enum machine_mode mode, const_tree type, int misalignment, bool is_packed),
default_builtin_support_vector_misalignment)
-HOOK_VECTOR_END (vectorize)
+/* Return the builtin decl needed to load a vector of TYPE. */
+DEFHOOK
+(builtin_tm_load,
+ "This hook should return the built-in decl needed to load a vector of the "
+ "given type within a transaction.",
+ tree,
+ (tree),
+ default_builtin_tm_load_store)
-#undef HOOK_PREFIX
-#define HOOK_PREFIX "TARGET_"
+/* Return the builtin decl needed to store a vector of TYPE. */
+DEFHOOK
+(builtin_tm_store,
+ "This hook should return the built-in decl needed to store a vector of the "
+ "given type within a transaction.",
+ tree,
+ (tree),
+ default_builtin_tm_load_store)
-/* The initial value of target_flags. */
-DEFHOOKPOD
-(default_target_flags,
+/* Returns the preferred mode for SIMD operations for the specified
+ scalar mode. */
+DEFHOOK
+(preferred_simd_mode,
"",
- int, 0)
+ enum machine_mode,
+ (enum machine_mode mode),
+ default_preferred_simd_mode)
-/* 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. */
+/* Returns a mask of vector sizes to iterate over when auto-vectorizing
+ after processing the preferred one derived from preferred_simd_mode. */
DEFHOOK
-(override_options_after_change,
+(autovectorize_vector_sizes,
"",
- void, (void),
- hook_void_void)
+ unsigned int,
+ (void),
+ default_autovectorize_vector_sizes)
-/* Handle target switch CODE (an OPT_* value). ARG is the argument
- passed to the switch; it is NULL if no argument was. VALUE is the
- value of ARG if CODE specifies a UInteger option, otherwise it is
- 1 if the positive form of the switch was used and 0 if the negative
- form was. Return true if the switch was valid. */
+/* Target builtin that implements vector gather operation. */
DEFHOOK
-(handle_option,
+(builtin_gather,
"",
- bool, (size_t code, const char *arg, int value),
- hook_bool_size_t_constcharptr_int_true)
+ tree,
+ (const_tree mem_vectype, const_tree index_type, int scale),
+ NULL)
-/* ??? Documenting this hook requires a GFDL license grant. */
-DEFHOOK_UNDOC
-(handle_ofast,
- "Handle target-specific parts of specifying -Ofast.",
- void, (void),
- hook_void_void)
+HOOK_VECTOR_END (vectorize)
+
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_"
-/* Display extra, target specific information in response to a
- --target-help switch. */
+/* 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
-(help,
+(override_options_after_change,
"",
- void, (void), NULL)
+ void, (void),
+ hook_void_void)
DEFHOOK_UNDOC
(eh_return_filter_mode,
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)
+
/* True if the target supports decimal floating point. */
DEFHOOK
(decimal_float_supported_p,
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. */
unsigned, (unsigned nunroll, struct loop *loop),
NULL)
+/* True if X is a legitimate MODE-mode immediate operand. */
+DEFHOOK
+(legitimate_constant_p,
+ "",
+ bool, (enum machine_mode mode, rtx x),
+ hook_bool_mode_rtx_true)
+
/* True if the constant X cannot be placed in the constant pool. */
DEFHOOK
(cannot_force_const_mem,
"",
- bool, (rtx x),
- hook_bool_rtx_false)
+ bool, (enum machine_mode mode, rtx x),
+ hook_bool_mode_rtx_false)
DEFHOOK_UNDOC
(cannot_copy_insn_p,
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,
+ "",
+ bool, (rtx x),
+ hook_bool_rtx_false)
+
/* Given an address RTX, say whether it is valid. */
DEFHOOK
(legitimate_address_p,
bool, (const_tree exp),
default_binds_local_p)
+/* Check if profiling code is before or after prologue. */
+DEFHOOK
+(profile_before_prologue,
+ "It returns true if target wants profile code emitted before prologue.\n\n\
+The default version of this hook use the target macro\n\
+@code{PROFILE_BEFORE_PROLOGUE}.",
+ bool, (void),
+ default_profile_before_prologue)
+
/* Modify and return the identifier of a DECL's external name,
originally identified by ID, as required by the target,
(eg, append @nn to windows32 stdcall function names).
bool, (enum machine_mode mode),
default_valid_pointer_mode)
+/* Disambiguate with errno. */
+DEFHOOK
+(ref_may_alias_errno,
+ "Define this to return nonzero if the memory reference @var{ref}\
+ may alias with the system C library errno location. The default\
+ version of this hook assumes the system C library errno location\
+ is either a declaration of type int or accessed by dereferencing\
+ a pointer to int.",
+ bool, (struct ao_ref_s *ref),
+ default_ref_may_alias_errno)
+
/* Support for named address spaces. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_ADDR_SPACE_"
DEFHOOK
(subset_p,
"",
- bool, (addr_space_t superset, addr_space_t subset),
+ bool, (addr_space_t subset, addr_space_t superset),
default_addr_space_subset_p)
/* Function to convert an rtl expression from one address space to another. */
bool, (enum machine_mode mode),
hook_bool_mode_false)
+/* True if we should try to use a scalar mode to represent an array,
+ overriding the usual MAX_FIXED_MODE limit. */
+DEFHOOK
+(array_mode_supported_p,
+ "Return true if GCC should try to use a scalar mode to store an array\n\
+of @var{nelems} elements, given that each element has mode @var{mode}.\n\
+Returning true here overrides the usual @code{MAX_FIXED_MODE} limit\n\
+and allows GCC to use any defined integer mode.\n\
+\n\
+One use of this hook is to support vector load and store operations\n\
+that operate on several homogeneous vectors. For example, ARM NEON\n\
+has operations like:\n\
+\n\
+@smallexample\n\
+int8x8x3_t vld3_s8 (const int8_t *)\n\
+@end smallexample\n\
+\n\
+where the return type is defined as:\n\
+\n\
+@smallexample\n\
+typedef struct int8x8x3_t\n\
+@{\n\
+ int8x8_t val[3];\n\
+@} int8x8x3_t;\n\
+@end smallexample\n\
+\n\
+If this hook allows @code{val} to have a scalar mode, then\n\
+@code{int8x8x3_t} can have the same mode. GCC can then store\n\
+@code{int8x8x3_t}s in registers rather than forcing them onto the stack.",
+ bool, (enum machine_mode mode, unsigned HOST_WIDE_INT nelems),
+ hook_bool_mode_uhwi_false)
+
/* Compute cost of moving data from a register of class FROM to one of
TO, using MODE. */
DEFHOOK
bool, (enum machine_mode mode),
hook_bool_mode_false)
+/* Register number for a flags register. Only needs to be defined if the
+ target is constrainted to use post-reload comparison elimination. */
+DEFHOOKPOD
+(flags_regnum,
+ "If the target has a dedicated flags register, and it needs to use the\
+ post-reload comparison elimination pass, then this value should be set\
+ appropriately.",
+ unsigned int, INVALID_REGNUM)
+
/* Compute a (partial) cost for rtx X. Return true if the complete
cost has been computed, and false if subexpressions should be
scanned. In either case, *TOTAL contains the cost result. */
DEFHOOK
(rtx_costs,
"",
- bool, (rtx x, int code, int outer_code, int *total, bool speed),
- hook_bool_rtx_int_int_intp_bool_false)
+ bool, (rtx x, int code, int outer_code, int opno, int *total, bool speed),
+ hook_bool_rtx_int_int_int_intp_bool_false)
/* Compute the cost of X, used as an address. Never called with
invalid addresses. */
const char *, (const void *data, size_t sz),
default_pch_valid_p)
+DEFHOOK
+(prepare_pch_save,
+ "Called before writing out a PCH file. If the target has some\n\
+garbage-collected data that needs to be in a particular state on PCH loads,\n\
+it can use this hook to enforce that state. Very few targets need\n\
+to do anything here.",
+ void, (void),
+ hook_void_void)
+
/* If nonnull, this function checks whether a PCH file with the
given set of target flags can be used. It returns NULL if so,
otherwise it returns an error message. */
(pass_by_reference,
"",
bool,
- (CUMULATIVE_ARGS *cum, enum machine_mode mode, const_tree type, bool named),
+ (cumulative_args_t cum, enum machine_mode mode, const_tree type, bool named),
hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false)
DEFHOOK
DEFHOOK
(setup_incoming_varargs,
"",
- void, (CUMULATIVE_ARGS *args_so_far, enum machine_mode mode, tree type,
+ void, (cumulative_args_t args_so_far, enum machine_mode mode, tree type,
int *pretend_args_size, int second_time),
default_setup_incoming_varargs)
DEFHOOK
(strict_argument_naming,
"",
- bool, (CUMULATIVE_ARGS *ca),
+ bool, (cumulative_args_t ca),
hook_bool_CUMULATIVE_ARGS_false)
/* Returns true if we should use
DEFHOOK
(pretend_outgoing_varargs_named,
"",
- bool, (CUMULATIVE_ARGS *ca),
+ bool, (cumulative_args_t ca),
default_pretend_outgoing_varargs_named)
/* Given a complex type T, return true if a parameter of type T
(callee_copies,
"",
bool,
- (CUMULATIVE_ARGS *cum, enum machine_mode mode, const_tree type, bool named),
+ (cumulative_args_t cum, enum machine_mode mode, const_tree type, bool named),
hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false)
/* Return zero for arguments passed entirely on the stack or entirely
DEFHOOK
(arg_partial_bytes,
"",
- int, (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, bool named),
+ int, (cumulative_args_t cum, enum machine_mode mode, tree type, bool named),
hook_int_CUMULATIVE_ARGS_mode_tree_bool_0)
/* Update the state in CA to advance past an argument in the
argument list. The values MODE, TYPE, and NAMED describe that
argument. */
-/* ??? tm.texi still only describes the old macro. */
-DEFHOOK_UNDOC
+DEFHOOK
(function_arg_advance,
"",
void,
- (CUMULATIVE_ARGS *ca, enum machine_mode mode, const_tree type, bool named),
+ (cumulative_args_t ca, enum machine_mode mode, const_tree type, bool named),
default_function_arg_advance)
/* Return zero if the argument described by the state of CA should
be placed on a stack, or a hard register in which to store the
argument. The values MODE, TYPE, and NAMED describe that
argument. */
-/* ??? tm.texi still only describes the old macro. */
-DEFHOOK_UNDOC
+DEFHOOK
(function_arg,
"",
- rtx, (const CUMULATIVE_ARGS *ca, enum machine_mode mode, const_tree type,
+ rtx, (cumulative_args_t ca, enum machine_mode mode, const_tree type,
bool named),
default_function_arg)
/* Likewise, but for machines with register windows. Return the
location where the argument will appear to the callee. */
-/* ??? tm.texi still only describes the old macro. */
-DEFHOOK_UNDOC
+DEFHOOK
(function_incoming_arg,
"",
- rtx, (const CUMULATIVE_ARGS *ca, enum machine_mode mode, const_tree type,
+ rtx, (cumulative_args_t ca, enum machine_mode mode, const_tree type,
bool named),
default_function_incoming_arg)
+DEFHOOK
+(function_arg_boundary,
+ "",
+ unsigned int, (enum machine_mode mode, const_tree type),
+ default_function_arg_boundary)
+
+DEFHOOK
+(function_arg_round_boundary,
+ "Normally, the size of an argument is rounded up to @code{PARM_BOUNDARY},\n\
+which is the default value for this hook. You can define this hook to\n\
+return a different value if an argument size must be rounded to a larger\n\
+value.",
+ unsigned int, (enum machine_mode mode, const_tree type),
+ default_function_arg_round_boundary)
+
/* Return the diagnostic message string if function without a prototype
is not allowed for this 'val' argument; NULL otherwise. */
DEFHOOK
int, (tree fundecl, tree funtype, int size),
default_return_pops_args)
+/* Return a mode wide enough to copy any function value that might be
+ returned. */
+DEFHOOK
+(get_raw_result_mode,
+ "This target hook returns the mode to be used when accessing raw return\
+ registers in @code{__builtin_return}. Define this macro if the value\
+ in @var{reg_raw_mode} is not correct.",
+ enum machine_mode, (int regno),
+ default_get_reg_raw_mode)
+
+/* Return a mode wide enough to copy any argument value that might be
+ passed. */
+DEFHOOK
+(get_raw_arg_mode,
+ "This target hook returns the mode to be used when accessing raw argument\
+ registers in @code{__builtin_apply_args}. Define this macro if the value\
+ in @var{reg_raw_mode} is not correct.",
+ enum machine_mode, (int regno),
+ default_get_reg_raw_mode)
+
HOOK_VECTOR_END (calls)
/* Return the diagnostic message string if conversion from FROMTYPE
tree, (tree type, tree expr),
hook_tree_tree_tree_null)
-/* Return the array of IRA cover classes for the current target. */
-DEFHOOK
-(ira_cover_classes,
- "",
- const reg_class_t *, (void),
- default_ira_cover_classes)
-
/* Return the class for a secondary reload, and fill in extra information. */
DEFHOOK
(secondary_reload,
secondary_reload_info *sri),
default_secondary_reload)
+/* Given an rtx X being reloaded into a reg required to be in class CLASS,
+ return the class of reg to actually use. */
+DEFHOOK
+(preferred_reload_class,
+ "",
+ reg_class_t,
+ (rtx x, reg_class_t rclass),
+ default_preferred_reload_class)
+
+/* Like TARGET_PREFERRED_RELOAD_CLASS, but for output reloads instead of
+ input reloads. */
+DEFHOOK
+(preferred_output_reload_class,
+ "",
+ reg_class_t,
+ (rtx x, reg_class_t rclass),
+ default_preferred_output_reload_class)
+
+DEFHOOK
+(class_likely_spilled_p,
+ "",
+ bool, (reg_class_t rclass),
+ default_class_likely_spilled_p)
+
+/* Return the maximum number of consecutive registers
+ needed to represent mode MODE in a register of class RCLASS. */
+DEFHOOK
+(class_max_nregs,
+ "",
+ unsigned char, (reg_class_t rclass, enum machine_mode mode),
+ default_class_max_nregs)
+
+DEFHOOK
+(preferred_rename_class,
+ "A target hook that places additional preference on the register\
+ class to use when it is necessary to rename a register in class\
+ @var{rclass} to another class, or perhaps @var{NO_REGS}, if no\
+ preferred register class is found or hook @code{preferred_rename_class}\
+ is not implemented.\
+ Sometimes returning a more restrictive class makes better code. For\
+ example, on ARM, thumb-2 instructions using @code{LO_REGS} may be\
+ smaller than instructions using @code{GENERIC_REGS}. By returning\
+ @code{LO_REGS} from @code{preferred_rename_class}, code size can\
+ be reduced.",
+ reg_class_t, (reg_class_t rclass),
+ default_preferred_rename_class)
+
/* This target hook allows the backend to perform additional
processing while initializing for variable expansion. */
DEFHOOK
bool, (const int from_reg, const int to_reg),
hook_bool_const_int_const_int_true)
+/* Modify any or all of fixed_regs, call_used_regs, global_regs,
+ reg_names, and reg_class_contents to account of the vagaries of the
+ target. */
+DEFHOOK
+(conditional_register_usage,
+ "",
+ void, (void),
+ hook_void_void)
+
/* Functions specific to the C family of frontends. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_C_"
void, (tree type),
hook_void_tree)
+DEFHOOK
+(decl_mangling_context,
+ "Return target-specific mangling context of @var{decl} or @code{NULL_TREE}.",
+ tree, (const_tree decl),
+ hook_tree_const_tree_null)
+
HOOK_VECTOR_END (cxx)
/* Functions and data for emulated TLS support. */
(override,
"",
void, (void),
- default_target_option_override)
+ hook_void_void)
/* Function to determine if one function can inline another function. */
#undef HOOK_PREFIX
void, (bitmap regs),
hook_void_bitmap)
-/* Leave the boolean fields at the end. */
+/* Fill in additional registers set up by prologue into a regset. */
+DEFHOOK
+(set_up_by_prologue,
+ "This hook should add additional registers that are computed by the prologue\
+ to the hard regset for shrink-wrapping optimization purposes.",
+ void, (struct hard_reg_set_container *),
+ NULL)
-/* True if unwinding tables should be generated by default. */
-DEFHOOKPOD
-(unwind_tables_default,
+/* Determine the type of unwind info to emit for debugging. */
+DEFHOOK
+(debug_unwind_info,
"",
- bool, false)
+ enum unwind_info_type, (void),
+ default_debug_unwind_info)
-/* True if arbitrary sections are supported. */
-DEFHOOKPOD
-(have_named_sections,
- "",
- bool, false)
+/* Leave the boolean fields at the end. */
/* True if we can create zeroed data by switching to a BSS section
and then using ASM_OUTPUT_SKIP to allocate the space. */
"",
bool, false)
-/* Leave the boolean fields at the end. */
+DEFHOOKPOD
+(want_debug_pub_sections,
+ "True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections\
+ should be emitted. These sections are not used on most platforms, and\
+ in particular GDB does not use them.",
+ bool, false)
-/* Empty macro arguments are undefined in C90, so use an empty macro. */
-#define C90_EMPTY_HACK
-/* Close the 'struct gcc_target' definition. */
-HOOK_VECTOR_END (C90_EMPTY_HACK)
+DEFHOOKPOD
+(delay_sched2, "True if sched2 is not to be run at its normal place. \
+This usually means it will be run as part of machine-specific reorg.",
+bool, false)
-HOOK_VECTOR (TARGETCM_INITIALIZER, gcc_targetcm)
+DEFHOOKPOD
+(delay_vartrack, "True if vartrack is not to be run at its normal place. \
+This usually means it will be run as part of machine-specific reorg.",
+bool, false)
-/* Handle target switch CODE (an OPT_* value). ARG is the argument
- passed to the switch; it is NULL if no argument was. VALUE is the
- value of ARG if CODE specifies a UInteger option, otherwise it is
- 1 if the positive form of the switch was used and 0 if the negative
- form was. Return true if the switch was valid. */
-DEFHOOK
-(handle_c_option,
- "",
- bool, (size_t code, const char *arg, int value),
- default_handle_c_option)
+/* Leave the boolean fields at the end. */
+/* Close the 'struct gcc_target' definition. */
HOOK_VECTOR_END (C90_EMPTY_HACK)