1 /* Output variables, constants and external declarations, for GNU compiler.
2 Copyright (C) 1996 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"
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. */
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)"
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}"
52 /* We allow $'s in identifiers unless -ansi is used .. */
54 #define DOLLARS_IN_IDENTIFIERS 2
56 /* These match the definitions used in DECCRTL, the VMS C run-time library
58 #define SIZE_TYPE "unsigned int"
59 #define PTRDIFF_TYPE "int"
62 /* Use memcpy for structure copying, and so forth. */
63 #define TARGET_MEM_FUNCTIONS
65 /* By default, allow $ to be part of an identifier. */
66 #define DOLLARS_IN_IDENTIFIERS 2
69 #define TARGET_DEFAULT (MASK_FP|MASK_FPREGS|MASK_GAS|MASK_OPEN_VMS)
71 #define TARGET_NAME "OpenVMS/Alpha"
73 #define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
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
80 /* no floating emulation. */
81 #undef REAL_ARITHMETIC
83 /* "long" is 32 bits. */
85 #define LONG_TYPE_SIZE 32
87 /* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
89 #define POINTER_SIZE 32
90 #define POINTERS_EXTEND_UNSIGNED 0
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 */
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 }
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 }
111 #undef HARD_FRAME_POINTER_REGNUM
112 #define HARD_FRAME_POINTER_REGNUM 29
115 #define CAN_ELIMINATE(FROM, TO) \
116 ((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ())
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); \
131 #undef FUNCTION_ARG_ADVANCE
132 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
133 if (MUST_PASS_IN_STACK (MODE, TYPE)) \
134 (CUM) = (CUM & ~0xff) + 6; \
136 (CUM) += ALPHA_ARG_SIZE (MODE, TYPE, NAMED)
138 #undef FUNCTION_ARG_PARTIAL_NREGS
139 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
140 ((CUM & 0xff) < 6 && 6 < (CUM & 0xff) \
141 + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
142 ? 6 - (CUM & 0xff) : 0)
144 extern char *vmskrunch ();
145 #undef ENCODE_SECTION_INFO
146 #define ENCODE_SECTION_INFO(DECL) \
148 if (TREE_CODE (DECL) == FUNCTION_DECL && ! TREE_PUBLIC (DECL)) \
149 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
151 if (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd' \
152 && GET_CODE (DECL_RTL (DECL)) == MEM \
153 && GET_CODE (XEXP (DECL_RTL (DECL), 0)) == SYMBOL_REF) \
154 XSTR (XEXP (DECL_RTL (DECL), 0), 0) \
155 = vmskrunch (XSTR (XEXP (DECL_RTL (DECL), 0), 0)); \
158 /* Don't use BLKmode if VAX floats are used. */
159 #undef SETUP_INCOMING_VARARGS
160 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
161 { if ((CUM & 0xff) < 6) \
165 move_block_from_reg \
166 (16 + (CUM & 0xff), \
167 gen_rtx (MEM, BLKmode, \
168 plus_constant (virtual_incoming_args_rtx, \
169 ((CUM & 0xff) + 6)* UNITS_PER_WORD)),\
170 6 - (CUM & 0xff), (6 - (CUM & 0xff)) * UNITS_PER_WORD); \
171 if (!TARGET_FLOAT_VAX || !TARGET_FPREGS) \
172 move_block_from_reg \
173 (16 + (TARGET_FPREGS ? 32 : 0) + (CUM & 0xff), \
174 gen_rtx (MEM, BLKmode, \
175 plus_constant (virtual_incoming_args_rtx, \
176 (CUM & 0xff) * UNITS_PER_WORD)),\
177 6 - (CUM & 0xff), (6 - (CUM & 0xff)) * UNITS_PER_WORD); \
181 for (i = (CUM & 0xff); i < 6; i++) \
183 gen_rtx (MEM, DFmode, \
184 plus_constant (virtual_incoming_args_rtx, \
185 i * UNITS_PER_WORD)), \
186 gen_rtx (REG, DFmode, 48+i)); \
189 PRETEND_SIZE = 12 * UNITS_PER_WORD; \
193 #undef ASM_DECLARE_FUNCTION_NAME
194 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
196 alpha_function_name = vmskrunch (NAME); \
199 #undef ASM_FILE_START
200 #define ASM_FILE_START(FILE) \
202 alpha_write_verstamp (FILE); \
203 fprintf (FILE, "\t.set noreorder\n"); \
204 fprintf (FILE, "\t.set volatile\n"); \
205 ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \
208 #undef ASM_OUTPUT_FLOAT
209 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
211 if (REAL_VALUE_ISINF (VALUE) \
212 || REAL_VALUE_ISNAN (VALUE) \
213 || REAL_VALUE_MINUS_ZERO (VALUE)) \
216 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
217 fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
222 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
223 fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'f':'s', str); \
227 #define LINK_SECTION_ASM_OP ".link"
229 #define READONLY_SECTION_ASM_OP ".rdata"
231 #undef EXTRA_SECTIONS
232 #define EXTRA_SECTIONS in_link, in_rdata
234 #undef EXTRA_SECTION_FUNCTIONS
235 #define EXTRA_SECTION_FUNCTIONS \
237 readonly_section () \
239 if (in_section != in_rdata) \
241 fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \
242 in_section = in_rdata; \
248 if (in_section != in_link) \
250 fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP); \
251 in_section = in_link; \
255 #undef ASM_OUTPUT_ADDR_DIFF_ELT
256 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) abort ()
258 #undef ASM_OUTPUT_ADDR_VEC_ELT
259 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
260 fprintf (FILE, "\t.quad $%d\n", (VALUE) + 32)
262 #undef READONLY_DATA_SECTION
263 #define READONLY_DATA_SECTION readonly_section
265 #define ASM_FILE_END(FILE) alpha_write_linkage (FILE);
268 void *function_arg ();
269 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) function_arg (&CUM, MODE, TYPE, NAMED)
271 #undef CASE_VECTOR_MODE
272 #define CASE_VECTOR_MODE DImode
273 #undef CASE_VECTOR_PC_RELATIVE
275 #undef ASM_OUTPUT_CASE_LABEL
276 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
277 { ASM_OUTPUT_ALIGN (FILE, 3); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
279 #define NO_MD_PROTOTYPES
280 /* Perform any needed actions needed for a function that is receiving a
281 variable number of arguments.
285 MODE and TYPE are the mode and type of the current parameter.
287 PRETEND_SIZE is a variable that should be set to the amount of stack
288 that must be pushed by the prolog to pretend that our caller pushed
291 Normally, this macro will push all remaining incoming registers on the
292 stack and set PRETEND_SIZE to the length of the registers pushed.
294 For VMS, we allocate space for all 6 arg registers plus a count.
296 However, if NO registers need to be saved, don't allocate any space.
297 This is not only because we won't need the space, but because AP includes
298 the current_pretend_args_size and we don't want to mess up any
299 ap-relative addresses already made. */
302 #undef SETUP_INCOMING_VARARGS
303 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
308 emit_move_insn (gen_rtx (REG, DImode, 1), \
309 virtual_incoming_args_rtx); \
310 emit_insn (gen_arg_home ()); \
313 PRETEND_SIZE = 7 * UNITS_PER_WORD; \
317 /* Output assembler code for a block containing the constant parts
318 of a trampoline, leaving space for the variable parts.
320 The trampoline should set the static chain pointer to value placed
321 into the trampoline and should branch to the specified routine.
322 Note that $27 has been set to the address of the trampoline, so we can
323 use it for addressability of the two data items. Trampolines are always
324 aligned to FUNCTION_BOUNDARY, which is 64 bits. */
326 #undef TRAMPOLINE_TEMPLATE
327 #define TRAMPOLINE_TEMPLATE(FILE) \
329 fprintf (FILE, "\t.quad 0\n"); \
330 fprintf (FILE, "\t.linkage __tramp\n"); \
333 /* Length in units of the trampoline for entering a nested function. */
335 #undef TRAMPOLINE_SIZE
336 #define TRAMPOLINE_SIZE 24
338 /* Emit RTL insns to initialize the variable parts of a trampoline.
339 FNADDR is an RTX for the address of the function's pure code.
340 CXT is an RTX for the static chain value for the function. */
342 #undef INITIALIZE_TRAMPOLINE
343 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
345 emit_move_insn (gen_rtx (MEM, Pmode, (TRAMP)), (FNADDR)); \
346 emit_move_insn (gen_rtx (MEM, Pmode, \
347 memory_address (Pmode, \
348 plus_constant ((TRAMP), 16))), \
352 #undef TRANSFER_FROM_TRAMPOLINE
354 #undef SDB_DEBUGGING_INFO
355 #undef MIPS_DEBUGGING_INFO
357 #ifndef DBX_DEBUGGING_INFO
358 #define DBX_DEBUGGING_INFO
361 #ifdef PREFERRED_DEBUGGING_TYPE
362 #undef PREFERRED_DEBUGGING_TYPE
364 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
366 #ifdef ASM_FORMAT_PRIVATE_NAME
367 #undef ASM_FORMAT_PRIVATE_NAME
369 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
370 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
371 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
374 #define ASM_SPEC "-nocpp %{pg}"
376 #undef ASM_FINAL_SPEC
379 #define LIBGCC_SPEC "-lgcc2 -lgcclib"
381 #define OPTIMIZATION_OPTIONS \
383 write_symbols = PREFERRED_DEBUGGING_TYPE; \
384 debug_info_level = (enum debug_info_level) 2; \
387 #undef OVERRIDE_OPTIONS
388 #define OVERRIDE_OPTIONS \
390 if (write_symbols == NO_DEBUG) \
391 debug_info_level = (enum debug_info_level) 0; \
392 override_options (); \
396 #define LINK_SPEC "%{g3:-g3} %{g0:-g0}"
398 #undef STARTFILE_SPEC
399 #define STARTFILE_SPEC ""
402 #define ENDFILE_SPEC "gnu_cc:[000000]crt0.obj"
404 /* Define the names of the division and modulus functions. */
405 #define DIVSI3_LIBCALL "ots$div_i"
406 #define DIVDI3_LIBCALL "ots$div_l"
407 #define UDIVSI3_LIBCALL "ots$div_ui"
408 #define UDIVDI3_LIBCALL "ots$div_ul"
409 #define MODSI3_LIBCALL "ots$mod_i"
410 #define MODDI3_LIBCALL "ots$mod_l"
411 #define UMODSI3_LIBCALL "ots$rem_ui"
412 #define UMODDI3_LIBCALL "ots$rem_ul"