OSDN Git Service

2011-12-16 Tristan Gingold <gingold@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / alpha / vms.h
1 /* Output variables, constants and external declarations, for GNU compiler.
2    Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2004, 2005, 2007, 2008,
3    2009, 2010, 2011
4    Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 /* Alpha/VMS object format is not really Elf, but this makes compiling
23    crtstuff.c and dealing with shared library initialization much easier.  */
24 #define OBJECT_FORMAT_ELF
25
26 /* Do not use TM clone registry as it currently doesn't work.  Alpha/VMS
27    object is too far from ELF for supporting TM out of the box.  */
28 #define USE_TM_CLONE_REGISTRY 0
29
30 /* This enables certain macros in alpha.h, which will make an indirect
31    reference to an external symbol an invalid address.  This needs to be
32    defined before we include alpha.h, since it determines which macros
33    are used for GO_IF_*.  */
34
35 #define NO_EXTERNAL_INDIRECT_ADDRESS
36
37 #define SUBTARGET_OS_CPP_BUILTINS()             \
38     do {                                        \
39       builtin_define ("__ALPHA");               \
40       if (TARGET_FLOAT_VAX)                     \
41         builtin_define ("__G_FLOAT");           \
42       else                                      \
43         builtin_define ("__IEEE_FLOAT");        \
44     } while (0)
45
46 #undef TARGET_DEFAULT
47 #if POINTER_SIZE == 64
48 #define TARGET_DEFAULT (MASK_FPREGS | MASK_GAS | MASK_MALLOC64)
49 #else
50 #define TARGET_DEFAULT (MASK_FPREGS | MASK_GAS)
51 #endif
52
53 #define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
54
55 #undef PCC_STATIC_STRUCT_RETURN
56
57 #define MAX_OFILE_ALIGNMENT 524288  /* 8 x 2^16 by DEC Ada Test CD40VRA */
58
59 /* The maximum alignment 'malloc' honors.  */
60 #undef  MALLOC_ABI_ALIGNMENT
61 #define MALLOC_ABI_ALIGNMENT ((TARGET_MALLOC64 ? 16 : 8) * BITS_PER_UNIT)
62
63 #undef FIXED_REGISTERS
64 #define FIXED_REGISTERS  \
65  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
66   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
67   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
68   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
69
70 #undef CALL_USED_REGISTERS
71 #define CALL_USED_REGISTERS  \
72  {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
73   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
74   1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
75   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
76
77 /* List the order in which to allocate registers.  Each register must be
78    listed once, even those in FIXED_REGISTERS.
79
80    We allocate in the following order:
81    $f1                  (nonsaved floating-point register)
82    $f10-$f15            (likewise)
83    $f22-$f30            (likewise)
84    $f21-$f16            (likewise, but input args)
85    $f0                  (nonsaved, but return value)
86    $f2-$f9              (saved floating-point registers)
87    $1                   (nonsaved integer registers)
88    $22-$25              (likewise)
89    $28                  (likewise)
90    $0                   (likewise, but return value)
91    $21-$16              (likewise, but input args)
92    $27                  (procedure value in OSF, nonsaved in NT)
93    $2-$8                (saved integer registers)
94    $9-$14               (saved integer registers)
95    $26                  (return PC)
96    $15                  (frame pointer)
97    $29                  (global pointer)
98    $30, $31, $f31       (stack pointer and always zero/ap & fp)  */
99
100 #undef REG_ALLOC_ORDER
101 #define REG_ALLOC_ORDER         \
102   {33,                                  \
103    42, 43, 44, 45, 46, 47,              \
104    54, 55, 56, 57, 58, 59, 60, 61, 62,  \
105    53, 52, 51, 50, 49, 48,              \
106    32,                                  \
107    34, 35, 36, 37, 38, 39, 40, 41,      \
108    1,                                   \
109    22, 23, 24, 25,                      \
110    28,                                  \
111    0,                                   \
112    21, 20, 19, 18, 17, 16,              \
113    27,                                  \
114    2, 3, 4, 5, 6, 7, 8,                 \
115    9, 10, 11, 12, 13, 14,               \
116    26,                                  \
117    15,                                  \
118    29,                                  \
119    30, 31, 63 }
120
121 #undef HARD_FRAME_POINTER_REGNUM
122 #define HARD_FRAME_POINTER_REGNUM 29
123
124 /* Define registers used by the epilogue and return instruction.  */
125 #undef EPILOGUE_USES
126 #define EPILOGUE_USES(REGNO)    ((REGNO) == 26 || (REGNO) == 29)
127
128 #undef INITIAL_ELIMINATION_OFFSET
129 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)                    \
130   ((OFFSET) = alpha_vms_initial_elimination_offset(FROM, TO))
131
132 \f
133 /* Define a data type for recording info about an argument list
134    during the scan of that argument list.  This data type should
135    hold all necessary information about the function itself
136    and about the args processed so far, enough to enable macros
137    such as FUNCTION_ARG to determine where the next arg should go.
138
139    On Alpha/VMS, this is a structure that contains the number of
140    arguments and, for each argument, the datatype of that argument.
141
142    The number of arguments is a number of words of arguments scanned so far.
143    Thus 6 or more means all following args should go on the stack.  */
144
145 enum avms_arg_type {I64, FF, FD, FG, FS, FT};
146 typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
147
148 #undef CUMULATIVE_ARGS
149 #define CUMULATIVE_ARGS avms_arg_info
150
151 /* Initialize a variable CUM of type CUMULATIVE_ARGS
152    for a call to a function whose data type is FNTYPE.
153    For a library call, FNTYPE is 0.  */
154
155 #undef INIT_CUMULATIVE_ARGS
156 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
157   (CUM).num_args = 0;                                           \
158   (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64;    \
159   (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
160
161 #define DEFAULT_PCC_STRUCT_RETURN 0
162
163 #if POINTER_SIZE == 64
164 /* Eventhough pointers are 64bits, only 32bit ever remain significant in code
165    addresses.  */
166 #define MASK_RETURN_ADDR (GEN_INT (0xffffffff))
167 #endif
168
169 #undef  ASM_WEAKEN_LABEL
170 #define ASM_WEAKEN_LABEL(FILE, NAME)                            \
171    do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME);  \
172         fputc ('\n', FILE); } while (0)
173
174 #define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
175 #define CTORS_SECTION_ASM_OP "\t.ctors"
176 #define DTORS_SECTION_ASM_OP "\t.dtors"
177 #define SDATA_SECTION_ASM_OP "\t.sdata"
178 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)              \
179    asm (SECTION_OP "\n\t.long " #FUNC"\n");
180
181 #undef ASM_OUTPUT_ADDR_DIFF_ELT
182
183 #undef ASM_OUTPUT_ADDR_VEC_ELT
184 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
185   fprintf (FILE, "\t.quad $L%d\n", (VALUE))
186
187 #undef CASE_VECTOR_MODE
188 #define CASE_VECTOR_MODE DImode
189 #undef CASE_VECTOR_PC_RELATIVE
190
191 #undef ASM_OUTPUT_CASE_LABEL
192 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN)        \
193 { ASM_OUTPUT_ALIGN (FILE, 3); (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); }
194
195 /* This says how to output assembler code to declare an                
196    uninitialized external linkage data object.  */ 
197
198 #define COMMON_ASM_OP "\t.comm\t"
199
200 #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
201 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
202   vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
203 \f
204 /* Control how constructors and destructors are emitted.  */
205 #define TARGET_ASM_CONSTRUCTOR  vms_asm_out_constructor
206 #define TARGET_ASM_DESTRUCTOR   vms_asm_out_destructor
207
208 #undef SDB_DEBUGGING_INFO
209 #undef MIPS_DEBUGGING_INFO
210 #undef DBX_DEBUGGING_INFO
211
212 #define DWARF2_DEBUGGING_INFO 1
213 #define VMS_DEBUGGING_INFO 1
214
215 #define DWARF2_UNWIND_INFO 1
216
217 #undef EH_RETURN_HANDLER_RTX
218 #define EH_RETURN_HANDLER_RTX \
219   gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, 8))
220
221 #define LINK_EH_SPEC "vms-dwarf2eh.o%s "
222 #define LINK_GCC_C_SEQUENCE_SPEC "%G"
223
224 /* This is how to output an assembler line
225    that says to advance the location counter
226    to a multiple of 2**LOG bytes.  */
227
228 #undef ASM_OUTPUT_ALIGN
229 #define ASM_OUTPUT_ALIGN(FILE,LOG)      \
230     fprintf (FILE, "\t.align %d\n", LOG);
231
232 /* Switch into a generic section.  */
233 #define TARGET_ASM_NAMED_SECTION vms_asm_named_section
234
235 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)      \
236   do                                            \
237     {                                           \
238       fprintf ((FILE), "\t");                   \
239       assemble_name (FILE, LABEL1);             \
240       fprintf (FILE, " = ");                    \
241       assemble_name (FILE, LABEL2);             \
242       fprintf (FILE, "\n");                     \
243     }                                           \
244  while (0)
245
246 #undef PREFERRED_DEBUGGING_TYPE
247 #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
248
249 #define ASM_PN_FORMAT "%s___%lu"
250
251 /* ??? VMS uses different linkage.  */
252 #undef TARGET_ASM_OUTPUT_MI_THUNK
253
254 #undef ASM_SPEC
255 #undef ASM_FINAL_SPEC
256
257 /* The VMS convention is to always provide minimal debug info
258    for a traceback unless specifically overridden.  */
259
260 #undef SUBTARGET_OVERRIDE_OPTIONS
261 #define SUBTARGET_OVERRIDE_OPTIONS                  \
262 do {                                                \
263   if (write_symbols == NO_DEBUG                     \
264       && debug_info_level == DINFO_LEVEL_NONE)      \
265     {                                               \
266       write_symbols = VMS_DEBUG;                    \
267       debug_info_level = DINFO_LEVEL_TERSE;         \
268     }                                               \
269 } while (0)
270
271 #undef LINK_SPEC
272 #if HAVE_GNU_LD
273 /* GNU-ld built-in linker script already handles the dwarf2 debug sections.  */
274 #define LINK_SPEC "%{shared} %{v}"
275 #else
276 /* Link with vms-dwarf2.o if -g (except -g0). This causes the
277    VMS link to pull all the dwarf2 debug sections together.  */
278 #define LINK_SPEC "%{g:-g vms-dwarf2.o%s} %{g0} %{g1:-g1 vms-dwarf2.o%s} \
279 %{g2:-g2 vms-dwarf2.o%s} %{g3:-g3 vms-dwarf2.o%s} %{shared} %{v} %{map}"
280 #endif
281
282 #undef STARTFILE_SPEC
283 #define STARTFILE_SPEC \
284 "%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
285     crtbegin.o%s} \
286  %{!static:%{shared:crtbeginS.o%s}}"
287
288 #define ENDFILE_SPEC \
289 "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
290
291 #define NAME__MAIN "__gccmain"
292 #define SYMBOL__MAIN __gccmain
293
294 #define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT"
295
296 #define LONGLONG_STANDALONE 1
297
298 #undef TARGET_VALID_POINTER_MODE
299 #define TARGET_VALID_POINTER_MODE vms_valid_pointer_mode