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__alpha__ -D__alpha -D__vms__ -D__VMS__\
35 -Asystem(vms) -Acpu(alpha) -Amachine(alpha)"
39 %{mfloat-ieee:-D__IEEE_FLOAT} \
40 %{mfloat-vax:-D__G_FLOAT} \
41 %{!mfloat-vax:-D__IEEE_FLOAT} \
42 %{!.S: -D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}} \
43 %{.S: -D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
44 %{.cc: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
45 %{.cxx: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
46 %{.C: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
47 %{.m: -D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C}"
49 /* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf. */
51 #define LIB_SPEC "%{p:-lprof1 -lpdf} %{pg:-lprof1 -lpdf} %{a:-lprof2} -lc"
53 /* Pass "-G 8" to ld because Alpha's CC does. Pass -O3 if we are
54 optimizing, -O1 if we are not. Pass -shared, -non_shared or
55 -call_shared as appropriate. Also pass -pg. */
57 "-G 8 %{O*:-O3} %{!O*:-O1} %{static:-non_shared} \
58 %{!static:%{shared:-shared} %{!shared:-call_shared}} %{pg} %{taso} \
61 /* We allow $'s in identifiers unless -ansi is used .. */
63 #define DOLLARS_IN_IDENTIFIERS 2
65 /* These match the definitions used in DECCRTL, the VMS C run-time library
67 #define SIZE_TYPE "unsigned int"
68 #define PTRDIFF_TYPE "int"
71 /* Use memcpy for structure copying, and so forth. */
72 #define TARGET_MEM_FUNCTIONS
74 /* By default, allow $ to be part of an identifier. */
75 #define DOLLARS_IN_IDENTIFIERS 2
78 #define TARGET_DEFAULT (MASK_FP|MASK_FPREGS|MASK_GAS)
79 #undef TARGET_OPEN_VMS
80 #define TARGET_OPEN_VMS 1
83 #define TARGET_NAME "OpenVMS/Alpha"
85 #define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
87 /* The structure return address arrives as an "argument" on VMS. */
88 #undef STRUCT_VALUE_REGNUM
89 #define STRUCT_VALUE 0
90 #undef PCC_STATIC_STRUCT_RETURN
92 /* no floating emulation. */
93 #undef REAL_ARITHMETIC
95 /* "long" is 32 bits. */
97 #define LONG_TYPE_SIZE 32
99 /* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
101 #define POINTER_SIZE 32
102 #define POINTERS_EXTEND_UNSIGNED 0
104 #define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
106 #undef FIXED_REGISTERS
107 #define FIXED_REGISTERS \
108 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
113 #undef CALL_USED_REGISTERS
114 #define CALL_USED_REGISTERS \
115 {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
116 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
117 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
118 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
120 #undef HARD_FRAME_POINTER_REGNUM
121 #define HARD_FRAME_POINTER_REGNUM 29
124 #define CAN_ELIMINATE(FROM, TO) \
125 ((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ())
127 #undef INITIAL_ELIMINATION_OFFSET
128 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
129 { if ((FROM) == FRAME_POINTER_REGNUM) \
130 (OFFSET) = alpha_sa_size () + alpha_pv_save_size (); \
131 else if ((FROM) == ARG_POINTER_REGNUM) \
132 (OFFSET) = (ALPHA_ROUND (alpha_sa_size () + alpha_pv_save_size () \
133 + get_frame_size () \
134 + current_function_pretend_args_size) \
135 - current_function_pretend_args_size); \
136 if ((TO) == STACK_POINTER_REGNUM) \
137 (OFFSET) += ALPHA_ROUND (current_function_outgoing_args_size); \
140 /* Define a data type for recording info about an argument list
141 during the scan of that argument list. This data type should
142 hold all necessary information about the function itself
143 and about the args processed so far, enough to enable macros
144 such as FUNCTION_ARG to determine where the next arg should go.
146 On Alpha/VMS, this is a structure that contains the number of
147 arguments and, for each argument, the datatype of that argument.
149 The number of arguments is a number of words of arguments scanned so far.
150 Thus 6 or more means all following args should go on the stack. */
152 enum avms_arg_type {I64, FF, FD, FG, FS, FT};
153 typedef struct {char num_args; enum avms_arg_type atypes[6];} avms_arg_info;
155 #undef CUMULATIVE_ARGS
156 #define CUMULATIVE_ARGS avms_arg_info
158 /* Initialize a variable CUM of type CUMULATIVE_ARGS
159 for a call to a function whose data type is FNTYPE.
160 For a library call, FNTYPE is 0. */
162 #undef INIT_CUMULATIVE_ARGS
163 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
164 (CUM).num_args = 0; \
165 (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \
166 (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
168 /* Update the data in CUM to advance over an argument
169 of mode MODE and data type TYPE.
170 (TYPE is null for libcalls where that information may not be available.) */
172 extern enum avms_arg_type alpha_arg_type ();
174 /* Determine where to put an argument to a function.
175 Value is zero to push the argument on the stack,
176 or a hard register in which to store the argument.
178 MODE is the argument's machine mode (or VOIDmode for no more args).
179 TYPE is the data type of the argument (as a tree).
180 This is null for libcalls where that information may
182 CUM is a variable of type CUMULATIVE_ARGS which gives info about
183 the preceding args and about the function being called.
184 NAMED is nonzero if this argument is a named parameter
185 (otherwise it is an extra parameter matching an ellipsis).
187 On Alpha the first 6 words of args are normally in registers
188 and the rest are pushed. */
190 extern struct rtx_def *alpha_arg_info_reg_val ();
192 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
193 ((MODE) == VOIDmode ? alpha_arg_info_reg_val (CUM) \
194 : ((CUM.num_args) < 6 && ! MUST_PASS_IN_STACK (MODE, TYPE) \
195 ? gen_rtx(REG, (MODE), \
196 ((CUM).num_args + 16 \
198 && (GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \
199 || GET_MODE_CLASS (MODE) == MODE_FLOAT)) \
203 #undef FUNCTION_ARG_ADVANCE
204 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
205 if (MUST_PASS_IN_STACK (MODE, TYPE)) \
206 (CUM).num_args += 6; \
209 if ((CUM).num_args < 6) \
210 (CUM).atypes[(CUM).num_args] = alpha_arg_type (MODE); \
212 (CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED); \
215 /* For an arg passed partly in registers and partly in memory,
216 this is the number of registers used.
217 For args passed entirely in registers or entirely in memory, zero. */
219 #undef FUNCTION_ARG_PARTIAL_NREGS
220 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
221 ((CUM).num_args < 6 && 6 < (CUM).num_args \
222 + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
223 ? 6 - (CUM).num_args : 0)
225 /* Perform any needed actions needed for a function that is receiving a
226 variable number of arguments.
228 CUM is as for INIT_CUMULATIVE_ARGS.
230 MODE and TYPE are the mode and type of the current parameter.
232 PRETEND_SIZE is a variable that should be set to the amount of stack
233 that must be pushed by the prolog to pretend that our caller pushed
236 Normally, this macro will push all remaining incoming registers on the
237 stack and set PRETEND_SIZE to the length of the registers pushed.
239 For VMS, we allocate space for all 6 arg registers plus a count.
241 However, if NO registers need to be saved, don't allocate any space.
242 This is not only because we won't need the space, but because AP includes
243 the current_pretend_args_size and we don't want to mess up any
244 ap-relative addresses already made. */
246 #undef SETUP_INCOMING_VARARGS
247 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
248 { if ((CUM).num_args < 6) \
252 emit_move_insn (gen_rtx (REG, DImode, 1), \
253 virtual_incoming_args_rtx); \
254 emit_insn (gen_arg_home ()); \
257 PRETEND_SIZE = 7 * UNITS_PER_WORD; \
261 #undef ASM_FILE_START
262 #define ASM_FILE_START(FILE) \
264 alpha_write_verstamp (FILE); \
265 fprintf (FILE, "\t.set noreorder\n"); \
266 fprintf (FILE, "\t.set volatile\n"); \
267 ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \
270 #undef ASM_OUTPUT_FLOAT
271 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
273 if (REAL_VALUE_ISINF (VALUE) \
274 || REAL_VALUE_ISNAN (VALUE) \
275 || REAL_VALUE_MINUS_ZERO (VALUE)) \
278 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
279 fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
284 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
285 fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'f':'s', str); \
289 #define LINK_SECTION_ASM_OP ".link"
290 #define READONLY_SECTION_ASM_OP ".rdata"
291 #define LITERALS_SECTION_ASM_OP ".literals"
292 #define CTORS_SECTION_ASM_OP ".ctors"
293 #define DTORS_SECTION_ASM_OP ".dtors"
295 #undef EXTRA_SECTIONS
296 #define EXTRA_SECTIONS in_link, in_rdata, in_literals, in_ctors, in_dtors
298 #undef EXTRA_SECTION_FUNCTIONS
299 #define EXTRA_SECTION_FUNCTIONS \
301 readonly_section () \
303 if (in_section != in_rdata) \
305 fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \
306 in_section = in_rdata; \
312 if (in_section != in_link) \
314 fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP); \
315 in_section = in_link; \
319 literals_section () \
321 if (in_section != in_literals) \
323 fprintf (asm_out_file, "%s\n", LITERALS_SECTION_ASM_OP); \
324 in_section = in_literals; \
330 if (in_section != in_ctors) \
332 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
333 in_section = in_ctors; \
339 if (in_section != in_dtors) \
341 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
342 in_section = in_dtors; \
346 #undef ASM_OUTPUT_ADDR_DIFF_ELT
347 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) abort ()
349 #undef ASM_OUTPUT_ADDR_VEC_ELT
350 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
351 fprintf (FILE, "\t.quad $L%d\n", (VALUE))
353 #undef READONLY_DATA_SECTION
354 #define READONLY_DATA_SECTION readonly_section
356 #define ASM_FILE_END(FILE) alpha_write_linkage (FILE);
358 #undef CASE_VECTOR_MODE
359 #define CASE_VECTOR_MODE DImode
360 #undef CASE_VECTOR_PC_RELATIVE
362 #undef ASM_OUTPUT_CASE_LABEL
363 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
364 { ASM_OUTPUT_ALIGN (FILE, 3); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
366 /* This says how to output assembler code to declare an
367 uninitialized external linkage data object. */
369 #define COMMON_ASM_OP ".comm"
371 #undef ASM_OUTPUT_ALIGNED_COMMON
372 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
374 fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \
375 assemble_name ((FILE), (NAME)); \
376 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
379 #define NO_MD_PROTOTYPES
381 /* Output assembler code for a block containing the constant parts
382 of a trampoline, leaving space for the variable parts.
384 The trampoline should set the static chain pointer to value placed
385 into the trampoline and should branch to the specified routine.
386 Note that $27 has been set to the address of the trampoline, so we can
387 use it for addressability of the two data items. Trampolines are always
388 aligned to FUNCTION_BOUNDARY, which is 64 bits. */
390 #undef TRAMPOLINE_TEMPLATE
391 #define TRAMPOLINE_TEMPLATE(FILE) \
393 fprintf (FILE, "\t.quad 0\n"); \
394 fprintf (FILE, "\t.linkage __tramp\n"); \
395 fprintf (FILE, "\t.quad 0\n"); \
398 /* Length in units of the trampoline for entering a nested function. */
400 #undef TRAMPOLINE_SIZE
401 #define TRAMPOLINE_SIZE 32
403 /* Emit RTL insns to initialize the variable parts of a trampoline.
404 FNADDR is an RTX for the address of the function's pure code.
405 CXT is an RTX for the static chain value for the function. */
407 #undef INITIALIZE_TRAMPOLINE
408 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
410 emit_move_insn (gen_rtx (MEM, Pmode, \
411 memory_address (Pmode, \
412 plus_constant ((TRAMP), 16))), \
414 emit_move_insn (gen_rtx (MEM, Pmode, \
415 memory_address (Pmode, \
416 plus_constant ((TRAMP), 24))), \
420 #undef TRANSFER_FROM_TRAMPOLINE
422 /* A C statement (sans semicolon) to output an element in the table of
423 global constructors. */
424 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
427 fprintf (FILE, "\t.quad "); \
428 assemble_name (FILE, NAME); \
429 fprintf (FILE, "\n"); \
432 /* A C statement (sans semicolon) to output an element in the table of
433 global destructors. */
434 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
437 fprintf (FILE, "\t.quad "); \
438 assemble_name (FILE, NAME); \
439 fprintf (FILE, "\n"); \
442 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
443 (vms_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
444 extern int vms_valid_decl_attribute_p ();
446 #undef SDB_DEBUGGING_INFO
447 #undef MIPS_DEBUGGING_INFO
448 #undef DBX_DEBUGGING_INFO
450 #define DWARF2_DEBUGGING_INFO
452 /* This is how to output an assembler line
453 that says to advance the location counter
454 to a multiple of 2**LOG bytes. */
456 #undef ASM_OUTPUT_ALIGN
457 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
458 fprintf (FILE, "\t.align %d\n", LOG);
460 #define UNALIGNED_SHORT_ASM_OP ".word"
461 #define UNALIGNED_INT_ASM_OP ".long"
462 #define UNALIGNED_DOUBLE_INT_ASM_OP ".quad"
464 #define ASM_OUTPUT_SECTION(FILE,SECTION) \
465 (strcmp (SECTION, ".text") == 0) \
467 : named_section (NULL_TREE, SECTION, 0), \
468 ASM_OUTPUT_ALIGN (FILE, 0) \
470 #define ASM_OUTPUT_SECTION_NAME(FILE,DECL,NAME,RELOC) \
475 if (DECL && DECL_MACHINE_ATTRIBUTES (DECL) \
476 && lookup_attribute \
477 ("overlaid", DECL_MACHINE_ATTRIBUTES (DECL))) \
478 flags = ",OVR", ovr = 1; \
479 else if (strncmp (NAME,".debug", 6) == 0) \
483 fputc ('\n', (FILE)); \
484 fprintf (FILE, ".section\t%s%s\n", NAME, flags); \
489 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
490 do { literals_section(); \
491 fprintf ((FILE), "\t"); \
492 assemble_name (FILE, LABEL1); \
493 fprintf (FILE, " = "); \
494 assemble_name (FILE, LABEL2); \
495 fprintf (FILE, "\n"); \
498 #undef PREFERRED_DEBUGGING_TYPE
499 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
501 #undef ASM_FORMAT_PRIVATE_NAME
502 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
503 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
504 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
506 /* ??? VMS uses different linkage. */
507 #undef ASM_OUTPUT_MI_THUNK
510 #undef ASM_FINAL_SPEC
512 #undef STARTFILE_SPEC
513 #define ASM_SPEC "-nocpp %{pg}"
514 #define LINK_SPEC "%{g3:-g3} %{g0:-g0} %{shared:-shared} %{v:-v}"
516 /* Define the names of the division and modulus functions. */
517 #define DIVSI3_LIBCALL "OTS$DIV_I"
518 #define DIVDI3_LIBCALL "OTS$DIV_L"
519 #define UDIVSI3_LIBCALL "OTS$DIV_UI"
520 #define UDIVDI3_LIBCALL "OTS$DIV_UL"
521 #define MODSI3_LIBCALL "OTS$REM_I"
522 #define MODDI3_LIBCALL "OTS$REM_L"
523 #define UMODSI3_LIBCALL "OTS$REM_UI"
524 #define UMODDI3_LIBCALL "OTS$REM_UL"
526 #define DIR_SEPARATOR ']'
528 #define PREFIX "GNU_ROOT:"