OSDN Git Service

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