]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/alpha/vms.h
Update mainline egcs to gcc2 snapshot 971021.
[thirdparty/gcc.git] / gcc / config / alpha / vms.h
CommitLineData
aacdb8bb 1/* Output variables, constants and external declarations, for GNU compiler.
c2ae5b5f 2 Copyright (C) 1996, 1997 Free Software Foundation, Inc.
aacdb8bb
RK
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
20
21#define OPEN_VMS 1
22
23/* This enables certain macros in alpha.h, which will make an indirect
24 reference to an external symbol an invalid address. This needs to be
25 defined before we include alpha.h, since it determines which macros
26 are used for GO_IF_*. */
27
28#define NO_EXTERNAL_INDIRECT_ADDRESS
29
30#include "alpha/alpha.h"
31
32/* Predefine this in CPP because VMS limits the size of command options
33 and GNU CPP is not used on VMS except with GNU C. */
34#undef CPP_PREDEFINES
35#define CPP_PREDEFINES \
36"-Dalpha -D__ALPHA -Dvms -DVMS -D__alpha__ -D__alpha -D__vms__ -D__VMS__\
37 -D__VMS_VER=70000022 \
38 -D__GNUC__=2 -D__GNUC_MINOR__=7 -Asystem(vms) -Acpu(alpha) -Amachine(alpha)"
39
40#undef CPP_SPEC
41#define CPP_SPEC "\
42%{mfloat-ieee:-D__IEEE_FLOAT} \
43%{mfloat-vax:-D__G_FLOAT} \
44%{!mfloat-vax:-D__IEEE_FLOAT} \
45%{!.S: -D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}} \
46%{.S: -D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
47%{.cc: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
48%{.cxx: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
49%{.C: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
50%{.m: -D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C}"
51
52/* We allow $'s in identifiers unless -ansi is used .. */
53
54#define DOLLARS_IN_IDENTIFIERS 2
55
56/* These match the definitions used in DECCRTL, the VMS C run-time library
57
58#define SIZE_TYPE "unsigned int"
59#define PTRDIFF_TYPE "int"
60*/
61
62/* Use memcpy for structure copying, and so forth. */
63#define TARGET_MEM_FUNCTIONS
64
65/* By default, allow $ to be part of an identifier. */
66#define DOLLARS_IN_IDENTIFIERS 2
67
aacdb8bb 68#undef TARGET_DEFAULT
2e645d88 69#define TARGET_DEFAULT (MASK_FP|MASK_FPREGS|MASK_GAS|MASK_OPEN_VMS)
aacdb8bb 70#undef TARGET_NAME
60814f40 71#define TARGET_NAME "OpenVMS/Alpha"
aacdb8bb
RK
72#undef TARGET_VERSION
73#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
74
75/* The structure return address arrives as an "argument" on VMS. */
76#undef STRUCT_VALUE_REGNUM
77#define STRUCT_VALUE 0
78#undef PCC_STATIC_STRUCT_RETURN
79
80/* no floating emulation. */
81#undef REAL_ARITHMETIC
82
83/* "long" is 32 bits. */
84#undef LONG_TYPE_SIZE
85#define LONG_TYPE_SIZE 32
86
87/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
88#undef POINTER_SIZE
89#define POINTER_SIZE 32
90#define POINTERS_EXTEND_UNSIGNED 0
91
92/* No data type wants to be aligned rounder than this. */
93#undef BIGGEST_ALIGNMENT
94#define BIGGEST_ALIGNMENT 128 /* X Complex */
95#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC 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#undef CAN_ELIMINATE
115#define CAN_ELIMINATE(FROM, TO) \
116((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ())
117
118#undef INITIAL_ELIMINATION_OFFSET
119#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
120{ if ((FROM) == FRAME_POINTER_REGNUM) \
121 (OFFSET) = alpha_sa_size () + alpha_pv_save_size (); \
122 else if ((FROM) == ARG_POINTER_REGNUM) \
123 (OFFSET) = (ALPHA_ROUND (alpha_sa_size () + alpha_pv_save_size () \
124 + get_frame_size () \
125 + current_function_pretend_args_size) \
126 - current_function_pretend_args_size); \
127 if ((TO) == STACK_POINTER_REGNUM) \
128 (OFFSET) += ALPHA_ROUND (current_function_outgoing_args_size); \
129}
e9a25f70
JL
130\f
131/* Define a data type for recording info about an argument list
132 during the scan of that argument list. This data type should
133 hold all necessary information about the function itself
134 and about the args processed so far, enough to enable macros
135 such as FUNCTION_ARG to determine where the next arg should go.
136
137 On Alpha/VMS, this is a structure that contains the number of
138 arguments and, for each argument, the datatype of that argument.
139
140 The number of arguments is a number of words of arguments scanned so far.
141 Thus 6 or more means all following args should go on the stack. */
142
143enum avms_arg_type {I64, FF, FD, FG, FS, FT};
144typedef struct {char num_args; enum avms_arg_type atypes[6];} avms_arg_info;
145
146#undef CUMULATIVE_ARGS
147#define CUMULATIVE_ARGS avms_arg_info
148
149/* Initialize a variable CUM of type CUMULATIVE_ARGS
150 for a call to a function whose data type is FNTYPE.
151 For a library call, FNTYPE is 0. */
152
153#undef INIT_CUMULATIVE_ARGS
154#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
155 (CUM).num_args = 0; \
156 (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \
157 (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
158
159/* Update the data in CUM to advance over an argument
160 of mode MODE and data type TYPE.
161 (TYPE is null for libcalls where that information may not be available.) */
162
163extern enum avms_arg_type alpha_arg_type ();
164
165/* Determine where to put an argument to a function.
166 Value is zero to push the argument on the stack,
167 or a hard register in which to store the argument.
168
169 MODE is the argument's machine mode (or VOIDmode for no more args).
170 TYPE is the data type of the argument (as a tree).
171 This is null for libcalls where that information may
172 not be available.
173 CUM is a variable of type CUMULATIVE_ARGS which gives info about
174 the preceding args and about the function being called.
175 NAMED is nonzero if this argument is a named parameter
176 (otherwise it is an extra parameter matching an ellipsis).
177
178 On Alpha the first 6 words of args are normally in registers
179 and the rest are pushed. */
180
181extern struct rtx_def *alpha_arg_info_reg_val ();
182#undef FUNCTION_ARG
183#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
184((MODE) == VOIDmode ? alpha_arg_info_reg_val (CUM) \
185 : ((CUM.num_args) < 6 && ! MUST_PASS_IN_STACK (MODE, TYPE) \
186 ? gen_rtx(REG, (MODE), \
187 ((CUM).num_args + 16 \
188 + ((TARGET_FPREGS \
189 && (GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \
190 || GET_MODE_CLASS (MODE) == MODE_FLOAT)) \
191 * 32))) \
192 : 0))
aacdb8bb
RK
193
194#undef FUNCTION_ARG_ADVANCE
195#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
196 if (MUST_PASS_IN_STACK (MODE, TYPE)) \
e9a25f70 197 (CUM).num_args += 6; \
aacdb8bb 198 else \
e9a25f70
JL
199 { \
200 if ((CUM).num_args < 6) \
201 (CUM).atypes[(CUM).num_args] = alpha_arg_type (MODE); \
202 \
203 (CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED); \
204 }
205
206/* For an arg passed partly in registers and partly in memory,
207 this is the number of registers used.
208 For args passed entirely in registers or entirely in memory, zero. */
aacdb8bb
RK
209
210#undef FUNCTION_ARG_PARTIAL_NREGS
211#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
e9a25f70 212((CUM).num_args < 6 && 6 < (CUM).num_args \
aacdb8bb 213 + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
e9a25f70
JL
214 ? 6 - (CUM).num_args : 0)
215
216#undef ENCODE_SECTION_INFO
217#define ENCODE_SECTION_INFO(DECL) \
218do { \
219 if (TREE_CODE (DECL) == FUNCTION_DECL && ! TREE_PUBLIC (DECL)) \
220 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
221} while (0)
aacdb8bb 222
73fef4fe
RK
223/* Perform any needed actions needed for a function that is receiving a
224 variable number of arguments.
225
226 CUM is as for INIT_CUMULATIVE_ARGS.
227
228 MODE and TYPE are the mode and type of the current parameter.
229
230 PRETEND_SIZE is a variable that should be set to the amount of stack
231 that must be pushed by the prolog to pretend that our caller pushed
232 it.
233
234 Normally, this macro will push all remaining incoming registers on the
235 stack and set PRETEND_SIZE to the length of the registers pushed.
236
237 For VMS, we allocate space for all 6 arg registers plus a count.
238
239 However, if NO registers need to be saved, don't allocate any space.
240 This is not only because we won't need the space, but because AP includes
241 the current_pretend_args_size and we don't want to mess up any
242 ap-relative addresses already made. */
243
aacdb8bb
RK
244#undef SETUP_INCOMING_VARARGS
245#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
e9a25f70 246{ if ((CUM).num_args < 6) \
73fef4fe
RK
247 { \
248 if (! (NO_RTL)) \
249 { \
250 emit_move_insn (gen_rtx (REG, DImode, 1), \
251 virtual_incoming_args_rtx); \
252 emit_insn (gen_arg_home ()); \
253 } \
254 \
255 PRETEND_SIZE = 7 * UNITS_PER_WORD; \
256 } \
aacdb8bb
RK
257}
258
aacdb8bb
RK
259#undef ASM_FILE_START
260#define ASM_FILE_START(FILE) \
261{ \
262 alpha_write_verstamp (FILE); \
263 fprintf (FILE, "\t.set noreorder\n"); \
264 fprintf (FILE, "\t.set volatile\n"); \
265 ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \
266}
267
268#undef ASM_OUTPUT_FLOAT
269#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
270 { \
271 if (REAL_VALUE_ISINF (VALUE) \
272 || REAL_VALUE_ISNAN (VALUE) \
273 || REAL_VALUE_MINUS_ZERO (VALUE)) \
274 { \
275 long t; \
276 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
277 fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
278 } \
279 else \
280 { \
281 char str[30]; \
282 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
283 fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'f':'s', str); \
284 } \
285 }
286
287#define LINK_SECTION_ASM_OP ".link"
aacdb8bb 288#define READONLY_SECTION_ASM_OP ".rdata"
e9a25f70 289#define LITERALS_SECTION_ASM_OP ".literals"
aacdb8bb
RK
290
291#undef EXTRA_SECTIONS
e9a25f70 292#define EXTRA_SECTIONS in_link, in_rdata, in_literals
aacdb8bb
RK
293
294#undef EXTRA_SECTION_FUNCTIONS
295#define EXTRA_SECTION_FUNCTIONS \
296void \
297readonly_section () \
298{ \
299 if (in_section != in_rdata) \
300 { \
301 fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \
302 in_section = in_rdata; \
303 } \
304} \
305void \
306link_section () \
307{ \
308 if (in_section != in_link) \
309 { \
310 fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP); \
311 in_section = in_link; \
312 } \
e9a25f70
JL
313} \
314void \
315literals_section () \
316{ \
317 if (in_section != in_literals) \
318 { \
319 fprintf (asm_out_file, "%s\n", LITERALS_SECTION_ASM_OP); \
320 in_section = in_literals; \
321 } \
aacdb8bb
RK
322}
323
324#undef ASM_OUTPUT_ADDR_DIFF_ELT
325#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) abort ()
326
327#undef ASM_OUTPUT_ADDR_VEC_ELT
328#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
329 fprintf (FILE, "\t.quad $%d\n", (VALUE) + 32)
330
331#undef READONLY_DATA_SECTION
332#define READONLY_DATA_SECTION readonly_section
333
334#define ASM_FILE_END(FILE) alpha_write_linkage (FILE);
335
aacdb8bb
RK
336#undef CASE_VECTOR_MODE
337#define CASE_VECTOR_MODE DImode
338#undef CASE_VECTOR_PC_RELATIVE
339
340#undef ASM_OUTPUT_CASE_LABEL
341#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
342{ ASM_OUTPUT_ALIGN (FILE, 3); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
343
344#define NO_MD_PROTOTYPES
aacdb8bb
RK
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"); \
e9a25f70 360 fprintf (FILE, "\t.quad 0\n"); \
aacdb8bb
RK
361}
362
363/* Length in units of the trampoline for entering a nested function. */
364
365#undef TRAMPOLINE_SIZE
e9a25f70 366#define TRAMPOLINE_SIZE 32
aacdb8bb
RK
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
e9a25f70
JL
373#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
374{ \
375 emit_move_insn (gen_rtx (MEM, Pmode, \
376 memory_address (Pmode, \
aacdb8bb 377 plus_constant ((TRAMP), 16))), \
e9a25f70
JL
378 (FNADDR)); \
379 emit_move_insn (gen_rtx (MEM, Pmode, \
380 memory_address (Pmode, \
381 plus_constant ((TRAMP), 24))), \
382 (CXT)); \
aacdb8bb
RK
383}
384
385#undef TRANSFER_FROM_TRAMPOLINE
386
e9a25f70
JL
387#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
388 (vms_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
389extern int vms_valid_decl_attribute_p ();
390
aacdb8bb
RK
391#undef SDB_DEBUGGING_INFO
392#undef MIPS_DEBUGGING_INFO
e9a25f70 393#undef DBX_DEBUGGING_INFO
aacdb8bb 394
388320a5
RK
395#define DWARF2_DEBUGGING_INFO
396
e9a25f70
JL
397/* This is how to output an assembler line
398 that says to advance the location counter
399 to a multiple of 2**LOG bytes. */
400
401#undef ASM_OUTPUT_ALIGN
402#define ASM_OUTPUT_ALIGN(FILE,LOG) \
403 fprintf (FILE, "\t.align %d\n", LOG);
404
405#define UNALIGNED_SHORT_ASM_OP ".word"
406#define UNALIGNED_INT_ASM_OP ".long"
407#define UNALIGNED_DOUBLE_INT_ASM_OP ".quad"
408
409#undef ASM_OUTPUT_ALIGNED_COMMON
410#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
411do { \
412 fprintf ((FILE), "\t.comm\t"); \
413 assemble_name ((FILE), (NAME)); \
414 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
415} while (0)
416
417#define ASM_OUTPUT_SECTION(FILE,SECTION) \
418 (strcmp (SECTION, ".text") == 0) \
419 ? text_section () \
420 : named_section (NULL_TREE, SECTION, 0), \
421 ASM_OUTPUT_ALIGN (FILE, 0) \
422
423#define ASM_OUTPUT_SECTION_NAME(FILE,DECL,NAME,RELOC) \
424 do \
425 { \
426 char *flags; \
427 int ovr = 0; \
428 if (DECL && DECL_MACHINE_ATTRIBUTES (DECL) \
429 && lookup_attribute \
430 ("overlaid", DECL_MACHINE_ATTRIBUTES (DECL))) \
431 flags = ",OVR", ovr = 1; \
432 else if (strncmp (NAME,".debug", 6) == 0) \
433 flags = ",NOWRT"; \
434 else \
435 flags = ""; \
436 fputc ('\n', (FILE)); \
437 fprintf (FILE, ".section\t%s%s\n", NAME, flags); \
438 if (ovr) \
439 (NAME) = ""; \
440 } while (0)
441
442#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
443 do { literals_section(); \
444 fprintf ((FILE), "\t"); \
445 assemble_name (FILE, LABEL1); \
446 fprintf (FILE, " = "); \
447 assemble_name (FILE, LABEL2); \
448 fprintf (FILE, "\n"); \
449 } while (0)
450
aacdb8bb 451#undef PREFERRED_DEBUGGING_TYPE
e9a25f70 452#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
aacdb8bb 453
aacdb8bb 454#undef ASM_FORMAT_PRIVATE_NAME
aacdb8bb
RK
455#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
456( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
457 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
458
459#undef ASM_SPEC
460#define ASM_SPEC "-nocpp %{pg}"
461
462#undef ASM_FINAL_SPEC
463
aacdb8bb
RK
464#define OPTIMIZATION_OPTIONS \
465{ \
466 write_symbols = PREFERRED_DEBUGGING_TYPE; \
467 debug_info_level = (enum debug_info_level) 2; \
468}
469
470#undef OVERRIDE_OPTIONS
471#define OVERRIDE_OPTIONS \
472{ \
473 if (write_symbols == NO_DEBUG) \
474 debug_info_level = (enum debug_info_level) 0; \
475 override_options (); \
476}
477
478#undef LINK_SPEC
e9a25f70 479#define LINK_SPEC "%{g3:-g3} %{g0:-g0} %{shared:-shared} %{v:-v}"
aacdb8bb
RK
480
481#undef STARTFILE_SPEC
aacdb8bb
RK
482
483/* Define the names of the division and modulus functions. */
3a133c72
KK
484#define DIVSI3_LIBCALL "OTS$DIV_I"
485#define DIVDI3_LIBCALL "OTS$DIV_L"
486#define UDIVSI3_LIBCALL "OTS$DIV_UI"
487#define UDIVDI3_LIBCALL "OTS$DIV_UL"
488#define MODSI3_LIBCALL "OTS$REM_I"
489#define MODDI3_LIBCALL "OTS$REM_L"
490#define UMODSI3_LIBCALL "OTS$REM_UI"
491#define UMODDI3_LIBCALL "OTS$REM_UL"