re PR target/44241 (vms-crtl.h, vms-crtl-64.h need many more symbols)
[gcc.git] / gcc / config / alpha / vms.h
1 /* Output variables, constants and external declarations, for GNU compiler.
2 Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2004, 2005, 2007, 2008,
3 2009, 2010, 2011
4 Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
21
22 #define TARGET_OBJECT_SUFFIX ".obj"
23 #define TARGET_EXECUTABLE_SUFFIX ".exe"
24
25 /* Alpha/VMS object format is not really Elf, but this makes compiling
26 crtstuff.c and dealing with shared library initialization much easier. */
27 #define OBJECT_FORMAT_ELF
28
29 /* This enables certain macros in alpha.h, which will make an indirect
30 reference to an external symbol an invalid address. This needs to be
31 defined before we include alpha.h, since it determines which macros
32 are used for GO_IF_*. */
33
34 #define NO_EXTERNAL_INDIRECT_ADDRESS
35
36 #define TARGET_OS_CPP_BUILTINS() \
37 do { \
38 builtin_define_std ("vms"); \
39 builtin_define_std ("VMS"); \
40 builtin_define ("__ALPHA"); \
41 builtin_assert ("system=vms"); \
42 if (TARGET_FLOAT_VAX) \
43 builtin_define ("__G_FLOAT"); \
44 else \
45 builtin_define ("__IEEE_FLOAT"); \
46 } while (0)
47
48 #undef TARGET_DEFAULT
49 #define TARGET_DEFAULT (MASK_FPREGS|MASK_GAS)
50 #undef TARGET_ABI_OPEN_VMS
51 #define TARGET_ABI_OPEN_VMS 1
52
53 #define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
54
55 #undef PCC_STATIC_STRUCT_RETURN
56
57 /* "long" is 32 bits, but 64 bits for Ada. */
58 #undef LONG_TYPE_SIZE
59 #define LONG_TYPE_SIZE 32
60 #define ADA_LONG_TYPE_SIZE 64
61
62 /* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
63 #undef POINTER_SIZE
64 #define POINTER_SIZE 32
65 #define POINTERS_EXTEND_UNSIGNED 0
66
67 #define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
68
69 /* The maximum alignment 'malloc' honors. */
70 #undef MALLOC_ABI_ALIGNMENT
71 #define MALLOC_ABI_ALIGNMENT ((TARGET_MALLOC64 ? 16 : 8) * BITS_PER_UNIT)
72
73 #undef FIXED_REGISTERS
74 #define FIXED_REGISTERS \
75 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
76 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
77 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
78 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
79
80 #undef CALL_USED_REGISTERS
81 #define CALL_USED_REGISTERS \
82 {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
83 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
84 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
85 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
86
87 /* List the order in which to allocate registers. Each register must be
88 listed once, even those in FIXED_REGISTERS.
89
90 We allocate in the following order:
91 $f1 (nonsaved floating-point register)
92 $f10-$f15 (likewise)
93 $f22-$f30 (likewise)
94 $f21-$f16 (likewise, but input args)
95 $f0 (nonsaved, but return value)
96 $f2-$f9 (saved floating-point registers)
97 $1 (nonsaved integer registers)
98 $22-$25 (likewise)
99 $28 (likewise)
100 $0 (likewise, but return value)
101 $21-$16 (likewise, but input args)
102 $27 (procedure value in OSF, nonsaved in NT)
103 $2-$8 (saved integer registers)
104 $9-$14 (saved integer registers)
105 $26 (return PC)
106 $15 (frame pointer)
107 $29 (global pointer)
108 $30, $31, $f31 (stack pointer and always zero/ap & fp) */
109
110 #undef REG_ALLOC_ORDER
111 #define REG_ALLOC_ORDER \
112 {33, \
113 42, 43, 44, 45, 46, 47, \
114 54, 55, 56, 57, 58, 59, 60, 61, 62, \
115 53, 52, 51, 50, 49, 48, \
116 32, \
117 34, 35, 36, 37, 38, 39, 40, 41, \
118 1, \
119 22, 23, 24, 25, \
120 28, \
121 0, \
122 21, 20, 19, 18, 17, 16, \
123 27, \
124 2, 3, 4, 5, 6, 7, 8, \
125 9, 10, 11, 12, 13, 14, \
126 26, \
127 15, \
128 29, \
129 30, 31, 63 }
130
131 #undef HARD_FRAME_POINTER_REGNUM
132 #define HARD_FRAME_POINTER_REGNUM 29
133
134 /* Define registers used by the epilogue and return instruction. */
135 #undef EPILOGUE_USES
136 #define EPILOGUE_USES(REGNO) ((REGNO) == 26 || (REGNO) == 29)
137
138 #undef INITIAL_ELIMINATION_OFFSET
139 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
140 ((OFFSET) = alpha_vms_initial_elimination_offset(FROM, TO))
141
142 \f
143 /* Define a data type for recording info about an argument list
144 during the scan of that argument list. This data type should
145 hold all necessary information about the function itself
146 and about the args processed so far, enough to enable macros
147 such as FUNCTION_ARG to determine where the next arg should go.
148
149 On Alpha/VMS, this is a structure that contains the number of
150 arguments and, for each argument, the datatype of that argument.
151
152 The number of arguments is a number of words of arguments scanned so far.
153 Thus 6 or more means all following args should go on the stack. */
154
155 enum avms_arg_type {I64, FF, FD, FG, FS, FT};
156 typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
157
158 #undef CUMULATIVE_ARGS
159 #define CUMULATIVE_ARGS avms_arg_info
160
161 /* Initialize a variable CUM of type CUMULATIVE_ARGS
162 for a call to a function whose data type is FNTYPE.
163 For a library call, FNTYPE is 0. */
164
165 #undef INIT_CUMULATIVE_ARGS
166 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
167 (CUM).num_args = 0; \
168 (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \
169 (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
170
171 #define DEFAULT_PCC_STRUCT_RETURN 0
172
173 #undef ASM_WEAKEN_LABEL
174 #define ASM_WEAKEN_LABEL(FILE, NAME) \
175 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
176 fputc ('\n', FILE); } while (0)
177
178 #define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
179 #define CTORS_SECTION_ASM_OP "\t.ctors"
180 #define DTORS_SECTION_ASM_OP "\t.dtors"
181 #define SDATA_SECTION_ASM_OP "\t.sdata"
182 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
183 asm (SECTION_OP "\n\t.long " #FUNC"\n");
184
185 #undef ASM_OUTPUT_ADDR_DIFF_ELT
186
187 #undef ASM_OUTPUT_ADDR_VEC_ELT
188 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
189 fprintf (FILE, "\t.quad $L%d\n", (VALUE))
190
191 #undef CASE_VECTOR_MODE
192 #define CASE_VECTOR_MODE DImode
193 #undef CASE_VECTOR_PC_RELATIVE
194
195 #undef ASM_OUTPUT_CASE_LABEL
196 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
197 { ASM_OUTPUT_ALIGN (FILE, 3); (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); }
198
199 /* This says how to output assembler code to declare an
200 uninitialized external linkage data object. */
201
202 #define COMMON_ASM_OP "\t.comm\t"
203
204 #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
205 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
206 vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
207 \f
208 /* Control how constructors and destructors are emitted. */
209 #define TARGET_ASM_CONSTRUCTOR vms_asm_out_constructor
210 #define TARGET_ASM_DESTRUCTOR vms_asm_out_destructor
211
212 #undef SDB_DEBUGGING_INFO
213 #undef MIPS_DEBUGGING_INFO
214 #undef DBX_DEBUGGING_INFO
215
216 #define DWARF2_DEBUGGING_INFO 1
217 #define VMS_DEBUGGING_INFO 1
218
219 #define DWARF2_UNWIND_INFO 1
220
221 #undef EH_RETURN_HANDLER_RTX
222 #define EH_RETURN_HANDLER_RTX \
223 gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, 8))
224
225 #define LINK_EH_SPEC "vms-dwarf2eh.o%s "
226 #define LINK_GCC_C_SEQUENCE_SPEC "%G"
227
228 /* This is how to output an assembler line
229 that says to advance the location counter
230 to a multiple of 2**LOG bytes. */
231
232 #undef ASM_OUTPUT_ALIGN
233 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
234 fprintf (FILE, "\t.align %d\n", LOG);
235
236 /* Switch into a generic section. */
237 #define TARGET_ASM_NAMED_SECTION vms_asm_named_section
238
239 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
240 do { fprintf ((FILE), "\t.literals\n"); \
241 in_section = NULL; \
242 fprintf ((FILE), "\t"); \
243 assemble_name (FILE, LABEL1); \
244 fprintf (FILE, " = "); \
245 assemble_name (FILE, LABEL2); \
246 fprintf (FILE, "\n"); \
247 } while (0)
248
249 #undef PREFERRED_DEBUGGING_TYPE
250 #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
251
252 #define ASM_PN_FORMAT "%s___%lu"
253
254 /* ??? VMS uses different linkage. */
255 #undef TARGET_ASM_OUTPUT_MI_THUNK
256
257 #undef ASM_SPEC
258 #undef ASM_FINAL_SPEC
259
260 /* The VMS convention is to always provide minimal debug info
261 for a traceback unless specifically overridden. */
262
263 #undef SUBTARGET_OVERRIDE_OPTIONS
264 #define SUBTARGET_OVERRIDE_OPTIONS \
265 do { \
266 if (write_symbols == NO_DEBUG \
267 && debug_info_level == DINFO_LEVEL_NONE) \
268 { \
269 write_symbols = VMS_DEBUG; \
270 debug_info_level = DINFO_LEVEL_TERSE; \
271 } \
272 } while (0)
273
274 #undef LINK_SPEC
275 #if HAVE_GNU_LD
276 /* GNU-ld built-in linker script already handles the dwarf2 debug sections. */
277 #define LINK_SPEC "%{shared} %{v}"
278 #else
279 /* Link with vms-dwarf2.o if -g (except -g0). This causes the
280 VMS link to pull all the dwarf2 debug sections together. */
281 #define LINK_SPEC "%{g:-g vms-dwarf2.o%s} %{g0} %{g1:-g1 vms-dwarf2.o%s} \
282 %{g2:-g2 vms-dwarf2.o%s} %{g3:-g3 vms-dwarf2.o%s} %{shared} %{v} %{map}"
283 #endif
284
285 #undef STARTFILE_SPEC
286 #define STARTFILE_SPEC \
287 "%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
288 crtbegin.o%s} \
289 %{!static:%{shared:crtbeginS.o%s}}"
290
291 #define ENDFILE_SPEC \
292 "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
293
294 #define NAME__MAIN "__gccmain"
295 #define SYMBOL__MAIN __gccmain
296
297 #define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT"
298
299 #define LONGLONG_STANDALONE 1
300
301 #undef TARGET_VALID_POINTER_MODE
302 #define TARGET_VALID_POINTER_MODE vms_valid_pointer_mode