]>
git.ipfire.org Git - thirdparty/gcc.git/blob - 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,
4 Free Software Foundation, Inc.
6 This file is part of GCC.
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)
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.
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/>. */
22 /* Alpha/VMS object format is not really Elf, but this makes compiling
23 crtstuff.c and dealing with shared library initialization much easier. */
24 #define OBJECT_FORMAT_ELF
26 /* Do not use TM clone registry as it currently doesn't work. Alpha/VMS
27 object is too far from ELF for supporting TM out of the box. */
28 #define USE_TM_CLONE_REGISTRY 0
30 /* This enables certain macros in alpha.h, which will make an indirect
31 reference to an external symbol an invalid address. This needs to be
32 defined before we include alpha.h, since it determines which macros
33 are used for GO_IF_*. */
35 #define NO_EXTERNAL_INDIRECT_ADDRESS
37 #define SUBTARGET_OS_CPP_BUILTINS() \
39 builtin_define ("__ALPHA"); \
40 if (TARGET_FLOAT_VAX) \
41 builtin_define ("__G_FLOAT"); \
43 builtin_define ("__IEEE_FLOAT"); \
46 #undef PCC_STATIC_STRUCT_RETURN
48 #define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
50 /* The maximum alignment 'malloc' honors. */
51 #undef MALLOC_ABI_ALIGNMENT
52 #define MALLOC_ABI_ALIGNMENT \
53 ((flag_vms_malloc64 && flag_vms_pointer_size != VMS_POINTER_SIZE_NONE \
54 ? 16 : 8) * BITS_PER_UNIT)
56 #undef FIXED_REGISTERS
57 #define FIXED_REGISTERS \
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, 1, 1, 1, 1, 1, 1, \
60 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
61 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
63 #undef CALL_USED_REGISTERS
64 #define CALL_USED_REGISTERS \
65 {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
66 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
67 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
68 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
70 /* List the order in which to allocate registers. Each register must be
71 listed once, even those in FIXED_REGISTERS.
73 We allocate in the following order:
74 $f1 (nonsaved floating-point register)
77 $f21-$f16 (likewise, but input args)
78 $f0 (nonsaved, but return value)
79 $f2-$f9 (saved floating-point registers)
80 $1 (nonsaved integer registers)
83 $0 (likewise, but return value)
84 $21-$16 (likewise, but input args)
85 $27 (procedure value in OSF, nonsaved in NT)
86 $2-$8 (saved integer registers)
87 $9-$14 (saved integer registers)
91 $30, $31, $f31 (stack pointer and always zero/ap & fp) */
93 #undef REG_ALLOC_ORDER
94 #define REG_ALLOC_ORDER \
96 42, 43, 44, 45, 46, 47, \
97 54, 55, 56, 57, 58, 59, 60, 61, 62, \
98 53, 52, 51, 50, 49, 48, \
100 34, 35, 36, 37, 38, 39, 40, 41, \
105 21, 20, 19, 18, 17, 16, \
107 2, 3, 4, 5, 6, 7, 8, \
108 9, 10, 11, 12, 13, 14, \
114 #undef HARD_FRAME_POINTER_REGNUM
115 #define HARD_FRAME_POINTER_REGNUM 29
117 /* Define registers used by the epilogue and return instruction. */
119 #define EPILOGUE_USES(REGNO) ((REGNO) == 26 || (REGNO) == 29)
121 #undef INITIAL_ELIMINATION_OFFSET
122 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
123 ((OFFSET) = alpha_vms_initial_elimination_offset(FROM, TO))
126 /* Define a data type for recording info about an argument list
127 during the scan of that argument list. This data type should
128 hold all necessary information about the function itself
129 and about the args processed so far, enough to enable macros
130 such as FUNCTION_ARG to determine where the next arg should go.
132 On Alpha/VMS, this is a structure that contains the number of
133 arguments and, for each argument, the datatype of that argument.
135 The number of arguments is a number of words of arguments scanned so far.
136 Thus 6 or more means all following args should go on the stack. */
138 enum avms_arg_type
{I64
, FF
, FD
, FG
, FS
, FT
};
139 typedef struct {int num_args
; enum avms_arg_type atypes
[6];} avms_arg_info
;
141 #undef CUMULATIVE_ARGS
142 #define CUMULATIVE_ARGS avms_arg_info
144 /* Initialize a variable CUM of type CUMULATIVE_ARGS
145 for a call to a function whose data type is FNTYPE.
146 For a library call, FNTYPE is 0. */
148 #undef INIT_CUMULATIVE_ARGS
149 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
150 (CUM).num_args = 0; \
151 (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \
152 (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
154 #define DEFAULT_PCC_STRUCT_RETURN 0
156 /* Even though pointers are 64bits, only 32bit ever remain significant in code
158 #define MASK_RETURN_ADDR \
159 (flag_vms_pointer_size == VMS_POINTER_SIZE_NONE \
161 : GEN_INT (0xffffffff))
163 #undef ASM_WEAKEN_LABEL
164 #define ASM_WEAKEN_LABEL(FILE, NAME) \
165 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
166 fputc ('\n', FILE); } while (0)
168 #define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
169 #define CTORS_SECTION_ASM_OP "\t.ctors"
170 #define DTORS_SECTION_ASM_OP "\t.dtors"
171 #define SDATA_SECTION_ASM_OP "\t.sdata"
172 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
173 asm (SECTION_OP "\n\t.long " #FUNC"\n");
175 #undef ASM_OUTPUT_ADDR_DIFF_ELT
177 #undef ASM_OUTPUT_ADDR_VEC_ELT
178 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
179 fprintf (FILE, "\t.quad $L%d\n", (VALUE))
181 #undef CASE_VECTOR_MODE
182 #define CASE_VECTOR_MODE DImode
183 #undef CASE_VECTOR_PC_RELATIVE
185 #undef ASM_OUTPUT_CASE_LABEL
186 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
187 { ASM_OUTPUT_ALIGN (FILE, 3); (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); }
189 /* This says how to output assembler code to declare an
190 uninitialized external linkage data object. */
192 #define COMMON_ASM_OP "\t.comm\t"
194 #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
195 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
196 vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
198 /* Control how constructors and destructors are emitted. */
199 #define TARGET_ASM_CONSTRUCTOR vms_asm_out_constructor
200 #define TARGET_ASM_DESTRUCTOR vms_asm_out_destructor
202 #define DWARF2_DEBUGGING_INFO 1
203 #define VMS_DEBUGGING_INFO 1
205 #define DWARF2_UNWIND_INFO 1
207 #undef EH_RETURN_HANDLER_RTX
208 #define EH_RETURN_HANDLER_RTX \
209 gen_rtx_MEM (Pmode, plus_constant (Pmode, stack_pointer_rtx, 8))
211 #define LINK_EH_SPEC "vms-dwarf2eh.o%s "
212 #define LINK_GCC_C_SEQUENCE_SPEC "%G"
214 /* This is how to output an assembler line
215 that says to advance the location counter
216 to a multiple of 2**LOG bytes. */
218 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
219 fprintf (FILE, "\t.align %d\n", LOG);
221 /* This is how to advance the location counter by SIZE bytes. */
223 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
224 fprintf (FILE, "\t.space "HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE))
226 /* This says how to output an assembler line
227 to define a global common symbol. */
229 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
230 ( fputs ("\t.lcomm ", (FILE)), \
231 assemble_name ((FILE), (NAME)), \
232 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)))
234 /* Switch into a generic section. */
235 #define TARGET_ASM_NAMED_SECTION vms_asm_named_section
237 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
240 fprintf ((FILE), "\t"); \
241 assemble_name (FILE, LABEL1); \
242 fprintf (FILE, " = "); \
243 assemble_name (FILE, LABEL2); \
244 fprintf (FILE, "\n"); \
248 #undef PREFERRED_DEBUGGING_TYPE
249 #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
251 #define ASM_PN_FORMAT "%s___%lu"
253 /* ??? VMS uses different linkage. */
254 #undef TARGET_ASM_OUTPUT_MI_THUNK
257 #undef ASM_FINAL_SPEC
259 /* The VMS convention is to always provide minimal debug info
260 for a traceback unless specifically overridden.
262 Because ASM_OUTPUT_ADDR_DIFF_ELT is not defined for alpha-vms,
263 jump tables cannot be output for PIC code, because you can't put
264 an absolute address in a readonly section. Putting the table in
265 a writable section is a security hole. Therefore, we unset the
266 flag_jump_tables flag, forcing switch statements to be expanded
267 using decision trees. There are probably other ways to address
268 this issue, but using a decision tree is clearly safe. */
270 #undef SUBTARGET_OVERRIDE_OPTIONS
271 #define SUBTARGET_OVERRIDE_OPTIONS \
273 if (write_symbols == NO_DEBUG \
274 && debug_info_level == DINFO_LEVEL_NONE) \
276 write_symbols = VMS_DEBUG; \
277 debug_info_level = DINFO_LEVEL_TERSE; \
280 flag_jump_tables = 0; \
285 /* GNU-ld built-in linker script already handles the dwarf2 debug sections. */
286 #define LINK_SPEC "%{shared} %{v}"
288 /* Link with vms-dwarf2.o if -g (except -g0). This causes the
289 VMS link to pull all the dwarf2 debug sections together. */
290 #define LINK_SPEC "%{g0} %{g*:-g vms-dwarf2.o%s} %{shared} %{v} %{map}"
293 #undef STARTFILE_SPEC
294 #define STARTFILE_SPEC "%{!shared:crt0.o%s crtbegin.o%s} \
295 %{!static:%{shared:crtbeginS.o%s}}"
297 #define ENDFILE_SPEC "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
299 #define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT"
301 #define LONGLONG_STANDALONE 1
303 #undef TARGET_VALID_POINTER_MODE
304 #define TARGET_VALID_POINTER_MODE vms_valid_pointer_mode
306 /* Default values for _CRTL_VER and _VMS_VER. */
307 #define VMS_DEFAULT_CRTL_VER 70320000
308 #define VMS_DEFAULT_VMS_VER 70320000