Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / target.def
blob653981f71ad7488cc453f99324a97d595a1d732a
1 /* Target hook definitions.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
3 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 3, or (at your option) any
8 later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING3. If not see
17 <http://www.gnu.org/licenses/>.
19 In other words, you are welcome to use, share and improve this program.
20 You are forbidden to forbid anyone else to use, share and improve
21 what you give them. Help stamp out software-hoarding! */
23 /* The following macros should be provided by the including file:
25 DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT): Define a function-valued hook.
26 DEFHOOKPOD(DOC, TYPE, NAME, INIT): Define a piece-of-data 'hook'. */
28 /* Defaults for optional macros:
29 DEFHOOKPODX(NAME, TYPE, INIT): Like DEFHOOKPOD, but share documentation
30 with the previous 'hook'. */
31 #ifndef DEFHOOKPODX
32 #define DEFHOOKPODX(NAME, TYPE, INIT) DEFHOOKPOD (NAME, 0, TYPE, INIT)
33 #endif
35 /* HOOKSTRUCT(FRAGMENT): Declarator fragments to encapsulate all the
36 members into a struct gcc_target, which in turn contains several
37 sub-structs. */
38 #ifndef HOOKSTRUCT
39 #define HOOKSTRUCT(FRAGMENT)
40 #endif
41 /* HOOK_VECTOR: Start a struct declaration, which then gets its own initializer.
42 HOOK_VECTOR_END: Close a struct declaration, providing a member declarator
43 name for nested use. */
44 #ifndef HOOK_VECTOR_1
45 #define HOOK_VECTOR_1(NAME, FRAGMENT) HOOKSTRUCT(FRAGMENT)
46 #endif
47 #define HOOK_VECTOR(INIT_NAME, SNAME) HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)
48 #define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
50 HOOK_VECTOR (TARGET_INITIALIZER, gcc_target)
52 /* FIXME: For pre-existing hooks, we can't place the documentation in the
53 documentation field here till we get permission from the FSF to include
54 it in GPLed software - the target hook documentation is so far only
55 available under the GFDL. */
57 /* A hook should generally be documented by a string in the DOC parameter,
58 which should contain texinfo markup. If the documentation is only available
59 under the GPL, but not under the GFDL, put it in a comment above the hook
60 definition. If the function declaration is available both under GPL and
61 GFDL, but the documentation is only available under the GFDL, put the
62 documentaton in tm.texi.in, heading with @hook <hookname> and closing
63 the paragraph with @end deftypefn / deftypevr as appropriate, and marking
64 the next autogenerated hook with @hook <hookname>.
65 In both these cases, leave the DOC string empty, i.e. "".
66 Sometimes, for some historic reason the function declaration
67 has to be documented differently
68 than what it is. In that case, use DEFHOOK_UNDOC to supress auto-generation
69 of documentation. DEFHOOK_UNDOC takes a DOC string which it ignores, so
70 you can put GPLed documentation string there if you have hopes that you
71 can clear the declaration & documentation for GFDL distribution later,
72 in which case you can then simply change the DEFHOOK_UNDOC to DEFHOOK
73 to turn on the autogeneration of the documentation.
75 A documentation string of "*" means not to emit any documentation at all,
76 and is mainly used internally for DEFHOOK_UNDOC. It should generally not
77 be used otherwise, but it has its use for exceptional cases where automatic
78 documentation is not wanted, and the real documentation is elsewere, like
79 for TARGET_ASM_{,UN}ALIGNED_INT_OP, which are hooks only for implementation
80 purposes; they refer to structs, the components of which are documented as
81 separate hooks TARGET_ASM_{,UN}ALIGNED_[HSDT]I_OP.
82 A DOC string of 0 is for internal use of DEFHOOKPODX and special table
83 entries only. */
85 /* Functions that output assembler for the target. */
86 #define HOOK_PREFIX "TARGET_ASM_"
87 HOOK_VECTOR (TARGET_ASM_OUT, asm_out)
89 /* Opening and closing parentheses for asm expression grouping. */
90 DEFHOOKPOD
91 (open_paren,
92 "",
93 const char *, "(")
94 DEFHOOKPODX (close_paren, const char *, ")")
96 /* Assembler instructions for creating various kinds of integer object. */
97 DEFHOOKPOD
98 (byte_op,
99 "",
100 const char *, "\t.byte\t")
101 DEFHOOKPOD (aligned_op, "*", struct asm_int_op, TARGET_ASM_ALIGNED_INT_OP)
102 DEFHOOKPOD (unaligned_op, "*", struct asm_int_op, TARGET_ASM_UNALIGNED_INT_OP)
104 /* The maximum number of bytes to skip when applying
105 LABEL_ALIGN_AFTER_BARRIER. */
106 DEFHOOK
107 (label_align_after_barrier_max_skip,
109 int, (rtx label),
110 default_label_align_after_barrier_max_skip)
112 /* The maximum number of bytes to skip when applying
113 LOOP_ALIGN. */
114 DEFHOOK
115 (loop_align_max_skip,
117 int, (rtx label),
118 default_loop_align_max_skip)
120 /* The maximum number of bytes to skip when applying
121 LABEL_ALIGN. */
122 DEFHOOK
123 (label_align_max_skip,
125 int, (rtx label),
126 default_label_align_max_skip)
128 /* The maximum number of bytes to skip when applying
129 JUMP_ALIGN. */
130 DEFHOOK
131 (jump_align_max_skip,
133 int, (rtx label),
134 default_jump_align_max_skip)
136 /* Try to output the assembler code for an integer object whose
137 value is given by X. SIZE is the size of the object in bytes and
138 ALIGNED_P indicates whether it is aligned. Return true if
139 successful. Only handles cases for which BYTE_OP, ALIGNED_OP
140 and UNALIGNED_OP are NULL. */
141 DEFHOOK
142 (integer,
144 /* Only handles cases for which BYTE_OP, ALIGNED_OP and UNALIGNED_OP are
145 NULL. */
146 bool, (rtx x, unsigned int size, int aligned_p),
147 default_assemble_integer)
149 /* Output code that will globalize a label. */
150 DEFHOOK
151 (globalize_label,
153 void, (FILE *stream, const char *name),
154 default_globalize_label)
156 /* Output code that will globalize a declaration. */
157 DEFHOOK
158 (globalize_decl_name,
160 void, (FILE *stream, tree decl), default_globalize_decl_name)
162 /* Output code that will emit a label for unwind info, if this
163 target requires such labels. Second argument is the decl the
164 unwind info is associated with, third is a boolean: true if
165 this is for exception handling, fourth is a boolean: true if
166 this is only a placeholder for an omitted FDE. */
167 DEFHOOK
168 (emit_unwind_label,
170 void, (FILE *stream, tree decl, int for_eh, int empty),
171 default_emit_unwind_label)
173 /* Output code that will emit a label to divide up the exception table. */
174 DEFHOOK
175 (emit_except_table_label,
177 void, (FILE *stream),
178 default_emit_except_table_label)
180 /* Emit a directive for setting the personality for the function. */
181 DEFHOOK
182 (emit_except_personality,
183 "If the target implements @code{TARGET_ASM_UNWIND_EMIT}, this hook may be\
184 used to emit a directive to install a personality hook into the unwind\
185 info. This hook should not be used if dwarf2 unwind info is used.",
186 void, (rtx personality),
187 NULL)
189 /* Emit any directives required to unwind this instruction. */
190 DEFHOOK
191 (unwind_emit,
193 void, (FILE *stream, rtx insn),
194 NULL)
196 DEFHOOKPOD
197 (unwind_emit_before_insn,
198 "True if the @code{TARGET_ASM_UNWIND_EMIT} hook should be called before\
199 the assembly for @var{insn} has been emitted, false if the hook should\
200 be called afterward.",
201 bool, true)
203 /* Generate an internal label.
204 For now this is just a wrapper for ASM_GENERATE_INTERNAL_LABEL. */
205 DEFHOOK_UNDOC
206 (generate_internal_label,
208 void, (char *buf, const char *prefix, unsigned long labelno),
209 default_generate_internal_label)
211 /* Output an internal label. */
212 DEFHOOK
213 (internal_label,
215 void, (FILE *stream, const char *prefix, unsigned long labelno),
216 default_internal_label)
218 /* Output label for the constant. */
219 DEFHOOK
220 (declare_constant_name,
222 void, (FILE *file, const char *name, const_tree expr, HOST_WIDE_INT size),
223 default_asm_declare_constant_name)
225 /* Emit a ttype table reference to a typeinfo object. */
226 DEFHOOK
227 (ttype,
229 bool, (rtx sym),
230 hook_bool_rtx_false)
232 /* Emit an assembler directive to set visibility for the symbol
233 associated with the tree decl. */
234 DEFHOOK
235 (assemble_visibility,
237 void, (tree decl, int visibility),
238 default_assemble_visibility)
240 /* Output the assembler code for entry to a function. */
241 DEFHOOK
242 (function_prologue,
244 void, (FILE *file, HOST_WIDE_INT size),
245 default_function_pro_epilogue)
247 /* Output the assembler code for end of prologue. */
248 DEFHOOK
249 (function_end_prologue,
251 void, (FILE *file),
252 no_asm_to_stream)
254 /* Output the assembler code for start of epilogue. */
255 DEFHOOK
256 (function_begin_epilogue,
258 void, (FILE *file),
259 no_asm_to_stream)
261 /* Output the assembler code for function exit. */
262 DEFHOOK
263 (function_epilogue,
265 void, (FILE *file, HOST_WIDE_INT size),
266 default_function_pro_epilogue)
268 /* Initialize target-specific sections. */
269 DEFHOOK
270 (init_sections,
272 void, (void),
273 hook_void_void)
275 /* Tell assembler to change to section NAME with attributes FLAGS.
276 If DECL is non-NULL, it is the VAR_DECL or FUNCTION_DECL with
277 which this section is associated. */
278 DEFHOOK
279 (named_section,
281 void, (const char *name, unsigned int flags, tree decl),
282 default_no_named_section)
284 /* Return preferred text (sub)section for function DECL.
285 Main purpose of this function is to separate cold, normal and hot
286 functions. STARTUP is true when function is known to be used only
287 at startup (from static constructors or it is main()).
288 EXIT is true when function is known to be used only at exit
289 (from static destructors).
290 Return NULL if function should go to default text section. */
291 DEFHOOK
292 (function_section,
294 section *, (tree decl, enum node_frequency freq, bool startup, bool exit),
295 default_function_section)
297 /* Return a mask describing how relocations should be treated when
298 selecting sections. Bit 1 should be set if global relocations
299 should be placed in a read-write section; bit 0 should be set if
300 local relocations should be placed in a read-write section. */
301 DEFHOOK
302 (reloc_rw_mask,
304 int, (void),
305 default_reloc_rw_mask)
307 /* Return a section for EXP. It may be a DECL or a constant. RELOC
308 is nonzero if runtime relocations must be applied; bit 1 will be
309 set if the runtime relocations require non-local name resolution.
310 ALIGN is the required alignment of the data. */
311 DEFHOOK
312 (select_section,
314 section *, (tree exp, int reloc, unsigned HOST_WIDE_INT align),
315 default_select_section)
317 /* Return a section for X. MODE is X's mode and ALIGN is its
318 alignment in bits. */
319 DEFHOOK
320 (select_rtx_section,
322 section *, (enum machine_mode mode, rtx x, unsigned HOST_WIDE_INT align),
323 default_select_rtx_section)
325 /* Select a unique section name for DECL. RELOC is the same as
326 for SELECT_SECTION. */
327 DEFHOOK
328 (unique_section,
330 void, (tree decl, int reloc),
331 default_unique_section)
333 /* Return the readonly data section associated with function DECL. */
334 DEFHOOK
335 (function_rodata_section,
337 section *, (tree decl),
338 default_function_rodata_section)
340 /* Output a constructor for a symbol with a given priority. */
341 DEFHOOK
342 (constructor,
344 void, (rtx symbol, int priority), NULL)
346 /* Output a destructor for a symbol with a given priority. */
347 DEFHOOK
348 (destructor,
350 void, (rtx symbol, int priority), NULL)
352 /* Output the assembler code for a thunk function. THUNK_DECL is the
353 declaration for the thunk function itself, FUNCTION is the decl for
354 the target function. DELTA is an immediate constant offset to be
355 added to THIS. If VCALL_OFFSET is nonzero, the word at
356 *(*this + vcall_offset) should be added to THIS. */
357 DEFHOOK
358 (output_mi_thunk,
360 void, (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta,
361 HOST_WIDE_INT vcall_offset, tree function),
362 NULL)
364 /* Determine whether output_mi_thunk would succeed. */
365 /* ??? Ideally, this hook would not exist, and success or failure
366 would be returned from output_mi_thunk directly. But there's
367 too much undo-able setup involved in invoking output_mi_thunk.
368 Could be fixed by making output_mi_thunk emit rtl instead of
369 text to the output file. */
370 DEFHOOK
371 (can_output_mi_thunk,
373 bool, (const_tree thunk_fndecl, HOST_WIDE_INT delta,
374 HOST_WIDE_INT vcall_offset, const_tree function),
375 hook_bool_const_tree_hwi_hwi_const_tree_false)
377 /* Output any boilerplate text needed at the beginning of a
378 translation unit. */
379 DEFHOOK
380 (file_start,
382 void, (void),
383 default_file_start)
385 /* Output any boilerplate text needed at the end of a translation unit. */
386 DEFHOOK
387 (file_end,
389 void, (void),
390 hook_void_void)
392 /* Output any boilerplate text needed at the beginning of an
393 LTO output stream. */
394 DEFHOOK
395 (lto_start,
397 void, (void),
398 hook_void_void)
400 /* Output any boilerplate text needed at the end of an
401 LTO output stream. */
402 DEFHOOK
403 (lto_end,
405 void, (void),
406 hook_void_void)
408 /* Output any boilerplace text needed at the end of a
409 translation unit before debug and unwind info is emitted. */
410 DEFHOOK
411 (code_end,
413 void, (void),
414 hook_void_void)
416 /* Output an assembler pseudo-op to declare a library function name
417 external. */
418 DEFHOOK
419 (external_libcall,
421 void, (rtx symref),
422 default_external_libcall)
424 /* Output an assembler directive to mark decl live. This instructs
425 linker to not dead code strip this symbol. */
426 DEFHOOK
427 (mark_decl_preserved,
429 void, (const char *symbol),
430 hook_void_constcharptr)
432 /* Output a record of the command line switches that have been passed. */
433 DEFHOOK
434 (record_gcc_switches,
436 int, (print_switch_type type, const char *text),
437 NULL)
439 /* The name of the section that the example ELF implementation of
440 record_gcc_switches will use to store the information. Target
441 specific versions of record_gcc_switches may or may not use
442 this information. */
443 DEFHOOKPOD
444 (record_gcc_switches_section,
446 const char *, ".GCC.command.line")
448 /* Output the definition of a section anchor. */
449 DEFHOOK
450 (output_anchor,
452 void, (rtx x),
453 default_asm_output_anchor)
455 /* Output a DTP-relative reference to a TLS symbol. */
456 DEFHOOK
457 (output_dwarf_dtprel,
459 void, (FILE *file, int size, rtx x),
460 NULL)
462 /* Some target machines need to postscan each insn after it is output. */
463 DEFHOOK
464 (final_postscan_insn,
466 void, (FILE *file, rtx insn, rtx *opvec, int noperands),
467 NULL)
469 /* Emit the trampoline template. This hook may be NULL. */
470 DEFHOOK
471 (trampoline_template,
473 void, (FILE *f),
474 NULL)
476 DEFHOOK
477 (output_source_filename,
478 "Output COFF information or DWARF debugging information which indicates\
479 that filename @var{name} is the current source file to the stdio\
480 stream @var{file}.\n\
482 This target hook need not be defined if the standard form of output\
483 for the file format in use is appropriate.",
484 void ,(FILE *file, const char *name),
485 default_asm_output_source_filename)
487 DEFHOOK
488 (output_addr_const_extra,
490 bool, (FILE *file, rtx x),
491 default_asm_output_addr_const_extra)
493 /* ??? The TARGET_PRINT_OPERAND* hooks are part of the asm_out struct,
494 even though that is not reflected in the macro name to override their
495 initializers. */
496 #undef HOOK_PREFIX
497 #define HOOK_PREFIX "TARGET_"
499 /* Emit a machine-specific insn operand. */
500 /* ??? tm.texi only documents the old macro PRINT_OPERAND,
501 not this hook, and uses a different name for the argument FILE. */
502 DEFHOOK_UNDOC
503 (print_operand,
505 void, (FILE *file, rtx x, int code),
506 default_print_operand)
508 /* Emit a machine-specific memory address. */
509 /* ??? tm.texi only documents the old macro PRINT_OPERAND_ADDRESS,
510 not this hook, and uses different argument names. */
511 DEFHOOK_UNDOC
512 (print_operand_address,
514 void, (FILE *file, rtx addr),
515 default_print_operand_address)
517 /* Determine whether CODE is a valid punctuation character for the
518 `print_operand' hook. */
519 /* ??? tm.texi only documents the old macro PRINT_OPERAND_PUNCT_VALID_P,
520 not this hook. */
521 DEFHOOK_UNDOC
522 (print_operand_punct_valid_p,
524 bool ,(unsigned char code),
525 default_print_operand_punct_valid_p)
527 /* Given a symbol name, perform same mangling as assemble_name and
528 ASM_OUTPUT_LABELREF, returning result as an IDENTIFIER_NODE. */
529 DEFHOOK
530 (mangle_assembler_name,
531 "Given a symbol @var{name}, perform same mangling as @code{varasm.c}'s\
532 @code{assemble_name}, but in memory rather than to a file stream, returning\
533 result as an @code{IDENTIFIER_NODE}. Required for correct LTO symtabs. The\
534 default implementation calls the @code{TARGET_STRIP_NAME_ENCODING} hook and\
535 then prepends the @code{USER_LABEL_PREFIX}, if any.",
536 tree, (const char *name),
537 default_mangle_assembler_name)
539 HOOK_VECTOR_END (asm_out)
541 /* Functions relating to instruction scheduling. All of these
542 default to null pointers, which haifa-sched.c looks for and handles. */
543 #undef HOOK_PREFIX
544 #define HOOK_PREFIX "TARGET_SCHED_"
545 HOOK_VECTOR (TARGET_SCHED, sched)
547 /* Given the current cost, COST, of an insn, INSN, calculate and
548 return a new cost based on its relationship to DEP_INSN through
549 the dependence LINK. The default is to make no adjustment. */
550 DEFHOOK
551 (adjust_cost,
553 int, (rtx insn, rtx link, rtx dep_insn, int cost), NULL)
555 /* Adjust the priority of an insn as you see fit. Returns the new priority. */
556 DEFHOOK
557 (adjust_priority,
559 int, (rtx insn, int priority), NULL)
561 /* Function which returns the maximum number of insns that can be
562 scheduled in the same machine cycle. This must be constant
563 over an entire compilation. The default is 1. */
564 DEFHOOK
565 (issue_rate,
567 int, (void), NULL)
569 /* Calculate how much this insn affects how many more insns we
570 can emit this cycle. Default is they all cost the same. */
571 DEFHOOK
572 (variable_issue,
574 int, (FILE *file, int verbose, rtx insn, int more), NULL)
576 /* Initialize machine-dependent scheduling code. */
577 DEFHOOK
578 (init,
580 void, (FILE *file, int verbose, int max_ready), NULL)
582 /* Finalize machine-dependent scheduling code. */
583 DEFHOOK
584 (finish,
586 void, (FILE *file, int verbose), NULL)
588 /* Initialize machine-dependent function wide scheduling code. */
589 DEFHOOK
590 (init_global,
592 void, (FILE *file, int verbose, int old_max_uid), NULL)
594 /* Finalize machine-dependent function wide scheduling code. */
595 DEFHOOK
596 (finish_global,
598 void, (FILE *file, int verbose), NULL)
600 /* Reorder insns in a machine-dependent fashion, in two different
601 places. Default does nothing. */
602 DEFHOOK
603 (reorder,
605 int, (FILE *file, int verbose, rtx *ready, int *n_readyp, int clock), NULL)
607 DEFHOOK
608 (reorder2,
610 int, (FILE *file, int verbose, rtx *ready, int *n_readyp, int clock), NULL)
612 /* The following member value is a pointer to a function called
613 after evaluation forward dependencies of insns in chain given
614 by two parameter values (head and tail correspondingly). */
615 DEFHOOK
616 (dependencies_evaluation_hook,
618 void, (rtx head, rtx tail), NULL)
620 /* The values of the following four members are pointers to functions
621 used to simplify the automaton descriptions. dfa_pre_cycle_insn and
622 dfa_post_cycle_insn give functions returning insns which are used to
623 change the pipeline hazard recognizer state when the new simulated
624 processor cycle correspondingly starts and finishes. The function
625 defined by init_dfa_pre_cycle_insn and init_dfa_post_cycle_insn are
626 used to initialize the corresponding insns. The default values of
627 the members result in not changing the automaton state when the
628 new simulated processor cycle correspondingly starts and finishes. */
630 DEFHOOK
631 (init_dfa_pre_cycle_insn,
633 void, (void), NULL)
635 DEFHOOK
636 (dfa_pre_cycle_insn,
638 rtx, (void), NULL)
640 DEFHOOK
641 (init_dfa_post_cycle_insn,
643 void, (void), NULL)
645 DEFHOOK
646 (dfa_post_cycle_insn,
648 rtx, (void), NULL)
650 /* The values of the following two members are pointers to
651 functions used to simplify the automaton descriptions.
652 dfa_pre_advance_cycle and dfa_post_advance_cycle are getting called
653 immediately before and after cycle is advanced. */
655 DEFHOOK
656 (dfa_pre_advance_cycle,
658 void, (void), NULL)
660 DEFHOOK
661 (dfa_post_advance_cycle,
663 void, (void), NULL)
665 /* The following member value is a pointer to a function returning value
666 which defines how many insns in queue `ready' will we try for
667 multi-pass scheduling. If the member value is nonzero and the
668 function returns positive value, the DFA based scheduler will make
669 multi-pass scheduling for the first cycle. In other words, we will
670 try to choose ready insn which permits to start maximum number of
671 insns on the same cycle. */
672 DEFHOOK
673 (first_cycle_multipass_dfa_lookahead,
675 int, (void), NULL)
677 /* The following member value is pointer to a function controlling
678 what insns from the ready insn queue will be considered for the
679 multipass insn scheduling. If the hook returns zero for insn
680 passed as the parameter, the insn will be not chosen to be issued. */
681 DEFHOOK
682 (first_cycle_multipass_dfa_lookahead_guard,
684 int, (rtx insn), NULL)
686 /* This hook prepares the target for a new round of multipass
687 scheduling.
688 DATA is a pointer to target-specific data used for multipass scheduling.
689 READY_TRY and N_READY represent the current state of search in the
690 optimization space. The target can filter out instructions that
691 should not be tried during current round by setting corresponding
692 elements in READY_TRY to non-zero.
693 FIRST_CYCLE_INSN_P is true if this is the first round of multipass
694 scheduling on current cycle. */
695 DEFHOOK
696 (first_cycle_multipass_begin,
698 void, (void *data, char *ready_try, int n_ready, bool first_cycle_insn_p),
699 NULL)
701 /* This hook is called when multipass scheduling evaluates instruction INSN.
702 DATA is a pointer to target-specific data that can be used to record effects
703 of INSN on CPU that are not described in DFA.
704 READY_TRY and N_READY represent the current state of search in the
705 optimization space. The target can filter out instructions that
706 should not be tried after issueing INSN by setting corresponding
707 elements in READY_TRY to non-zero.
708 INSN is the instruction being evaluated.
709 PREV_DATA is a pointer to target-specific data corresponding
710 to a state before issueing INSN. */
711 DEFHOOK
712 (first_cycle_multipass_issue,
714 void, (void *data, char *ready_try, int n_ready, rtx insn,
715 const void *prev_data), NULL)
717 /* This hook is called when multipass scheduling backtracks from evaluation of
718 instruction corresponding to DATA.
719 DATA is a pointer to target-specific data that stores the effects
720 of instruction from which the algorithm backtracks on CPU that are not
721 described in DFA.
722 READY_TRY and N_READY represent the current state of search in the
723 optimization space. The target can filter out instructions that
724 should not be tried after issueing INSN by setting corresponding
725 elements in READY_TRY to non-zero. */
726 DEFHOOK
727 (first_cycle_multipass_backtrack,
729 void, (const void *data, char *ready_try, int n_ready), NULL)
731 /* This hook notifies the target about the result of the concluded current
732 round of multipass scheduling.
733 DATA is a pointer.
734 If DATA is non-NULL it points to target-specific data used for multipass
735 scheduling which corresponds to instruction at the start of the chain of
736 the winning solution. DATA is NULL when multipass scheduling cannot find
737 a good enough solution on current cycle and decides to retry later,
738 usually after advancing the cycle count. */
739 DEFHOOK
740 (first_cycle_multipass_end,
742 void, (const void *data), NULL)
744 /* This hook is called to initialize target-specific data for multipass
745 scheduling after it has been allocated.
746 DATA is a pointer to target-specific data that stores the effects
747 of instruction from which the algorithm backtracks on CPU that are not
748 described in DFA. */
749 DEFHOOK
750 (first_cycle_multipass_init,
752 void, (void *data), NULL)
754 /* This hook is called to finalize target-specific data for multipass
755 scheduling before it is deallocated.
756 DATA is a pointer to target-specific data that stores the effects
757 of instruction from which the algorithm backtracks on CPU that are not
758 described in DFA. */
759 DEFHOOK
760 (first_cycle_multipass_fini,
762 void, (void *data), NULL)
764 /* The following member value is pointer to a function called by
765 the insn scheduler before issuing insn passed as the third
766 parameter on given cycle. If the hook returns nonzero, the
767 insn is not issued on given processors cycle. Instead of that,
768 the processor cycle is advanced. If the value passed through
769 the last parameter is zero, the insn ready queue is not sorted
770 on the new cycle start as usually. The first parameter passes
771 file for debugging output. The second one passes the scheduler
772 verbose level of the debugging output. The forth and the fifth
773 parameter values are correspondingly processor cycle on which
774 the previous insn has been issued and the current processor cycle. */
775 DEFHOOK
776 (dfa_new_cycle,
778 int, (FILE *dump, int verbose, rtx insn, int last_clock,
779 int clock, int *sort_p),
780 NULL)
782 /* The following member value is a pointer to a function called by the
783 insn scheduler. It should return true if there exists a dependence
784 which is considered costly by the target, between the insn
785 DEP_PRO (&_DEP), and the insn DEP_CON (&_DEP). The first parameter is
786 the dep that represents the dependence between the two insns. The
787 second argument is the cost of the dependence as estimated by
788 the scheduler. The last argument is the distance in cycles
789 between the already scheduled insn (first parameter) and the
790 second insn (second parameter). */
791 DEFHOOK
792 (is_costly_dependence,
794 bool, (struct _dep *_dep, int cost, int distance), NULL)
796 DEFHOOK_UNDOC
797 (adjust_cost_2,
798 "Given the current cost, @var{cost}, of an insn, @var{insn}, calculate and\
799 return a new cost based on its relationship to @var{dep_insn} through the\
800 dependence of weakness @var{dw}. The default is to make no adjustment.",
801 int, (rtx insn, int dep_type1, rtx dep_insn, int cost, int dw), NULL)
803 /* The following member value is a pointer to a function called
804 by the insn scheduler. This hook is called to notify the backend
805 that new instructions were emitted. */
806 DEFHOOK
807 (h_i_d_extended,
809 void, (void), NULL)
811 /* Next 5 functions are for multi-point scheduling. */
813 /* Allocate memory for scheduler context. */
814 DEFHOOK
815 (alloc_sched_context,
817 void *, (void), NULL)
819 /* Fills the context from the local machine scheduler context. */
820 DEFHOOK
821 (init_sched_context,
823 void, (void *tc, bool clean_p), NULL)
825 /* Sets local machine scheduler context to a saved value. */
826 DEFHOOK
827 (set_sched_context,
829 void, (void *tc), NULL)
831 /* Clears a scheduler context so it becomes like after init. */
832 DEFHOOK
833 (clear_sched_context,
835 void, (void *tc), NULL)
837 /* Frees the scheduler context. */
838 DEFHOOK
839 (free_sched_context,
841 void, (void *tc), NULL)
843 /* The following member value is a pointer to a function called
844 by the insn scheduler.
845 The first parameter is an instruction, the second parameter is the type
846 of the requested speculation, and the third parameter is a pointer to the
847 speculative pattern of the corresponding type (set if return value == 1).
848 It should return
849 -1, if there is no pattern, that will satisfy the requested speculation type,
850 0, if current pattern satisfies the requested speculation type,
851 1, if pattern of the instruction should be changed to the newly
852 generated one. */
853 DEFHOOK
854 (speculate_insn,
856 int, (rtx insn, int request, rtx *new_pat), NULL)
858 /* The following member value is a pointer to a function called
859 by the insn scheduler. It should return true if the check instruction
860 passed as the parameter needs a recovery block. */
861 DEFHOOK
862 (needs_block_p,
864 bool, (int dep_status), NULL)
866 /* The following member value is a pointer to a function called
867 by the insn scheduler. It should return a pattern for the check
868 instruction.
869 The first parameter is a speculative instruction, the second parameter
870 is the label of the corresponding recovery block (or null, if it is a
871 simple check). If the mutation of the check is requested (e.g. from
872 ld.c to chk.a), the third parameter is true - in this case the first
873 parameter is the previous check. */
874 DEFHOOK
875 (gen_spec_check,
877 rtx, (rtx insn, rtx label, int mutate_p), NULL)
879 /* The following member value is a pointer to a function controlling
880 what insns from the ready insn queue will be considered for the
881 multipass insn scheduling. If the hook returns zero for the insn
882 passed as the parameter, the insn will not be chosen to be
883 issued. This hook is used to discard speculative instructions,
884 that stand at the first position of the ready list. */
885 DEFHOOK
886 (first_cycle_multipass_dfa_lookahead_guard_spec,
888 bool, (const_rtx insn), NULL)
890 /* The following member value is a pointer to a function that provides
891 information about the speculation capabilities of the target.
892 The parameter is a pointer to spec_info variable. */
893 DEFHOOK
894 (set_sched_flags,
896 void, (struct spec_info_def *spec_info), NULL)
898 DEFHOOK_UNDOC
899 (get_insn_spec_ds,
900 "Return speculation types of instruction @var{insn}.",
901 int, (rtx insn), NULL)
903 DEFHOOK_UNDOC
904 (get_insn_checked_ds,
905 "Return speculation types that are checked for instruction @var{insn}",
906 int, (rtx insn), NULL)
908 DEFHOOK_UNDOC
909 (skip_rtx_p,
910 "Return bool if rtx scanning should just skip current layer and\
911 advance to the inner rtxes.",
912 bool, (const_rtx x), NULL)
914 /* The following member value is a pointer to a function that provides
915 information about the target resource-based lower bound which is
916 used by the swing modulo scheduler. The parameter is a pointer
917 to ddg variable. */
918 DEFHOOK
919 (sms_res_mii,
921 int, (struct ddg *g), NULL)
923 /* The following member value is a function that initializes dispatch
924 schedling and adds instructions to dispatch window according to its
925 parameters. */
926 DEFHOOK
927 (dispatch_do,
929 void, (rtx insn, int x),
930 hook_void_rtx_int)
932 /* The following member value is a a function that returns true is
933 dispatch schedling is supported in hardware and condition passed
934 as the second parameter is true. */
935 DEFHOOK
936 (dispatch,
938 bool, (rtx insn, int x),
939 hook_bool_rtx_int_false)
941 HOOK_VECTOR_END (sched)
943 /* Functions relating to vectorization. */
944 #undef HOOK_PREFIX
945 #define HOOK_PREFIX "TARGET_VECTORIZE_"
946 HOOK_VECTOR (TARGET_VECTORIZE, vectorize)
948 /* The following member value is a pointer to a function called
949 by the vectorizer, and return the decl of the target builtin
950 function. */
951 DEFHOOK
952 (builtin_mask_for_load,
954 tree, (void), NULL)
956 /* Returns a code for builtin that realizes vectorized version of
957 function, or NULL_TREE if not available. */
958 DEFHOOK
959 (builtin_vectorized_function,
961 tree, (tree fndecl, tree vec_type_out, tree vec_type_in),
962 default_builtin_vectorized_function)
964 /* Returns a function declaration for a builtin that realizes the
965 vector conversion, or NULL_TREE if not available. */
966 DEFHOOK
967 (builtin_conversion,
969 tree, (unsigned code, tree dest_type, tree src_type),
970 default_builtin_vectorized_conversion)
972 /* Target builtin that implements vector widening multiplication.
973 builtin_mul_widen_eve computes the element-by-element products
974 for the even elements, and builtin_mul_widen_odd computes the
975 element-by-element products for the odd elements. */
976 DEFHOOK
977 (builtin_mul_widen_even,
979 tree, (tree x), NULL)
981 DEFHOOK
982 (builtin_mul_widen_odd,
984 tree, (tree x), NULL)
986 /* Cost of different vector/scalar statements in vectorization cost
987 model. In case of misaligned vector loads and stores the cost depends
988 on the data type and misalignment value. */
989 DEFHOOK
990 (builtin_vectorization_cost,
992 int, (enum vect_cost_for_stmt type_of_cost, tree vectype, int misalign),
993 default_builtin_vectorization_cost)
995 /* Return true if vector alignment is reachable (by peeling N
996 iterations) for the given type. */
997 DEFHOOK
998 (vector_alignment_reachable,
1000 bool, (const_tree type, bool is_packed),
1001 default_builtin_vector_alignment_reachable)
1003 /* Target builtin that implements vector permute. */
1004 DEFHOOK
1005 (builtin_vec_perm,
1007 tree, (tree type, tree *mask_element_type), NULL)
1009 /* Return true if a vector created for builtin_vec_perm is valid. */
1010 DEFHOOK
1011 (builtin_vec_perm_ok,
1013 bool, (tree vec_type, tree mask),
1014 hook_bool_tree_tree_true)
1016 /* Return true if the target supports misaligned store/load of a
1017 specific factor denoted in the third parameter. The last parameter
1018 is true if the access is defined in a packed struct. */
1019 DEFHOOK
1020 (support_vector_misalignment,
1022 bool,
1023 (enum machine_mode mode, const_tree type, int misalignment, bool is_packed),
1024 default_builtin_support_vector_misalignment)
1026 /* Returns the preferred mode for SIMD operations for the specified
1027 scalar mode. */
1028 DEFHOOK
1029 (preferred_simd_mode,
1031 enum machine_mode,
1032 (enum machine_mode mode),
1033 default_preferred_simd_mode)
1035 /* Returns a mask of vector sizes to iterate over when auto-vectorizing
1036 after processing the preferred one derived from preferred_simd_mode. */
1037 DEFHOOK
1038 (autovectorize_vector_sizes,
1040 unsigned int,
1041 (void),
1042 default_autovectorize_vector_sizes)
1044 HOOK_VECTOR_END (vectorize)
1046 #undef HOOK_PREFIX
1047 #define HOOK_PREFIX "TARGET_"
1049 /* The initial value of target_flags. */
1050 DEFHOOKPOD
1051 (default_target_flags,
1053 int, 0)
1055 /* Allow target specific overriding of option settings after options have
1056 been changed by an attribute or pragma or when it is reset at the
1057 end of the code affected by an attribute or pragma. */
1058 DEFHOOK
1059 (override_options_after_change,
1061 void, (void),
1062 hook_void_void)
1064 /* Handle target switch CODE (an OPT_* value). ARG is the argument
1065 passed to the switch; it is NULL if no argument was. VALUE is the
1066 value of ARG if CODE specifies a UInteger option, otherwise it is
1067 1 if the positive form of the switch was used and 0 if the negative
1068 form was. Return true if the switch was valid. */
1069 DEFHOOK
1070 (handle_option,
1072 bool, (size_t code, const char *arg, int value),
1073 hook_bool_size_t_constcharptr_int_true)
1075 /* Display extra, target specific information in response to a
1076 --target-help switch. */
1077 DEFHOOK
1078 (help,
1080 void, (void), NULL)
1082 DEFHOOK_UNDOC
1083 (eh_return_filter_mode,
1084 "Return machine mode for filter value.",
1085 enum machine_mode, (void),
1086 default_eh_return_filter_mode)
1088 /* Return machine mode for libgcc expanded cmp instructions. */
1089 DEFHOOK
1090 (libgcc_cmp_return_mode,
1092 enum machine_mode, (void),
1093 default_libgcc_cmp_return_mode)
1095 /* Return machine mode for libgcc expanded shift instructions. */
1096 DEFHOOK
1097 (libgcc_shift_count_mode,
1099 enum machine_mode, (void),
1100 default_libgcc_shift_count_mode)
1102 /* Return machine mode to be used for _Unwind_Word type. */
1103 DEFHOOK
1104 (unwind_word_mode,
1106 enum machine_mode, (void),
1107 default_unwind_word_mode)
1109 /* Given two decls, merge their attributes and return the result. */
1110 DEFHOOK
1111 (merge_decl_attributes,
1113 tree, (tree olddecl, tree newdecl),
1114 merge_decl_attributes)
1116 /* Given two types, merge their attributes and return the result. */
1117 DEFHOOK
1118 (merge_type_attributes,
1120 tree, (tree type1, tree type2),
1121 merge_type_attributes)
1123 /* Table of machine attributes and functions to handle them.
1124 Ignored if NULL. */
1125 DEFHOOKPOD
1126 (attribute_table,
1128 const struct attribute_spec *, NULL)
1130 /* Return true iff attribute NAME expects a plain identifier as its first
1131 argument. */
1132 DEFHOOK
1133 (attribute_takes_identifier_p,
1135 bool, (const_tree name),
1136 hook_bool_const_tree_false)
1138 /* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
1139 one if they are compatible and two if they are nearly compatible
1140 (which causes a warning to be generated). */
1141 DEFHOOK
1142 (comp_type_attributes,
1144 int, (const_tree type1, const_tree type2),
1145 hook_int_const_tree_const_tree_1)
1147 /* Assign default attributes to the newly defined TYPE. */
1148 DEFHOOK
1149 (set_default_type_attributes,
1151 void, (tree type),
1152 hook_void_tree)
1154 /* Insert attributes on the newly created DECL. */
1155 DEFHOOK
1156 (insert_attributes,
1158 void, (tree node, tree *attr_ptr),
1159 hook_void_tree_treeptr)
1161 /* Return true if FNDECL (which has at least one machine attribute)
1162 can be inlined despite its machine attributes, false otherwise. */
1163 DEFHOOK
1164 (function_attribute_inlinable_p,
1166 bool, (const_tree fndecl),
1167 hook_bool_const_tree_false)
1169 /* Return true if bitfields in RECORD_TYPE should follow the
1170 Microsoft Visual C++ bitfield layout rules. */
1171 DEFHOOK
1172 (ms_bitfield_layout_p,
1174 bool, (const_tree record_type),
1175 hook_bool_const_tree_false)
1177 /* For now this is only an interface to WORDS_BIG_ENDIAN for
1178 target-independent code like the front ends, need performance testing
1179 before switching completely to the target hook. */
1180 DEFHOOK_UNDOC
1181 (words_big_endian,
1183 bool, (void),
1184 targhook_words_big_endian)
1186 /* Likewise for FLOAT_WORDS_BIG_ENDIAN. */
1187 DEFHOOK_UNDOC
1188 (float_words_big_endian,
1190 bool, (void),
1191 targhook_float_words_big_endian)
1193 /* True if the target supports decimal floating point. */
1194 DEFHOOK
1195 (decimal_float_supported_p,
1197 bool, (void),
1198 default_decimal_float_supported_p)
1200 /* True if the target supports fixed-point. */
1201 DEFHOOK
1202 (fixed_point_supported_p,
1204 bool, (void),
1205 default_fixed_point_supported_p)
1207 /* Return true if anonymous bitfields affect structure alignment. */
1208 DEFHOOK
1209 (align_anon_bitfield,
1211 bool, (void),
1212 hook_bool_void_false)
1214 /* Return true if volatile bitfields should use the narrowest type possible.
1215 Return false if they should use the container type. */
1216 DEFHOOK
1217 (narrow_volatile_bitfield,
1219 bool, (void),
1220 hook_bool_void_false)
1222 /* Set up target-specific built-in functions. */
1223 DEFHOOK
1224 (init_builtins,
1226 void, (void),
1227 hook_void_void)
1229 /* Initialize (if INITIALIZE_P is true) and return the target-specific
1230 built-in function decl for CODE.
1231 Return NULL if that is not possible. Return error_mark_node if CODE
1232 is outside of the range of valid target builtin function codes. */
1233 DEFHOOK
1234 (builtin_decl,
1236 tree, (unsigned code, bool initialize_p), NULL)
1238 /* Expand a target-specific builtin. */
1239 DEFHOOK
1240 (expand_builtin,
1242 rtx,
1243 (tree exp, rtx target, rtx subtarget, enum machine_mode mode, int ignore),
1244 default_expand_builtin)
1246 /* Select a replacement for a target-specific builtin. This is done
1247 *before* regular type checking, and so allows the target to
1248 implement a crude form of function overloading. The result is a
1249 complete expression that implements the operation. PARAMS really
1250 has type VEC(tree,gc)*, but we don't want to include tree.h here. */
1251 DEFHOOK
1252 (resolve_overloaded_builtin,
1254 tree, (unsigned int /*location_t*/ loc, tree fndecl, void *arglist), NULL)
1256 /* Fold a target-specific builtin. */
1257 DEFHOOK
1258 (fold_builtin,
1260 tree, (tree fndecl, int n_args, tree *argp, bool ignore),
1261 hook_tree_tree_int_treep_bool_null)
1263 /* Returns a code for a target-specific builtin that implements
1264 reciprocal of the function, or NULL_TREE if not available. */
1265 DEFHOOK
1266 (builtin_reciprocal,
1268 tree, (unsigned fn, bool md_fn, bool sqrt),
1269 default_builtin_reciprocal)
1271 /* For a vendor-specific TYPE, return a pointer to a statically-allocated
1272 string containing the C++ mangling for TYPE. In all other cases, return
1273 NULL. */
1274 DEFHOOK
1275 (mangle_type,
1277 const char *, (const_tree type),
1278 hook_constcharptr_const_tree_null)
1280 /* Make any adjustments to libfunc names needed for this target. */
1281 DEFHOOK
1282 (init_libfuncs,
1284 void, (void),
1285 hook_void_void)
1287 /* Given a decl, a section name, and whether the decl initializer
1288 has relocs, choose attributes for the section. */
1289 /* ??? Should be merged with SELECT_SECTION and UNIQUE_SECTION. */
1290 DEFHOOK
1291 (section_type_flags,
1293 unsigned int, (tree decl, const char *name, int reloc),
1294 default_section_type_flags)
1296 /* True if new jumps cannot be created, to replace existing ones or
1297 not, at the current point in the compilation. */
1298 DEFHOOK
1299 (cannot_modify_jumps_p,
1301 bool, (void),
1302 hook_bool_void_false)
1304 /* Return a register class for which branch target register
1305 optimizations should be applied. */
1306 DEFHOOK
1307 (branch_target_register_class,
1309 reg_class_t, (void),
1310 default_branch_target_register_class)
1312 /* Return true if branch target register optimizations should include
1313 callee-saved registers that are not already live during the current
1314 function. AFTER_PE_GEN is true if prologues and epilogues have
1315 already been generated. */
1316 DEFHOOK
1317 (branch_target_register_callee_saved,
1319 bool, (bool after_prologue_epilogue_gen),
1320 hook_bool_bool_false)
1322 /* Return true if the target supports conditional execution. */
1323 DEFHOOK
1324 (have_conditional_execution,
1326 bool, (void),
1327 default_have_conditional_execution)
1329 /* Return a new value for loop unroll size. */
1330 DEFHOOK
1331 (loop_unroll_adjust,
1333 unsigned, (unsigned nunroll, struct loop *loop),
1334 NULL)
1336 /* True if the constant X cannot be placed in the constant pool. */
1337 DEFHOOK
1338 (cannot_force_const_mem,
1340 bool, (rtx x),
1341 hook_bool_rtx_false)
1343 DEFHOOK_UNDOC
1344 (cannot_copy_insn_p,
1345 "True if the insn @var{x} cannot be duplicated.",
1346 bool, (rtx), NULL)
1348 /* True if X is considered to be commutative. */
1349 DEFHOOK
1350 (commutative_p,
1352 bool, (const_rtx x, int outer_code),
1353 hook_bool_const_rtx_commutative_p)
1355 /* True if ADDR is an address-expression whose effect depends
1356 on the mode of the memory reference it is used in. */
1357 DEFHOOK
1358 (mode_dependent_address_p,
1360 bool, (const_rtx addr),
1361 default_mode_dependent_address_p)
1363 /* Given an invalid address X for a given machine mode, try machine-specific
1364 ways to make it legitimate. Return X or an invalid address on failure. */
1365 DEFHOOK
1366 (legitimize_address,
1368 rtx, (rtx x, rtx oldx, enum machine_mode mode),
1369 default_legitimize_address)
1371 /* Given an address RTX, undo the effects of LEGITIMIZE_ADDRESS. */
1372 DEFHOOK
1373 (delegitimize_address,
1375 rtx, (rtx x),
1376 delegitimize_mem_from_attrs)
1378 /* Given an address RTX, say whether it is valid. */
1379 DEFHOOK
1380 (legitimate_address_p,
1382 bool, (enum machine_mode mode, rtx x, bool strict),
1383 default_legitimate_address_p)
1385 /* True if the given constant can be put into an object_block. */
1386 DEFHOOK
1387 (use_blocks_for_constant_p,
1389 bool, (enum machine_mode mode, const_rtx x),
1390 hook_bool_mode_const_rtx_false)
1392 /* The minimum and maximum byte offsets for anchored addresses. */
1393 DEFHOOKPOD
1394 (min_anchor_offset,
1396 HOST_WIDE_INT, 0)
1398 DEFHOOKPOD
1399 (max_anchor_offset,
1401 HOST_WIDE_INT, 0)
1403 /* True if section anchors can be used to access the given symbol. */
1404 DEFHOOK
1405 (use_anchors_for_symbol_p,
1407 bool, (const_rtx x),
1408 default_use_anchors_for_symbol_p)
1410 /* True if it is OK to do sibling call optimization for the specified
1411 call expression EXP. DECL will be the called function, or NULL if
1412 this is an indirect call. */
1413 DEFHOOK
1414 (function_ok_for_sibcall,
1416 bool, (tree decl, tree exp),
1417 hook_bool_tree_tree_false)
1419 /* Establish appropriate back-end context for processing the function
1420 FNDECL. The argument might be NULL to indicate processing at top
1421 level, outside of any function scope. */
1422 DEFHOOK
1423 (set_current_function,
1425 void, (tree decl), hook_void_tree)
1427 /* True if EXP should be placed in a "small data" section. */
1428 DEFHOOK
1429 (in_small_data_p,
1431 bool, (const_tree exp),
1432 hook_bool_const_tree_false)
1434 /* True if EXP names an object for which name resolution must resolve
1435 to the current executable or shared library. */
1436 DEFHOOK
1437 (binds_local_p,
1439 bool, (const_tree exp),
1440 default_binds_local_p)
1442 /* Check if profiling code is before or after prologue. */
1443 DEFHOOK
1444 (profile_before_prologue,
1445 "It returns true if target wants profile code emitted before prologue.\n\n\
1446 The default version of this hook use the target macro\n\
1447 @code{PROFILE_BEFORE_PROLOGUE}.",
1448 bool, (void),
1449 default_profile_before_prologue)
1451 /* Modify and return the identifier of a DECL's external name,
1452 originally identified by ID, as required by the target,
1453 (eg, append @nn to windows32 stdcall function names).
1454 The default is to return ID without modification. */
1455 DEFHOOK
1456 (mangle_decl_assembler_name,
1458 tree, (tree decl, tree id),
1459 default_mangle_decl_assembler_name)
1461 /* Do something target-specific to record properties of the DECL into
1462 the associated SYMBOL_REF. */
1463 DEFHOOK
1464 (encode_section_info,
1466 void, (tree decl, rtx rtl, int new_decl_p),
1467 default_encode_section_info)
1469 /* Undo the effects of encode_section_info on the symbol string. */
1470 DEFHOOK
1471 (strip_name_encoding,
1473 const char *, (const char *name),
1474 default_strip_name_encoding)
1476 /* If shift optabs for MODE are known to always truncate the shift count,
1477 return the mask that they apply. Return 0 otherwise. */
1478 DEFHOOK
1479 (shift_truncation_mask,
1481 unsigned HOST_WIDE_INT, (enum machine_mode mode),
1482 default_shift_truncation_mask)
1484 /* Return the number of divisions in the given MODE that should be present,
1485 so that it is profitable to turn the division into a multiplication by
1486 the reciprocal. */
1487 DEFHOOK
1488 (min_divisions_for_recip_mul,
1490 unsigned int, (enum machine_mode mode),
1491 default_min_divisions_for_recip_mul)
1493 /* If the representation of integral MODE is such that values are
1494 always sign-extended to a wider mode MODE_REP then return
1495 SIGN_EXTEND. Return UNKNOWN otherwise. */
1496 /* Note that the return type ought to be RTX_CODE, but that's not
1497 necessarily defined at this point. */
1498 DEFHOOK
1499 (mode_rep_extended,
1501 int, (enum machine_mode mode, enum machine_mode rep_mode),
1502 default_mode_rep_extended)
1504 /* True if MODE is valid for a pointer in __attribute__((mode("MODE"))). */
1505 DEFHOOK
1506 (valid_pointer_mode,
1508 bool, (enum machine_mode mode),
1509 default_valid_pointer_mode)
1511 /* Support for named address spaces. */
1512 #undef HOOK_PREFIX
1513 #define HOOK_PREFIX "TARGET_ADDR_SPACE_"
1514 HOOK_VECTOR (TARGET_ADDR_SPACE_HOOKS, addr_space)
1516 /* MODE to use for a pointer into another address space. */
1517 DEFHOOK
1518 (pointer_mode,
1520 enum machine_mode, (addr_space_t address_space),
1521 default_addr_space_pointer_mode)
1523 /* MODE to use for an address in another address space. */
1524 DEFHOOK
1525 (address_mode,
1527 enum machine_mode, (addr_space_t address_space),
1528 default_addr_space_address_mode)
1530 /* True if MODE is valid for a pointer in __attribute__((mode("MODE")))
1531 in another address space. */
1532 DEFHOOK
1533 (valid_pointer_mode,
1535 bool, (enum machine_mode mode, addr_space_t as),
1536 default_addr_space_valid_pointer_mode)
1538 /* True if an address is a valid memory address to a given named address
1539 space for a given mode. */
1540 DEFHOOK
1541 (legitimate_address_p,
1543 bool, (enum machine_mode mode, rtx exp, bool strict, addr_space_t as),
1544 default_addr_space_legitimate_address_p)
1546 /* Return an updated address to convert an invalid pointer to a named
1547 address space to a valid one. If NULL_RTX is returned use machine
1548 independent methods to make the address valid. */
1549 DEFHOOK
1550 (legitimize_address,
1552 rtx, (rtx x, rtx oldx, enum machine_mode mode, addr_space_t as),
1553 default_addr_space_legitimize_address)
1555 /* True if one named address space is a subset of another named address. */
1556 DEFHOOK
1557 (subset_p,
1559 bool, (addr_space_t superset, addr_space_t subset),
1560 default_addr_space_subset_p)
1562 /* Function to convert an rtl expression from one address space to another. */
1563 DEFHOOK
1564 (convert,
1566 rtx, (rtx op, tree from_type, tree to_type),
1567 default_addr_space_convert)
1569 HOOK_VECTOR_END (addr_space)
1571 #undef HOOK_PREFIX
1572 #define HOOK_PREFIX "TARGET_"
1574 /* True if MODE is valid for the target. By "valid", we mean able to
1575 be manipulated in non-trivial ways. In particular, this means all
1576 the arithmetic is supported. */
1577 DEFHOOK
1578 (scalar_mode_supported_p,
1580 bool, (enum machine_mode mode),
1581 default_scalar_mode_supported_p)
1583 /* Similarly for vector modes. "Supported" here is less strict. At
1584 least some operations are supported; need to check optabs or builtins
1585 for further details. */
1586 DEFHOOK
1587 (vector_mode_supported_p,
1589 bool, (enum machine_mode mode),
1590 hook_bool_mode_false)
1592 /* Compute cost of moving data from a register of class FROM to one of
1593 TO, using MODE. */
1594 DEFHOOK
1595 (register_move_cost,
1597 int, (enum machine_mode mode, reg_class_t from, reg_class_t to),
1598 default_register_move_cost)
1600 /* Compute cost of moving registers to/from memory. */
1601 /* ??? Documenting the argument types for this hook requires a GFDL
1602 license grant. Also, the documentation uses a different name for RCLASS. */
1603 DEFHOOK
1604 (memory_move_cost,
1606 int, (enum machine_mode mode, reg_class_t rclass, bool in),
1607 default_memory_move_cost)
1609 /* True for MODE if the target expects that registers in this mode will
1610 be allocated to registers in a small register class. The compiler is
1611 allowed to use registers explicitly used in the rtl as spill registers
1612 but it should prevent extending the lifetime of these registers. */
1613 DEFHOOK
1614 (small_register_classes_for_mode_p,
1616 bool, (enum machine_mode mode),
1617 hook_bool_mode_false)
1619 /* Compute a (partial) cost for rtx X. Return true if the complete
1620 cost has been computed, and false if subexpressions should be
1621 scanned. In either case, *TOTAL contains the cost result. */
1622 /* Note that CODE and OUTER_CODE ought to be RTX_CODE, but that's
1623 not necessarily defined at this point. */
1624 DEFHOOK
1625 (rtx_costs,
1627 bool, (rtx x, int code, int outer_code, int *total, bool speed),
1628 hook_bool_rtx_int_int_intp_bool_false)
1630 /* Compute the cost of X, used as an address. Never called with
1631 invalid addresses. */
1632 DEFHOOK
1633 (address_cost,
1635 int, (rtx address, bool speed),
1636 default_address_cost)
1638 /* Return where to allocate pseudo for a given hard register initial value. */
1639 DEFHOOK
1640 (allocate_initial_value,
1642 rtx, (rtx hard_reg), NULL)
1644 /* Return nonzero if evaluating UNSPEC[_VOLATILE] X might cause a trap.
1645 FLAGS has the same meaning as in rtlanal.c: may_trap_p_1. */
1646 DEFHOOK
1647 (unspec_may_trap_p,
1649 int, (const_rtx x, unsigned flags),
1650 default_unspec_may_trap_p)
1652 /* Given a register, this hook should return a parallel of registers
1653 to represent where to find the register pieces. Define this hook
1654 if the register and its mode are represented in Dwarf in
1655 non-contiguous locations, or if the register should be
1656 represented in more than one register in Dwarf. Otherwise, this
1657 hook should return NULL_RTX. */
1658 DEFHOOK
1659 (dwarf_register_span,
1661 rtx, (rtx reg),
1662 hook_rtx_rtx_null)
1664 /* If expand_builtin_init_dwarf_reg_sizes needs to fill in table
1665 entries not corresponding directly to registers below
1666 FIRST_PSEUDO_REGISTER, this hook should generate the necessary
1667 code, given the address of the table. */
1668 DEFHOOK
1669 (init_dwarf_reg_sizes_extra,
1671 void, (tree address),
1672 hook_void_tree)
1674 /* Fetch the fixed register(s) which hold condition codes, for
1675 targets where it makes sense to look for duplicate assignments to
1676 the condition codes. This should return true if there is such a
1677 register, false otherwise. The arguments should be set to the
1678 fixed register numbers. Up to two condition code registers are
1679 supported. If there is only one for this target, the int pointed
1680 at by the second argument should be set to -1. */
1681 DEFHOOK
1682 (fixed_condition_code_regs,
1684 bool, (unsigned int *p1, unsigned int *p2),
1685 hook_bool_uintp_uintp_false)
1687 /* If two condition code modes are compatible, return a condition
1688 code mode which is compatible with both, such that a comparison
1689 done in the returned mode will work for both of the original
1690 modes. If the condition code modes are not compatible, return
1691 VOIDmode. */
1692 DEFHOOK
1693 (cc_modes_compatible,
1695 enum machine_mode, (enum machine_mode m1, enum machine_mode m2),
1696 default_cc_modes_compatible)
1698 /* Do machine-dependent code transformations. Called just before
1699 delayed-branch scheduling. */
1700 DEFHOOK
1701 (machine_dependent_reorg,
1703 void, (void), NULL)
1705 /* Create the __builtin_va_list type. */
1706 DEFHOOK
1707 (build_builtin_va_list,
1709 tree, (void),
1710 std_build_builtin_va_list)
1712 /* Enumerate the va list variants. */
1713 DEFHOOK
1714 (enum_va_list_p,
1716 int, (int idx, const char **pname, tree *ptree),
1717 NULL)
1719 /* Get the cfun/fndecl calling abi __builtin_va_list type. */
1720 DEFHOOK
1721 (fn_abi_va_list,
1723 tree, (tree fndecl),
1724 std_fn_abi_va_list)
1726 /* Get the __builtin_va_list type dependent on input type. */
1727 DEFHOOK
1728 (canonical_va_list_type,
1730 tree, (tree type),
1731 std_canonical_va_list_type)
1733 /* ??? Documenting this hook requires a GFDL license grant. */
1734 DEFHOOK_UNDOC
1735 (expand_builtin_va_start,
1736 "Expand the @code{__builtin_va_start} builtin.",
1737 void, (tree valist, rtx nextarg), NULL)
1739 /* Gimplifies a VA_ARG_EXPR. */
1740 DEFHOOK
1741 (gimplify_va_arg_expr,
1743 tree, (tree valist, tree type, gimple_seq *pre_p, gimple_seq *post_p),
1744 std_gimplify_va_arg_expr)
1746 /* Validity-checking routines for PCH files, target-specific.
1747 get_pch_validity returns a pointer to the data to be stored,
1748 and stores the size in its argument. pch_valid_p gets the same
1749 information back and returns NULL if the PCH is valid,
1750 or an error message if not. */
1751 DEFHOOK
1752 (get_pch_validity,
1754 void *, (size_t *sz),
1755 default_get_pch_validity)
1757 DEFHOOK
1758 (pch_valid_p,
1760 const char *, (const void *data, size_t sz),
1761 default_pch_valid_p)
1763 /* If nonnull, this function checks whether a PCH file with the
1764 given set of target flags can be used. It returns NULL if so,
1765 otherwise it returns an error message. */
1766 DEFHOOK
1767 (check_pch_target_flags,
1769 const char *, (int pch_flags), NULL)
1771 /* True if the compiler should give an enum type only as many
1772 bytes as it takes to represent the range of possible values of
1773 that type. */
1774 DEFHOOK
1775 (default_short_enums,
1777 bool, (void),
1778 hook_bool_void_false)
1780 /* This target hook returns an rtx that is used to store the address
1781 of the current frame into the built-in setjmp buffer. */
1782 DEFHOOK
1783 (builtin_setjmp_frame_value,
1785 rtx, (void),
1786 default_builtin_setjmp_frame_value)
1788 /* This target hook should add STRING_CST trees for any hard regs
1789 the port wishes to automatically clobber for an asm. */
1790 DEFHOOK
1791 (md_asm_clobbers,
1793 tree, (tree outputs, tree inputs, tree clobbers),
1794 hook_tree_tree_tree_tree_3rd_identity)
1796 /* This target hook allows the backend to specify a calling convention
1797 in the debug information. This function actually returns an
1798 enum dwarf_calling_convention, but because of forward declarations
1799 and not wanting to include dwarf2.h everywhere target.h is included
1800 the function is being declared as an int. */
1801 DEFHOOK
1802 (dwarf_calling_convention,
1804 int, (const_tree function),
1805 hook_int_const_tree_0)
1807 /* This target hook allows the backend to emit frame-related insns that
1808 contain UNSPECs or UNSPEC_VOLATILEs. The call frame debugging info
1809 engine will invoke it on insns of the form
1810 (set (reg) (unspec [...] UNSPEC_INDEX))
1812 (set (reg) (unspec_volatile [...] UNSPECV_INDEX))
1813 to let the backend emit the call frame instructions. */
1814 DEFHOOK
1815 (dwarf_handle_frame_unspec,
1817 void, (const char *label, rtx pattern, int index), NULL)
1819 /* ??? Documenting this hook requires a GFDL license grant. */
1820 DEFHOOK_UNDOC
1821 (stdarg_optimize_hook,
1822 "Perform architecture specific checking of statements gimplified\
1823 from @code{VA_ARG_EXPR}. @var{stmt} is the statement. Returns true if\
1824 the statement doesn't need to be checked for @code{va_list} references.",
1825 bool, (struct stdarg_info *ai, const_gimple stmt), NULL)
1827 /* This target hook allows the operating system to override the DECL
1828 that represents the external variable that contains the stack
1829 protection guard variable. The type of this DECL is ptr_type_node. */
1830 DEFHOOK
1831 (stack_protect_guard,
1833 tree, (void),
1834 default_stack_protect_guard)
1836 /* This target hook allows the operating system to override the CALL_EXPR
1837 that is invoked when a check vs the guard variable fails. */
1838 DEFHOOK
1839 (stack_protect_fail,
1841 tree, (void),
1842 default_external_stack_protect_fail)
1844 DEFHOOK
1845 (supports_split_stack,
1846 "Whether this target supports splitting the stack when the options\
1847 described in @var{opts} have been passed. This is called\
1848 after options have been parsed, so the target may reject splitting\
1849 the stack in some configurations. The default version of this hook\
1850 returns false. If @var{report} is true, this function may issue a warning\
1851 or error; if @var{report} is false, it must simply return a value",
1852 bool, (bool report, struct gcc_options *opts),
1853 hook_bool_bool_gcc_optionsp_false)
1855 /* Returns NULL if target supports the insn within a doloop block,
1856 otherwise it returns an error message. */
1857 DEFHOOK
1858 (invalid_within_doloop,
1860 const char *, (const_rtx insn),
1861 default_invalid_within_doloop)
1863 DEFHOOK
1864 (valid_dllimport_attribute_p,
1865 "@var{decl} is a variable or function with @code{__attribute__((dllimport))}\
1866 specified. Use this hook if the target needs to add extra validation\
1867 checks to @code{handle_dll_attribute}.",
1868 bool, (const_tree decl),
1869 hook_bool_const_tree_true)
1871 /* If non-zero, align constant anchors in CSE to a multiple of this
1872 value. */
1873 DEFHOOKPOD
1874 (const_anchor,
1876 unsigned HOST_WIDE_INT, 0)
1878 /* Functions relating to calls - argument passing, returns, etc. */
1879 /* Members of struct call have no special macro prefix. */
1880 HOOK_VECTOR (TARGET_CALLS, calls)
1882 DEFHOOK
1883 (promote_function_mode,
1885 enum machine_mode, (const_tree type, enum machine_mode mode, int *punsignedp,
1886 const_tree funtype, int for_return),
1887 default_promote_function_mode)
1889 DEFHOOK
1890 (promote_prototypes,
1892 bool, (const_tree fntype),
1893 hook_bool_const_tree_false)
1895 DEFHOOK
1896 (struct_value_rtx,
1898 rtx, (tree fndecl, int incoming),
1899 hook_rtx_tree_int_null)
1900 DEFHOOK
1901 (return_in_memory,
1903 bool, (const_tree type, const_tree fntype),
1904 default_return_in_memory)
1906 DEFHOOK
1907 (return_in_msb,
1909 bool, (const_tree type),
1910 hook_bool_const_tree_false)
1912 /* Return true if a parameter must be passed by reference. TYPE may
1913 be null if this is a libcall. CA may be null if this query is
1914 from __builtin_va_arg. */
1915 DEFHOOK
1916 (pass_by_reference,
1918 bool,
1919 (CUMULATIVE_ARGS *cum, enum machine_mode mode, const_tree type, bool named),
1920 hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false)
1922 DEFHOOK
1923 (expand_builtin_saveregs,
1925 rtx, (void),
1926 default_expand_builtin_saveregs)
1928 /* Returns pretend_argument_size. */
1929 DEFHOOK
1930 (setup_incoming_varargs,
1932 void, (CUMULATIVE_ARGS *args_so_far, enum machine_mode mode, tree type,
1933 int *pretend_args_size, int second_time),
1934 default_setup_incoming_varargs)
1936 DEFHOOK
1937 (strict_argument_naming,
1939 bool, (CUMULATIVE_ARGS *ca),
1940 hook_bool_CUMULATIVE_ARGS_false)
1942 /* Returns true if we should use
1943 targetm.calls.setup_incoming_varargs() and/or
1944 targetm.calls.strict_argument_naming(). */
1945 DEFHOOK
1946 (pretend_outgoing_varargs_named,
1948 bool, (CUMULATIVE_ARGS *ca),
1949 default_pretend_outgoing_varargs_named)
1951 /* Given a complex type T, return true if a parameter of type T
1952 should be passed as two scalars. */
1953 DEFHOOK
1954 (split_complex_arg,
1956 bool, (const_tree type), NULL)
1958 /* Return true if type T, mode MODE, may not be passed in registers,
1959 but must be passed on the stack. */
1960 /* ??? This predicate should be applied strictly after pass-by-reference.
1961 Need audit to verify that this is the case. */
1962 DEFHOOK
1963 (must_pass_in_stack,
1965 bool, (enum machine_mode mode, const_tree type),
1966 must_pass_in_stack_var_size_or_pad)
1968 /* Return true if type TYPE, mode MODE, which is passed by reference,
1969 should have the object copy generated by the callee rather than
1970 the caller. It is never called for TYPE requiring constructors. */
1971 DEFHOOK
1972 (callee_copies,
1974 bool,
1975 (CUMULATIVE_ARGS *cum, enum machine_mode mode, const_tree type, bool named),
1976 hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false)
1978 /* Return zero for arguments passed entirely on the stack or entirely
1979 in registers. If passed in both, return the number of bytes passed
1980 in registers; the balance is therefore passed on the stack. */
1981 DEFHOOK
1982 (arg_partial_bytes,
1984 int, (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, bool named),
1985 hook_int_CUMULATIVE_ARGS_mode_tree_bool_0)
1987 /* Update the state in CA to advance past an argument in the
1988 argument list. The values MODE, TYPE, and NAMED describe that
1989 argument. */
1990 /* ??? tm.texi still only describes the old macro. */
1991 DEFHOOK_UNDOC
1992 (function_arg_advance,
1994 void,
1995 (CUMULATIVE_ARGS *ca, enum machine_mode mode, const_tree type, bool named),
1996 default_function_arg_advance)
1998 /* Return zero if the argument described by the state of CA should
1999 be placed on a stack, or a hard register in which to store the
2000 argument. The values MODE, TYPE, and NAMED describe that
2001 argument. */
2002 /* ??? tm.texi still only describes the old macro. */
2003 DEFHOOK_UNDOC
2004 (function_arg,
2006 rtx, (CUMULATIVE_ARGS *ca, enum machine_mode mode, const_tree type,
2007 bool named),
2008 default_function_arg)
2010 /* Likewise, but for machines with register windows. Return the
2011 location where the argument will appear to the callee. */
2012 /* ??? tm.texi still only describes the old macro. */
2013 DEFHOOK_UNDOC
2014 (function_incoming_arg,
2016 rtx, (CUMULATIVE_ARGS *ca, enum machine_mode mode, const_tree type,
2017 bool named),
2018 default_function_incoming_arg)
2020 DEFHOOK
2021 (function_arg_boundary,
2023 unsigned int, (enum machine_mode mode, const_tree type),
2024 default_function_arg_boundary)
2026 /* Return the diagnostic message string if function without a prototype
2027 is not allowed for this 'val' argument; NULL otherwise. */
2028 DEFHOOK
2029 (invalid_arg_for_unprototyped_fn,
2031 const char *, (const_tree typelist, const_tree funcdecl, const_tree val),
2032 hook_invalid_arg_for_unprototyped_fn)
2034 /* Return an rtx for the return value location of the function
2035 specified by FN_DECL_OR_TYPE with a return type of RET_TYPE. */
2036 DEFHOOK
2037 (function_value,
2039 rtx, (const_tree ret_type, const_tree fn_decl_or_type, bool outgoing),
2040 default_function_value)
2042 /* Return the rtx for the result of a libcall of mode MODE,
2043 calling the function FN_NAME. */
2044 DEFHOOK
2045 (libcall_value,
2047 rtx, (enum machine_mode mode, const_rtx fun),
2048 default_libcall_value)
2050 /* Return true if REGNO is a possible register number for
2051 a function value as seen by the caller. */
2052 DEFHOOK
2053 (function_value_regno_p,
2055 bool, (const unsigned int regno),
2056 default_function_value_regno_p)
2058 /* ??? Documenting this hook requires a GFDL license grant. */
2059 DEFHOOK_UNDOC
2060 (internal_arg_pointer,
2061 "Return an rtx for the argument pointer incoming to the\
2062 current function.",
2063 rtx, (void),
2064 default_internal_arg_pointer)
2066 /* Update the current function stack boundary if needed. */
2067 DEFHOOK
2068 (update_stack_boundary,
2070 void, (void), NULL)
2072 /* Handle stack alignment and return an rtx for Dynamic Realign
2073 Argument Pointer if necessary. */
2074 DEFHOOK
2075 (get_drap_rtx,
2077 rtx, (void), NULL)
2079 /* Return true if all function parameters should be spilled to the
2080 stack. */
2081 DEFHOOK
2082 (allocate_stack_slots_for_args,
2084 bool, (void),
2085 hook_bool_void_true)
2087 /* Return an rtx for the static chain for FNDECL. If INCOMING_P is true,
2088 then it should be for the callee; otherwise for the caller. */
2089 DEFHOOK
2090 (static_chain,
2092 rtx, (const_tree fndecl, bool incoming_p),
2093 default_static_chain)
2095 /* Fill in the trampoline at MEM with a call to FNDECL and a
2096 static chain value of CHAIN. */
2097 DEFHOOK
2098 (trampoline_init,
2100 void, (rtx m_tramp, tree fndecl, rtx static_chain),
2101 default_trampoline_init)
2103 /* Adjust the address of the trampoline in a target-specific way. */
2104 DEFHOOK
2105 (trampoline_adjust_address,
2107 rtx, (rtx addr), NULL)
2109 /* Return the number of bytes of its own arguments that a function
2110 pops on returning, or 0 if the function pops no arguments and the
2111 caller must therefore pop them all after the function returns. */
2112 /* ??? tm.texi has no types for the parameters. */
2113 DEFHOOK
2114 (return_pops_args,
2116 int, (tree fundecl, tree funtype, int size),
2117 default_return_pops_args)
2119 /* Return a mode wide enough to copy any function value that might be
2120 returned. */
2121 DEFHOOK
2122 (get_raw_result_mode,
2123 "This target hook returns the mode to be used when accessing raw return\
2124 registers in @code{__builtin_return}. Define this macro if the value\
2125 in @var{reg_raw_mode} is not correct.",
2126 enum machine_mode, (int regno),
2127 default_get_reg_raw_mode)
2129 /* Return a mode wide enough to copy any argument value that might be
2130 passed. */
2131 DEFHOOK
2132 (get_raw_arg_mode,
2133 "This target hook returns the mode to be used when accessing raw argument\
2134 registers in @code{__builtin_apply_args}. Define this macro if the value\
2135 in @var{reg_raw_mode} is not correct.",
2136 enum machine_mode, (int regno),
2137 default_get_reg_raw_mode)
2139 HOOK_VECTOR_END (calls)
2141 /* Return the diagnostic message string if conversion from FROMTYPE
2142 to TOTYPE is not allowed, NULL otherwise. */
2143 DEFHOOK
2144 (invalid_conversion,
2146 const char *, (const_tree fromtype, const_tree totype),
2147 hook_constcharptr_const_tree_const_tree_null)
2149 /* Return the diagnostic message string if the unary operation OP is
2150 not permitted on TYPE, NULL otherwise. */
2151 DEFHOOK
2152 (invalid_unary_op,
2154 const char *, (int op, const_tree type),
2155 hook_constcharptr_int_const_tree_null)
2157 /* Return the diagnostic message string if the binary operation OP
2158 is not permitted on TYPE1 and TYPE2, NULL otherwise. */
2159 DEFHOOK
2160 (invalid_binary_op,
2162 const char *, (int op, const_tree type1, const_tree type2),
2163 hook_constcharptr_int_const_tree_const_tree_null)
2165 /* Return the diagnostic message string if TYPE is not valid as a
2166 function parameter type, NULL otherwise. */
2167 DEFHOOK
2168 (invalid_parameter_type,
2170 const char *, (const_tree type),
2171 hook_constcharptr_const_tree_null)
2173 /* Return the diagnostic message string if TYPE is not valid as a
2174 function return type, NULL otherwise. */
2175 DEFHOOK
2176 (invalid_return_type,
2178 const char *, (const_tree type),
2179 hook_constcharptr_const_tree_null)
2181 /* If values of TYPE are promoted to some other type when used in
2182 expressions (analogous to the integer promotions), return that type,
2183 or NULL_TREE otherwise. */
2184 DEFHOOK
2185 (promoted_type,
2187 tree, (const_tree type),
2188 hook_tree_const_tree_null)
2190 /* Convert EXPR to TYPE, if target-specific types with special conversion
2191 rules are involved. Return the converted expression, or NULL to apply
2192 the standard conversion rules. */
2193 DEFHOOK
2194 (convert_to_type,
2196 tree, (tree type, tree expr),
2197 hook_tree_tree_tree_null)
2199 /* Return the array of IRA cover classes for the current target. */
2200 DEFHOOK
2201 (ira_cover_classes,
2203 const reg_class_t *, (void),
2204 default_ira_cover_classes)
2206 /* Return the class for a secondary reload, and fill in extra information. */
2207 DEFHOOK
2208 (secondary_reload,
2210 reg_class_t,
2211 (bool in_p, rtx x, reg_class_t reload_class, enum machine_mode reload_mode,
2212 secondary_reload_info *sri),
2213 default_secondary_reload)
2215 /* Given an rtx X being reloaded into a reg required to be in class CLASS,
2216 return the class of reg to actually use. */
2217 DEFHOOK
2218 (preferred_reload_class,
2220 reg_class_t,
2221 (rtx x, reg_class_t rclass),
2222 default_preferred_reload_class)
2224 /* Like TARGET_PREFERRED_RELOAD_CLASS, but for output reloads instead of
2225 input reloads. */
2226 DEFHOOK
2227 (preferred_output_reload_class,
2229 reg_class_t,
2230 (rtx x, reg_class_t rclass),
2231 default_preferred_output_reload_class)
2233 DEFHOOK
2234 (class_likely_spilled_p,
2236 bool, (reg_class_t rclass),
2237 default_class_likely_spilled_p)
2239 DEFHOOK
2240 (preferred_rename_class,
2241 "A target hook that places additional preference on the register\
2242 class to use when it is necessary to rename a register in class\
2243 @var{rclass} to another class, or perhaps @var{NO_REGS}, if no\
2244 preferred register class is found or hook @code{preferred_rename_class}\
2245 is not implemented.\
2246 Sometimes returning a more restrictive class makes better code. For\
2247 example, on ARM, thumb-2 instructions using @code{LO_REGS} may be\
2248 smaller than instructions using @code{GENERIC_REGS}. By returning\
2249 @code{LO_REGS} from @code{preferred_rename_class}, code size can\
2250 be reduced.",
2251 reg_class_t, (reg_class_t rclass),
2252 default_preferred_rename_class)
2254 /* This target hook allows the backend to perform additional
2255 processing while initializing for variable expansion. */
2256 DEFHOOK
2257 (expand_to_rtl_hook,
2259 void, (void),
2260 hook_void_void)
2262 /* This target hook allows the backend to perform additional
2263 instantiations on rtx that are not actually in insns yet,
2264 but will be later. */
2265 DEFHOOK
2266 (instantiate_decls,
2268 void, (void),
2269 hook_void_void)
2271 /* Return true if is OK to use a hard register REGNO as scratch register
2272 in peephole2. */
2273 DEFHOOK
2274 (hard_regno_scratch_ok,
2276 bool, (unsigned int regno),
2277 default_hard_regno_scratch_ok)
2279 /* Return the smallest number of different values for which it is best to
2280 use a jump-table instead of a tree of conditional branches. */
2281 DEFHOOK
2282 (case_values_threshold,
2284 unsigned int, (void),
2285 default_case_values_threshold)
2287 /* Retutn true if a function must have and use a frame pointer. */
2288 DEFHOOK
2289 (frame_pointer_required,
2291 bool, (void),
2292 hook_bool_void_false)
2294 /* Returns true if the compiler is allowed to try to replace register number
2295 from-reg with register number to-reg. */
2296 DEFHOOK
2297 (can_eliminate,
2299 bool, (const int from_reg, const int to_reg),
2300 hook_bool_const_int_const_int_true)
2302 /* Modify any or all of fixed_regs, call_used_regs, global_regs,
2303 reg_names, and reg_class_contents to account of the vagaries of the
2304 target. */
2305 DEFHOOK
2306 (conditional_register_usage,
2308 void, (void),
2309 hook_void_void)
2311 /* Functions specific to the C family of frontends. */
2312 #undef HOOK_PREFIX
2313 #define HOOK_PREFIX "TARGET_C_"
2314 HOOK_VECTOR (TARGET_C, c)
2316 /* ??? Documenting this hook requires a GFDL license grant. */
2317 DEFHOOK_UNDOC
2318 (mode_for_suffix,
2319 "Return machine mode for non-standard constant literal suffix @var{c},\
2320 or VOIDmode if non-standard suffixes are unsupported.",
2321 enum machine_mode, (char c),
2322 default_mode_for_suffix)
2324 HOOK_VECTOR_END (c)
2326 /* Functions specific to the C++ frontend. */
2327 #undef HOOK_PREFIX
2328 #define HOOK_PREFIX "TARGET_CXX_"
2329 HOOK_VECTOR (TARGET_CXX, cxx)
2331 /* Return the integer type used for guard variables. */
2332 DEFHOOK
2333 (guard_type,
2335 tree, (void),
2336 default_cxx_guard_type)
2338 /* Return true if only the low bit of the guard should be tested. */
2339 DEFHOOK
2340 (guard_mask_bit,
2342 bool, (void),
2343 hook_bool_void_false)
2345 /* Returns the size of the array cookie for an array of type. */
2346 DEFHOOK
2347 (get_cookie_size,
2349 tree, (tree type),
2350 default_cxx_get_cookie_size)
2352 /* Returns true if the element size should be stored in the array cookie. */
2353 DEFHOOK
2354 (cookie_has_size,
2356 bool, (void),
2357 hook_bool_void_false)
2359 /* Allows backends to perform additional processing when
2360 deciding if a class should be exported or imported. */
2361 DEFHOOK
2362 (import_export_class,
2364 int, (tree type, int import_export), NULL)
2366 /* Returns true if constructors and destructors return "this". */
2367 DEFHOOK
2368 (cdtor_returns_this,
2370 bool, (void),
2371 hook_bool_void_false)
2373 /* Returns true if the key method for a class can be an inline
2374 function, so long as it is not declared inline in the class
2375 itself. Returning true is the behavior required by the Itanium C++ ABI. */
2376 DEFHOOK
2377 (key_method_may_be_inline,
2379 bool, (void),
2380 hook_bool_void_true)
2382 DEFHOOK
2383 (determine_class_data_visibility,
2384 "@var{decl} is a virtual table, virtual table table, typeinfo object,\
2385 or other similar implicit class data object that will be emitted with\
2386 external linkage in this translation unit. No ELF visibility has been\
2387 explicitly specified. If the target needs to specify a visibility\
2388 other than that of the containing class, use this hook to set\
2389 @code{DECL_VISIBILITY} and @code{DECL_VISIBILITY_SPECIFIED}.",
2390 void, (tree decl),
2391 hook_void_tree)
2393 /* Returns true (the default) if virtual tables and other
2394 similar implicit class data objects are always COMDAT if they
2395 have external linkage. If this hook returns false, then
2396 class data for classes whose virtual table will be emitted in
2397 only one translation unit will not be COMDAT. */
2398 DEFHOOK
2399 (class_data_always_comdat,
2401 bool, (void),
2402 hook_bool_void_true)
2404 /* Returns true (the default) if the RTTI for the basic types,
2405 which is always defined in the C++ runtime, should be COMDAT;
2406 false if it should not be COMDAT. */
2407 DEFHOOK
2408 (library_rtti_comdat,
2410 bool, (void),
2411 hook_bool_void_true)
2413 /* Returns true if __aeabi_atexit should be used to register static
2414 destructors. */
2415 DEFHOOK
2416 (use_aeabi_atexit,
2418 bool, (void),
2419 hook_bool_void_false)
2421 /* Returns true if target may use atexit in the same manner as
2422 __cxa_atexit to register static destructors. */
2423 DEFHOOK
2424 (use_atexit_for_cxa_atexit,
2426 bool, (void),
2427 hook_bool_void_false)
2429 DEFHOOK
2430 (adjust_class_at_definition,
2431 "@var{type} is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that has just\
2432 been defined. Use this hook to make adjustments to the class (eg, tweak\
2433 visibility or perform any other required target modifications).",
2434 void, (tree type),
2435 hook_void_tree)
2437 HOOK_VECTOR_END (cxx)
2439 /* Functions and data for emulated TLS support. */
2440 #undef HOOK_PREFIX
2441 #define HOOK_PREFIX "TARGET_EMUTLS_"
2442 HOOK_VECTOR (TARGET_EMUTLS, emutls)
2444 /* Name of the address and common functions. */
2445 DEFHOOKPOD
2446 (get_address,
2448 const char *, "__builtin___emutls_get_address")
2450 DEFHOOKPOD
2451 (register_common,
2453 const char *, "__builtin___emutls_register_common")
2455 /* Prefixes for proxy variable and template. */
2456 DEFHOOKPOD
2457 (var_section,
2459 const char *, NULL)
2461 DEFHOOKPOD
2462 (tmpl_section,
2464 const char *, NULL)
2466 /* Prefixes for proxy variable and template. */
2467 DEFHOOKPOD
2468 (var_prefix,
2470 const char *, NULL)
2472 DEFHOOKPOD
2473 (tmpl_prefix,
2475 const char *, NULL)
2477 /* Function to generate field definitions of the proxy variable. */
2478 DEFHOOK
2479 (var_fields,
2481 tree, (tree type, tree *name),
2482 default_emutls_var_fields)
2484 /* Function to initialize a proxy variable. */
2485 DEFHOOK
2486 (var_init,
2488 tree, (tree var, tree decl, tree tmpl_addr),
2489 default_emutls_var_init)
2491 /* Whether we are allowed to alter the usual alignment of the
2492 proxy variable. */
2493 DEFHOOKPOD
2494 (var_align_fixed,
2496 bool, false)
2498 /* Whether we can emit debug information for TLS vars. */
2499 DEFHOOKPOD
2500 (debug_form_tls_address,
2502 bool, false)
2504 HOOK_VECTOR_END (emutls)
2506 #undef HOOK_PREFIX
2507 #define HOOK_PREFIX "TARGET_OPTION_"
2508 HOOK_VECTOR (TARGET_OPTION_HOOKS, target_option_hooks)
2510 /* Function to validate the attribute((option(...))) strings or NULL. If
2511 the option is validated, it is assumed that DECL_FUNCTION_SPECIFIC will
2512 be filled in in the function decl node. */
2513 DEFHOOK
2514 (valid_attribute_p,
2516 bool, (tree fndecl, tree name, tree args, int flags),
2517 default_target_option_valid_attribute_p)
2519 /* Function to save any extra target state in the target options structure. */
2520 DEFHOOK
2521 (save,
2523 void, (struct cl_target_option *ptr), NULL)
2525 /* Function to restore any extra target state from the target options
2526 structure. */
2527 DEFHOOK
2528 (restore,
2530 void, (struct cl_target_option *ptr), NULL)
2532 /* Function to print any extra target state from the target options
2533 structure. */
2534 DEFHOOK
2535 (print,
2537 void, (FILE *file, int indent, struct cl_target_option *ptr), NULL)
2539 /* Function to parse arguments to be validated for #pragma option, and to
2540 change the state if the options are valid. If the first argument is
2541 NULL, the second argument specifies the default options to use. Return
2542 true if the options are valid, and set the current state. */
2543 /* ??? The documentation in tm.texi is incomplete. */
2544 DEFHOOK
2545 (pragma_parse,
2547 bool, (tree args, tree pop_target),
2548 default_target_option_pragma_parse)
2550 /* Do option overrides for the target. */
2551 DEFHOOK
2552 (override,
2554 void, (void),
2555 hook_void_void)
2557 /* Set default optimizations for the target. */
2558 DEFHOOKPOD
2559 (optimization_table,
2561 const struct default_options *, empty_optimization_table)
2563 DEFHOOK
2564 (default_params,
2565 "Set target-dependent default values for @option{--param} settings, using\
2566 calls to @code{set_default_param_value}.",
2567 void, (void),
2568 hook_void_void)
2570 DEFHOOK
2571 (init_struct,
2572 "Set target-dependent initial values of fields in @var{opts}.",
2573 void, (struct gcc_options *opts),
2574 hook_void_gcc_optionsp)
2576 /* Function to determine if one function can inline another function. */
2577 #undef HOOK_PREFIX
2578 #define HOOK_PREFIX "TARGET_"
2579 DEFHOOK
2580 (can_inline_p,
2582 bool, (tree caller, tree callee),
2583 default_target_can_inline_p)
2585 HOOK_VECTOR_END (target_option)
2587 /* For targets that need to mark extra registers as live on entry to
2588 the function, they should define this target hook and set their
2589 bits in the bitmap passed in. */
2590 DEFHOOK
2591 (extra_live_on_entry,
2593 void, (bitmap regs),
2594 hook_void_bitmap)
2596 /* Determine the type of unwind info to emit for debugging. */
2597 DEFHOOK
2598 (debug_unwind_info,
2600 enum unwind_info_type, (void),
2601 default_debug_unwind_info)
2603 /* Determine the type of unwind info to emit for exceptions. */
2604 DEFHOOK
2605 (except_unwind_info,
2607 enum unwind_info_type, (struct gcc_options *opts),
2608 default_except_unwind_info)
2610 /* Leave the boolean fields at the end. */
2612 /* True if unwinding tables should be generated by default. */
2613 DEFHOOKPOD
2614 (unwind_tables_default,
2616 bool, false)
2618 /* True if arbitrary sections are supported. */
2619 DEFHOOKPOD
2620 (have_named_sections,
2622 bool, false)
2624 /* True if we can create zeroed data by switching to a BSS section
2625 and then using ASM_OUTPUT_SKIP to allocate the space. */
2626 DEFHOOKPOD
2627 (have_switchable_bss_sections,
2629 bool, false)
2631 /* True if "native" constructors and destructors are supported,
2632 false if we're using collect2 for the job. */
2633 DEFHOOKPOD
2634 (have_ctors_dtors,
2636 bool, false)
2638 /* True if thread-local storage is supported. */
2639 DEFHOOKPOD
2640 (have_tls,
2642 bool, false)
2644 /* True if a small readonly data section is supported. */
2645 DEFHOOKPOD
2646 (have_srodata_section,
2648 bool, false)
2650 /* True if EH frame info sections should be zero-terminated. */
2651 DEFHOOKPOD
2652 (terminate_dw2_eh_frame_info,
2654 bool, true)
2656 /* True if #NO_APP should be emitted at the beginning of assembly output. */
2657 DEFHOOKPOD
2658 (asm_file_start_app_off,
2660 bool, false)
2662 /* True if output_file_directive should be called for main_input_filename
2663 at the beginning of assembly output. */
2664 DEFHOOKPOD
2665 (asm_file_start_file_directive,
2667 bool, false)
2669 DEFHOOKPOD
2670 (handle_pragma_extern_prefix,
2671 "True if @code{#pragma extern_prefix} is to be supported.",
2672 bool, 0)
2674 /* True if the target is allowed to reorder memory accesses unless
2675 synchronization is explicitly requested. */
2676 DEFHOOKPOD
2677 (relaxed_ordering,
2679 bool, false)
2681 /* Returns true if we should generate exception tables for use with the
2682 ARM EABI. The effects the encoding of function exception specifications. */
2683 DEFHOOKPOD
2684 (arm_eabi_unwinder,
2686 bool, false)
2688 DEFHOOKPOD
2689 (want_debug_pub_sections,
2690 "True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections\
2691 should be emitted. These sections are not used on most platforms, and\
2692 in particular GDB does not use them.",
2693 bool, false)
2695 /* Leave the boolean fields at the end. */
2697 /* Empty macro arguments are undefined in C90, so use an empty macro. */
2698 #define C90_EMPTY_HACK
2699 /* Close the 'struct gcc_target' definition. */
2700 HOOK_VECTOR_END (C90_EMPTY_HACK)
2702 HOOK_VECTOR (TARGETCM_INITIALIZER, gcc_targetcm)
2704 /* Handle target switch CODE (an OPT_* value). ARG is the argument
2705 passed to the switch; it is NULL if no argument was. VALUE is the
2706 value of ARG if CODE specifies a UInteger option, otherwise it is
2707 1 if the positive form of the switch was used and 0 if the negative
2708 form was. Return true if the switch was valid. */
2709 DEFHOOK
2710 (handle_c_option,
2712 bool, (size_t code, const char *arg, int value),
2713 default_handle_c_option)
2715 /* Targets may provide a string object type that can be used within
2716 and between C, C++, and Objective-C dialects. */
2718 DEFHOOK
2719 (objc_construct_string_object,
2720 "Targets may provide a string object type that can be used within\
2721 and between C, C++ and their respective Objective-C dialects.\
2722 A string object might, for example, embed encoding and length information.\
2723 These objects are considered opaque to the compiler and handled as references.\
2724 An ideal implementation makes the composition of the string object\
2725 match that of the Objective-C @code{NSString} (@code{NXString} for GNUStep),\
2726 allowing efficient interworking between C-only and Objective-C code.\
2727 If a target implements string objects then this hook should return a\
2728 reference to such an object constructed from the normal `C' string\
2729 representation provided in @var{string}.\
2730 At present, the hook is used by Objective-C only, to obtain a\
2731 common-format string object when the target provides one.",
2732 tree, (tree string),
2733 NULL)
2735 DEFHOOK
2736 (string_object_ref_type_p,
2737 "If a target implements string objects then this hook should return\
2738 @code{true} if @var{stringref} is a valid reference to such an object.",
2739 bool, (const_tree stringref),
2740 hook_bool_const_tree_false)
2742 DEFHOOK
2743 (check_string_object_format_arg,
2744 "If a target implements string objects then this hook should should\
2745 provide a facility to check the function arguments in @var{args_list}\
2746 against the format specifiers in @var{format_arg} where the type of\
2747 @var{format_arg} is one recognized as a valid string reference type.",
2748 void, (tree format_arg, tree args_list),
2749 NULL)
2751 HOOK_VECTOR_END (C90_EMPTY_HACK)