0
|
1 /* Output variables, constants and external declarations, for GNU compiler.
|
|
2 Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2004, 2005, 2007, 2008
|
|
3 Free Software Foundation, Inc.
|
|
4
|
|
5 This file is part of GCC.
|
|
6
|
|
7 GCC is free software; you can redistribute it and/or modify
|
|
8 it under the terms of the GNU General Public License as published by
|
|
9 the Free Software Foundation; either version 3, or (at your option)
|
|
10 any later version.
|
|
11
|
|
12 GCC is distributed in the hope that it will be useful,
|
|
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 GNU General Public License for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with GCC; see the file COPYING3. If not see
|
|
19 <http://www.gnu.org/licenses/>. */
|
|
20
|
|
21 #define TARGET_OBJECT_SUFFIX ".obj"
|
|
22 #define TARGET_EXECUTABLE_SUFFIX ".exe"
|
|
23
|
|
24 /* This enables certain macros in alpha.h, which will make an indirect
|
|
25 reference to an external symbol an invalid address. This needs to be
|
|
26 defined before we include alpha.h, since it determines which macros
|
|
27 are used for GO_IF_*. */
|
|
28
|
|
29 #define NO_EXTERNAL_INDIRECT_ADDRESS
|
|
30
|
|
31 #define TARGET_OS_CPP_BUILTINS() \
|
|
32 do { \
|
|
33 builtin_define_std ("vms"); \
|
|
34 builtin_define_std ("VMS"); \
|
|
35 builtin_define ("__ALPHA"); \
|
|
36 builtin_assert ("system=vms"); \
|
|
37 if (TARGET_FLOAT_VAX) \
|
|
38 builtin_define ("__G_FLOAT"); \
|
|
39 else \
|
|
40 builtin_define ("__IEEE_FLOAT"); \
|
|
41 } while (0)
|
|
42
|
|
43 #undef TARGET_DEFAULT
|
|
44 #define TARGET_DEFAULT (MASK_FPREGS|MASK_GAS)
|
|
45 #undef TARGET_ABI_OPEN_VMS
|
|
46 #define TARGET_ABI_OPEN_VMS 1
|
|
47
|
|
48 #undef TARGET_NAME
|
|
49 #define TARGET_NAME "OpenVMS/Alpha"
|
|
50 #undef TARGET_VERSION
|
|
51 #define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
|
|
52
|
|
53 #undef PCC_STATIC_STRUCT_RETURN
|
|
54
|
|
55 /* "long" is 32 bits, but 64 bits for Ada. */
|
|
56 #undef LONG_TYPE_SIZE
|
|
57 #define LONG_TYPE_SIZE 32
|
|
58 #define ADA_LONG_TYPE_SIZE 64
|
|
59
|
|
60 /* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
|
|
61 #undef POINTER_SIZE
|
|
62 #define POINTER_SIZE 32
|
|
63 #define POINTERS_EXTEND_UNSIGNED 0
|
|
64
|
|
65 #define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
|
|
66
|
|
67 #undef FIXED_REGISTERS
|
|
68 #define FIXED_REGISTERS \
|
|
69 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
|
70 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
|
|
71 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
|
72 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
|
|
73
|
|
74 #undef CALL_USED_REGISTERS
|
|
75 #define CALL_USED_REGISTERS \
|
|
76 {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
|
77 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
|
78 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
|
|
79 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
|
|
80
|
|
81 /* List the order in which to allocate registers. Each register must be
|
|
82 listed once, even those in FIXED_REGISTERS.
|
|
83
|
|
84 We allocate in the following order:
|
|
85 $f1 (nonsaved floating-point register)
|
|
86 $f10-$f15 (likewise)
|
|
87 $f22-$f30 (likewise)
|
|
88 $f21-$f16 (likewise, but input args)
|
|
89 $f0 (nonsaved, but return value)
|
|
90 $f2-$f9 (saved floating-point registers)
|
|
91 $1 (nonsaved integer registers)
|
|
92 $22-$25 (likewise)
|
|
93 $28 (likewise)
|
|
94 $0 (likewise, but return value)
|
|
95 $21-$16 (likewise, but input args)
|
|
96 $27 (procedure value in OSF, nonsaved in NT)
|
|
97 $2-$8 (saved integer registers)
|
|
98 $9-$14 (saved integer registers)
|
|
99 $26 (return PC)
|
|
100 $15 (frame pointer)
|
|
101 $29 (global pointer)
|
|
102 $30, $31, $f31 (stack pointer and always zero/ap & fp) */
|
|
103
|
|
104 #undef REG_ALLOC_ORDER
|
|
105 #define REG_ALLOC_ORDER \
|
|
106 {33, \
|
|
107 42, 43, 44, 45, 46, 47, \
|
|
108 54, 55, 56, 57, 58, 59, 60, 61, 62, \
|
|
109 53, 52, 51, 50, 49, 48, \
|
|
110 32, \
|
|
111 34, 35, 36, 37, 38, 39, 40, 41, \
|
|
112 1, \
|
|
113 22, 23, 24, 25, \
|
|
114 28, \
|
|
115 0, \
|
|
116 21, 20, 19, 18, 17, 16, \
|
|
117 27, \
|
|
118 2, 3, 4, 5, 6, 7, 8, \
|
|
119 9, 10, 11, 12, 13, 14, \
|
|
120 26, \
|
|
121 15, \
|
|
122 29, \
|
|
123 30, 31, 63 }
|
|
124
|
|
125 #undef HARD_FRAME_POINTER_REGNUM
|
|
126 #define HARD_FRAME_POINTER_REGNUM 29
|
|
127
|
|
128 /* Define registers used by the epilogue and return instruction. */
|
|
129 #undef EPILOGUE_USES
|
|
130 #define EPILOGUE_USES(REGNO) ((REGNO) == 26 || (REGNO) == 29)
|
|
131
|
|
132 #undef CAN_ELIMINATE
|
|
133 #define CAN_ELIMINATE(FROM, TO) \
|
|
134 ((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ())
|
|
135
|
|
136 #undef INITIAL_ELIMINATION_OFFSET
|
|
137 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
|
|
138 { switch (FROM) \
|
|
139 { \
|
|
140 case FRAME_POINTER_REGNUM: \
|
|
141 (OFFSET) = alpha_sa_size () + alpha_pv_save_size (); \
|
|
142 break; \
|
|
143 case ARG_POINTER_REGNUM: \
|
|
144 (OFFSET) = (ALPHA_ROUND (alpha_sa_size () + alpha_pv_save_size () \
|
|
145 + get_frame_size () \
|
|
146 + crtl->args.pretend_args_size) \
|
|
147 - crtl->args.pretend_args_size); \
|
|
148 break; \
|
|
149 default: \
|
|
150 gcc_unreachable (); \
|
|
151 } \
|
|
152 if ((TO) == STACK_POINTER_REGNUM) \
|
|
153 (OFFSET) += ALPHA_ROUND (crtl->outgoing_args_size); \
|
|
154 }
|
|
155
|
|
156 /* Define a data type for recording info about an argument list
|
|
157 during the scan of that argument list. This data type should
|
|
158 hold all necessary information about the function itself
|
|
159 and about the args processed so far, enough to enable macros
|
|
160 such as FUNCTION_ARG to determine where the next arg should go.
|
|
161
|
|
162 On Alpha/VMS, this is a structure that contains the number of
|
|
163 arguments and, for each argument, the datatype of that argument.
|
|
164
|
|
165 The number of arguments is a number of words of arguments scanned so far.
|
|
166 Thus 6 or more means all following args should go on the stack. */
|
|
167
|
|
168 enum avms_arg_type {I64, FF, FD, FG, FS, FT};
|
|
169 typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
|
|
170
|
|
171 #undef CUMULATIVE_ARGS
|
|
172 #define CUMULATIVE_ARGS avms_arg_info
|
|
173
|
|
174 /* Initialize a variable CUM of type CUMULATIVE_ARGS
|
|
175 for a call to a function whose data type is FNTYPE.
|
|
176 For a library call, FNTYPE is 0. */
|
|
177
|
|
178 #undef INIT_CUMULATIVE_ARGS
|
|
179 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
|
|
180 (CUM).num_args = 0; \
|
|
181 (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \
|
|
182 (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
|
|
183
|
|
184 #undef FUNCTION_ARG_ADVANCE
|
|
185 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
|
|
186 if (targetm.calls.must_pass_in_stack (MODE, TYPE)) \
|
|
187 (CUM).num_args += 6; \
|
|
188 else \
|
|
189 { \
|
|
190 if ((CUM).num_args < 6) \
|
|
191 (CUM).atypes[(CUM).num_args] = alpha_arg_type (MODE); \
|
|
192 \
|
|
193 (CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED); \
|
|
194 }
|
|
195
|
|
196 /* ABI has stack checking, but it's broken. */
|
|
197 #undef STACK_CHECK_BUILTIN
|
|
198 #define STACK_CHECK_BUILTIN 0
|
|
199
|
|
200 #define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
|
|
201 #define CTORS_SECTION_ASM_OP "\t.ctors"
|
|
202 #define DTORS_SECTION_ASM_OP "\t.dtors"
|
|
203
|
|
204 #undef ASM_OUTPUT_ADDR_DIFF_ELT
|
|
205 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) gcc_unreachable ()
|
|
206
|
|
207 #undef ASM_OUTPUT_ADDR_VEC_ELT
|
|
208 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
|
|
209 fprintf (FILE, "\t.quad $L%d\n", (VALUE))
|
|
210
|
|
211 #undef CASE_VECTOR_MODE
|
|
212 #define CASE_VECTOR_MODE DImode
|
|
213 #undef CASE_VECTOR_PC_RELATIVE
|
|
214
|
|
215 #undef ASM_OUTPUT_CASE_LABEL
|
|
216 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
|
|
217 { ASM_OUTPUT_ALIGN (FILE, 3); (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); }
|
|
218
|
|
219 /* This says how to output assembler code to declare an
|
|
220 uninitialized external linkage data object. */
|
|
221
|
|
222 #define COMMON_ASM_OP "\t.comm\t"
|
|
223
|
|
224 #undef ASM_OUTPUT_ALIGNED_COMMON
|
|
225 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
|
|
226 do { \
|
|
227 fprintf ((FILE), "%s", COMMON_ASM_OP); \
|
|
228 assemble_name ((FILE), (NAME)); \
|
|
229 fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
|
|
230 } while (0)
|
|
231
|
|
232
|
|
233 /* Output assembler code for a block containing the constant parts
|
|
234 of a trampoline, leaving space for the variable parts.
|
|
235
|
|
236 The trampoline should set the static chain pointer to value placed
|
|
237 into the trampoline and should branch to the specified routine.
|
|
238 Note that $27 has been set to the address of the trampoline, so we can
|
|
239 use it for addressability of the two data items. */
|
|
240
|
|
241 #undef TRAMPOLINE_TEMPLATE
|
|
242 #define TRAMPOLINE_TEMPLATE(FILE) \
|
|
243 { \
|
|
244 fprintf (FILE, "\t.quad 0\n"); \
|
|
245 fprintf (FILE, "\t.linkage __tramp\n"); \
|
|
246 fprintf (FILE, "\t.quad 0\n"); \
|
|
247 }
|
|
248
|
|
249 /* Length in units of the trampoline for entering a nested function. */
|
|
250
|
|
251 #undef TRAMPOLINE_SIZE
|
|
252 #define TRAMPOLINE_SIZE 32
|
|
253
|
|
254 /* The alignment of a trampoline, in bits. */
|
|
255
|
|
256 #undef TRAMPOLINE_ALIGNMENT
|
|
257 #define TRAMPOLINE_ALIGNMENT 64
|
|
258
|
|
259 /* Emit RTL insns to initialize the variable parts of a trampoline.
|
|
260 FNADDR is an RTX for the address of the function's pure code.
|
|
261 CXT is an RTX for the static chain value for the function. */
|
|
262
|
|
263 #undef INITIALIZE_TRAMPOLINE
|
|
264 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
|
|
265 alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, -1)
|
|
266
|
|
267 /* Control how constructors and destructors are emitted. */
|
|
268 #define TARGET_ASM_CONSTRUCTOR vms_asm_out_constructor
|
|
269 #define TARGET_ASM_DESTRUCTOR vms_asm_out_destructor
|
|
270
|
|
271 #undef SDB_DEBUGGING_INFO
|
|
272 #undef MIPS_DEBUGGING_INFO
|
|
273 #undef DBX_DEBUGGING_INFO
|
|
274
|
|
275 #define DWARF2_DEBUGGING_INFO 1
|
|
276 #define VMS_DEBUGGING_INFO 1
|
|
277
|
|
278 #define DWARF2_UNWIND_INFO 1
|
|
279
|
|
280 #undef EH_RETURN_HANDLER_RTX
|
|
281 #define EH_RETURN_HANDLER_RTX \
|
|
282 gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, 8))
|
|
283
|
|
284 #define LINK_EH_SPEC "vms-dwarf2eh.o%s "
|
|
285
|
|
286 #define MD_UNWIND_SUPPORT "config/alpha/vms-unwind.h"
|
|
287
|
|
288 /* This is how to output an assembler line
|
|
289 that says to advance the location counter
|
|
290 to a multiple of 2**LOG bytes. */
|
|
291
|
|
292 #undef ASM_OUTPUT_ALIGN
|
|
293 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
|
|
294 fprintf (FILE, "\t.align %d\n", LOG);
|
|
295
|
|
296 /* Switch into a generic section. */
|
|
297 #define TARGET_ASM_NAMED_SECTION vms_asm_named_section
|
|
298
|
|
299 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
|
|
300 do { fprintf ((FILE), "\t.literals\n"); \
|
|
301 in_section = NULL; \
|
|
302 fprintf ((FILE), "\t"); \
|
|
303 assemble_name (FILE, LABEL1); \
|
|
304 fprintf (FILE, " = "); \
|
|
305 assemble_name (FILE, LABEL2); \
|
|
306 fprintf (FILE, "\n"); \
|
|
307 } while (0)
|
|
308
|
|
309 #undef PREFERRED_DEBUGGING_TYPE
|
|
310 #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
|
|
311
|
|
312 #define ASM_PN_FORMAT "%s___%lu"
|
|
313
|
|
314 /* ??? VMS uses different linkage. */
|
|
315 #undef TARGET_ASM_OUTPUT_MI_THUNK
|
|
316
|
|
317 #undef ASM_SPEC
|
|
318 #undef ASM_FINAL_SPEC
|
|
319
|
|
320 /* The VMS convention is to always provide minimal debug info
|
|
321 for a traceback unless specifically overridden. Defaulting this here
|
|
322 is a kludge. */
|
|
323
|
|
324 #define OPTIMIZATION_OPTIONS(OPTIMIZE, OPTIMIZE_SIZE) \
|
|
325 { \
|
|
326 write_symbols = VMS_DEBUG; \
|
|
327 debug_info_level = (enum debug_info_level) 1; \
|
|
328 }
|
|
329
|
|
330 /* Override traceback debug info on -g0. */
|
|
331 #undef OVERRIDE_OPTIONS
|
|
332 #define OVERRIDE_OPTIONS \
|
|
333 { \
|
|
334 if (write_symbols == NO_DEBUG) \
|
|
335 debug_info_level = (enum debug_info_level) 0; \
|
|
336 override_options (); \
|
|
337 }
|
|
338
|
|
339 /* Link with vms-dwarf2.o if -g (except -g0). This causes the
|
|
340 VMS link to pull all the dwarf2 debug sections together. */
|
|
341 #undef LINK_SPEC
|
|
342 #define LINK_SPEC "%{g:-g vms-dwarf2.o%s} %{g0} %{g1:-g1 vms-dwarf2.o%s} \
|
|
343 %{g2:-g2 vms-dwarf2.o%s} %{g3:-g3 vms-dwarf2.o%s} %{shared} %{v} %{map}"
|
|
344
|
|
345 #undef STARTFILE_SPEC
|
|
346 #define STARTFILE_SPEC "%{!shared:%{mvms-return-codes:vcrt0.o%s} \
|
|
347 %{!mvms-return-codes:pcrt0.o%s}}"
|
|
348
|
|
349 #undef LIB_SPEC
|
|
350 #define LIB_SPEC "-lc"
|
|
351
|
|
352 #define NAME__MAIN "__gccmain"
|
|
353 #define SYMBOL__MAIN __gccmain
|
|
354
|
|
355 #define MD_EXEC_PREFIX "/gnu/lib/gcc-lib/"
|
|
356 #define MD_STARTFILE_PREFIX "/gnu/lib/gcc-lib/"
|
|
357
|
|
358 /* Specify the list of include file directories. */
|
|
359 #define INCLUDE_DEFAULTS \
|
|
360 { \
|
|
361 { "/gnu/lib/gcc-lib/include", 0, 0, 0 }, \
|
|
362 { "/gnu_gxx_include", 0, 1, 1 }, \
|
|
363 { "/gnu_cc_include", 0, 0, 0 }, \
|
|
364 { "/gnu/include", 0, 0, 0 }, \
|
|
365 { 0, 0, 0, 0 } \
|
|
366 }
|
|
367
|
|
368 #define LONGLONG_STANDALONE 1
|