forked from riscvarchive/riscv-gcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtarget.def
6849 lines (6335 loc) · 304 KB
/
target.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Target hook definitions.
Copyright (C) 2001-2020 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
/* See target-hooks-macros.h for details of macros that should be
provided by the including file, and how to use them here. */
#include "target-hooks-macros.h"
#undef HOOK_TYPE
#define HOOK_TYPE "Target Hook"
HOOK_VECTOR (TARGET_INITIALIZER, gcc_target)
/* Functions that output assembler for the target. */
#define HOOK_PREFIX "TARGET_ASM_"
HOOK_VECTOR (TARGET_ASM_OUT, asm_out)
/* Opening and closing parentheses for asm expression grouping. */
DEFHOOKPOD
(open_paren,
"These target hooks are C string constants, describing the syntax in the\n\
assembler for grouping arithmetic expressions. If not overridden, they\n\
default to normal parentheses, which is correct for most assemblers.",
const char *, "(")
DEFHOOKPODX (close_paren, const char *, ")")
/* Assembler instructions for creating various kinds of integer object. */
DEFHOOKPOD
(byte_op,
"@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_HI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PSI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PDI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PTI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_TI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_HI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PSI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PDI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PTI_OP\n\
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_TI_OP\n\
These hooks specify assembly directives for creating certain kinds\n\
of integer object. The @code{TARGET_ASM_BYTE_OP} directive creates a\n\
byte-sized object, the @code{TARGET_ASM_ALIGNED_HI_OP} one creates an\n\
aligned two-byte object, and so on. Any of the hooks may be\n\
@code{NULL}, indicating that no suitable directive is available.\n\
\n\
The compiler will print these strings at the start of a new line,\n\
followed immediately by the object's initial value. In most cases,\n\
the string should contain a tab, a pseudo-op, and then another tab.",
const char *, "\t.byte\t")
DEFHOOKPOD (aligned_op, "*", struct asm_int_op, TARGET_ASM_ALIGNED_INT_OP)
DEFHOOKPOD (unaligned_op, "*", struct asm_int_op, TARGET_ASM_UNALIGNED_INT_OP)
/* Try to output the assembler code for an integer object whose
value is given by X. SIZE is the size of the object in bytes and
ALIGNED_P indicates whether it is aligned. Return true if
successful. Only handles cases for which BYTE_OP, ALIGNED_OP
and UNALIGNED_OP are NULL. */
DEFHOOK
(integer,
"The @code{assemble_integer} function uses this hook to output an\n\
integer object. @var{x} is the object's value, @var{size} is its size\n\
in bytes and @var{aligned_p} indicates whether it is aligned. The\n\
function should return @code{true} if it was able to output the\n\
object. If it returns false, @code{assemble_integer} will try to\n\
split the object into smaller parts.\n\
\n\
The default implementation of this hook will use the\n\
@code{TARGET_ASM_BYTE_OP} family of strings, returning @code{false}\n\
when the relevant string is @code{NULL}.",
/* Only handles cases for which BYTE_OP, ALIGNED_OP and UNALIGNED_OP are
NULL. */
bool, (rtx x, unsigned int size, int aligned_p),
default_assemble_integer)
/* Assembly strings required after the .cfi_startproc label. */
DEFHOOK
(post_cfi_startproc,
"This target hook is used to emit assembly strings required by the target\n\
after the .cfi_startproc directive. The first argument is the file stream to\n\
write the strings to and the second argument is the function\'s declaration. The\n\
expected use is to add more .cfi_* directives.\n\
\n\
The default is to not output any assembly strings.",
void, (FILE *, tree),
hook_void_FILEptr_tree)
/* Notify the backend that we have completed emitting the data for a
decl. */
DEFHOOK
(decl_end,
"Define this hook if the target assembler requires a special marker to\n\
terminate an initialized variable declaration.",
void, (void),
hook_void_void)
/* Output code that will globalize a label. */
DEFHOOK
(globalize_label,
"This target hook is a function to output to the stdio stream\n\
@var{stream} some commands that will make the label @var{name} global;\n\
that is, available for reference from other files.\n\
\n\
The default implementation relies on a proper definition of\n\
@code{GLOBAL_ASM_OP}.",
void, (FILE *stream, const char *name),
default_globalize_label)
/* Output code that will globalize a declaration. */
DEFHOOK
(globalize_decl_name,
"This target hook is a function to output to the stdio stream\n\
@var{stream} some commands that will make the name associated with @var{decl}\n\
global; that is, available for reference from other files.\n\
\n\
The default implementation uses the TARGET_ASM_GLOBALIZE_LABEL target hook.",
void, (FILE *stream, tree decl), default_globalize_decl_name)
/* Output code that will declare an external variable. */
DEFHOOK
(assemble_undefined_decl,
"This target hook is a function to output to the stdio stream\n\
@var{stream} some commands that will declare the name associated with\n\
@var{decl} which is not defined in the current translation unit. Most\n\
assemblers do not require anything to be output in this case.",
void, (FILE *stream, const char *name, const_tree decl),
hook_void_FILEptr_constcharptr_const_tree)
/* Output code that will emit a label for unwind info, if this
target requires such labels. Second argument is the decl the
unwind info is associated with, third is a boolean: true if
this is for exception handling, fourth is a boolean: true if
this is only a placeholder for an omitted FDE. */
DEFHOOK
(emit_unwind_label,
"This target hook emits a label at the beginning of each FDE@. It\n\
should be defined on targets where FDEs need special labels, and it\n\
should write the appropriate label, for the FDE associated with the\n\
function declaration @var{decl}, to the stdio stream @var{stream}.\n\
The third argument, @var{for_eh}, is a boolean: true if this is for an\n\
exception table. The fourth argument, @var{empty}, is a boolean:\n\
true if this is a placeholder label for an omitted FDE@.\n\
\n\
The default is that FDEs are not given nonlocal labels.",
void, (FILE *stream, tree decl, int for_eh, int empty),
default_emit_unwind_label)
/* Output code that will emit a label to divide up the exception table. */
DEFHOOK
(emit_except_table_label,
"This target hook emits a label at the beginning of the exception table.\n\
It should be defined on targets where it is desirable for the table\n\
to be broken up according to function.\n\
\n\
The default is that no label is emitted.",
void, (FILE *stream),
default_emit_except_table_label)
/* Emit a directive for setting the personality for the function. */
DEFHOOK
(emit_except_personality,
"If the target implements @code{TARGET_ASM_UNWIND_EMIT}, this hook may be\
used to emit a directive to install a personality hook into the unwind\
info. This hook should not be used if dwarf2 unwind info is used.",
void, (rtx personality),
NULL)
/* Emit any directives required to unwind this instruction. */
DEFHOOK
(unwind_emit,
"This target hook emits assembly directives required to unwind the\n\
given instruction. This is only used when @code{TARGET_EXCEPT_UNWIND_INFO}\n\
returns @code{UI_TARGET}.",
void, (FILE *stream, rtx_insn *insn),
NULL)
DEFHOOKPOD
(unwind_emit_before_insn,
"True if the @code{TARGET_ASM_UNWIND_EMIT} hook should be called before\
the assembly for @var{insn} has been emitted, false if the hook should\
be called afterward.",
bool, true)
/* Generate an internal label.
For now this is just a wrapper for ASM_GENERATE_INTERNAL_LABEL. */
DEFHOOK_UNDOC
(generate_internal_label,
"",
void, (char *buf, const char *prefix, unsigned long labelno),
default_generate_internal_label)
/* Output an internal label. */
DEFHOOK
(internal_label,
"A function to output to the stdio stream @var{stream} a label whose\n\
name is made from the string @var{prefix} and the number @var{labelno}.\n\
\n\
It is absolutely essential that these labels be distinct from the labels\n\
used for user-level functions and variables. Otherwise, certain programs\n\
will have name conflicts with internal labels.\n\
\n\
It is desirable to exclude internal labels from the symbol table of the\n\
object file. Most assemblers have a naming convention for labels that\n\
should be excluded; on many systems, the letter @samp{L} at the\n\
beginning of a label has this effect. You should find out what\n\
convention your system uses, and follow it.\n\
\n\
The default version of this function utilizes @code{ASM_GENERATE_INTERNAL_LABEL}.",
void, (FILE *stream, const char *prefix, unsigned long labelno),
default_internal_label)
/* Output label for the constant. */
DEFHOOK
(declare_constant_name,
"A target hook to output to the stdio stream @var{file} any text necessary\n\
for declaring the name @var{name} of a constant which is being defined. This\n\
target hook is responsible for outputting the label definition (perhaps using\n\
@code{assemble_label}). The argument @var{exp} is the value of the constant,\n\
and @var{size} is the size of the constant in bytes. The @var{name}\n\
will be an internal label.\n\
\n\
The default version of this target hook, define the @var{name} in the\n\
usual manner as a label (by means of @code{assemble_label}).\n\
\n\
You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in this target hook.",
void, (FILE *file, const char *name, const_tree expr, HOST_WIDE_INT size),
default_asm_declare_constant_name)
/* Emit a ttype table reference to a typeinfo object. */
DEFHOOK
(ttype,
"This hook is used to output a reference from a frame unwinding table to\n\
the type_info object identified by @var{sym}. It should return @code{true}\n\
if the reference was output. Returning @code{false} will cause the\n\
reference to be output using the normal Dwarf2 routines.",
bool, (rtx sym),
hook_bool_rtx_false)
/* Emit an assembler directive to set visibility for the symbol
associated with the tree decl. */
DEFHOOK
(assemble_visibility,
"This target hook is a function to output to @var{asm_out_file} some\n\
commands that will make the symbol(s) associated with @var{decl} have\n\
hidden, protected or internal visibility as specified by @var{visibility}.",
void, (tree decl, int visibility),
default_assemble_visibility)
DEFHOOK
(print_patchable_function_entry,
"Generate a patchable area at the function start, consisting of\n\
@var{patch_area_size} NOP instructions. If the target supports named\n\
sections and if @var{record_p} is true, insert a pointer to the current\n\
location in the table of patchable functions. The default implementation\n\
of the hook places the table of pointers in the special section named\n\
@code{__patchable_function_entries}.",
void, (FILE *file, unsigned HOST_WIDE_INT patch_area_size, bool record_p),
default_print_patchable_function_entry)
/* Output the assembler code for entry to a function. */
DEFHOOK
(function_prologue,
"If defined, a function that outputs the assembler code for entry to a\n\
function. The prologue is responsible for setting up the stack frame,\n\
initializing the frame pointer register, saving registers that must be\n\
saved, and allocating @var{size} additional bytes of storage for the\n\
local variables. @var{file} is a stdio stream to which the assembler\n\
code should be output.\n\
\n\
The label for the beginning of the function need not be output by this\n\
macro. That has already been done when the macro is run.\n\
\n\
@findex regs_ever_live\n\
To determine which registers to save, the macro can refer to the array\n\
@code{regs_ever_live}: element @var{r} is nonzero if hard register\n\
@var{r} is used anywhere within the function. This implies the function\n\
prologue should save register @var{r}, provided it is not one of the\n\
call-used registers. (@code{TARGET_ASM_FUNCTION_EPILOGUE} must likewise use\n\
@code{regs_ever_live}.)\n\
\n\
On machines that have ``register windows'', the function entry code does\n\
not save on the stack the registers that are in the windows, even if\n\
they are supposed to be preserved by function calls; instead it takes\n\
appropriate steps to ``push'' the register stack, if any non-call-used\n\
registers are used in the function.\n\
\n\
@findex frame_pointer_needed\n\
On machines where functions may or may not have frame-pointers, the\n\
function entry code must vary accordingly; it must set up the frame\n\
pointer if one is wanted, and not otherwise. To determine whether a\n\
frame pointer is in wanted, the macro can refer to the variable\n\
@code{frame_pointer_needed}. The variable's value will be 1 at run\n\
time in a function that needs a frame pointer. @xref{Elimination}.\n\
\n\
The function entry code is responsible for allocating any stack space\n\
required for the function. This stack space consists of the regions\n\
listed below. In most cases, these regions are allocated in the\n\
order listed, with the last listed region closest to the top of the\n\
stack (the lowest address if @code{STACK_GROWS_DOWNWARD} is defined, and\n\
the highest address if it is not defined). You can use a different order\n\
for a machine if doing so is more convenient or required for\n\
compatibility reasons. Except in cases where required by standard\n\
or by a debugger, there is no reason why the stack layout used by GCC\n\
need agree with that used by other compilers for a machine.",
void, (FILE *file),
default_function_pro_epilogue)
/* Output the assembler code for end of prologue. */
DEFHOOK
(function_end_prologue,
"If defined, a function that outputs assembler code at the end of a\n\
prologue. This should be used when the function prologue is being\n\
emitted as RTL, and you have some extra assembler that needs to be\n\
emitted. @xref{prologue instruction pattern}.",
void, (FILE *file),
no_asm_to_stream)
/* Output the assembler code for start of epilogue. */
DEFHOOK
(function_begin_epilogue,
"If defined, a function that outputs assembler code at the start of an\n\
epilogue. This should be used when the function epilogue is being\n\
emitted as RTL, and you have some extra assembler that needs to be\n\
emitted. @xref{epilogue instruction pattern}.",
void, (FILE *file),
no_asm_to_stream)
/* Output the assembler code for function exit. */
DEFHOOK
(function_epilogue,
"If defined, a function that outputs the assembler code for exit from a\n\
function. The epilogue is responsible for restoring the saved\n\
registers and stack pointer to their values when the function was\n\
called, and returning control to the caller. This macro takes the\n\
same argument as the macro @code{TARGET_ASM_FUNCTION_PROLOGUE}, and the\n\
registers to restore are determined from @code{regs_ever_live} and\n\
@code{CALL_USED_REGISTERS} in the same way.\n\
\n\
On some machines, there is a single instruction that does all the work\n\
of returning from the function. On these machines, give that\n\
instruction the name @samp{return} and do not define the macro\n\
@code{TARGET_ASM_FUNCTION_EPILOGUE} at all.\n\
\n\
Do not define a pattern named @samp{return} if you want the\n\
@code{TARGET_ASM_FUNCTION_EPILOGUE} to be used. If you want the target\n\
switches to control whether return instructions or epilogues are used,\n\
define a @samp{return} pattern with a validity condition that tests the\n\
target switches appropriately. If the @samp{return} pattern's validity\n\
condition is false, epilogues will be used.\n\
\n\
On machines where functions may or may not have frame-pointers, the\n\
function exit code must vary accordingly. Sometimes the code for these\n\
two cases is completely different. To determine whether a frame pointer\n\
is wanted, the macro can refer to the variable\n\
@code{frame_pointer_needed}. The variable's value will be 1 when compiling\n\
a function that needs a frame pointer.\n\
\n\
Normally, @code{TARGET_ASM_FUNCTION_PROLOGUE} and\n\
@code{TARGET_ASM_FUNCTION_EPILOGUE} must treat leaf functions specially.\n\
The C variable @code{current_function_is_leaf} is nonzero for such a\n\
function. @xref{Leaf Functions}.\n\
\n\
On some machines, some functions pop their arguments on exit while\n\
others leave that for the caller to do. For example, the 68020 when\n\
given @option{-mrtd} pops arguments in functions that take a fixed\n\
number of arguments.\n\
\n\
@findex pops_args\n\
@findex crtl->args.pops_args\n\
Your definition of the macro @code{RETURN_POPS_ARGS} decides which\n\
functions pop their own arguments. @code{TARGET_ASM_FUNCTION_EPILOGUE}\n\
needs to know what was decided. The number of bytes of the current\n\
function's arguments that this function should pop is available in\n\
@code{crtl->args.pops_args}. @xref{Scalar Return}.",
void, (FILE *file),
default_function_pro_epilogue)
/* Initialize target-specific sections. */
DEFHOOK
(init_sections,
"Define this hook if you need to do something special to set up the\n\
@file{varasm.c} sections, or if your target has some special sections\n\
of its own that you need to create.\n\
\n\
GCC calls this hook after processing the command line, but before writing\n\
any assembly code, and before calling any of the section-returning hooks\n\
described below.",
void, (void),
hook_void_void)
/* Tell assembler to change to section NAME with attributes FLAGS.
If DECL is non-NULL, it is the VAR_DECL or FUNCTION_DECL with
which this section is associated. */
DEFHOOK
(named_section,
"Output assembly directives to switch to section @var{name}. The section\n\
should have attributes as specified by @var{flags}, which is a bit mask\n\
of the @code{SECTION_*} flags defined in @file{output.h}. If @var{decl}\n\
is non-NULL, it is the @code{VAR_DECL} or @code{FUNCTION_DECL} with which\n\
this section is associated.",
void, (const char *name, unsigned int flags, tree decl),
default_no_named_section)
/* Tell assembler what section attributes to assign this elf section
declaration, using their numerical value. */
DEFHOOK
(elf_flags_numeric,
"This hook can be used to encode ELF section flags for which no letter\n\
code has been defined in the assembler. It is called by\n\
@code{default_asm_named_section} whenever the section flags need to be\n\
emitted in the assembler output. If the hook returns true, then the\n\
numerical value for ELF section flags should be calculated from\n\
@var{flags} and saved in @var{*num}; the value is printed out instead of the\n\
normal sequence of letter codes. If the hook is not defined, or if it\n\
returns false, then @var{num} is ignored and the traditional letter sequence\n\
is emitted.",
bool, (unsigned int flags, unsigned int *num),
hook_bool_uint_uintp_false)
/* Return preferred text (sub)section for function DECL.
Main purpose of this function is to separate cold, normal and hot
functions. STARTUP is true when function is known to be used only
at startup (from static constructors or it is main()).
EXIT is true when function is known to be used only at exit
(from static destructors).
Return NULL if function should go to default text section. */
DEFHOOK
(function_section,
"Return preferred text (sub)section for function @var{decl}.\n\
Main purpose of this function is to separate cold, normal and hot\n\
functions. @var{startup} is true when function is known to be used only\n\
at startup (from static constructors or it is @code{main()}).\n\
@var{exit} is true when function is known to be used only at exit\n\
(from static destructors).\n\
Return NULL if function should go to default text section.",
section *, (tree decl, enum node_frequency freq, bool startup, bool exit),
default_function_section)
/* Output the assembler code for function exit. */
DEFHOOK
(function_switched_text_sections,
"Used by the target to emit any assembler directives or additional\
labels needed when a function is partitioned between different\
sections. Output should be written to @var{file}. The function\
decl is available as @var{decl} and the new section is `cold' if\
@var{new_is_cold} is @code{true}.",
void, (FILE *file, tree decl, bool new_is_cold),
default_function_switched_text_sections)
/* Return a mask describing how relocations should be treated when
selecting sections. Bit 1 should be set if global relocations
should be placed in a read-write section; bit 0 should be set if
local relocations should be placed in a read-write section. */
DEFHOOK
(reloc_rw_mask,
"Return a mask describing how relocations should be treated when\n\
selecting sections. Bit 1 should be set if global relocations\n\
should be placed in a read-write section; bit 0 should be set if\n\
local relocations should be placed in a read-write section.\n\
\n\
The default version of this function returns 3 when @option{-fpic}\n\
is in effect, and 0 otherwise. The hook is typically redefined\n\
when the target cannot support (some kinds of) dynamic relocations\n\
in read-only sections even in executables.",
int, (void),
default_reloc_rw_mask)
/* Return a flag for either generating ADDR_DIF_VEC table
or ADDR_VEC table for jumps in case of -fPIC/-fPIE. */
DEFHOOK
(generate_pic_addr_diff_vec,
"Return true to generate ADDR_DIF_VEC table\n\
or false to generate ADDR_VEC table for jumps in case of -fPIC.\n\
\n\
The default version of this function returns true if flag_pic\n\
equals true and false otherwise",
bool, (void),
default_generate_pic_addr_diff_vec)
/* Return a section for EXP. It may be a DECL or a constant. RELOC
is nonzero if runtime relocations must be applied; bit 1 will be
set if the runtime relocations require non-local name resolution.
ALIGN is the required alignment of the data. */
DEFHOOK
(select_section,
"Return the section into which @var{exp} should be placed. You can\n\
assume that @var{exp} is either a @code{VAR_DECL} node or a constant of\n\
some sort. @var{reloc} indicates whether the initial value of @var{exp}\n\
requires link-time relocations. Bit 0 is set when variable contains\n\
local relocations only, while bit 1 is set for global relocations.\n\
@var{align} is the constant alignment in bits.\n\
\n\
The default version of this function takes care of putting read-only\n\
variables in @code{readonly_data_section}.\n\
\n\
See also @var{USE_SELECT_SECTION_FOR_FUNCTIONS}.",
section *, (tree exp, int reloc, unsigned HOST_WIDE_INT align),
default_select_section)
/* Return a section for X. MODE is X's mode and ALIGN is its
alignment in bits. */
DEFHOOK
(select_rtx_section,
"Return the section into which a constant @var{x}, of mode @var{mode},\n\
should be placed. You can assume that @var{x} is some kind of\n\
constant in RTL@. The argument @var{mode} is redundant except in the\n\
case of a @code{const_int} rtx. @var{align} is the constant alignment\n\
in bits.\n\
\n\
The default version of this function takes care of putting symbolic\n\
constants in @code{flag_pic} mode in @code{data_section} and everything\n\
else in @code{readonly_data_section}.",
section *, (machine_mode mode, rtx x, unsigned HOST_WIDE_INT align),
default_select_rtx_section)
/* Select a unique section name for DECL. RELOC is the same as
for SELECT_SECTION. */
DEFHOOK
(unique_section,
"Build up a unique section name, expressed as a @code{STRING_CST} node,\n\
and assign it to @samp{DECL_SECTION_NAME (@var{decl})}.\n\
As with @code{TARGET_ASM_SELECT_SECTION}, @var{reloc} indicates whether\n\
the initial value of @var{exp} requires link-time relocations.\n\
\n\
The default version of this function appends the symbol name to the\n\
ELF section name that would normally be used for the symbol. For\n\
example, the function @code{foo} would be placed in @code{.text.foo}.\n\
Whatever the actual target object format, this is often good enough.",
void, (tree decl, int reloc),
default_unique_section)
/* Return the readonly data section associated with function DECL. */
DEFHOOK
(function_rodata_section,
"Return the readonly data section associated with\n\
@samp{DECL_SECTION_NAME (@var{decl})}.\n\
The default version of this function selects @code{.gnu.linkonce.r.name} if\n\
the function's section is @code{.gnu.linkonce.t.name}, @code{.rodata.name}\n\
if function is in @code{.text.name}, and the normal readonly-data section\n\
otherwise.",
section *, (tree decl),
default_function_rodata_section)
/* Nonnull if the target wants to override the default ".rodata" prefix
for mergeable data sections. */
DEFHOOKPOD
(mergeable_rodata_prefix,
"Usually, the compiler uses the prefix @code{\".rodata\"} to construct\n\
section names for mergeable constant data. Define this macro to override\n\
the string if a different section name should be used.",
const char *, ".rodata")
/* Return the section to be used for transactional memory clone tables. */
DEFHOOK
(tm_clone_table_section,
"Return the section that should be used for transactional memory clone\
tables.",
section *, (void), default_clone_table_section)
/* Output a constructor for a symbol with a given priority. */
DEFHOOK
(constructor,
"If defined, a function that outputs assembler code to arrange to call\n\
the function referenced by @var{symbol} at initialization time.\n\
\n\
Assume that @var{symbol} is a @code{SYMBOL_REF} for a function taking\n\
no arguments and with no return value. If the target supports initialization\n\
priorities, @var{priority} is a value between 0 and @code{MAX_INIT_PRIORITY};\n\
otherwise it must be @code{DEFAULT_INIT_PRIORITY}.\n\
\n\
If this macro is not defined by the target, a suitable default will\n\
be chosen if (1) the target supports arbitrary section names, (2) the\n\
target defines @code{CTORS_SECTION_ASM_OP}, or (3) @code{USE_COLLECT2}\n\
is not defined.",
void, (rtx symbol, int priority), NULL)
/* Output a destructor for a symbol with a given priority. */
DEFHOOK
(destructor,
"This is like @code{TARGET_ASM_CONSTRUCTOR} but used for termination\n\
functions rather than initialization functions.",
void, (rtx symbol, int priority), NULL)
/* Output the assembler code for a thunk function. THUNK_DECL is the
declaration for the thunk function itself, FUNCTION is the decl for
the target function. DELTA is an immediate constant offset to be
added to THIS. If VCALL_OFFSET is nonzero, the word at
*(*this + vcall_offset) should be added to THIS. */
DEFHOOK
(output_mi_thunk,
"A function that outputs the assembler code for a thunk\n\
function, used to implement C++ virtual function calls with multiple\n\
inheritance. The thunk acts as a wrapper around a virtual function,\n\
adjusting the implicit object parameter before handing control off to\n\
the real function.\n\
\n\
First, emit code to add the integer @var{delta} to the location that\n\
contains the incoming first argument. Assume that this argument\n\
contains a pointer, and is the one used to pass the @code{this} pointer\n\
in C++. This is the incoming argument @emph{before} the function prologue,\n\
e.g.@: @samp{%o0} on a sparc. The addition must preserve the values of\n\
all other incoming arguments.\n\
\n\
Then, if @var{vcall_offset} is nonzero, an additional adjustment should be\n\
made after adding @code{delta}. In particular, if @var{p} is the\n\
adjusted pointer, the following adjustment should be made:\n\
\n\
@smallexample\n\
p += (*((ptrdiff_t **)p))[vcall_offset/sizeof(ptrdiff_t)]\n\
@end smallexample\n\
\n\
After the additions, emit code to jump to @var{function}, which is a\n\
@code{FUNCTION_DECL}. This is a direct pure jump, not a call, and does\n\
not touch the return address. Hence returning from @var{FUNCTION} will\n\
return to whoever called the current @samp{thunk}.\n\
\n\
The effect must be as if @var{function} had been called directly with\n\
the adjusted first argument. This macro is responsible for emitting all\n\
of the code for a thunk function; @code{TARGET_ASM_FUNCTION_PROLOGUE}\n\
and @code{TARGET_ASM_FUNCTION_EPILOGUE} are not invoked.\n\
\n\
The @var{thunk_fndecl} is redundant. (@var{delta} and @var{function}\n\
have already been extracted from it.) It might possibly be useful on\n\
some targets, but probably not.\n\
\n\
If you do not define this macro, the target-independent code in the C++\n\
front end will generate a less efficient heavyweight thunk that calls\n\
@var{function} instead of jumping to it. The generic approach does\n\
not support varargs.",
void, (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta,
HOST_WIDE_INT vcall_offset, tree function),
NULL)
/* Determine whether output_mi_thunk would succeed. */
/* ??? Ideally, this hook would not exist, and success or failure
would be returned from output_mi_thunk directly. But there's
too much undo-able setup involved in invoking output_mi_thunk.
Could be fixed by making output_mi_thunk emit rtl instead of
text to the output file. */
DEFHOOK
(can_output_mi_thunk,
"A function that returns true if TARGET_ASM_OUTPUT_MI_THUNK would be able\n\
to output the assembler code for the thunk function specified by the\n\
arguments it is passed, and false otherwise. In the latter case, the\n\
generic approach will be used by the C++ front end, with the limitations\n\
previously exposed.",
bool, (const_tree thunk_fndecl, HOST_WIDE_INT delta,
HOST_WIDE_INT vcall_offset, const_tree function),
hook_bool_const_tree_hwi_hwi_const_tree_false)
/* Output any boilerplate text needed at the beginning of a
translation unit. */
DEFHOOK
(file_start,
"Output to @code{asm_out_file} any text which the assembler expects to\n\
find at the beginning of a file. The default behavior is controlled\n\
by two flags, documented below. Unless your target's assembler is\n\
quite unusual, if you override the default, you should call\n\
@code{default_file_start} at some point in your target hook. This\n\
lets other target files rely on these variables.",
void, (void),
default_file_start)
/* Output any boilerplate text needed at the end of a translation unit. */
DEFHOOK
(file_end,
"Output to @code{asm_out_file} any text which the assembler expects\n\
to find at the end of a file. The default is to output nothing.",
void, (void),
hook_void_void)
/* Output any boilerplate text needed at the beginning of an
LTO output stream. */
DEFHOOK
(lto_start,
"Output to @code{asm_out_file} any text which the assembler expects\n\
to find at the start of an LTO section. The default is to output\n\
nothing.",
void, (void),
hook_void_void)
/* Output any boilerplate text needed at the end of an
LTO output stream. */
DEFHOOK
(lto_end,
"Output to @code{asm_out_file} any text which the assembler expects\n\
to find at the end of an LTO section. The default is to output\n\
nothing.",
void, (void),
hook_void_void)
/* Output any boilerplace text needed at the end of a
translation unit before debug and unwind info is emitted. */
DEFHOOK
(code_end,
"Output to @code{asm_out_file} any text which is needed before emitting\n\
unwind info and debug info at the end of a file. Some targets emit\n\
here PIC setup thunks that cannot be emitted at the end of file,\n\
because they couldn't have unwind info then. The default is to output\n\
nothing.",
void, (void),
hook_void_void)
/* Output an assembler pseudo-op to declare a library function name
external. */
DEFHOOK
(external_libcall,
"This target hook is a function to output to @var{asm_out_file} an assembler\n\
pseudo-op to declare a library function name external. The name of the\n\
library function is given by @var{symref}, which is a @code{symbol_ref}.",
void, (rtx symref),
default_external_libcall)
/* Output an assembler directive to mark decl live. This instructs
linker to not dead code strip this symbol. */
DEFHOOK
(mark_decl_preserved,
"This target hook is a function to output to @var{asm_out_file} an assembler\n\
directive to annotate @var{symbol} as used. The Darwin target uses the\n\
.no_dead_code_strip directive.",
void, (const char *symbol),
hook_void_constcharptr)
/* Output a record of the command line switches that have been passed. */
DEFHOOK
(record_gcc_switches,
"Provides the target with the ability to record the gcc command line\n\
switches that have been passed to the compiler, and options that are\n\
enabled. The @var{type} argument specifies what is being recorded.\n\
It can take the following values:\n\
\n\
@table @gcctabopt\n\
@item SWITCH_TYPE_PASSED\n\
@var{text} is a command line switch that has been set by the user.\n\
\n\
@item SWITCH_TYPE_ENABLED\n\
@var{text} is an option which has been enabled. This might be as a\n\
direct result of a command line switch, or because it is enabled by\n\
default or because it has been enabled as a side effect of a different\n\
command line switch. For example, the @option{-O2} switch enables\n\
various different individual optimization passes.\n\
\n\
@item SWITCH_TYPE_DESCRIPTIVE\n\
@var{text} is either NULL or some descriptive text which should be\n\
ignored. If @var{text} is NULL then it is being used to warn the\n\
target hook that either recording is starting or ending. The first\n\
time @var{type} is SWITCH_TYPE_DESCRIPTIVE and @var{text} is NULL, the\n\
warning is for start up and the second time the warning is for\n\
wind down. This feature is to allow the target hook to make any\n\
necessary preparations before it starts to record switches and to\n\
perform any necessary tidying up after it has finished recording\n\
switches.\n\
\n\
@item SWITCH_TYPE_LINE_START\n\
This option can be ignored by this target hook.\n\
\n\
@item SWITCH_TYPE_LINE_END\n\
This option can be ignored by this target hook.\n\
@end table\n\
\n\
The hook's return value must be zero. Other return values may be\n\
supported in the future.\n\
\n\
By default this hook is set to NULL, but an example implementation is\n\
provided for ELF based targets. Called @var{elf_record_gcc_switches},\n\
it records the switches as ASCII text inside a new, string mergeable\n\
section in the assembler output file. The name of the new section is\n\
provided by the @code{TARGET_ASM_RECORD_GCC_SWITCHES_SECTION} target\n\
hook.",
int, (print_switch_type type, const char *text),
NULL)
/* The name of the section that the example ELF implementation of
record_gcc_switches will use to store the information. Target
specific versions of record_gcc_switches may or may not use
this information. */
DEFHOOKPOD
(record_gcc_switches_section,
"This is the name of the section that will be created by the example\n\
ELF implementation of the @code{TARGET_ASM_RECORD_GCC_SWITCHES} target\n\
hook.",
const char *, ".GCC.command.line")
/* Output the definition of a section anchor. */
DEFHOOK
(output_anchor,
"Write the assembly code to define section anchor @var{x}, which is a\n\
@code{SYMBOL_REF} for which @samp{SYMBOL_REF_ANCHOR_P (@var{x})} is true.\n\
The hook is called with the assembly output position set to the beginning\n\
of @code{SYMBOL_REF_BLOCK (@var{x})}.\n\
\n\
If @code{ASM_OUTPUT_DEF} is available, the hook's default definition uses\n\
it to define the symbol as @samp{. + SYMBOL_REF_BLOCK_OFFSET (@var{x})}.\n\
If @code{ASM_OUTPUT_DEF} is not available, the hook's default definition\n\
is @code{NULL}, which disables the use of section anchors altogether.",
void, (rtx x),
default_asm_output_anchor)
DEFHOOK
(output_ident,
"Output a string based on @var{name}, suitable for the @samp{#ident} \
directive, or the equivalent directive or pragma in non-C-family languages. \
If this hook is not defined, nothing is output for the @samp{#ident} \
directive.",
void, (const char *name),
hook_void_constcharptr)
/* Output a DTP-relative reference to a TLS symbol. */
DEFHOOK
(output_dwarf_dtprel,
"If defined, this target hook is a function which outputs a DTP-relative\n\
reference to the given TLS symbol of the specified size.",
void, (FILE *file, int size, rtx x),
NULL)
/* Some target machines need to postscan each insn after it is output. */
DEFHOOK
(final_postscan_insn,
"If defined, this target hook is a function which is executed just after the\n\
output of assembler code for @var{insn}, to change the mode of the assembler\n\
if necessary.\n\
\n\
Here the argument @var{opvec} is the vector containing the operands\n\
extracted from @var{insn}, and @var{noperands} is the number of\n\
elements of the vector which contain meaningful data for this insn.\n\
The contents of this vector are what was used to convert the insn\n\
template into assembler code, so you can change the assembler mode\n\
by checking the contents of the vector.",
void, (FILE *file, rtx_insn *insn, rtx *opvec, int noperands),
NULL)
/* Emit the trampoline template. This hook may be NULL. */
DEFHOOK
(trampoline_template,
"This hook is called by @code{assemble_trampoline_template} to output,\n\
on the stream @var{f}, assembler code for a block of data that contains\n\
the constant parts of a trampoline. This code should not include a\n\
label---the label is taken care of automatically.\n\
\n\
If you do not define this hook, it means no template is needed\n\
for the target. Do not define this hook on systems where the block move\n\
code to copy the trampoline into place would be larger than the code\n\
to generate it on the spot.",
void, (FILE *f),
NULL)
DEFHOOK
(output_source_filename,
"Output DWARF debugging information which indicates that filename\
@var{name} is the current source file to the stdio stream @var{file}.\n\
\n\
This target hook need not be defined if the standard form of output\
for the file format in use is appropriate.",
void ,(FILE *file, const char *name),
default_asm_output_source_filename)
DEFHOOK
(output_addr_const_extra,
"A target hook to recognize @var{rtx} patterns that @code{output_addr_const}\n\
can't deal with, and output assembly code to @var{file} corresponding to\n\
the pattern @var{x}. This may be used to allow machine-dependent\n\
@code{UNSPEC}s to appear within constants.\n\
\n\
If target hook fails to recognize a pattern, it must return @code{false},\n\
so that a standard error message is printed. If it prints an error message\n\
itself, by calling, for example, @code{output_operand_lossage}, it may just\n\
return @code{true}.",
bool, (FILE *file, rtx x),
hook_bool_FILEptr_rtx_false)
/* ??? The TARGET_PRINT_OPERAND* hooks are part of the asm_out struct,
even though that is not reflected in the macro name to override their
initializers. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_"
/* Emit a machine-specific insn operand. */
/* ??? tm.texi only documents the old macro PRINT_OPERAND,
not this hook, and uses a different name for the argument FILE. */
DEFHOOK_UNDOC
(print_operand,
"",
void, (FILE *file, rtx x, int code),
default_print_operand)
/* Emit a machine-specific memory address. */
/* ??? tm.texi only documents the old macro PRINT_OPERAND_ADDRESS,
not this hook, and uses different argument names. */
DEFHOOK_UNDOC
(print_operand_address,
"",
void, (FILE *file, machine_mode mode, rtx addr),
default_print_operand_address)
/* Determine whether CODE is a valid punctuation character for the
`print_operand' hook. */
/* ??? tm.texi only documents the old macro PRINT_OPERAND_PUNCT_VALID_P,
not this hook. */
DEFHOOK_UNDOC
(print_operand_punct_valid_p,
"",
bool ,(unsigned char code),
default_print_operand_punct_valid_p)
/* Given a symbol name, perform same mangling as assemble_name and
ASM_OUTPUT_LABELREF, returning result as an IDENTIFIER_NODE. */
DEFHOOK
(mangle_assembler_name,
"Given a symbol @var{name}, perform same mangling as @code{varasm.c}'s\
@code{assemble_name}, but in memory rather than to a file stream, returning\
result as an @code{IDENTIFIER_NODE}. Required for correct LTO symtabs. The\
default implementation calls the @code{TARGET_STRIP_NAME_ENCODING} hook and\
then prepends the @code{USER_LABEL_PREFIX}, if any.",
tree, (const char *name),
default_mangle_assembler_name)
HOOK_VECTOR_END (asm_out)
/* Functions relating to instruction scheduling. All of these
default to null pointers, which haifa-sched.c looks for and handles. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_SCHED_"
HOOK_VECTOR (TARGET_SCHED, sched)
/* Given the current cost, COST, of an insn, INSN, calculate and
return a new cost based on its relationship to DEP_INSN through
the dependence LINK. The default is to make no adjustment. */
DEFHOOK
(adjust_cost,
"This function corrects the value of @var{cost} based on the\n\
relationship between @var{insn} and @var{dep_insn} through a\n\
dependence of type dep_type, and strength @var{dw}. It should return the new\n\
value. The default is to make no adjustment to @var{cost}. This can be\n\
used for example to specify to the scheduler using the traditional pipeline\n\
description that an output- or anti-dependence does not incur the same cost\n\
as a data-dependence. If the scheduler using the automaton based pipeline\n\
description, the cost of anti-dependence is zero and the cost of\n\
output-dependence is maximum of one and the difference of latency\n\
times of the first and the second insns. If these values are not\n\
acceptable, you could use the hook to modify them too. See also\n\
@pxref{Processor pipeline description}.",
int, (rtx_insn *insn, int dep_type1, rtx_insn *dep_insn, int cost,
unsigned int dw),
NULL)
/* Adjust the priority of an insn as you see fit. Returns the new priority. */
DEFHOOK
(adjust_priority,
"This hook adjusts the integer scheduling priority @var{priority} of\n\
@var{insn}. It should return the new priority. Increase the priority to\n\
execute @var{insn} earlier, reduce the priority to execute @var{insn}\n\
later. Do not define this hook if you do not need to adjust the\n\
scheduling priorities of insns.",
int, (rtx_insn *insn, int priority), NULL)
/* Function which returns the maximum number of insns that can be
scheduled in the same machine cycle. This must be constant
over an entire compilation. The default is 1. */
DEFHOOK
(issue_rate,
"This hook returns the maximum number of instructions that can ever\n\
issue at the same time on the target machine. The default is one.\n\
Although the insn scheduler can define itself the possibility of issue\n\
an insn on the same cycle, the value can serve as an additional\n\
constraint to issue insns on the same simulated processor cycle (see\n\
hooks @samp{TARGET_SCHED_REORDER} and @samp{TARGET_SCHED_REORDER2}).\n\
This value must be constant over the entire compilation. If you need\n\
it to vary depending on what the instructions are, you must use\n\
@samp{TARGET_SCHED_VARIABLE_ISSUE}.",
int, (void), NULL)
/* Calculate how much this insn affects how many more insns we
can emit this cycle. Default is they all cost the same. */
DEFHOOK
(variable_issue,
"This hook is executed by the scheduler after it has scheduled an insn\n\
from the ready list. It should return the number of insns which can\n\
still be issued in the current cycle. The default is\n\
@samp{@w{@var{more} - 1}} for insns other than @code{CLOBBER} and\n\
@code{USE}, which normally are not counted against the issue rate.\n\