]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/alpha/vms.h
alpha.c (alpha_sa_size): Force procedure type to PT_STACK when frame_pointer_needed...
[thirdparty/gcc.git] / gcc / config / alpha / vms.h
CommitLineData
16b61764 1/* Output variables, constants and external declarations, for GNU compiler.
5ea8f977
DR
2 Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2004, 2005, 2007, 2008,
3 2009
16b61764
DR
4 Free Software Foundation, Inc.
5
7ec022b2 6This file is part of GCC.
16b61764 7
7ec022b2 8GCC is free software; you can redistribute it and/or modify
16b61764 9it under the terms of the GNU General Public License as published by
2f83c7d6 10the Free Software Foundation; either version 3, or (at your option)
16b61764
DR
11any later version.
12
7ec022b2 13GCC is distributed in the hope that it will be useful,
16b61764
DR
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
2f83c7d6
NC
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
16b61764
DR
21
22#define TARGET_OBJECT_SUFFIX ".obj"
23#define TARGET_EXECUTABLE_SUFFIX ".exe"
24
3bd1b109
DR
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
16b61764
DR
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
12a41c22
NB
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"); \
e0322d5c
NB
42 if (TARGET_FLOAT_VAX) \
43 builtin_define ("__G_FLOAT"); \
44 else \
45 builtin_define ("__IEEE_FLOAT"); \
12a41c22 46 } while (0)
16b61764 47
16b61764 48#undef TARGET_DEFAULT
8bea7f7c 49#define TARGET_DEFAULT (MASK_FPREGS|MASK_GAS)
16b61764
DR
50#undef TARGET_ABI_OPEN_VMS
51#define TARGET_ABI_OPEN_VMS 1
52
53#undef TARGET_NAME
54#define TARGET_NAME "OpenVMS/Alpha"
55#undef TARGET_VERSION
56#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
57
5ea8f977
DR
58#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
59
16b61764
DR
60#undef PCC_STATIC_STRUCT_RETURN
61
62/* "long" is 32 bits, but 64 bits for Ada. */
63#undef LONG_TYPE_SIZE
64#define LONG_TYPE_SIZE 32
65#define ADA_LONG_TYPE_SIZE 64
66
67/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
68#undef POINTER_SIZE
69#define POINTER_SIZE 32
70#define POINTERS_EXTEND_UNSIGNED 0
71
c889a16f
DR
72#define HANDLE_SYSV_PRAGMA 1
73
16b61764
DR
74#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
75
5e3fef6c
DR
76/* The maximum alignment 'malloc' honors. */
77#undef MALLOC_ALIGNMENT
78#define MALLOC_ALIGNMENT ((TARGET_MALLOC64 ? 16 : 8) * BITS_PER_UNIT)
79
16b61764
DR
80#undef FIXED_REGISTERS
81#define FIXED_REGISTERS \
82 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
83 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
84 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
85 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
86
87#undef CALL_USED_REGISTERS
88#define CALL_USED_REGISTERS \
89 {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
90 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
91 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
92 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
93
94/* List the order in which to allocate registers. Each register must be
95 listed once, even those in FIXED_REGISTERS.
96
97 We allocate in the following order:
98 $f1 (nonsaved floating-point register)
99 $f10-$f15 (likewise)
100 $f22-$f30 (likewise)
101 $f21-$f16 (likewise, but input args)
102 $f0 (nonsaved, but return value)
103 $f2-$f9 (saved floating-point registers)
104 $1 (nonsaved integer registers)
105 $22-$25 (likewise)
106 $28 (likewise)
107 $0 (likewise, but return value)
108 $21-$16 (likewise, but input args)
109 $27 (procedure value in OSF, nonsaved in NT)
110 $2-$8 (saved integer registers)
111 $9-$14 (saved integer registers)
112 $26 (return PC)
113 $15 (frame pointer)
114 $29 (global pointer)
115 $30, $31, $f31 (stack pointer and always zero/ap & fp) */
116
117#undef REG_ALLOC_ORDER
118#define REG_ALLOC_ORDER \
119 {33, \
120 42, 43, 44, 45, 46, 47, \
121 54, 55, 56, 57, 58, 59, 60, 61, 62, \
122 53, 52, 51, 50, 49, 48, \
123 32, \
124 34, 35, 36, 37, 38, 39, 40, 41, \
125 1, \
126 22, 23, 24, 25, \
127 28, \
128 0, \
129 21, 20, 19, 18, 17, 16, \
130 27, \
131 2, 3, 4, 5, 6, 7, 8, \
132 9, 10, 11, 12, 13, 14, \
133 26, \
134 15, \
135 29, \
136 30, 31, 63 }
137
138#undef HARD_FRAME_POINTER_REGNUM
139#define HARD_FRAME_POINTER_REGNUM 29
140
141/* Define registers used by the epilogue and return instruction. */
142#undef EPILOGUE_USES
143#define EPILOGUE_USES(REGNO) ((REGNO) == 26 || (REGNO) == 29)
144
145#undef CAN_ELIMINATE
146#define CAN_ELIMINATE(FROM, TO) \
1d3499d8 147 (alpha_vms_can_eliminate ((FROM), (TO)))
16b61764
DR
148
149#undef INITIAL_ELIMINATION_OFFSET
150#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1d3499d8
OH
151 ((OFFSET) = alpha_vms_initial_elimination_offset(FROM, TO))
152
16b61764
DR
153\f
154/* Define a data type for recording info about an argument list
155 during the scan of that argument list. This data type should
156 hold all necessary information about the function itself
157 and about the args processed so far, enough to enable macros
158 such as FUNCTION_ARG to determine where the next arg should go.
159
160 On Alpha/VMS, this is a structure that contains the number of
161 arguments and, for each argument, the datatype of that argument.
162
163 The number of arguments is a number of words of arguments scanned so far.
164 Thus 6 or more means all following args should go on the stack. */
165
166enum avms_arg_type {I64, FF, FD, FG, FS, FT};
167typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
168
169#undef CUMULATIVE_ARGS
170#define CUMULATIVE_ARGS avms_arg_info
171
172/* Initialize a variable CUM of type CUMULATIVE_ARGS
173 for a call to a function whose data type is FNTYPE.
174 For a library call, FNTYPE is 0. */
175
176#undef INIT_CUMULATIVE_ARGS
0f6937fe 177#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
16b61764
DR
178 (CUM).num_args = 0; \
179 (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \
180 (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
181
182#undef FUNCTION_ARG_ADVANCE
183#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
fe984136 184 if (targetm.calls.must_pass_in_stack (MODE, TYPE)) \
16b61764
DR
185 (CUM).num_args += 6; \
186 else \
187 { \
188 if ((CUM).num_args < 6) \
189 (CUM).atypes[(CUM).num_args] = alpha_arg_type (MODE); \
190 \
191 (CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED); \
192 }
193
16b61764
DR
194/* ABI has stack checking, but it's broken. */
195#undef STACK_CHECK_BUILTIN
196#define STACK_CHECK_BUILTIN 0
197
3bd1b109
DR
198#undef ASM_WEAKEN_LABEL
199#define ASM_WEAKEN_LABEL(FILE, NAME) \
200 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
201 fputc ('\n', FILE); } while (0)
202
d48bc59a 203#define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
16b61764
DR
204#define CTORS_SECTION_ASM_OP "\t.ctors"
205#define DTORS_SECTION_ASM_OP "\t.dtors"
3bd1b109
DR
206#define SDATA_SECTION_ASM_OP "\t.sdata"
207#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
208 asm (SECTION_OP "\n\t.long " #FUNC"\n");
16b61764 209
16b61764 210#undef ASM_OUTPUT_ADDR_DIFF_ELT
56daab84 211#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) gcc_unreachable ()
16b61764
DR
212
213#undef ASM_OUTPUT_ADDR_VEC_ELT
214#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
215 fprintf (FILE, "\t.quad $L%d\n", (VALUE))
216
16b61764
DR
217#undef CASE_VECTOR_MODE
218#define CASE_VECTOR_MODE DImode
219#undef CASE_VECTOR_PC_RELATIVE
220
221#undef ASM_OUTPUT_CASE_LABEL
222#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
4977bab6 223{ ASM_OUTPUT_ALIGN (FILE, 3); (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); }
16b61764
DR
224
225/* This says how to output assembler code to declare an
226 uninitialized external linkage data object. */
227
228#define COMMON_ASM_OP "\t.comm\t"
229
18fd5621
EB
230#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
231#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
232 vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
16b61764 233\f
16b61764 234#undef TRAMPOLINE_TEMPLATE
16b61764
DR
235
236/* Length in units of the trampoline for entering a nested function. */
237
238#undef TRAMPOLINE_SIZE
239#define TRAMPOLINE_SIZE 32
240
241/* The alignment of a trampoline, in bits. */
242
243#undef TRAMPOLINE_ALIGNMENT
244#define TRAMPOLINE_ALIGNMENT 64
245
246/* Emit RTL insns to initialize the variable parts of a trampoline.
247 FNADDR is an RTX for the address of the function's pure code.
248 CXT is an RTX for the static chain value for the function. */
249
250#undef INITIALIZE_TRAMPOLINE
251#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
252 alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, -1)
253
254/* Control how constructors and destructors are emitted. */
255#define TARGET_ASM_CONSTRUCTOR vms_asm_out_constructor
256#define TARGET_ASM_DESTRUCTOR vms_asm_out_destructor
257
258#undef SDB_DEBUGGING_INFO
259#undef MIPS_DEBUGGING_INFO
260#undef DBX_DEBUGGING_INFO
261
23532de9
JT
262#define DWARF2_DEBUGGING_INFO 1
263#define VMS_DEBUGGING_INFO 1
16b61764
DR
264
265#define DWARF2_UNWIND_INFO 1
266
267#undef EH_RETURN_HANDLER_RTX
268#define EH_RETURN_HANDLER_RTX \
269 gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, 8))
270
12300dad 271#define LINK_EH_SPEC "vms-dwarf2eh.o%s "
c889a16f 272#define LINK_GCC_C_SEQUENCE_SPEC "%G"
16b61764 273
221cf9ab
OH
274#ifdef IN_LIBGCC2
275/* Get the definition for MD_FALLBACK_FRAME_STATE_FOR from a separate
276 file. This avoids having to recompile the world instead of libgcc only
277 when changes to this macro are exercised. */
278
8662eb14 279#define MD_UNWIND_SUPPORT "config/alpha/vms-unwind.h"
221cf9ab 280#endif
16b61764 281
5e3fef6c
DR
282#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
283 avms_asm_output_external (FILE, DECL, NAME)
284
285typedef struct crtl_name_spec
286{
287 const char *const name;
288 const char *deccname;
289 int referenced;
290} crtl_name_spec;
291
292#include "config/vms/vms-crtl.h"
293
294/* Alias CRTL names to 32/64bit DECCRTL functions.
295 Fixme: This should do a binary search. */
296#define DO_CRTL_NAMES \
297 do \
298 { \
299 int i; \
300 static crtl_name_spec vms_crtl_names[] = CRTL_NAMES; \
301 static int malloc64_init = 0; \
302 \
303 if ((malloc64_init == 0) && TARGET_MALLOC64) \
304 { \
305 for (i=0; vms_crtl_names [i].name; i++) \
306 { \
307 if (strcmp ("calloc", vms_crtl_names [i].name) == 0) \
308 vms_crtl_names [i].deccname = "decc$_calloc64"; \
309 else \
310 if (strcmp ("malloc", vms_crtl_names [i].name) == 0) \
311 vms_crtl_names [i].deccname = "decc$_malloc64"; \
312 else \
313 if (strcmp ("realloc", vms_crtl_names [i].name) == 0) \
314 vms_crtl_names [i].deccname = "decc$_realloc64"; \
315 else \
316 if (strcmp ("strdup", vms_crtl_names [i].name) == 0) \
317 vms_crtl_names [i].deccname = "decc$_strdup64"; \
318 } \
319 malloc64_init = 1; \
320 } \
321 for (i=0; vms_crtl_names [i].name; i++) \
322 if (!vms_crtl_names [i].referenced && \
323 (strcmp (name, vms_crtl_names [i].name) == 0)) \
324 { \
325 fprintf (file, "\t%s=%s\n", \
326 name, vms_crtl_names [i].deccname); \
327 vms_crtl_names [i].referenced = 1; \
328 } \
329 } while (0)
330
e9a25f70
JL
331/* This is how to output an assembler line
332 that says to advance the location counter
333 to a multiple of 2**LOG bytes. */
334
335#undef ASM_OUTPUT_ALIGN
336#define ASM_OUTPUT_ALIGN(FILE,LOG) \
337 fprintf (FILE, "\t.align %d\n", LOG);
338
7c262518
RH
339/* Switch into a generic section. */
340#define TARGET_ASM_NAMED_SECTION vms_asm_named_section
e9a25f70
JL
341
342#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
d6b5193b
RS
343 do { fprintf ((FILE), "\t.literals\n"); \
344 in_section = NULL; \
e9a25f70
JL
345 fprintf ((FILE), "\t"); \
346 assemble_name (FILE, LABEL1); \
347 fprintf (FILE, " = "); \
348 assemble_name (FILE, LABEL2); \
349 fprintf (FILE, "\n"); \
350 } while (0)
351
aacdb8bb 352#undef PREFERRED_DEBUGGING_TYPE
7a0c8d71 353#define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
aacdb8bb 354
4977bab6 355#define ASM_PN_FORMAT "%s___%lu"
aacdb8bb 356
60593797 357/* ??? VMS uses different linkage. */
eb0424da 358#undef TARGET_ASM_OUTPUT_MI_THUNK
60593797 359
aacdb8bb 360#undef ASM_SPEC
aacdb8bb 361#undef ASM_FINAL_SPEC
7a0c8d71
DR
362
363/* The VMS convention is to always provide minimal debug info
364 for a traceback unless specifically overridden. Defaulting this here
365 is a kludge. */
366
367#define OPTIMIZATION_OPTIONS(OPTIMIZE, OPTIMIZE_SIZE) \
368{ \
369 write_symbols = VMS_DEBUG; \
370 debug_info_level = (enum debug_info_level) 1; \
371}
372
373/* Override traceback debug info on -g0. */
374#undef OVERRIDE_OPTIONS
375#define OVERRIDE_OPTIONS \
376{ \
377 if (write_symbols == NO_DEBUG) \
378 debug_info_level = (enum debug_info_level) 0; \
379 override_options (); \
380}
381
382/* Link with vms-dwarf2.o if -g (except -g0). This causes the
d6b4baa4 383 VMS link to pull all the dwarf2 debug sections together. */
aacdb8bb 384#undef LINK_SPEC
7a0c8d71
DR
385#define LINK_SPEC "%{g:-g vms-dwarf2.o%s} %{g0} %{g1:-g1 vms-dwarf2.o%s} \
386%{g2:-g2 vms-dwarf2.o%s} %{g3:-g3 vms-dwarf2.o%s} %{shared} %{v} %{map}"
387
aacdb8bb 388#undef STARTFILE_SPEC
3bd1b109
DR
389#define STARTFILE_SPEC \
390"%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
391 crtbegin.o%s} \
392 %{!static:%{shared:crtbeginS.o%s}}"
393
394#define ENDFILE_SPEC \
395"%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
aacdb8bb 396
5a598ccc
DR
397#define NAME__MAIN "__gccmain"
398#define SYMBOL__MAIN __gccmain
5dd8a9b1 399
3bd1b109
DR
400#define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT"
401
41823c5e 402#define LONGLONG_STANDALONE 1