OSDN Git Service

Fix typo in last change.
[pf3gnuchains/gcc-fork.git] / gcc / config / alpha / vms.h
1 /* Output variables, constants and external declarations, for GNU compiler.
2    Copyright (C) 1996 Free Software Foundation, Inc.
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
68 #undef TARGET_DEFAULT
69 #define TARGET_DEFAULT (MASK_FP|MASK_FPREGS|MASK_GAS|MASK_OPEN_VMS)
70 #undef TARGET_NAME   
71 #define TARGET_NAME "OpenVMS/Alpha"
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
144 extern char *vmskrunch ();
145 #undef ENCODE_SECTION_INFO
146 #define ENCODE_SECTION_INFO(DECL)                               \
147 do {                                                            \
148   if (TREE_CODE (DECL) == FUNCTION_DECL && ! TREE_PUBLIC (DECL)) \
149     SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;            \
150                                                                 \
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));    \
156 } while (0)
157
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)                                                 \
162     {                                                                   \
163       if (! (NO_RTL))                                                   \
164         {                                                               \
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); \
178           else                                                          \
179             {                                                           \
180               int i;                                                    \
181               for (i = (CUM & 0xff); i < 6; i++)                        \
182                 emit_move_insn (                                        \
183                   gen_rtx (MEM, DFmode,                                 \
184                     plus_constant (virtual_incoming_args_rtx,           \
185                                    i * UNITS_PER_WORD)),                \
186                   gen_rtx (REG, DFmode, 48+i));                         \
187             }                                                           \
188          }                                                              \
189       PRETEND_SIZE = 12 * UNITS_PER_WORD;                               \
190     }                                                                   \
191 }
192
193 #undef ASM_DECLARE_FUNCTION_NAME
194 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL)       \
195 {                                                       \
196    alpha_function_name = vmskrunch (NAME);              \
197 }
198
199 #undef ASM_FILE_START
200 #define ASM_FILE_START(FILE)                                    \
201 {                                                               \
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);       \
206 }
207
208 #undef ASM_OUTPUT_FLOAT
209 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                    \
210   {                                                                     \
211     if (REAL_VALUE_ISINF (VALUE)                                        \
212         || REAL_VALUE_ISNAN (VALUE)                                     \
213         || REAL_VALUE_MINUS_ZERO (VALUE))                               \
214       {                                                                 \
215         long t;                                                         \
216         REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t);                       \
217         fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff);              \
218       }                                                                 \
219     else                                                                \
220       {                                                                 \
221         char str[30];                                                   \
222         REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str);                  \
223         fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'f':'s', str); \
224       }                                                                 \
225   }
226
227 #define LINK_SECTION_ASM_OP ".link"
228
229 #define READONLY_SECTION_ASM_OP ".rdata"
230
231 #undef EXTRA_SECTIONS
232 #define EXTRA_SECTIONS  in_link, in_rdata
233
234 #undef EXTRA_SECTION_FUNCTIONS
235 #define EXTRA_SECTION_FUNCTIONS                                 \
236 void                                                            \
237 readonly_section ()                                             \
238 {                                                               \
239   if (in_section != in_rdata)                           \
240     {                                                           \
241       fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP);  \
242       in_section = in_rdata;                            \
243     }                                                           \
244 }                                                               \
245 void                                                            \
246 link_section ()                                                 \
247 {                                                               \
248   if (in_section != in_link)                                    \
249     {                                                           \
250       fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP);      \
251       in_section = in_link;                                     \
252     }                                                           \
253 }
254
255 #undef ASM_OUTPUT_ADDR_DIFF_ELT
256 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) abort ()
257
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)
261
262 #undef READONLY_DATA_SECTION
263 #define READONLY_DATA_SECTION readonly_section
264
265 #define ASM_FILE_END(FILE) alpha_write_linkage (FILE);
266
267 #undef FUNCTION_ARG
268 void *function_arg ();
269 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED)    function_arg (&CUM, MODE, TYPE, NAMED)
270
271 #undef CASE_VECTOR_MODE
272 #define CASE_VECTOR_MODE DImode
273 #undef CASE_VECTOR_PC_RELATIVE
274
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); }
278
279 #define NO_MD_PROTOTYPES
280 /* Perform any needed actions needed for a function that is receiving a
281    variable number of arguments. 
282
283    CUM is as above.
284
285    MODE and TYPE are the mode and type of the current parameter.
286
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
289    it.
290
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. 
293
294    For VMS, we allocate space for all 6 arg registers plus a count.
295
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.   */
300    
301
302 #undef SETUP_INCOMING_VARARGS
303 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL)       \
304 { if ((CUM) < 6)                                        \
305     {                                                   \
306       if (! (NO_RTL))                                   \
307         {                                               \
308           emit_move_insn (gen_rtx (REG, DImode, 1),     \
309                           virtual_incoming_args_rtx);   \
310           emit_insn (gen_arg_home ());                  \
311         }                                               \
312                                                         \
313       PRETEND_SIZE = 7 * UNITS_PER_WORD;                \
314     }                                                   \
315 }
316 \f
317 /* Output assembler code for a block containing the constant parts
318    of a trampoline, leaving space for the variable parts.
319
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.  */
325
326 #undef TRAMPOLINE_TEMPLATE
327 #define TRAMPOLINE_TEMPLATE(FILE)               \
328 {                                               \
329   fprintf (FILE, "\t.quad 0\n");                \
330   fprintf (FILE, "\t.linkage __tramp\n");       \
331 }
332
333 /* Length in units of the trampoline for entering a nested function.  */
334
335 #undef TRAMPOLINE_SIZE
336 #define TRAMPOLINE_SIZE    24
337
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.  */
341
342 #undef INITIALIZE_TRAMPOLINE
343 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)                       \
344 {                                                                       \
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))), \
349                   (CXT));                                               \
350 }
351
352 #undef TRANSFER_FROM_TRAMPOLINE
353
354 #undef SDB_DEBUGGING_INFO
355 #undef MIPS_DEBUGGING_INFO
356
357 #ifndef DBX_DEBUGGING_INFO
358 #define DBX_DEBUGGING_INFO
359 #endif
360
361 #ifdef PREFERRED_DEBUGGING_TYPE
362 #undef PREFERRED_DEBUGGING_TYPE
363 #endif
364 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
365
366 #ifdef ASM_FORMAT_PRIVATE_NAME
367 #undef ASM_FORMAT_PRIVATE_NAME
368 #endif
369 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)  \
370 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12),    \
371   sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
372
373 #undef ASM_SPEC
374 #define ASM_SPEC "-nocpp %{pg}"
375
376 #undef ASM_FINAL_SPEC
377
378 #undef LIBGCC_SPEC
379 #define LIBGCC_SPEC "-lgcc2 -lgcclib"
380
381 #define OPTIMIZATION_OPTIONS                       \
382 {                                                  \
383    write_symbols = PREFERRED_DEBUGGING_TYPE;       \
384    debug_info_level = (enum debug_info_level) 2;   \
385 }
386
387 #undef OVERRIDE_OPTIONS
388 #define OVERRIDE_OPTIONS                           \
389 {                                                  \
390    if (write_symbols == NO_DEBUG)                  \
391      debug_info_level = (enum debug_info_level) 0; \
392    override_options ();                            \
393 }
394
395 #undef LINK_SPEC
396 #define LINK_SPEC "%{g3:-g3} %{g0:-g0}"
397
398 #undef STARTFILE_SPEC
399 #define STARTFILE_SPEC ""
400
401 #undef ENDFILE_SPEC
402 #define ENDFILE_SPEC "gnu_cc:[000000]crt0.obj"
403
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"