]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/alpha/vms.h
alpha-protos.h (vms_valid_decl_attribute_p): Delete.
[thirdparty/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 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 #define OPEN_VMS 1
22
23 #define TARGET_OBJECT_SUFFIX ".obj"
24 #define TARGET_EXECUTABLE_SUFFIX ".exe"
25
26 /* This enables certain macros in alpha.h, which will make an indirect
27 reference to an external symbol an invalid address. This needs to be
28 defined before we include alpha.h, since it determines which macros
29 are used for GO_IF_*. */
30
31 #define NO_EXTERNAL_INDIRECT_ADDRESS
32
33 #include "alpha/alpha.h"
34
35 #undef CPP_PREDEFINES
36 #define CPP_PREDEFINES \
37 "-D__ALPHA -Dvms -DVMS -D__vms__ -D__VMS__ -Asystem=vms"
38
39 #undef CPP_SUBTARGET_SPEC
40 #define CPP_SUBTARGET_SPEC "\
41 %{mfloat-ieee:-D__IEEE_FLOAT} \
42 %{mfloat-vax:-D__G_FLOAT} \
43 %{!mfloat-vax:-D__IEEE_FLOAT}"
44
45 /* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf. */
46
47 #define LIB_SPEC "%{p:-lprof1 -lpdf} %{pg:-lprof1 -lpdf} %{a:-lprof2} -lc"
48
49 /* Pass "-G 8" to ld because Alpha's CC does. Pass -O3 if we are
50 optimizing, -O1 if we are not. Pass -shared, -non_shared or
51 -call_shared as appropriate. Also pass -pg. */
52 #define LINK_SPEC \
53 "-G 8 %{O*:-O3} %{!O*:-O1} %{static:-non_shared} \
54 %{!static:%{shared:-shared} %{!shared:-call_shared}} %{pg} %{taso} \
55 %{rpath*}"
56
57 /* We allow $'s in identifiers unless -ansi is used .. */
58
59 #define DOLLARS_IN_IDENTIFIERS 2
60
61 /* These match the definitions used in DECCRTL, the VMS C run-time library
62
63 #define SIZE_TYPE "unsigned int"
64 #define PTRDIFF_TYPE "int"
65 */
66
67 /* By default, allow $ to be part of an identifier. */
68 #define DOLLARS_IN_IDENTIFIERS 2
69
70 #undef TARGET_DEFAULT
71 #define TARGET_DEFAULT (MASK_FP|MASK_FPREGS|MASK_GAS)
72 #undef TARGET_OPEN_VMS
73 #define TARGET_OPEN_VMS 1
74
75 #undef TARGET_NAME
76 #define TARGET_NAME "OpenVMS/Alpha"
77 #undef TARGET_VERSION
78 #define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
79
80 /* The structure return address arrives as an "argument" on VMS. */
81 #undef STRUCT_VALUE_REGNUM
82 #define STRUCT_VALUE 0
83 #undef PCC_STATIC_STRUCT_RETURN
84
85 /* no floating emulation. */
86 #undef REAL_ARITHMETIC
87
88 /* "long" is 32 bits. */
89 #undef LONG_TYPE_SIZE
90 #define LONG_TYPE_SIZE 32
91
92 /* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
93 #undef POINTER_SIZE
94 #define POINTER_SIZE 32
95 #define POINTERS_EXTEND_UNSIGNED 0
96
97 #define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
98
99 #undef FIXED_REGISTERS
100 #define FIXED_REGISTERS \
101 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
105
106 #undef CALL_USED_REGISTERS
107 #define CALL_USED_REGISTERS \
108 {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
109 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
110 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
111 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
112
113 #undef HARD_FRAME_POINTER_REGNUM
114 #define HARD_FRAME_POINTER_REGNUM 29
115
116 #undef CAN_ELIMINATE
117 #define CAN_ELIMINATE(FROM, TO) \
118 ((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ())
119
120 #undef INITIAL_ELIMINATION_OFFSET
121 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
122 { if ((FROM) == FRAME_POINTER_REGNUM) \
123 (OFFSET) = alpha_sa_size () + alpha_pv_save_size (); \
124 else if ((FROM) == ARG_POINTER_REGNUM) \
125 (OFFSET) = (ALPHA_ROUND (alpha_sa_size () + alpha_pv_save_size () \
126 + get_frame_size () \
127 + current_function_pretend_args_size) \
128 - current_function_pretend_args_size); \
129 if ((TO) == STACK_POINTER_REGNUM) \
130 (OFFSET) += ALPHA_ROUND (current_function_outgoing_args_size); \
131 }
132 \f
133 /* Define a data type for recording info about an argument list
134 during the scan of that argument list. This data type should
135 hold all necessary information about the function itself
136 and about the args processed so far, enough to enable macros
137 such as FUNCTION_ARG to determine where the next arg should go.
138
139 On Alpha/VMS, this is a structure that contains the number of
140 arguments and, for each argument, the datatype of that argument.
141
142 The number of arguments is a number of words of arguments scanned so far.
143 Thus 6 or more means all following args should go on the stack. */
144
145 enum avms_arg_type {I64, FF, FD, FG, FS, FT};
146 typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
147
148 #undef CUMULATIVE_ARGS
149 #define CUMULATIVE_ARGS avms_arg_info
150
151 /* Initialize a variable CUM of type CUMULATIVE_ARGS
152 for a call to a function whose data type is FNTYPE.
153 For a library call, FNTYPE is 0. */
154
155 #undef INIT_CUMULATIVE_ARGS
156 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
157 (CUM).num_args = 0; \
158 (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \
159 (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
160
161 #undef FUNCTION_ARG_ADVANCE
162 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
163 if (MUST_PASS_IN_STACK (MODE, TYPE)) \
164 (CUM).num_args += 6; \
165 else \
166 { \
167 if ((CUM).num_args < 6) \
168 (CUM).atypes[(CUM).num_args] = alpha_arg_type (MODE); \
169 \
170 (CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED); \
171 }
172
173 /* For an arg passed partly in registers and partly in memory,
174 this is the number of registers used.
175 For args passed entirely in registers or entirely in memory, zero. */
176
177 #undef FUNCTION_ARG_PARTIAL_NREGS
178 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
179 ((CUM).num_args < 6 && 6 < (CUM).num_args \
180 + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
181 ? 6 - (CUM).num_args : 0)
182
183 /* Perform any needed actions needed for a function that is receiving a
184 variable number of arguments.
185
186 CUM is as for INIT_CUMULATIVE_ARGS.
187
188 MODE and TYPE are the mode and type of the current parameter.
189
190 PRETEND_SIZE is a variable that should be set to the amount of stack
191 that must be pushed by the prolog to pretend that our caller pushed
192 it.
193
194 Normally, this macro will push all remaining incoming registers on the
195 stack and set PRETEND_SIZE to the length of the registers pushed.
196
197 For VMS, we allocate space for all 6 arg registers plus a count.
198
199 However, if NO registers need to be saved, don't allocate any space.
200 This is not only because we won't need the space, but because AP includes
201 the current_pretend_args_size and we don't want to mess up any
202 ap-relative addresses already made. */
203
204 #undef SETUP_INCOMING_VARARGS
205 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
206 { if ((CUM).num_args < 6) \
207 { \
208 if (! (NO_RTL)) \
209 { \
210 emit_move_insn (gen_rtx_REG (DImode, 1), \
211 virtual_incoming_args_rtx); \
212 emit_insn (gen_arg_home ()); \
213 } \
214 \
215 PRETEND_SIZE = 7 * UNITS_PER_WORD; \
216 } \
217 }
218
219 #undef ASM_FILE_START
220 #define ASM_FILE_START(FILE) \
221 { \
222 alpha_write_verstamp (FILE); \
223 fprintf (FILE, "\t.set noreorder\n"); \
224 fprintf (FILE, "\t.set volatile\n"); \
225 ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \
226 }
227
228 #undef ASM_OUTPUT_FLOAT
229 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
230 { \
231 if (REAL_VALUE_ISINF (VALUE) \
232 || REAL_VALUE_ISNAN (VALUE) \
233 || REAL_VALUE_MINUS_ZERO (VALUE)) \
234 { \
235 long t; \
236 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
237 fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
238 } \
239 else \
240 { \
241 char str[30]; \
242 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
243 fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'f':'s', str); \
244 } \
245 }
246
247 #define LINK_SECTION_ASM_OP "\t.link"
248 #define READONLY_SECTION_ASM_OP "\t.rdata"
249 #define LITERALS_SECTION_ASM_OP "\t.literals"
250 #define CTORS_SECTION_ASM_OP "\t.ctors"
251 #define DTORS_SECTION_ASM_OP "\t.dtors"
252
253 #undef EXTRA_SECTIONS
254 #define EXTRA_SECTIONS in_link, in_rdata, in_literals, in_ctors, in_dtors
255
256 #undef EXTRA_SECTION_FUNCTIONS
257 #define EXTRA_SECTION_FUNCTIONS \
258 void \
259 readonly_section () \
260 { \
261 if (in_section != in_rdata) \
262 { \
263 fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \
264 in_section = in_rdata; \
265 } \
266 } \
267 void \
268 link_section () \
269 { \
270 if (in_section != in_link) \
271 { \
272 fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP); \
273 in_section = in_link; \
274 } \
275 } \
276 void \
277 literals_section () \
278 { \
279 if (in_section != in_literals) \
280 { \
281 fprintf (asm_out_file, "%s\n", LITERALS_SECTION_ASM_OP); \
282 in_section = in_literals; \
283 } \
284 } \
285 void \
286 ctors_section () \
287 { \
288 if (in_section != in_ctors) \
289 { \
290 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
291 in_section = in_ctors; \
292 } \
293 } \
294 void \
295 dtors_section () \
296 { \
297 if (in_section != in_dtors) \
298 { \
299 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
300 in_section = in_dtors; \
301 } \
302 }
303
304 extern void readonly_section PARAMS ((void));
305 extern void link_section PARAMS ((void));
306 extern void literals_section PARAMS ((void));
307 extern void ctors_section PARAMS ((void));
308 extern void dtors_section PARAMS ((void));
309
310 #undef ASM_OUTPUT_ADDR_DIFF_ELT
311 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) abort ()
312
313 #undef ASM_OUTPUT_ADDR_VEC_ELT
314 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
315 fprintf (FILE, "\t.quad $L%d\n", (VALUE))
316
317 #undef READONLY_DATA_SECTION
318 #define READONLY_DATA_SECTION readonly_section
319
320 #define ASM_FILE_END(FILE) alpha_write_linkage (FILE);
321
322 #undef CASE_VECTOR_MODE
323 #define CASE_VECTOR_MODE DImode
324 #undef CASE_VECTOR_PC_RELATIVE
325
326 #undef ASM_OUTPUT_CASE_LABEL
327 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
328 { ASM_OUTPUT_ALIGN (FILE, 3); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
329
330 /* This says how to output assembler code to declare an
331 uninitialized external linkage data object. */
332
333 #define COMMON_ASM_OP "\t.comm\t"
334
335 #undef ASM_OUTPUT_ALIGNED_COMMON
336 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
337 do { \
338 fprintf ((FILE), "%s", COMMON_ASM_OP); \
339 assemble_name ((FILE), (NAME)); \
340 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
341 } while (0)
342
343 \f
344 /* Output assembler code for a block containing the constant parts
345 of a trampoline, leaving space for the variable parts.
346
347 The trampoline should set the static chain pointer to value placed
348 into the trampoline and should branch to the specified routine.
349 Note that $27 has been set to the address of the trampoline, so we can
350 use it for addressability of the two data items. Trampolines are always
351 aligned to FUNCTION_BOUNDARY, which is 64 bits. */
352
353 #undef TRAMPOLINE_TEMPLATE
354 #define TRAMPOLINE_TEMPLATE(FILE) \
355 { \
356 fprintf (FILE, "\t.quad 0\n"); \
357 fprintf (FILE, "\t.linkage __tramp\n"); \
358 fprintf (FILE, "\t.quad 0\n"); \
359 }
360
361 /* Length in units of the trampoline for entering a nested function. */
362
363 #undef TRAMPOLINE_SIZE
364 #define TRAMPOLINE_SIZE 32
365
366 /* Emit RTL insns to initialize the variable parts of a trampoline.
367 FNADDR is an RTX for the address of the function's pure code.
368 CXT is an RTX for the static chain value for the function. */
369
370 #undef INITIALIZE_TRAMPOLINE
371 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
372 alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, -1)
373
374 /* A C statement (sans semicolon) to output an element in the table of
375 global constructors. */
376 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
377 do { \
378 ctors_section (); \
379 fprintf (FILE, "\t.quad "); \
380 assemble_name (FILE, NAME); \
381 fprintf (FILE, "\n"); \
382 } while (0)
383
384 /* A C statement (sans semicolon) to output an element in the table of
385 global destructors. */
386 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
387 do { \
388 dtors_section (); \
389 fprintf (FILE, "\t.quad "); \
390 assemble_name (FILE, NAME); \
391 fprintf (FILE, "\n"); \
392 } while (0)
393
394 #undef SDB_DEBUGGING_INFO
395 #undef MIPS_DEBUGGING_INFO
396 #undef DBX_DEBUGGING_INFO
397
398 #define DWARF2_DEBUGGING_INFO
399
400 /* This is how to output an assembler line
401 that says to advance the location counter
402 to a multiple of 2**LOG bytes. */
403
404 #undef ASM_OUTPUT_ALIGN
405 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
406 fprintf (FILE, "\t.align %d\n", LOG);
407
408 #define ASM_OUTPUT_SECTION(FILE,SECTION) \
409 (strcmp (SECTION, ".text") == 0) \
410 ? text_section () \
411 : named_section (NULL_TREE, SECTION, 0), \
412 ASM_OUTPUT_ALIGN (FILE, 0) \
413
414 #define ASM_OUTPUT_SECTION_NAME(FILE,DECL,NAME,RELOC) \
415 do \
416 { \
417 const char *flags; \
418 int ovr = 0; \
419 if (DECL && DECL_MACHINE_ATTRIBUTES (DECL) \
420 && lookup_attribute \
421 ("overlaid", DECL_MACHINE_ATTRIBUTES (DECL))) \
422 flags = ",OVR", ovr = 1; \
423 else if (strncmp (NAME,".debug", 6) == 0) \
424 flags = ",NOWRT"; \
425 else \
426 flags = ""; \
427 fputc ('\n', (FILE)); \
428 fprintf (FILE, ".section\t%s%s\n", NAME, flags); \
429 if (ovr) \
430 (NAME) = ""; \
431 } while (0)
432
433 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
434 do { literals_section(); \
435 fprintf ((FILE), "\t"); \
436 assemble_name (FILE, LABEL1); \
437 fprintf (FILE, " = "); \
438 assemble_name (FILE, LABEL2); \
439 fprintf (FILE, "\n"); \
440 } while (0)
441
442 #undef PREFERRED_DEBUGGING_TYPE
443 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
444
445 #undef ASM_FORMAT_PRIVATE_NAME
446 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
447 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
448 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
449
450 /* ??? VMS uses different linkage. */
451 #undef ASM_OUTPUT_MI_THUNK
452
453 #undef ASM_SPEC
454 #undef ASM_FINAL_SPEC
455 #undef LINK_SPEC
456 #undef STARTFILE_SPEC
457 #define ASM_SPEC "-nocpp %{pg}"
458 #define LINK_SPEC "%{g3:-g3} %{g0:-g0} %{shared:-shared} %{v:-v}"
459
460 /* Define the names of the division and modulus functions. */
461 #define DIVSI3_LIBCALL "OTS$DIV_I"
462 #define DIVDI3_LIBCALL "OTS$DIV_L"
463 #define UDIVSI3_LIBCALL "OTS$DIV_UI"
464 #define UDIVDI3_LIBCALL "OTS$DIV_UL"
465 #define MODSI3_LIBCALL "OTS$REM_I"
466 #define MODDI3_LIBCALL "OTS$REM_L"
467 #define UMODSI3_LIBCALL "OTS$REM_UI"
468 #define UMODDI3_LIBCALL "OTS$REM_UL"
469
470 #define DIR_SEPARATOR ']'
471
472 #define PREFIX "GNU_ROOT:"
473
474 /* XXX Really? Even with modern CRTL? */
475 #define NEED_ATEXIT