]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/alpha/vms.h
elf.h: Fix comment formatting.
[thirdparty/gcc.git] / gcc / config / alpha / vms.h
CommitLineData
16b61764
DR
1/* Output variables, constants and external declarations, for GNU compiler.
2 Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002
3 Free Software Foundation, Inc.
4
7ec022b2 5This file is part of GCC.
16b61764 6
7ec022b2 7GCC is free software; you can redistribute it and/or modify
16b61764
DR
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
7ec022b2 12GCC is distributed in the hope that it will be useful,
16b61764
DR
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
7ec022b2 18along with GCC; see the file COPYING. If not, write to
16b61764
DR
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22#define TARGET_OBJECT_SUFFIX ".obj"
23#define TARGET_EXECUTABLE_SUFFIX ".exe"
24
25/* This enables certain macros in alpha.h, which will make an indirect
26 reference to an external symbol an invalid address. This needs to be
27 defined before we include alpha.h, since it determines which macros
28 are used for GO_IF_*. */
29
30#define NO_EXTERNAL_INDIRECT_ADDRESS
31
12a41c22
NB
32#define TARGET_OS_CPP_BUILTINS() \
33 do { \
34 builtin_define_std ("vms"); \
35 builtin_define_std ("VMS"); \
36 builtin_define ("__ALPHA"); \
37 builtin_assert ("system=vms"); \
e0322d5c
NB
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 TARGET_DEFAULT
45#define TARGET_DEFAULT (MASK_FP|MASK_FPREGS|MASK_GAS)
46#undef TARGET_ABI_OPEN_VMS
47#define TARGET_ABI_OPEN_VMS 1
48
49#undef TARGET_NAME
50#define TARGET_NAME "OpenVMS/Alpha"
51#undef TARGET_VERSION
52#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
53
54/* The structure return address arrives as an "argument" on VMS. */
55#undef STRUCT_VALUE_REGNUM
56#define STRUCT_VALUE 0
57#undef PCC_STATIC_STRUCT_RETURN
58
59/* "long" is 32 bits, but 64 bits for Ada. */
60#undef LONG_TYPE_SIZE
61#define LONG_TYPE_SIZE 32
62#define ADA_LONG_TYPE_SIZE 64
63
64/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
65#undef POINTER_SIZE
66#define POINTER_SIZE 32
67#define POINTERS_EXTEND_UNSIGNED 0
68
69#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
70
71#undef FIXED_REGISTERS
72#define FIXED_REGISTERS \
73 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
74 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
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, 0, 0, 0, 0, 0, 1 }
77
78#undef CALL_USED_REGISTERS
79#define CALL_USED_REGISTERS \
80 {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
81 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
82 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
83 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
84
85/* List the order in which to allocate registers. Each register must be
86 listed once, even those in FIXED_REGISTERS.
87
88 We allocate in the following order:
89 $f1 (nonsaved floating-point register)
90 $f10-$f15 (likewise)
91 $f22-$f30 (likewise)
92 $f21-$f16 (likewise, but input args)
93 $f0 (nonsaved, but return value)
94 $f2-$f9 (saved floating-point registers)
95 $1 (nonsaved integer registers)
96 $22-$25 (likewise)
97 $28 (likewise)
98 $0 (likewise, but return value)
99 $21-$16 (likewise, but input args)
100 $27 (procedure value in OSF, nonsaved in NT)
101 $2-$8 (saved integer registers)
102 $9-$14 (saved integer registers)
103 $26 (return PC)
104 $15 (frame pointer)
105 $29 (global pointer)
106 $30, $31, $f31 (stack pointer and always zero/ap & fp) */
107
108#undef REG_ALLOC_ORDER
109#define REG_ALLOC_ORDER \
110 {33, \
111 42, 43, 44, 45, 46, 47, \
112 54, 55, 56, 57, 58, 59, 60, 61, 62, \
113 53, 52, 51, 50, 49, 48, \
114 32, \
115 34, 35, 36, 37, 38, 39, 40, 41, \
116 1, \
117 22, 23, 24, 25, \
118 28, \
119 0, \
120 21, 20, 19, 18, 17, 16, \
121 27, \
122 2, 3, 4, 5, 6, 7, 8, \
123 9, 10, 11, 12, 13, 14, \
124 26, \
125 15, \
126 29, \
127 30, 31, 63 }
128
129#undef HARD_FRAME_POINTER_REGNUM
130#define HARD_FRAME_POINTER_REGNUM 29
131
132/* Define registers used by the epilogue and return instruction. */
133#undef EPILOGUE_USES
134#define EPILOGUE_USES(REGNO) ((REGNO) == 26 || (REGNO) == 29)
135
136#undef CAN_ELIMINATE
137#define CAN_ELIMINATE(FROM, TO) \
138((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ())
139
140#undef INITIAL_ELIMINATION_OFFSET
141#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
142{ if ((FROM) == FRAME_POINTER_REGNUM) \
143 (OFFSET) = alpha_sa_size () + alpha_pv_save_size (); \
144 else if ((FROM) == ARG_POINTER_REGNUM) \
145 (OFFSET) = (ALPHA_ROUND (alpha_sa_size () + alpha_pv_save_size () \
146 + get_frame_size () \
147 + current_function_pretend_args_size) \
148 - current_function_pretend_args_size); \
149 else \
150 abort(); \
151 if ((TO) == STACK_POINTER_REGNUM) \
152 (OFFSET) += ALPHA_ROUND (current_function_outgoing_args_size); \
153}
154\f
155/* Define a data type for recording info about an argument list
156 during the scan of that argument list. This data type should
157 hold all necessary information about the function itself
158 and about the args processed so far, enough to enable macros
159 such as FUNCTION_ARG to determine where the next arg should go.
160
161 On Alpha/VMS, this is a structure that contains the number of
162 arguments and, for each argument, the datatype of that argument.
163
164 The number of arguments is a number of words of arguments scanned so far.
165 Thus 6 or more means all following args should go on the stack. */
166
167enum avms_arg_type {I64, FF, FD, FG, FS, FT};
168typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
169
170#undef CUMULATIVE_ARGS
171#define CUMULATIVE_ARGS avms_arg_info
172
173/* Initialize a variable CUM of type CUMULATIVE_ARGS
174 for a call to a function whose data type is FNTYPE.
175 For a library call, FNTYPE is 0. */
176
177#undef INIT_CUMULATIVE_ARGS
178#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
179 (CUM).num_args = 0; \
180 (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \
181 (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
182
183#undef FUNCTION_ARG_ADVANCE
184#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
185 if (MUST_PASS_IN_STACK (MODE, TYPE)) \
186 (CUM).num_args += 6; \
187 else \
188 { \
189 if ((CUM).num_args < 6) \
190 (CUM).atypes[(CUM).num_args] = alpha_arg_type (MODE); \
191 \
192 (CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED); \
193 }
194
195/* For an arg passed partly in registers and partly in memory,
196 this is the number of registers used.
197 For args passed entirely in registers or entirely in memory, zero. */
198
199#undef FUNCTION_ARG_PARTIAL_NREGS
200#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
201((CUM).num_args < 6 && 6 < (CUM).num_args \
202 + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
203 ? 6 - (CUM).num_args : 0)
204
16b61764
DR
205/* ABI has stack checking, but it's broken. */
206#undef STACK_CHECK_BUILTIN
207#define STACK_CHECK_BUILTIN 0
208
16b61764 209#define LINK_SECTION_ASM_OP "\t.link"
d48bc59a 210#define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
16b61764
DR
211#define LITERALS_SECTION_ASM_OP "\t.literals"
212#define CTORS_SECTION_ASM_OP "\t.ctors"
213#define DTORS_SECTION_ASM_OP "\t.dtors"
214
215#undef EXTRA_SECTIONS
d48bc59a 216#define EXTRA_SECTIONS in_link, in_literals
16b61764
DR
217
218#undef EXTRA_SECTION_FUNCTIONS
219#define EXTRA_SECTION_FUNCTIONS \
220void \
1cd93a2a 221link_section (void) \
16b61764
DR
222{ \
223 if (in_section != in_link) \
224 { \
225 fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP); \
226 in_section = in_link; \
227 } \
228} \
229void \
1cd93a2a 230literals_section (void) \
16b61764
DR
231{ \
232 if (in_section != in_literals) \
233 { \
234 fprintf (asm_out_file, "%s\n", LITERALS_SECTION_ASM_OP); \
235 in_section = in_literals; \
236 } \
237}
238
a5c24926
RH
239extern void link_section (void);
240extern void literals_section (void);
16b61764
DR
241
242#undef ASM_OUTPUT_ADDR_DIFF_ELT
243#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) abort ()
244
245#undef ASM_OUTPUT_ADDR_VEC_ELT
246#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
247 fprintf (FILE, "\t.quad $L%d\n", (VALUE))
248
16b61764
DR
249#undef CASE_VECTOR_MODE
250#define CASE_VECTOR_MODE DImode
251#undef CASE_VECTOR_PC_RELATIVE
252
253#undef ASM_OUTPUT_CASE_LABEL
254#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
4977bab6 255{ ASM_OUTPUT_ALIGN (FILE, 3); (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); }
16b61764
DR
256
257/* This says how to output assembler code to declare an
258 uninitialized external linkage data object. */
259
260#define COMMON_ASM_OP "\t.comm\t"
261
262#undef ASM_OUTPUT_ALIGNED_COMMON
263#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
264do { \
265 fprintf ((FILE), "%s", COMMON_ASM_OP); \
266 assemble_name ((FILE), (NAME)); \
74eda121 267 fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
16b61764
DR
268} while (0)
269
270\f
271/* Output assembler code for a block containing the constant parts
272 of a trampoline, leaving space for the variable parts.
273
274 The trampoline should set the static chain pointer to value placed
275 into the trampoline and should branch to the specified routine.
276 Note that $27 has been set to the address of the trampoline, so we can
277 use it for addressability of the two data items. */
278
279#undef TRAMPOLINE_TEMPLATE
280#define TRAMPOLINE_TEMPLATE(FILE) \
281{ \
282 fprintf (FILE, "\t.quad 0\n"); \
283 fprintf (FILE, "\t.linkage __tramp\n"); \
284 fprintf (FILE, "\t.quad 0\n"); \
285}
286
287/* Length in units of the trampoline for entering a nested function. */
288
289#undef TRAMPOLINE_SIZE
290#define TRAMPOLINE_SIZE 32
291
292/* The alignment of a trampoline, in bits. */
293
294#undef TRAMPOLINE_ALIGNMENT
295#define TRAMPOLINE_ALIGNMENT 64
296
297/* Emit RTL insns to initialize the variable parts of a trampoline.
298 FNADDR is an RTX for the address of the function's pure code.
299 CXT is an RTX for the static chain value for the function. */
300
301#undef INITIALIZE_TRAMPOLINE
302#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
303 alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, -1)
304
305/* Control how constructors and destructors are emitted. */
306#define TARGET_ASM_CONSTRUCTOR vms_asm_out_constructor
307#define TARGET_ASM_DESTRUCTOR vms_asm_out_destructor
308
309#undef SDB_DEBUGGING_INFO
310#undef MIPS_DEBUGGING_INFO
311#undef DBX_DEBUGGING_INFO
312
23532de9
JT
313#define DWARF2_DEBUGGING_INFO 1
314#define VMS_DEBUGGING_INFO 1
16b61764
DR
315
316#define DWARF2_UNWIND_INFO 1
317
318#undef EH_RETURN_HANDLER_RTX
319#define EH_RETURN_HANDLER_RTX \
320 gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, 8))
321
12300dad 322#define LINK_EH_SPEC "vms-dwarf2eh.o%s "
16b61764
DR
323
324#ifdef IN_LIBGCC2
16b61764 325#include <pdscdef.h>
16b61764
DR
326
327#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \
328 do { \
3deb00ce 329 PDSCDEF *pv = *((PDSCDEF **) (CONTEXT)->reg [29]); \
16b61764 330 \
3deb00ce
DR
331 if (pv && ((long) pv & 0x7) == 0) /* low bits 0 means address */ \
332 pv = *(PDSCDEF **) pv; \
16b61764
DR
333 \
334 if (pv && ((pv->pdsc$w_flags & 0xf) == PDSC$K_KIND_FP_STACK)) \
335 { \
336 int i, j; \
337 \
338 (FS)->cfa_offset = pv->pdsc$l_size; \
12300dad 339 (FS)->cfa_reg = pv->pdsc$w_flags & PDSC$M_BASE_REG_IS_FP ? 29 : 30; \
16b61764
DR
340 (FS)->retaddr_column = 26; \
341 (FS)->cfa_how = CFA_REG_OFFSET; \
342 (FS)->regs.reg[27].loc.offset = -pv->pdsc$l_size; \
343 (FS)->regs.reg[27].how = REG_SAVED_OFFSET; \
344 (FS)->regs.reg[26].loc.offset \
4857d29d 345 = -(pv->pdsc$l_size - pv->pdsc$w_rsa_offset); \
16b61764
DR
346 (FS)->regs.reg[26].how = REG_SAVED_OFFSET; \
347 \
348 for (i = 0, j = 0; i < 32; i++) \
349 if (1<<i & pv->pdsc$l_ireg_mask) \
350 { \
351 (FS)->regs.reg[i].loc.offset \
4857d29d 352 = -(pv->pdsc$l_size - pv->pdsc$w_rsa_offset - 8 * ++j); \
16b61764
DR
353 (FS)->regs.reg[i].how = REG_SAVED_OFFSET; \
354 } \
355 \
356 goto SUCCESS; \
357 } \
3deb00ce
DR
358 else if (pv && ((pv->pdsc$w_flags & 0xf) == PDSC$K_KIND_FP_REGISTER)) \
359 { \
360 (FS)->cfa_offset = pv->pdsc$l_size; \
361 (FS)->cfa_reg = pv->pdsc$w_flags & PDSC$M_BASE_REG_IS_FP ? 29 : 30; \
362 (FS)->retaddr_column = 26; \
363 (FS)->cfa_how = CFA_REG_OFFSET; \
364 (FS)->regs.reg[26].loc.reg = pv->pdsc$b_save_ra; \
365 (FS)->regs.reg[26].how = REG_SAVED_REG; \
366 (FS)->regs.reg[29].loc.reg = pv->pdsc$b_save_fp; \
367 (FS)->regs.reg[29].how = REG_SAVED_REG; \
368 \
369 goto SUCCESS; \
370 } \
16b61764 371} while (0)
12300dad 372#endif
16b61764 373
e9a25f70
JL
374/* This is how to output an assembler line
375 that says to advance the location counter
376 to a multiple of 2**LOG bytes. */
377
378#undef ASM_OUTPUT_ALIGN
379#define ASM_OUTPUT_ALIGN(FILE,LOG) \
380 fprintf (FILE, "\t.align %d\n", LOG);
381
7c262518
RH
382/* Switch into a generic section. */
383#define TARGET_ASM_NAMED_SECTION vms_asm_named_section
e9a25f70
JL
384
385#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
386 do { literals_section(); \
387 fprintf ((FILE), "\t"); \
388 assemble_name (FILE, LABEL1); \
389 fprintf (FILE, " = "); \
390 assemble_name (FILE, LABEL2); \
391 fprintf (FILE, "\n"); \
392 } while (0)
393
aacdb8bb 394#undef PREFERRED_DEBUGGING_TYPE
7a0c8d71 395#define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
aacdb8bb 396
4977bab6 397#define ASM_PN_FORMAT "%s___%lu"
aacdb8bb 398
60593797 399/* ??? VMS uses different linkage. */
eb0424da 400#undef TARGET_ASM_OUTPUT_MI_THUNK
60593797 401
aacdb8bb 402#undef ASM_SPEC
aacdb8bb 403#undef ASM_FINAL_SPEC
7a0c8d71
DR
404
405/* The VMS convention is to always provide minimal debug info
406 for a traceback unless specifically overridden. Defaulting this here
407 is a kludge. */
408
409#define OPTIMIZATION_OPTIONS(OPTIMIZE, OPTIMIZE_SIZE) \
410{ \
411 write_symbols = VMS_DEBUG; \
412 debug_info_level = (enum debug_info_level) 1; \
413}
414
415/* Override traceback debug info on -g0. */
416#undef OVERRIDE_OPTIONS
417#define OVERRIDE_OPTIONS \
418{ \
419 if (write_symbols == NO_DEBUG) \
420 debug_info_level = (enum debug_info_level) 0; \
421 override_options (); \
422}
423
424/* Link with vms-dwarf2.o if -g (except -g0). This causes the
425 VMS link to pull all the dwarf2 debug sections together. */
aacdb8bb 426#undef LINK_SPEC
7a0c8d71
DR
427#define LINK_SPEC "%{g:-g vms-dwarf2.o%s} %{g0} %{g1:-g1 vms-dwarf2.o%s} \
428%{g2:-g2 vms-dwarf2.o%s} %{g3:-g3 vms-dwarf2.o%s} %{shared} %{v} %{map}"
429
aacdb8bb 430#undef STARTFILE_SPEC
d7c23cdc
DR
431#define STARTFILE_SPEC "%{!shared:%{mvms-return-codes:vcrt0.o%s} \
432%{!mvms-return-codes:pcrt0.o%s}}"
aacdb8bb 433
02f7da12
DR
434#undef LIB_SPEC
435#define LIB_SPEC "-lc"
436
5a598ccc
DR
437#define NAME__MAIN "__gccmain"
438#define SYMBOL__MAIN __gccmain
5dd8a9b1 439
41823c5e
DR
440#define MD_EXEC_PREFIX "/gnu/lib/gcc-lib/"
441#define MD_STARTFILE_PREFIX "/gnu/lib/gcc-lib/"
442
5dd8a9b1 443/* Specify the list of include file directories. */
41823c5e
DR
444#define INCLUDE_DEFAULTS \
445{ \
446 { "/gnu/lib/gcc-lib/include", 0, 0, 0 }, \
447 { "/gnu_gxx_include", 0, 1, 1 }, \
448 { "/gnu_cc_include", 0, 0, 0 }, \
449 { "/gnu/include", 0, 0, 0 }, \
450 { 0, 0, 0, 0 } \
5dd8a9b1 451}
ea5b9a1f 452
41823c5e 453#define LONGLONG_STANDALONE 1