]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/alpha/vms.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / alpha / vms.h
CommitLineData
16b61764 1/* Output variables, constants and external declarations, for GNU compiler.
a5544970 2 Copyright (C) 1996-2019 Free Software Foundation, Inc.
16b61764 3
7ec022b2 4This file is part of GCC.
16b61764 5
7ec022b2 6GCC is free software; you can redistribute it and/or modify
16b61764 7it under the terms of the GNU General Public License as published by
2f83c7d6 8the Free Software Foundation; either version 3, or (at your option)
16b61764
DR
9any later version.
10
7ec022b2 11GCC is distributed in the hope that it will be useful,
16b61764
DR
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
2f83c7d6
NC
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
16b61764 19
3bd1b109
DR
20/* Alpha/VMS object format is not really Elf, but this makes compiling
21 crtstuff.c and dealing with shared library initialization much easier. */
22#define OBJECT_FORMAT_ELF
23
d3702b4f
TG
24/* Do not use TM clone registry as it currently doesn't work. Alpha/VMS
25 object is too far from ELF for supporting TM out of the box. */
26#define USE_TM_CLONE_REGISTRY 0
27
16b61764
DR
28/* This enables certain macros in alpha.h, which will make an indirect
29 reference to an external symbol an invalid address. This needs to be
30 defined before we include alpha.h, since it determines which macros
31 are used for GO_IF_*. */
32
33#define NO_EXTERNAL_INDIRECT_ADDRESS
34
ba89fcb6 35#define SUBTARGET_OS_CPP_BUILTINS() \
12a41c22 36 do { \
ba89fcb6
TG
37 builtin_define ("__ALPHA"); \
38 if (TARGET_FLOAT_VAX) \
39 builtin_define ("__G_FLOAT"); \
40 else \
41 builtin_define ("__IEEE_FLOAT"); \
12a41c22 42 } while (0)
16b61764 43
16b61764
DR
44#undef PCC_STATIC_STRUCT_RETURN
45
16b61764
DR
46#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
47
5e3fef6c 48/* The maximum alignment 'malloc' honors. */
ff1bb6ee 49#undef MALLOC_ABI_ALIGNMENT
d8aba32a
TG
50#define MALLOC_ABI_ALIGNMENT \
51 ((flag_vms_malloc64 && flag_vms_pointer_size != VMS_POINTER_SIZE_NONE \
52 ? 16 : 8) * BITS_PER_UNIT)
5e3fef6c 53
16b61764
DR
54#undef FIXED_REGISTERS
55#define FIXED_REGISTERS \
56 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
57 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
58 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
59 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
60
61#undef CALL_USED_REGISTERS
62#define CALL_USED_REGISTERS \
63 {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
64 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
65 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
66 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
67
68/* List the order in which to allocate registers. Each register must be
69 listed once, even those in FIXED_REGISTERS.
70
71 We allocate in the following order:
72 $f1 (nonsaved floating-point register)
73 $f10-$f15 (likewise)
74 $f22-$f30 (likewise)
75 $f21-$f16 (likewise, but input args)
76 $f0 (nonsaved, but return value)
77 $f2-$f9 (saved floating-point registers)
78 $1 (nonsaved integer registers)
79 $22-$25 (likewise)
80 $28 (likewise)
81 $0 (likewise, but return value)
82 $21-$16 (likewise, but input args)
83 $27 (procedure value in OSF, nonsaved in NT)
84 $2-$8 (saved integer registers)
85 $9-$14 (saved integer registers)
86 $26 (return PC)
87 $15 (frame pointer)
88 $29 (global pointer)
89 $30, $31, $f31 (stack pointer and always zero/ap & fp) */
90
91#undef REG_ALLOC_ORDER
92#define REG_ALLOC_ORDER \
93 {33, \
94 42, 43, 44, 45, 46, 47, \
95 54, 55, 56, 57, 58, 59, 60, 61, 62, \
96 53, 52, 51, 50, 49, 48, \
97 32, \
98 34, 35, 36, 37, 38, 39, 40, 41, \
99 1, \
100 22, 23, 24, 25, \
101 28, \
102 0, \
103 21, 20, 19, 18, 17, 16, \
104 27, \
105 2, 3, 4, 5, 6, 7, 8, \
106 9, 10, 11, 12, 13, 14, \
107 26, \
108 15, \
109 29, \
110 30, 31, 63 }
111
112#undef HARD_FRAME_POINTER_REGNUM
113#define HARD_FRAME_POINTER_REGNUM 29
114
115/* Define registers used by the epilogue and return instruction. */
116#undef EPILOGUE_USES
117#define EPILOGUE_USES(REGNO) ((REGNO) == 26 || (REGNO) == 29)
118
16b61764
DR
119#undef INITIAL_ELIMINATION_OFFSET
120#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1d3499d8
OH
121 ((OFFSET) = alpha_vms_initial_elimination_offset(FROM, TO))
122
16b61764
DR
123\f
124/* Define a data type for recording info about an argument list
125 during the scan of that argument list. This data type should
126 hold all necessary information about the function itself
127 and about the args processed so far, enough to enable macros
128 such as FUNCTION_ARG to determine where the next arg should go.
129
130 On Alpha/VMS, this is a structure that contains the number of
131 arguments and, for each argument, the datatype of that argument.
132
133 The number of arguments is a number of words of arguments scanned so far.
134 Thus 6 or more means all following args should go on the stack. */
135
136enum avms_arg_type {I64, FF, FD, FG, FS, FT};
137typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
138
139#undef CUMULATIVE_ARGS
140#define CUMULATIVE_ARGS avms_arg_info
141
142/* Initialize a variable CUM of type CUMULATIVE_ARGS
143 for a call to a function whose data type is FNTYPE.
144 For a library call, FNTYPE is 0. */
145
146#undef INIT_CUMULATIVE_ARGS
0f6937fe 147#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
16b61764
DR
148 (CUM).num_args = 0; \
149 (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \
150 (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
151
050d3f9d 152#define DEFAULT_PCC_STRUCT_RETURN 0
16b61764 153
073a8998 154/* Even though pointers are 64bits, only 32bit ever remain significant in code
ba89fcb6 155 addresses. */
d8aba32a
TG
156#define MASK_RETURN_ADDR \
157 (flag_vms_pointer_size == VMS_POINTER_SIZE_NONE \
158 ? constm1_rtx \
159 : GEN_INT (0xffffffff))
ba89fcb6 160
3bd1b109
DR
161#undef ASM_WEAKEN_LABEL
162#define ASM_WEAKEN_LABEL(FILE, NAME) \
163 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
164 fputc ('\n', FILE); } while (0)
165
d48bc59a 166#define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
16b61764
DR
167#define CTORS_SECTION_ASM_OP "\t.ctors"
168#define DTORS_SECTION_ASM_OP "\t.dtors"
3bd1b109
DR
169#define SDATA_SECTION_ASM_OP "\t.sdata"
170#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
171 asm (SECTION_OP "\n\t.long " #FUNC"\n");
16b61764 172
16b61764 173#undef ASM_OUTPUT_ADDR_DIFF_ELT
16b61764
DR
174
175#undef ASM_OUTPUT_ADDR_VEC_ELT
176#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
177 fprintf (FILE, "\t.quad $L%d\n", (VALUE))
178
16b61764
DR
179#undef CASE_VECTOR_MODE
180#define CASE_VECTOR_MODE DImode
181#undef CASE_VECTOR_PC_RELATIVE
182
183#undef ASM_OUTPUT_CASE_LABEL
184#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
4977bab6 185{ ASM_OUTPUT_ALIGN (FILE, 3); (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); }
16b61764
DR
186
187/* This says how to output assembler code to declare an
188 uninitialized external linkage data object. */
189
190#define COMMON_ASM_OP "\t.comm\t"
191
18fd5621
EB
192#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
193#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
194 vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
16b61764 195\f
16b61764
DR
196/* Control how constructors and destructors are emitted. */
197#define TARGET_ASM_CONSTRUCTOR vms_asm_out_constructor
198#define TARGET_ASM_DESTRUCTOR vms_asm_out_destructor
199
23532de9
JT
200#define DWARF2_DEBUGGING_INFO 1
201#define VMS_DEBUGGING_INFO 1
16b61764
DR
202
203#define DWARF2_UNWIND_INFO 1
204
205#undef EH_RETURN_HANDLER_RTX
206#define EH_RETURN_HANDLER_RTX \
0a81f074 207 gen_rtx_MEM (Pmode, plus_constant (Pmode, stack_pointer_rtx, 8))
16b61764 208
12300dad 209#define LINK_EH_SPEC "vms-dwarf2eh.o%s "
c889a16f 210#define LINK_GCC_C_SEQUENCE_SPEC "%G"
16b61764 211
e9a25f70
JL
212/* This is how to output an assembler line
213 that says to advance the location counter
214 to a multiple of 2**LOG bytes. */
215
e9a25f70
JL
216#define ASM_OUTPUT_ALIGN(FILE,LOG) \
217 fprintf (FILE, "\t.align %d\n", LOG);
218
b31a2c5a
UB
219/* This is how to advance the location counter by SIZE bytes. */
220
221#define ASM_OUTPUT_SKIP(FILE,SIZE) \
16998094 222 fprintf (FILE, "\t.space " HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE))
b31a2c5a
UB
223
224/* This says how to output an assembler line
225 to define a global common symbol. */
226
227#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
228( fputs ("\t.lcomm ", (FILE)), \
229 assemble_name ((FILE), (NAME)), \
16998094 230 fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)))
b31a2c5a 231
7c262518
RH
232/* Switch into a generic section. */
233#define TARGET_ASM_NAMED_SECTION vms_asm_named_section
e9a25f70 234
872b942a
TG
235#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
236 do \
237 { \
238 fprintf ((FILE), "\t"); \
239 assemble_name (FILE, LABEL1); \
240 fprintf (FILE, " = "); \
241 assemble_name (FILE, LABEL2); \
242 fprintf (FILE, "\n"); \
243 } \
244 while (0)
e9a25f70 245
aacdb8bb 246#undef PREFERRED_DEBUGGING_TYPE
7a0c8d71 247#define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
aacdb8bb 248
4977bab6 249#define ASM_PN_FORMAT "%s___%lu"
aacdb8bb 250
60593797 251/* ??? VMS uses different linkage. */
eb0424da 252#undef TARGET_ASM_OUTPUT_MI_THUNK
60593797 253
aacdb8bb 254#undef ASM_SPEC
aacdb8bb 255#undef ASM_FINAL_SPEC
7a0c8d71
DR
256
257/* The VMS convention is to always provide minimal debug info
daccad6d
SB
258 for a traceback unless specifically overridden.
259
260 Because ASM_OUTPUT_ADDR_DIFF_ELT is not defined for alpha-vms,
261 jump tables cannot be output for PIC code, because you can't put
262 an absolute address in a readonly section. Putting the table in
263 a writable section is a security hole. Therefore, we unset the
264 flag_jump_tables flag, forcing switch statements to be expanded
265 using decision trees. There are probably other ways to address
266 this issue, but using a decision tree is clearly safe. */
7a0c8d71 267
c5387660
JM
268#undef SUBTARGET_OVERRIDE_OPTIONS
269#define SUBTARGET_OVERRIDE_OPTIONS \
270do { \
fddeba6d
DR
271 if (write_symbols == NO_DEBUG \
272 && debug_info_level == DINFO_LEVEL_NONE) \
273 { \
274 write_symbols = VMS_DEBUG; \
275 debug_info_level = DINFO_LEVEL_TERSE; \
276 } \
daccad6d
SB
277 if (flag_pic) \
278 flag_jump_tables = 0; \
c5387660 279} while (0)
7a0c8d71 280
b501ce4e
TG
281#undef LINK_SPEC
282#if HAVE_GNU_LD
283/* GNU-ld built-in linker script already handles the dwarf2 debug sections. */
284#define LINK_SPEC "%{shared} %{v}"
285#else
7a0c8d71 286/* Link with vms-dwarf2.o if -g (except -g0). This causes the
d6b4baa4 287 VMS link to pull all the dwarf2 debug sections together. */
4b12e93d 288#define LINK_SPEC "%{g0} %{g*:-g vms-dwarf2.o%s} %{shared} %{v} %{map}"
b501ce4e 289#endif
7a0c8d71 290
aacdb8bb 291#undef STARTFILE_SPEC
4b12e93d 292#define STARTFILE_SPEC "%{!shared:crt0.o%s crtbegin.o%s} \
3bd1b109
DR
293 %{!static:%{shared:crtbeginS.o%s}}"
294
4b12e93d 295#define ENDFILE_SPEC "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
5dd8a9b1 296
3bd1b109
DR
297#define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT"
298
41823c5e 299#define LONGLONG_STANDALONE 1
dfe6ba6d
DR
300
301#undef TARGET_VALID_POINTER_MODE
302#define TARGET_VALID_POINTER_MODE vms_valid_pointer_mode
6ceb677f
TG
303
304/* Default values for _CRTL_VER and _VMS_VER. */
305#define VMS_DEFAULT_CRTL_VER 70320000
306#define VMS_DEFAULT_VMS_VER 70320000