1 /* Output variables, constants and external declarations, for GNU compiler.
2 Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
4 This file is part of GNU CC.
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)
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.
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. */
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_*. */
28 #define NO_EXTERNAL_INDIRECT_ADDRESS
30 #include "alpha/alpha.h"
33 #define CPP_PREDEFINES \
34 "-D__ALPHA -Dvms -DVMS -D__vms__ -D__VMS__ -Asystem(vms)"
36 #undef CPP_SUBTARGET_SPEC
37 #define CPP_SUBTARGET_SPEC "\
38 %{mfloat-ieee:-D__IEEE_FLOAT} \
39 %{mfloat-vax:-D__G_FLOAT} \
40 %{!mfloat-vax:-D__IEEE_FLOAT}"
42 /* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf. */
44 #define LIB_SPEC "%{p:-lprof1 -lpdf} %{pg:-lprof1 -lpdf} %{a:-lprof2} -lc"
46 /* Pass "-G 8" to ld because Alpha's CC does. Pass -O3 if we are
47 optimizing, -O1 if we are not. Pass -shared, -non_shared or
48 -call_shared as appropriate. Also pass -pg. */
50 "-G 8 %{O*:-O3} %{!O*:-O1} %{static:-non_shared} \
51 %{!static:%{shared:-shared} %{!shared:-call_shared}} %{pg} %{taso} \
54 /* We allow $'s in identifiers unless -ansi is used .. */
56 #define DOLLARS_IN_IDENTIFIERS 2
58 /* These match the definitions used in DECCRTL, the VMS C run-time library
60 #define SIZE_TYPE "unsigned int"
61 #define PTRDIFF_TYPE "int"
64 /* Use memcpy for structure copying, and so forth. */
65 #define TARGET_MEM_FUNCTIONS
67 /* By default, allow $ to be part of an identifier. */
68 #define DOLLARS_IN_IDENTIFIERS 2
71 #define TARGET_DEFAULT (MASK_FP|MASK_FPREGS|MASK_GAS)
72 #undef TARGET_OPEN_VMS
73 #define TARGET_OPEN_VMS 1
76 #define TARGET_NAME "OpenVMS/Alpha"
78 #define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
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
85 /* no floating emulation. */
86 #undef REAL_ARITHMETIC
88 /* "long" is 32 bits. */
90 #define LONG_TYPE_SIZE 32
92 /* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
94 #define POINTER_SIZE 32
95 #define POINTERS_EXTEND_UNSIGNED 0
97 #define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
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 }
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 }
113 #undef HARD_FRAME_POINTER_REGNUM
114 #define HARD_FRAME_POINTER_REGNUM 29
117 #define CAN_ELIMINATE(FROM, TO) \
118 ((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ())
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); \
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.
139 On Alpha/VMS, this is a structure that contains the number of
140 arguments and, for each argument, the datatype of that argument.
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. */
145 enum avms_arg_type {I64, FF, FD, FG, FS, FT};
146 typedef struct {char num_args; enum avms_arg_type atypes[6];} avms_arg_info;
148 #undef CUMULATIVE_ARGS
149 #define CUMULATIVE_ARGS avms_arg_info
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. */
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;
161 /* Update the data in CUM to advance over an argument
162 of mode MODE and data type TYPE.
163 (TYPE is null for libcalls where that information may not be available.) */
165 extern enum avms_arg_type alpha_arg_type ();
167 /* Determine where to put an argument to a function.
168 Value is zero to push the argument on the stack,
169 or a hard register in which to store the argument.
171 MODE is the argument's machine mode (or VOIDmode for no more args).
172 TYPE is the data type of the argument (as a tree).
173 This is null for libcalls where that information may
175 CUM is a variable of type CUMULATIVE_ARGS which gives info about
176 the preceding args and about the function being called.
177 NAMED is nonzero if this argument is a named parameter
178 (otherwise it is an extra parameter matching an ellipsis).
180 On Alpha the first 6 words of args are normally in registers
181 and the rest are pushed. */
183 extern struct rtx_def *alpha_arg_info_reg_val ();
185 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
186 ((MODE) == VOIDmode ? alpha_arg_info_reg_val (CUM) \
187 : ((CUM.num_args) < 6 && ! MUST_PASS_IN_STACK (MODE, TYPE) \
188 ? gen_rtx(REG, (MODE), \
189 ((CUM).num_args + 16 \
191 && (GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \
192 || GET_MODE_CLASS (MODE) == MODE_FLOAT)) \
196 #undef FUNCTION_ARG_ADVANCE
197 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
198 if (MUST_PASS_IN_STACK (MODE, TYPE)) \
199 (CUM).num_args += 6; \
202 if ((CUM).num_args < 6) \
203 (CUM).atypes[(CUM).num_args] = alpha_arg_type (MODE); \
205 (CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED); \
208 /* For an arg passed partly in registers and partly in memory,
209 this is the number of registers used.
210 For args passed entirely in registers or entirely in memory, zero. */
212 #undef FUNCTION_ARG_PARTIAL_NREGS
213 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
214 ((CUM).num_args < 6 && 6 < (CUM).num_args \
215 + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
216 ? 6 - (CUM).num_args : 0)
218 /* Perform any needed actions needed for a function that is receiving a
219 variable number of arguments.
221 CUM is as for INIT_CUMULATIVE_ARGS.
223 MODE and TYPE are the mode and type of the current parameter.
225 PRETEND_SIZE is a variable that should be set to the amount of stack
226 that must be pushed by the prolog to pretend that our caller pushed
229 Normally, this macro will push all remaining incoming registers on the
230 stack and set PRETEND_SIZE to the length of the registers pushed.
232 For VMS, we allocate space for all 6 arg registers plus a count.
234 However, if NO registers need to be saved, don't allocate any space.
235 This is not only because we won't need the space, but because AP includes
236 the current_pretend_args_size and we don't want to mess up any
237 ap-relative addresses already made. */
239 #undef SETUP_INCOMING_VARARGS
240 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
241 { if ((CUM).num_args < 6) \
245 emit_move_insn (gen_rtx (REG, DImode, 1), \
246 virtual_incoming_args_rtx); \
247 emit_insn (gen_arg_home ()); \
250 PRETEND_SIZE = 7 * UNITS_PER_WORD; \
254 #undef ASM_FILE_START
255 #define ASM_FILE_START(FILE) \
257 alpha_write_verstamp (FILE); \
258 fprintf (FILE, "\t.set noreorder\n"); \
259 fprintf (FILE, "\t.set volatile\n"); \
260 ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \
263 #undef ASM_OUTPUT_FLOAT
264 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
266 if (REAL_VALUE_ISINF (VALUE) \
267 || REAL_VALUE_ISNAN (VALUE) \
268 || REAL_VALUE_MINUS_ZERO (VALUE)) \
271 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
272 fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
277 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
278 fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'f':'s', str); \
282 #define LINK_SECTION_ASM_OP ".link"
283 #define READONLY_SECTION_ASM_OP ".rdata"
284 #define LITERALS_SECTION_ASM_OP ".literals"
285 #define CTORS_SECTION_ASM_OP ".ctors"
286 #define DTORS_SECTION_ASM_OP ".dtors"
288 #undef EXTRA_SECTIONS
289 #define EXTRA_SECTIONS in_link, in_rdata, in_literals, in_ctors, in_dtors
291 #undef EXTRA_SECTION_FUNCTIONS
292 #define EXTRA_SECTION_FUNCTIONS \
294 readonly_section () \
296 if (in_section != in_rdata) \
298 fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \
299 in_section = in_rdata; \
305 if (in_section != in_link) \
307 fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP); \
308 in_section = in_link; \
312 literals_section () \
314 if (in_section != in_literals) \
316 fprintf (asm_out_file, "%s\n", LITERALS_SECTION_ASM_OP); \
317 in_section = in_literals; \
323 if (in_section != in_ctors) \
325 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
326 in_section = in_ctors; \
332 if (in_section != in_dtors) \
334 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
335 in_section = in_dtors; \
339 #undef ASM_OUTPUT_ADDR_DIFF_ELT
340 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) abort ()
342 #undef ASM_OUTPUT_ADDR_VEC_ELT
343 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
344 fprintf (FILE, "\t.quad $L%d\n", (VALUE))
346 #undef READONLY_DATA_SECTION
347 #define READONLY_DATA_SECTION readonly_section
349 #define ASM_FILE_END(FILE) alpha_write_linkage (FILE);
351 #undef CASE_VECTOR_MODE
352 #define CASE_VECTOR_MODE DImode
353 #undef CASE_VECTOR_PC_RELATIVE
355 #undef ASM_OUTPUT_CASE_LABEL
356 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
357 { ASM_OUTPUT_ALIGN (FILE, 3); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
359 /* This says how to output assembler code to declare an
360 uninitialized external linkage data object. */
362 #define COMMON_ASM_OP ".comm"
364 #undef ASM_OUTPUT_ALIGNED_COMMON
365 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
367 fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \
368 assemble_name ((FILE), (NAME)); \
369 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
372 #define NO_MD_PROTOTYPES
374 /* Output assembler code for a block containing the constant parts
375 of a trampoline, leaving space for the variable parts.
377 The trampoline should set the static chain pointer to value placed
378 into the trampoline and should branch to the specified routine.
379 Note that $27 has been set to the address of the trampoline, so we can
380 use it for addressability of the two data items. Trampolines are always
381 aligned to FUNCTION_BOUNDARY, which is 64 bits. */
383 #undef TRAMPOLINE_TEMPLATE
384 #define TRAMPOLINE_TEMPLATE(FILE) \
386 fprintf (FILE, "\t.quad 0\n"); \
387 fprintf (FILE, "\t.linkage __tramp\n"); \
388 fprintf (FILE, "\t.quad 0\n"); \
391 /* Length in units of the trampoline for entering a nested function. */
393 #undef TRAMPOLINE_SIZE
394 #define TRAMPOLINE_SIZE 32
396 /* Emit RTL insns to initialize the variable parts of a trampoline.
397 FNADDR is an RTX for the address of the function's pure code.
398 CXT is an RTX for the static chain value for the function. */
400 #undef INITIALIZE_TRAMPOLINE
401 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
402 alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, -1)
404 /* A C statement (sans semicolon) to output an element in the table of
405 global constructors. */
406 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
409 fprintf (FILE, "\t.quad "); \
410 assemble_name (FILE, NAME); \
411 fprintf (FILE, "\n"); \
414 /* A C statement (sans semicolon) to output an element in the table of
415 global destructors. */
416 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
419 fprintf (FILE, "\t.quad "); \
420 assemble_name (FILE, NAME); \
421 fprintf (FILE, "\n"); \
424 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
425 (vms_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
426 extern int vms_valid_decl_attribute_p ();
428 #undef SDB_DEBUGGING_INFO
429 #undef MIPS_DEBUGGING_INFO
430 #undef DBX_DEBUGGING_INFO
432 #define DWARF2_DEBUGGING_INFO
434 /* This is how to output an assembler line
435 that says to advance the location counter
436 to a multiple of 2**LOG bytes. */
438 #undef ASM_OUTPUT_ALIGN
439 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
440 fprintf (FILE, "\t.align %d\n", LOG);
442 #define ASM_OUTPUT_SECTION(FILE,SECTION) \
443 (strcmp (SECTION, ".text") == 0) \
445 : named_section (NULL_TREE, SECTION, 0), \
446 ASM_OUTPUT_ALIGN (FILE, 0) \
448 #define ASM_OUTPUT_SECTION_NAME(FILE,DECL,NAME,RELOC) \
453 if (DECL && DECL_MACHINE_ATTRIBUTES (DECL) \
454 && lookup_attribute \
455 ("overlaid", DECL_MACHINE_ATTRIBUTES (DECL))) \
456 flags = ",OVR", ovr = 1; \
457 else if (strncmp (NAME,".debug", 6) == 0) \
461 fputc ('\n', (FILE)); \
462 fprintf (FILE, ".section\t%s%s\n", NAME, flags); \
467 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
468 do { literals_section(); \
469 fprintf ((FILE), "\t"); \
470 assemble_name (FILE, LABEL1); \
471 fprintf (FILE, " = "); \
472 assemble_name (FILE, LABEL2); \
473 fprintf (FILE, "\n"); \
476 #undef PREFERRED_DEBUGGING_TYPE
477 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
479 #undef ASM_FORMAT_PRIVATE_NAME
480 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
481 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
482 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
484 /* ??? VMS uses different linkage. */
485 #undef ASM_OUTPUT_MI_THUNK
488 #undef ASM_FINAL_SPEC
490 #undef STARTFILE_SPEC
491 #define ASM_SPEC "-nocpp %{pg}"
492 #define LINK_SPEC "%{g3:-g3} %{g0:-g0} %{shared:-shared} %{v:-v}"
494 /* Define the names of the division and modulus functions. */
495 #define DIVSI3_LIBCALL "OTS$DIV_I"
496 #define DIVDI3_LIBCALL "OTS$DIV_L"
497 #define UDIVSI3_LIBCALL "OTS$DIV_UI"
498 #define UDIVDI3_LIBCALL "OTS$DIV_UL"
499 #define MODSI3_LIBCALL "OTS$REM_I"
500 #define MODDI3_LIBCALL "OTS$REM_L"
501 #define UMODSI3_LIBCALL "OTS$REM_UI"
502 #define UMODDI3_LIBCALL "OTS$REM_UL"
504 #define DIR_SEPARATOR ']'
506 #define PREFIX "GNU_ROOT:"