]>
Commit | Line | Data |
---|---|---|
aacdb8bb | 1 | /* Output variables, constants and external declarations, for GNU compiler. |
c2ae5b5f | 2 | Copyright (C) 1996, 1997 Free Software Foundation, Inc. |
aacdb8bb RK |
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 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 | } | |
130 | ||
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; \ | |
135 | else \ | |
136 | (CUM) += ALPHA_ARG_SIZE (MODE, TYPE, NAMED) | |
137 | ||
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) | |
143 | ||
73fef4fe RK |
144 | /* Perform any needed actions needed for a function that is receiving a |
145 | variable number of arguments. | |
146 | ||
147 | CUM is as for INIT_CUMULATIVE_ARGS. | |
148 | ||
149 | MODE and TYPE are the mode and type of the current parameter. | |
150 | ||
151 | PRETEND_SIZE is a variable that should be set to the amount of stack | |
152 | that must be pushed by the prolog to pretend that our caller pushed | |
153 | it. | |
154 | ||
155 | Normally, this macro will push all remaining incoming registers on the | |
156 | stack and set PRETEND_SIZE to the length of the registers pushed. | |
157 | ||
158 | For VMS, we allocate space for all 6 arg registers plus a count. | |
159 | ||
160 | However, if NO registers need to be saved, don't allocate any space. | |
161 | This is not only because we won't need the space, but because AP includes | |
162 | the current_pretend_args_size and we don't want to mess up any | |
163 | ap-relative addresses already made. */ | |
164 | ||
aacdb8bb RK |
165 | #undef SETUP_INCOMING_VARARGS |
166 | #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ | |
73fef4fe RK |
167 | { if ((CUM) < 6) \ |
168 | { \ | |
169 | if (! (NO_RTL)) \ | |
170 | { \ | |
171 | emit_move_insn (gen_rtx (REG, DImode, 1), \ | |
172 | virtual_incoming_args_rtx); \ | |
173 | emit_insn (gen_arg_home ()); \ | |
174 | } \ | |
175 | \ | |
176 | PRETEND_SIZE = 7 * UNITS_PER_WORD; \ | |
177 | } \ | |
aacdb8bb RK |
178 | } |
179 | ||
aacdb8bb RK |
180 | #undef ASM_FILE_START |
181 | #define ASM_FILE_START(FILE) \ | |
182 | { \ | |
183 | alpha_write_verstamp (FILE); \ | |
184 | fprintf (FILE, "\t.set noreorder\n"); \ | |
185 | fprintf (FILE, "\t.set volatile\n"); \ | |
186 | ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \ | |
187 | } | |
188 | ||
189 | #undef ASM_OUTPUT_FLOAT | |
190 | #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ | |
191 | { \ | |
192 | if (REAL_VALUE_ISINF (VALUE) \ | |
193 | || REAL_VALUE_ISNAN (VALUE) \ | |
194 | || REAL_VALUE_MINUS_ZERO (VALUE)) \ | |
195 | { \ | |
196 | long t; \ | |
197 | REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \ | |
198 | fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \ | |
199 | } \ | |
200 | else \ | |
201 | { \ | |
202 | char str[30]; \ | |
203 | REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \ | |
204 | fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'f':'s', str); \ | |
205 | } \ | |
206 | } | |
207 | ||
208 | #define LINK_SECTION_ASM_OP ".link" | |
209 | ||
210 | #define READONLY_SECTION_ASM_OP ".rdata" | |
211 | ||
212 | #undef EXTRA_SECTIONS | |
213 | #define EXTRA_SECTIONS in_link, in_rdata | |
214 | ||
215 | #undef EXTRA_SECTION_FUNCTIONS | |
216 | #define EXTRA_SECTION_FUNCTIONS \ | |
217 | void \ | |
218 | readonly_section () \ | |
219 | { \ | |
220 | if (in_section != in_rdata) \ | |
221 | { \ | |
222 | fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \ | |
223 | in_section = in_rdata; \ | |
224 | } \ | |
225 | } \ | |
226 | void \ | |
227 | link_section () \ | |
228 | { \ | |
229 | if (in_section != in_link) \ | |
230 | { \ | |
231 | fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP); \ | |
232 | in_section = in_link; \ | |
233 | } \ | |
234 | } | |
235 | ||
236 | #undef ASM_OUTPUT_ADDR_DIFF_ELT | |
237 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) abort () | |
238 | ||
239 | #undef ASM_OUTPUT_ADDR_VEC_ELT | |
240 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ | |
241 | fprintf (FILE, "\t.quad $%d\n", (VALUE) + 32) | |
242 | ||
243 | #undef READONLY_DATA_SECTION | |
244 | #define READONLY_DATA_SECTION readonly_section | |
245 | ||
246 | #define ASM_FILE_END(FILE) alpha_write_linkage (FILE); | |
247 | ||
248 | #undef FUNCTION_ARG | |
249 | void *function_arg (); | |
250 | #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) function_arg (&CUM, MODE, TYPE, NAMED) | |
251 | ||
252 | #undef CASE_VECTOR_MODE | |
253 | #define CASE_VECTOR_MODE DImode | |
254 | #undef CASE_VECTOR_PC_RELATIVE | |
255 | ||
256 | #undef ASM_OUTPUT_CASE_LABEL | |
257 | #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \ | |
258 | { ASM_OUTPUT_ALIGN (FILE, 3); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); } | |
259 | ||
260 | #define NO_MD_PROTOTYPES | |
aacdb8bb RK |
261 | \f |
262 | /* Output assembler code for a block containing the constant parts | |
263 | of a trampoline, leaving space for the variable parts. | |
264 | ||
265 | The trampoline should set the static chain pointer to value placed | |
266 | into the trampoline and should branch to the specified routine. | |
267 | Note that $27 has been set to the address of the trampoline, so we can | |
268 | use it for addressability of the two data items. Trampolines are always | |
269 | aligned to FUNCTION_BOUNDARY, which is 64 bits. */ | |
270 | ||
271 | #undef TRAMPOLINE_TEMPLATE | |
272 | #define TRAMPOLINE_TEMPLATE(FILE) \ | |
273 | { \ | |
274 | fprintf (FILE, "\t.quad 0\n"); \ | |
275 | fprintf (FILE, "\t.linkage __tramp\n"); \ | |
276 | } | |
277 | ||
278 | /* Length in units of the trampoline for entering a nested function. */ | |
279 | ||
280 | #undef TRAMPOLINE_SIZE | |
281 | #define TRAMPOLINE_SIZE 24 | |
282 | ||
283 | /* Emit RTL insns to initialize the variable parts of a trampoline. | |
284 | FNADDR is an RTX for the address of the function's pure code. | |
285 | CXT is an RTX for the static chain value for the function. */ | |
286 | ||
287 | #undef INITIALIZE_TRAMPOLINE | |
288 | #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ | |
289 | { \ | |
290 | emit_move_insn (gen_rtx (MEM, Pmode, (TRAMP)), (FNADDR)); \ | |
291 | emit_move_insn (gen_rtx (MEM, Pmode, \ | |
292 | memory_address (Pmode, \ | |
293 | plus_constant ((TRAMP), 16))), \ | |
294 | (CXT)); \ | |
295 | } | |
296 | ||
297 | #undef TRANSFER_FROM_TRAMPOLINE | |
298 | ||
299 | #undef SDB_DEBUGGING_INFO | |
300 | #undef MIPS_DEBUGGING_INFO | |
301 | ||
302 | #ifndef DBX_DEBUGGING_INFO | |
303 | #define DBX_DEBUGGING_INFO | |
304 | #endif | |
305 | ||
388320a5 RK |
306 | #define DWARF2_DEBUGGING_INFO |
307 | ||
aacdb8bb RK |
308 | #ifdef PREFERRED_DEBUGGING_TYPE |
309 | #undef PREFERRED_DEBUGGING_TYPE | |
310 | #endif | |
311 | #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG | |
312 | ||
313 | #ifdef ASM_FORMAT_PRIVATE_NAME | |
314 | #undef ASM_FORMAT_PRIVATE_NAME | |
315 | #endif | |
316 | #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ | |
317 | ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \ | |
318 | sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO))) | |
319 | ||
320 | #undef ASM_SPEC | |
321 | #define ASM_SPEC "-nocpp %{pg}" | |
322 | ||
323 | #undef ASM_FINAL_SPEC | |
324 | ||
325 | #undef LIBGCC_SPEC | |
326 | #define LIBGCC_SPEC "-lgcc2 -lgcclib" | |
327 | ||
328 | #define OPTIMIZATION_OPTIONS \ | |
329 | { \ | |
330 | write_symbols = PREFERRED_DEBUGGING_TYPE; \ | |
331 | debug_info_level = (enum debug_info_level) 2; \ | |
332 | } | |
333 | ||
334 | #undef OVERRIDE_OPTIONS | |
335 | #define OVERRIDE_OPTIONS \ | |
336 | { \ | |
337 | if (write_symbols == NO_DEBUG) \ | |
338 | debug_info_level = (enum debug_info_level) 0; \ | |
339 | override_options (); \ | |
340 | } | |
341 | ||
342 | #undef LINK_SPEC | |
343 | #define LINK_SPEC "%{g3:-g3} %{g0:-g0}" | |
344 | ||
345 | #undef STARTFILE_SPEC | |
346 | #define STARTFILE_SPEC "" | |
347 | ||
348 | #undef ENDFILE_SPEC | |
c2ae5b5f | 349 | #define ENDFILE_SPEC "gnu:[000000]crt0.obj" |
aacdb8bb RK |
350 | |
351 | /* Define the names of the division and modulus functions. */ | |
3a133c72 KK |
352 | #define DIVSI3_LIBCALL "OTS$DIV_I" |
353 | #define DIVDI3_LIBCALL "OTS$DIV_L" | |
354 | #define UDIVSI3_LIBCALL "OTS$DIV_UI" | |
355 | #define UDIVDI3_LIBCALL "OTS$DIV_UL" | |
356 | #define MODSI3_LIBCALL "OTS$REM_I" | |
357 | #define MODDI3_LIBCALL "OTS$REM_L" | |
358 | #define UMODSI3_LIBCALL "OTS$REM_UI" | |
359 | #define UMODDI3_LIBCALL "OTS$REM_UL" |