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