]>
Commit | Line | Data |
---|---|---|
c6243b4c | 1 | /* Xstormy16 cpu description. |
595cac16 | 2 | Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 |
4b58290f GK |
3 | Free Software Foundation, Inc. |
4 | Contributed by Red Hat, Inc. | |
5 | ||
595cac16 | 6 | This file is part of GCC. |
4b58290f | 7 | |
595cac16 | 8 | GCC is free software; you can redistribute it and/or modify |
4b58290f GK |
9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2, or (at your option) | |
11 | any later version. | |
12 | ||
595cac16 | 13 | GCC is distributed in the hope that it will be useful, |
4b58290f GK |
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 | |
595cac16 | 19 | along with GCC; see the file COPYING. If not, write to |
4b58290f GK |
20 | the Free Software Foundation, 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. */ | |
22 | ||
4b58290f GK |
23 | \f |
24 | /* Driver configuration */ | |
25 | ||
d1552d7b | 26 | /* Defined in svr4.h. */ |
4b58290f | 27 | #undef ASM_SPEC |
322fe6e1 | 28 | #define ASM_SPEC "" |
4b58290f | 29 | |
d1552d7b | 30 | /* For xstormy16: |
3eaaf577 GK |
31 | - If -msim is specified, everything is built and linked as for the sim. |
32 | - If -T is specified, that linker script is used, and it should provide | |
33 | appropriate libraries. | |
34 | - If neither is specified, everything is built as for the sim, but no | |
35 | I/O support is assumed. | |
36 | ||
37 | */ | |
4b58290f | 38 | #undef LIB_SPEC |
3eaaf577 | 39 | #define LIB_SPEC "-( -lc %{msim:-lsim}%{!msim:%{!T*:-lnosys}} -)" |
4b58290f | 40 | |
d1552d7b | 41 | /* Defined in svr4.h. */ |
4b58290f GK |
42 | #undef STARTFILE_SPEC |
43 | #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s" | |
44 | ||
d1552d7b | 45 | /* Defined in svr4.h. */ |
4b58290f GK |
46 | #undef ENDFILE_SPEC |
47 | #define ENDFILE_SPEC "crtend.o%s crtn.o%s" | |
48 | ||
d1552d7b | 49 | /* Defined in svr4.h for host compilers. */ |
4b58290f GK |
50 | /* #define MD_EXEC_PREFIX "" */ |
51 | ||
d1552d7b | 52 | /* Defined in svr4.h for host compilers. */ |
4b58290f GK |
53 | /* #define MD_STARTFILE_PREFIX "" */ |
54 | ||
4b58290f GK |
55 | \f |
56 | /* Run-time target specifications */ | |
57 | ||
4555be98 NB |
58 | #define TARGET_CPU_CPP_BUILTINS() do { \ |
59 | builtin_define_std ("xstormy16"); \ | |
60 | builtin_assert ("machine=xstormy16"); \ | |
61 | } while (0) | |
4b58290f GK |
62 | |
63 | /* This declaration should be present. */ | |
64 | extern int target_flags; | |
65 | ||
4b58290f GK |
66 | #define TARGET_SWITCHES \ |
67 | {{ "sim", 0, "Provide libraries for the simulator" }, \ | |
68 | { "", 0, "" }} | |
69 | ||
c6243b4c | 70 | #define TARGET_VERSION fprintf (stderr, " (xstormy16 cpu core)"); |
4b58290f | 71 | |
4b58290f GK |
72 | #define CAN_DEBUG_WITHOUT_FP |
73 | ||
74 | \f | |
75 | /* Storage Layout */ | |
76 | ||
4b58290f GK |
77 | #define BITS_BIG_ENDIAN 1 |
78 | ||
4b58290f GK |
79 | #define BYTES_BIG_ENDIAN 0 |
80 | ||
4b58290f GK |
81 | #define WORDS_BIG_ENDIAN 0 |
82 | ||
4b58290f GK |
83 | #define UNITS_PER_WORD 2 |
84 | ||
4b58290f GK |
85 | #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \ |
86 | do { \ | |
87 | if (GET_MODE_CLASS (MODE) == MODE_INT \ | |
88 | && GET_MODE_SIZE (MODE) < 2) \ | |
89 | (MODE) = HImode; \ | |
90 | } while (0) | |
91 | ||
4b58290f GK |
92 | #define PROMOTE_FUNCTION_ARGS 1 |
93 | ||
4b58290f GK |
94 | #define PROMOTE_FUNCTION_RETURN 1 |
95 | ||
4b58290f GK |
96 | #define PARM_BOUNDARY 16 |
97 | ||
4b58290f GK |
98 | #define STACK_BOUNDARY 16 |
99 | ||
4b58290f GK |
100 | #define FUNCTION_BOUNDARY 16 |
101 | ||
4b58290f GK |
102 | #define BIGGEST_ALIGNMENT 16 |
103 | ||
d1552d7b | 104 | /* Defined in svr4.h. */ |
4b58290f GK |
105 | /* #define MAX_OFILE_ALIGNMENT */ |
106 | ||
4b58290f GK |
107 | #define DATA_ALIGNMENT(TYPE, ALIGN) \ |
108 | (TREE_CODE (TYPE) == ARRAY_TYPE \ | |
109 | && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ | |
110 | && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) | |
111 | ||
4b58290f GK |
112 | #define CONSTANT_ALIGNMENT(EXP, ALIGN) \ |
113 | (TREE_CODE (EXP) == STRING_CST \ | |
114 | && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) | |
115 | ||
4b58290f GK |
116 | #define STRICT_ALIGNMENT 1 |
117 | ||
d1552d7b | 118 | /* Defined in svr4.h. */ |
4b58290f | 119 | #define PCC_BITFIELD_TYPE_MATTERS 1 |
4b58290f GK |
120 | \f |
121 | /* Layout of Source Language Data Types */ | |
122 | ||
4b58290f GK |
123 | #define INT_TYPE_SIZE 16 |
124 | ||
4b58290f GK |
125 | #define SHORT_TYPE_SIZE 16 |
126 | ||
4b58290f GK |
127 | #define LONG_TYPE_SIZE 32 |
128 | ||
4b58290f GK |
129 | #define LONG_LONG_TYPE_SIZE 64 |
130 | ||
4b58290f GK |
131 | #define FLOAT_TYPE_SIZE 32 |
132 | ||
4b58290f GK |
133 | #define DOUBLE_TYPE_SIZE 64 |
134 | ||
4b58290f GK |
135 | #define LONG_DOUBLE_TYPE_SIZE 64 |
136 | ||
4b58290f GK |
137 | #define DEFAULT_SIGNED_CHAR 0 |
138 | ||
d1552d7b | 139 | /* Defined in svr4.h. */ |
4b58290f GK |
140 | #define SIZE_TYPE "unsigned int" |
141 | ||
d1552d7b | 142 | /* Defined in svr4.h. */ |
4b58290f GK |
143 | #define PTRDIFF_TYPE "int" |
144 | ||
d1552d7b | 145 | /* Defined in svr4.h, to "long int". */ |
4b58290f GK |
146 | /* #define WCHAR_TYPE "long int" */ |
147 | ||
d1552d7b | 148 | /* Defined in svr4.h. */ |
4b58290f GK |
149 | #undef WCHAR_TYPE_SIZE |
150 | #define WCHAR_TYPE_SIZE 32 | |
151 | ||
43a88a8c | 152 | /* Define this macro if the type of Objective-C selectors should be `int'. |
4b58290f GK |
153 | |
154 | If this macro is not defined, then selectors should have the type `struct | |
155 | objc_selector *'. */ | |
156 | /* #define OBJC_INT_SELECTORS */ | |
157 | ||
4b58290f GK |
158 | \f |
159 | /* Register Basics */ | |
160 | ||
4b58290f GK |
161 | #define FIRST_PSEUDO_REGISTER 19 |
162 | ||
4b58290f GK |
163 | #define FIXED_REGISTERS \ |
164 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1 } | |
165 | ||
4b58290f GK |
166 | #define CALL_USED_REGISTERS \ |
167 | { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1 } | |
168 | ||
4b58290f GK |
169 | \f |
170 | /* Order of allocation of registers */ | |
171 | ||
da6e254e | 172 | #define REG_ALLOC_ORDER { 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 10, 11, 12, 13, 14, 15, 16 } |
4b58290f | 173 | |
4b58290f GK |
174 | \f |
175 | /* How Values Fit in Registers */ | |
176 | ||
4b58290f GK |
177 | #define HARD_REGNO_NREGS(REGNO, MODE) \ |
178 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
179 | ||
4b58290f GK |
180 | #define HARD_REGNO_MODE_OK(REGNO, MODE) ((REGNO) != 16 || (MODE) == BImode) |
181 | ||
182 | /* A C expression that is nonzero if it is desirable to choose register | |
183 | allocation so as to avoid move instructions between a value of mode MODE1 | |
184 | and a value of mode MODE2. | |
185 | ||
186 | If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, MODE2)' are | |
187 | ever different for any R, then `MODES_TIEABLE_P (MODE1, MODE2)' must be | |
188 | zero. */ | |
189 | #define MODES_TIEABLE_P(MODE1, MODE2) ((MODE1) != BImode && (MODE2) != BImode) | |
190 | ||
4b58290f GK |
191 | \f |
192 | /* Register Classes */ | |
193 | ||
4b58290f GK |
194 | enum reg_class |
195 | { | |
196 | NO_REGS, | |
197 | R0_REGS, | |
198 | R1_REGS, | |
199 | TWO_REGS, | |
200 | R2_REGS, | |
201 | EIGHT_REGS, | |
202 | R8_REGS, | |
da6e254e | 203 | ICALL_REGS, |
4b58290f GK |
204 | GENERAL_REGS, |
205 | CARRY_REGS, | |
206 | ALL_REGS, | |
207 | LIM_REG_CLASSES | |
208 | }; | |
209 | ||
4b58290f GK |
210 | #define N_REG_CLASSES ((int) LIM_REG_CLASSES) |
211 | ||
4b58290f GK |
212 | #define REG_CLASS_NAMES \ |
213 | { \ | |
214 | "NO_REGS", \ | |
215 | "R0_REGS", \ | |
216 | "R1_REGS", \ | |
217 | "TWO_REGS", \ | |
218 | "R2_REGS", \ | |
219 | "EIGHT_REGS", \ | |
220 | "R8_REGS", \ | |
da6e254e | 221 | "ICALL_REGS", \ |
4b58290f GK |
222 | "GENERAL_REGS", \ |
223 | "CARRY_REGS", \ | |
224 | "ALL_REGS" \ | |
225 | } | |
226 | ||
4b58290f GK |
227 | #define REG_CLASS_CONTENTS \ |
228 | { \ | |
b3656137 KG |
229 | { 0x00000 }, \ |
230 | { 0x00001 }, \ | |
231 | { 0x00002 }, \ | |
232 | { 0x00003 }, \ | |
233 | { 0x00004 }, \ | |
234 | { 0x000FF }, \ | |
235 | { 0x00100 }, \ | |
236 | { 0x00300 }, \ | |
237 | { 0x6FFFF }, \ | |
238 | { 0x10000 }, \ | |
239 | { (1 << FIRST_PSEUDO_REGISTER) - 1 } \ | |
4b58290f GK |
240 | } |
241 | ||
4b58290f GK |
242 | #define REGNO_REG_CLASS(REGNO) \ |
243 | ((REGNO) == 0 ? R0_REGS \ | |
244 | : (REGNO) == 1 ? R1_REGS \ | |
245 | : (REGNO) == 2 ? R2_REGS \ | |
246 | : (REGNO) < 8 ? EIGHT_REGS \ | |
247 | : (REGNO) == 8 ? R8_REGS \ | |
248 | : (REGNO) == 16 ? CARRY_REGS \ | |
249 | : (REGNO) <= 18 ? GENERAL_REGS \ | |
250 | : ALL_REGS) | |
251 | ||
4b58290f GK |
252 | #define BASE_REG_CLASS GENERAL_REGS |
253 | ||
4b58290f GK |
254 | #define INDEX_REG_CLASS GENERAL_REGS |
255 | ||
595cac16 | 256 | /* The following letters are unavailable, due to being used as |
4b58290f GK |
257 | constraints: |
258 | '0'..'9' | |
259 | '<', '>' | |
260 | 'E', 'F', 'G', 'H' | |
261 | 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P' | |
262 | 'Q', 'R', 'S', 'T', 'U' | |
263 | 'V', 'X' | |
264 | 'g', 'i', 'm', 'n', 'o', 'p', 'r', 's' */ | |
265 | ||
266 | #define REG_CLASS_FROM_LETTER(CHAR) \ | |
267 | ( (CHAR) == 'a' ? R0_REGS \ | |
268 | : (CHAR) == 'b' ? R1_REGS \ | |
269 | : (CHAR) == 'c' ? R2_REGS \ | |
1853547e | 270 | : (CHAR) == 'd' ? R8_REGS \ |
4b58290f | 271 | : (CHAR) == 'e' ? EIGHT_REGS \ |
1853547e | 272 | : (CHAR) == 't' ? TWO_REGS \ |
4b58290f | 273 | : (CHAR) == 'y' ? CARRY_REGS \ |
da6e254e | 274 | : (CHAR) == 'z' ? ICALL_REGS \ |
4b58290f GK |
275 | : NO_REGS) |
276 | ||
4b58290f GK |
277 | #define REGNO_OK_FOR_BASE_P(NUM) 1 |
278 | ||
4b58290f GK |
279 | #define REGNO_OK_FOR_INDEX_P(NUM) REGNO_OK_FOR_BASE_P (NUM) |
280 | ||
595cac16 | 281 | /* This declaration must be present. */ |
4b58290f | 282 | #define PREFERRED_RELOAD_CLASS(X, CLASS) \ |
c6243b4c | 283 | xstormy16_preferred_reload_class (X, CLASS) |
4b58290f | 284 | |
4b58290f | 285 | #define PREFERRED_OUTPUT_RELOAD_CLASS(X, CLASS) \ |
c6243b4c | 286 | xstormy16_preferred_reload_class (X, CLASS) |
4b58290f | 287 | |
4b58290f GK |
288 | /* This chip has the interesting property that only the first eight |
289 | registers can be moved to/from memory. */ | |
290 | #define SECONDARY_RELOAD_CLASS(CLASS, MODE, X) \ | |
c6243b4c | 291 | xstormy16_secondary_reload_class (CLASS, MODE, X) |
4b58290f | 292 | |
4b58290f GK |
293 | /* Normally the compiler avoids choosing registers that have been explicitly |
294 | mentioned in the rtl as spill registers (these registers are normally those | |
295 | used to pass parameters and return values). However, some machines have so | |
296 | few registers of certain classes that there would not be enough registers to | |
297 | use as spill registers if this were done. | |
298 | ||
5e7a8ee0 KH |
299 | Define `SMALL_REGISTER_CLASSES' to be an expression with a nonzero value on |
300 | these machines. When this macro has a nonzero value, the compiler allows | |
4b58290f GK |
301 | registers explicitly used in the rtl to be used as spill registers but |
302 | avoids extending the lifetime of these registers. | |
303 | ||
5e7a8ee0 | 304 | It is always safe to define this macro with a nonzero value, but if you |
4b58290f GK |
305 | unnecessarily define it, you will reduce the amount of optimizations that |
306 | can be performed in some cases. If you do not define this macro with a | |
5e7a8ee0 | 307 | nonzero value when it is required, the compiler will run out of spill |
4b58290f GK |
308 | registers and print a fatal error message. For most machines, you should |
309 | not define this macro at all. */ | |
310 | /* #define SMALL_REGISTER_CLASSES */ | |
311 | ||
595cac16 | 312 | /* This declaration is required. */ |
4b58290f GK |
313 | #define CLASS_MAX_NREGS(CLASS, MODE) \ |
314 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
315 | ||
316 | /* If defined, a C expression for a class that contains registers which the | |
317 | compiler must always access in a mode that is the same size as the mode in | |
318 | which it loaded the register. | |
319 | ||
320 | For the example, loading 32-bit integer or floating-point objects into | |
321 | floating-point registers on the Alpha extends them to 64-bits. Therefore | |
322 | loading a 64-bit object and then storing it as a 32-bit object does not | |
323 | store the low-order 32-bits, as would be the case for a normal register. | |
324 | Therefore, `alpha.h' defines this macro as `FLOAT_REGS'. */ | |
325 | /* #define CLASS_CANNOT_CHANGE_SIZE */ | |
326 | ||
4b58290f GK |
327 | #define CONST_OK_FOR_LETTER_P(VALUE, C) \ |
328 | ( (C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 3 \ | |
329 | : (C) == 'J' ? exact_log2 (VALUE) != -1 \ | |
330 | : (C) == 'K' ? exact_log2 (~(VALUE)) != -1 \ | |
331 | : (C) == 'L' ? (VALUE) >= 0 && (VALUE) <= 255 \ | |
332 | : (C) == 'M' ? (VALUE) >= -255 && (VALUE) <= 0 \ | |
333 | : (C) == 'N' ? (VALUE) >= -3 && (VALUE) <= 0 \ | |
334 | : (C) == 'O' ? (VALUE) >= 1 && (VALUE) <= 4 \ | |
335 | : (C) == 'P' ? (VALUE) >= -4 && (VALUE) <= -1 \ | |
336 | : 0 ) | |
337 | ||
4b58290f GK |
338 | #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0 |
339 | ||
4b58290f | 340 | #define EXTRA_CONSTRAINT(VALUE, C) \ |
c6243b4c | 341 | xstormy16_extra_constraint_p (VALUE, C) |
4b58290f GK |
342 | |
343 | \f | |
344 | /* Basic Stack Layout */ | |
345 | ||
4b58290f GK |
346 | /* We want to use post-increment instructions to push things on the stack, |
347 | because we don't have any pre-increment ones. */ | |
348 | #define STACK_PUSH_CODE POST_INC | |
349 | ||
4b58290f GK |
350 | /* #define FRAME_GROWS_DOWNWARD */ |
351 | ||
4b58290f GK |
352 | #define ARGS_GROW_DOWNWARD 1 |
353 | ||
4b58290f GK |
354 | #define STARTING_FRAME_OFFSET 0 |
355 | ||
4b58290f GK |
356 | #define FIRST_PARM_OFFSET(FUNDECL) 0 |
357 | ||
4b58290f GK |
358 | #define RETURN_ADDR_RTX(COUNT, FRAMEADDR) \ |
359 | ((COUNT) == 0 \ | |
360 | ? gen_rtx_MEM (Pmode, arg_pointer_rtx) \ | |
361 | : NULL_RTX) | |
362 | ||
4b58290f GK |
363 | #define INCOMING_RETURN_ADDR_RTX \ |
364 | gen_rtx_MEM (SImode, gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (-4))) | |
365 | ||
c6243b4c | 366 | #define INCOMING_FRAME_SP_OFFSET (xstormy16_interrupt_function_p () ? 6 : 4) |
4b58290f | 367 | |
4b58290f GK |
368 | \f |
369 | /* Register That Address the Stack Frame. */ | |
370 | ||
4b58290f GK |
371 | #define STACK_POINTER_REGNUM 15 |
372 | ||
4b58290f GK |
373 | #define FRAME_POINTER_REGNUM 17 |
374 | ||
4b58290f GK |
375 | #define HARD_FRAME_POINTER_REGNUM 13 |
376 | ||
4b58290f GK |
377 | #define ARG_POINTER_REGNUM 18 |
378 | ||
e2470e1b | 379 | #define STATIC_CHAIN_REGNUM 1 |
4b58290f GK |
380 | |
381 | \f | |
382 | /* Eliminating the Frame Pointer and the Arg Pointer */ | |
383 | ||
4b58290f GK |
384 | #define FRAME_POINTER_REQUIRED 0 |
385 | ||
4b58290f GK |
386 | #define ELIMINABLE_REGS \ |
387 | { \ | |
388 | {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | |
389 | {FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ | |
390 | {ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | |
391 | {ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ | |
392 | } | |
393 | ||
4b58290f GK |
394 | #define CAN_ELIMINATE(FROM, TO) \ |
395 | ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \ | |
396 | ? ! frame_pointer_needed \ | |
397 | : 1) | |
398 | ||
4b58290f | 399 | #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ |
c6243b4c | 400 | (OFFSET) = xstormy16_initial_elimination_offset (FROM, TO) |
4b58290f | 401 | |
4b58290f GK |
402 | \f |
403 | /* Passing Function Arguments on the Stack */ | |
404 | ||
4b58290f GK |
405 | #define PROMOTE_PROTOTYPES 1 |
406 | ||
4b58290f GK |
407 | #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1) |
408 | ||
4b58290f GK |
409 | #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0 |
410 | ||
411 | \f | |
412 | /* Function Arguments in Registers */ | |
413 | ||
da6e254e | 414 | #define NUM_ARGUMENT_REGISTERS 6 |
4b58290f GK |
415 | #define FIRST_ARGUMENT_REGISTER 2 |
416 | ||
c6243b4c | 417 | #define XSTORMY16_WORD_SIZE(TYPE, MODE) \ |
4b58290f GK |
418 | ((((TYPE) ? int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE)) \ |
419 | + 1) \ | |
420 | / 2) | |
421 | ||
06d22853 DD |
422 | #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ |
423 | xstormy16_function_arg (CUM, MODE, TYPE, NAMED) | |
4b58290f | 424 | |
4b58290f GK |
425 | #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0 |
426 | ||
4b58290f GK |
427 | #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) 0 |
428 | ||
429 | /* If defined, a C expression that indicates when it is more | |
430 | desirable to keep an argument passed by invisible reference as a | |
431 | reference, rather than copying it to a pseudo register. */ | |
432 | /* #define FUNCTION_ARG_KEEP_AS_REFERENCE(CUM, MODE, TYPE, NAMED) */ | |
433 | ||
595cac16 | 434 | /* For this platform, the value of CUMULATIVE_ARGS is the number of words |
4b58290f | 435 | of arguments that have been passed in registers so far. */ |
c8f863fc | 436 | #define CUMULATIVE_ARGS int |
4b58290f | 437 | |
4b58290f GK |
438 | #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) (CUM) = 0 |
439 | ||
4b58290f | 440 | #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ |
c6243b4c | 441 | ((CUM) = xstormy16_function_arg_advance (CUM, MODE, TYPE, NAMED)) |
4b58290f | 442 | |
4b58290f GK |
443 | #define FUNCTION_ARG_REGNO_P(REGNO) \ |
444 | ((REGNO) >= FIRST_ARGUMENT_REGISTER \ | |
445 | && (REGNO) < FIRST_ARGUMENT_REGISTER + NUM_ARGUMENT_REGISTERS) | |
446 | ||
447 | \f | |
448 | /* How Scalar Function Values are Returned */ | |
449 | ||
450 | /* The number of the hard register that is used to return a scalar value from a | |
451 | function call. */ | |
452 | #define RETURN_VALUE_REGNUM FIRST_ARGUMENT_REGISTER | |
453 | ||
4b58290f | 454 | #define FUNCTION_VALUE(VALTYPE, FUNC) \ |
c6243b4c | 455 | xstormy16_function_value (VALTYPE, FUNC) |
4b58290f | 456 | |
4b58290f GK |
457 | #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, RETURN_VALUE_REGNUM) |
458 | ||
4b58290f GK |
459 | #define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM) |
460 | ||
4b58290f GK |
461 | \f |
462 | /* How Large Values are Returned */ | |
463 | ||
4b58290f GK |
464 | #define RETURN_IN_MEMORY(TYPE) \ |
465 | (int_size_in_bytes (TYPE) > UNITS_PER_WORD * NUM_ARGUMENT_REGISTERS) | |
466 | ||
4b58290f GK |
467 | #define STRUCT_VALUE 0 |
468 | ||
4b58290f GK |
469 | \f |
470 | /* Function Entry and Exit */ | |
471 | ||
4b58290f | 472 | #define EPILOGUE_USES(REGNO) \ |
c6243b4c | 473 | xstormy16_epilogue_uses (REGNO) |
4b58290f | 474 | |
4b58290f GK |
475 | \f |
476 | /* Generating Code for Profiling. */ | |
477 | ||
595cac16 | 478 | /* This declaration must be present, but it can be an abort if profiling is |
4b58290f GK |
479 | not implemented. */ |
480 | ||
14b56832 | 481 | #define FUNCTION_PROFILER(FILE, LABELNO) xstormy16_function_profiler () |
4b58290f | 482 | |
4b58290f GK |
483 | \f |
484 | /* If the target has particular reasons why a function cannot be inlined, | |
485 | it may define the TARGET_CANNOT_INLINE_P. This macro takes one argument, | |
486 | the DECL describing the function. The function should NULL if the function | |
487 | *can* be inlined. Otherwise it should return a pointer to a string containing | |
488 | a message describing why the function could not be inlined. The message will | |
489 | displayed if the '-Winline' command line switch has been given. If the message | |
490 | contains a '%s' sequence, this will be replaced by the name of the function. */ | |
c6243b4c | 491 | /* #define TARGET_CANNOT_INLINE_P(FN_DECL) xstormy16_cannot_inline_p (FN_DECL) */ |
4b58290f GK |
492 | \f |
493 | /* Implementing the Varargs Macros. */ | |
494 | ||
4b58290f GK |
495 | #define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_ARGS_SIZE, SECOND_TIME) \ |
496 | if (! SECOND_TIME) \ | |
c6243b4c | 497 | xstormy16_setup_incoming_varargs (ARGS_SO_FAR, MODE, TYPE, & PRETEND_ARGS_SIZE) |
4b58290f | 498 | |
5e7a8ee0 | 499 | /* Implement the stdarg/varargs va_start macro. STDARG_P is nonzero if this |
4b58290f GK |
500 | is stdarg.h instead of varargs.h. VALIST is the tree of the va_list |
501 | variable to initialize. NEXTARG is the machine independent notion of the | |
502 | 'next' argument after the variable arguments. If not defined, a standard | |
503 | implementation will be defined that works for arguments passed on the stack. */ | |
e5faf155 ZW |
504 | #define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG) \ |
505 | xstormy16_expand_builtin_va_start (VALIST, NEXTARG) | |
4b58290f GK |
506 | |
507 | /* Implement the stdarg/varargs va_arg macro. VALIST is the variable of type | |
508 | va_list as a tree, TYPE is the type passed to va_arg. */ | |
509 | #define EXPAND_BUILTIN_VA_ARG(VALIST, TYPE) \ | |
c6243b4c | 510 | xstormy16_expand_builtin_va_arg (VALIST, TYPE) |
4b58290f GK |
511 | \f |
512 | /* Trampolines for Nested Functions. */ | |
513 | ||
4b58290f GK |
514 | #define TRAMPOLINE_SIZE 8 |
515 | ||
4b58290f GK |
516 | #define TRAMPOLINE_ALIGNMENT 16 |
517 | ||
4b58290f | 518 | #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \ |
c6243b4c | 519 | xstormy16_initialize_trampoline (ADDR, FNADDR, STATIC_CHAIN) |
4b58290f | 520 | |
4b58290f GK |
521 | \f |
522 | /* Implicit Calls to Library Routines */ | |
523 | ||
4b58290f GK |
524 | #define TARGET_MEM_FUNCTIONS |
525 | ||
4b58290f GK |
526 | /* Define this macro to override the type used by the library routines to pick |
527 | up arguments of type `float'. (By default, they use a union of `float' and | |
528 | `int'.) | |
529 | ||
530 | The obvious choice would be `float'--but that won't work with traditional C | |
531 | compilers that expect all arguments declared as `float' to arrive as | |
532 | `double'. To avoid this conversion, the library routines ask for the value | |
edf11bda | 533 | as some other type and then treat it as a `float'. */ |
4b58290f GK |
534 | /* #define FLOAT_ARG_TYPE */ |
535 | ||
536 | /* Define this macro to override the way library routines redesignate a `float' | |
537 | argument as a `float' instead of the type it was passed as. The default is | |
538 | an expression which takes the `float' field of the union. */ | |
539 | /* #define FLOATIFY(PASSED_VALUE) */ | |
540 | ||
541 | /* Define this macro to override the type used by the library routines to | |
542 | return values that ought to have type `float'. (By default, they use | |
543 | `int'.) | |
544 | ||
545 | The obvious choice would be `float'--but that won't work with traditional C | |
546 | compilers gratuitously convert values declared as `float' into `double'. */ | |
547 | /* #define FLOAT_VALUE_TYPE */ | |
548 | ||
549 | /* Define this macro to override the way the value of a `float'-returning | |
550 | library routine should be packaged in order to return it. These functions | |
551 | are actually declared to return type `FLOAT_VALUE_TYPE' (normally `int'). | |
552 | ||
553 | These values can't be returned as type `float' because traditional C | |
554 | compilers would gratuitously convert the value to a `double'. | |
555 | ||
556 | A local variable named `intify' is always available when the macro `INTIFY' | |
557 | is used. It is a union of a `float' field named `f' and a field named `i' | |
558 | whose type is `FLOAT_VALUE_TYPE' or `int'. | |
559 | ||
560 | If you don't define this macro, the default definition works by copying the | |
561 | value through that union. */ | |
562 | /* #define INTIFY(FLOAT_VALUE) */ | |
563 | ||
564 | /* Define this macro as the name of the data type corresponding to `SImode' in | |
565 | the system's own C compiler. | |
566 | ||
567 | You need not define this macro if that type is `long int', as it usually is. */ | |
568 | /* #define nongcc_SI_type */ | |
569 | ||
570 | /* Define this macro as the name of the data type corresponding to the | |
571 | word_mode in the system's own C compiler. | |
572 | ||
573 | You need not define this macro if that type is `long int', as it usually is. */ | |
574 | /* #define nongcc_word_type */ | |
575 | ||
576 | /* Define these macros to supply explicit C statements to carry out various | |
577 | arithmetic operations on types `float' and `double' in the library routines | |
578 | in `libgcc1.c'. See that file for a full list of these macros and their | |
579 | arguments. | |
580 | ||
581 | On most machines, you don't need to define any of these macros, because the | |
582 | C compiler that comes with the system takes care of doing them. */ | |
b1c9bc51 | 583 | /* #define perform_... */ |
4b58290f | 584 | |
4b58290f GK |
585 | \f |
586 | /* Addressing Modes */ | |
587 | ||
4b58290f GK |
588 | #define HAVE_POST_INCREMENT 1 |
589 | ||
4b58290f GK |
590 | #define HAVE_PRE_DECREMENT 1 |
591 | ||
4b58290f GK |
592 | #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X) |
593 | ||
4b58290f GK |
594 | #define MAX_REGS_PER_ADDRESS 1 |
595 | ||
4b58290f GK |
596 | #ifdef REG_OK_STRICT |
597 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ | |
598 | do { \ | |
c6243b4c | 599 | if (xstormy16_legitimate_address_p (MODE, X, 1)) \ |
4b58290f GK |
600 | goto LABEL; \ |
601 | } while (0) | |
602 | #else | |
603 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ | |
604 | do { \ | |
c6243b4c | 605 | if (xstormy16_legitimate_address_p (MODE, X, 0)) \ |
4b58290f GK |
606 | goto LABEL; \ |
607 | } while (0) | |
608 | #endif | |
595cac16 | 609 | |
4b58290f GK |
610 | #ifdef REG_OK_STRICT |
611 | #define REG_OK_FOR_BASE_P(X) \ | |
612 | (REGNO_OK_FOR_BASE_P (REGNO (X)) && (REGNO (X) < FIRST_PSEUDO_REGISTER)) | |
613 | #else | |
614 | #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) | |
615 | #endif | |
616 | ||
4b58290f GK |
617 | #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X) |
618 | ||
4b58290f GK |
619 | #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) |
620 | ||
595cac16 | 621 | /* On this chip, this is true if the address is valid with an offset |
4b58290f GK |
622 | of 0 but not of 6, because in that case it cannot be used as an |
623 | address for DImode or DFmode, or if the address is a post-increment | |
624 | or pre-decrement address. | |
625 | */ | |
626 | #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \ | |
c6243b4c | 627 | if (xstormy16_mode_dependent_address_p (ADDR)) \ |
4b58290f GK |
628 | goto LABEL |
629 | ||
4b58290f GK |
630 | #define LEGITIMATE_CONSTANT_P(X) 1 |
631 | ||
4b58290f GK |
632 | \f |
633 | /* Describing Relative Costs of Operations */ | |
634 | ||
4b58290f GK |
635 | #define REGISTER_MOVE_COST(MODE, FROM, TO) 2 |
636 | ||
3fdb2f71 | 637 | #define MEMORY_MOVE_COST(M,C,I) (5 + memory_move_secondary_cost (M, C, I)) |
4b58290f | 638 | |
4b58290f GK |
639 | #define BRANCH_COST 5 |
640 | ||
4b58290f GK |
641 | #define SLOW_BYTE_ACCESS 0 |
642 | ||
4b58290f GK |
643 | #define NO_FUNCTION_CSE |
644 | ||
4b58290f GK |
645 | #define NO_RECURSIVE_FUNCTION_CSE |
646 | ||
4b58290f GK |
647 | \f |
648 | /* Dividing the output into sections. */ | |
649 | ||
4b58290f GK |
650 | #define TEXT_SECTION_ASM_OP ".text" |
651 | ||
4b58290f GK |
652 | #define DATA_SECTION_ASM_OP ".data" |
653 | ||
752151e8 | 654 | #define BSS_SECTION_ASM_OP "\t.section\t.bss" |
4b58290f | 655 | |
4b58290f GK |
656 | /* Define the pseudo-ops used to switch to the .ctors and .dtors sections. |
657 | There are no shared libraries on this target so these sections need | |
658 | not be writable. | |
659 | ||
660 | Defined in elfos.h. */ | |
661 | ||
662 | #undef CTORS_SECTION_ASM_OP | |
663 | #undef DTORS_SECTION_ASM_OP | |
664 | #define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"a\"" | |
665 | #define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"a\"" | |
666 | ||
4b58290f | 667 | #define JUMP_TABLES_IN_TEXT_SECTION 1 |
4b58290f GK |
668 | |
669 | \f | |
670 | /* The Overall Framework of an Assembler File. */ | |
671 | ||
7c87e9f9 | 672 | #define ASM_COMMENT_START ";" |
4b58290f | 673 | |
4b58290f GK |
674 | #define ASM_APP_ON "#APP\n" |
675 | ||
4b58290f | 676 | #define ASM_APP_OFF "#NO_APP\n" |
4b58290f GK |
677 | \f |
678 | /* Output of Data. */ | |
679 | ||
4b58290f GK |
680 | #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '|') |
681 | ||
4b58290f GK |
682 | \f |
683 | /* Output and Generation of Labels. */ | |
684 | ||
4b58290f GK |
685 | #define ASM_OUTPUT_SYMBOL_REF(STREAM, SYMBOL) \ |
686 | do { \ | |
e7d687bb | 687 | if (SYMBOL_REF_FUNCTION_P (SYMBOL)) \ |
c27c15db | 688 | ASM_OUTPUT_LABEL_REF ((STREAM), XSTR (SYMBOL, 0)); \ |
4b58290f GK |
689 | else \ |
690 | assemble_name (STREAM, XSTR (SYMBOL, 0)); \ | |
691 | } while (0) | |
692 | ||
2f0b7af6 GK |
693 | #define ASM_OUTPUT_LABEL_REF(STREAM, NAME) \ |
694 | do { \ | |
695 | fputs ("@fptr(", STREAM); \ | |
696 | assemble_name (STREAM, NAME); \ | |
697 | fputc (')', STREAM); \ | |
698 | } while (0) | |
699 | ||
506a61b1 KG |
700 | /* Globalizing directive for a label. */ |
701 | #define GLOBAL_ASM_OP "\t.globl " | |
4b58290f | 702 | |
4b58290f GK |
703 | \f |
704 | /* Macros Controlling Initialization Routines. */ | |
705 | ||
595cac16 | 706 | /* When you are using special sections for |
4b58290f GK |
707 | initialization and termination functions, this macro also controls how |
708 | `crtstuff.c' and `libgcc2.c' arrange to run the initialization functions. | |
709 | ||
710 | Defined in svr4.h. */ | |
711 | /* #define INIT_SECTION_ASM_OP */ | |
712 | ||
4b58290f GK |
713 | /* Define this macro as a C statement to output on the stream STREAM the |
714 | assembler code to arrange to call the function named NAME at initialization | |
715 | time. | |
716 | ||
717 | Assume that NAME is the name of a C function generated automatically by the | |
718 | compiler. This function takes no arguments. Use the function | |
719 | `assemble_name' to output the name NAME; this performs any system-specific | |
720 | syntactic transformations such as adding an underscore. | |
721 | ||
722 | If you don't define this macro, nothing special is output to arrange to call | |
723 | the function. This is correct when the function will be called in some | |
724 | other manner--for example, by means of the `collect2' program, which looks | |
725 | through the symbol table to find these functions by their names. | |
726 | ||
727 | Defined in svr4.h. */ | |
728 | /* #define ASM_OUTPUT_CONSTRUCTOR(STREAM, NAME) */ | |
729 | ||
730 | /* This is like `ASM_OUTPUT_CONSTRUCTOR' but used for termination functions | |
731 | rather than initialization functions. | |
732 | ||
733 | Defined in svr4.h. */ | |
734 | /* #define ASM_OUTPUT_DESTRUCTOR(STREAM, NAME) */ | |
735 | ||
4b58290f GK |
736 | /* Define this macro if the system uses ELF format object files. |
737 | ||
738 | Defined in svr4.h. */ | |
739 | /* #define OBJECT_FORMAT_ELF */ | |
740 | ||
4b58290f GK |
741 | \f |
742 | /* Output of Assembler Instructions. */ | |
743 | ||
4b58290f GK |
744 | #define REGISTER_NAMES \ |
745 | { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \ | |
746 | "r11", "r12", "r13", "psw", "sp", "carry", "fp", "ap" } | |
747 | ||
4b58290f GK |
748 | #define ADDITIONAL_REGISTER_NAMES \ |
749 | { { "r14", 14 }, \ | |
750 | { "r15", 15 } } | |
751 | ||
c6243b4c | 752 | #define PRINT_OPERAND(STREAM, X, CODE) xstormy16_print_operand (STREAM, X, CODE) |
4b58290f | 753 | |
c6243b4c | 754 | #define PRINT_OPERAND_ADDRESS(STREAM, X) xstormy16_print_operand_address (STREAM, X) |
4b58290f | 755 | |
595cac16 | 756 | /* USER_LABEL_PREFIX is defined in svr4.h. */ |
4b58290f GK |
757 | #define REGISTER_PREFIX "" |
758 | #define LOCAL_LABEL_PREFIX "." | |
759 | #define USER_LABEL_PREFIX "" | |
760 | #define IMMEDIATE_PREFIX "#" | |
761 | ||
4b58290f GK |
762 | #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \ |
763 | fprintf (STREAM, "\tpush %d\n", REGNO) | |
764 | ||
4b58290f GK |
765 | #define ASM_OUTPUT_REG_POP(STREAM, REGNO) \ |
766 | fprintf (STREAM, "\tpop %d\n", REGNO) | |
767 | ||
768 | \f | |
769 | /* Output of dispatch tables. */ | |
770 | ||
771 | /* This port does not use the ASM_OUTPUT_ADDR_VEC_ELT macro, because | |
772 | this could cause label alignment to appear between the 'br' and the table, | |
773 | which would be bad. Instead, it controls the output of the table | |
774 | itself. */ | |
775 | #define ASM_OUTPUT_ADDR_VEC(LABEL, BODY) \ | |
c6243b4c | 776 | xstormy16_output_addr_vec (file, LABEL, BODY) |
4b58290f GK |
777 | |
778 | /* Alignment for ADDR_VECs is the same as for code. */ | |
779 | #define ADDR_VEC_ALIGN(ADDR_VEC) 1 | |
780 | ||
781 | \f | |
782 | /* Assembler Commands for Exception Regions. */ | |
783 | ||
e27e731d | 784 | #define DWARF2_UNWIND_INFO 0 |
4b58290f | 785 | |
9defc9b7 RH |
786 | /* Don't use __builtin_setjmp for unwinding, since it's tricky to get |
787 | at the high 16 bits of an address. */ | |
788 | #define DONT_USE_BUILTIN_SETJMP | |
789 | #define JMP_BUF_SIZE 8 | |
4b58290f GK |
790 | \f |
791 | /* Assembler Commands for Alignment. */ | |
792 | ||
4b58290f GK |
793 | #define ASM_OUTPUT_ALIGN(STREAM, POWER) \ |
794 | fprintf ((STREAM), "\t.p2align %d\n", (POWER)) | |
795 | ||
796 | \f | |
797 | /* Macros Affecting all Debug Formats. */ | |
798 | ||
595cac16 | 799 | /* Defined in svr4.h. */ |
4b58290f GK |
800 | #undef PREFERRED_DEBUGGING_TYPE |
801 | #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG | |
802 | ||
4b58290f GK |
803 | \f |
804 | /* Macros for SDB and Dwarf Output. */ | |
805 | ||
4b58290f GK |
806 | /* Define this macro if addresses in Dwarf 2 debugging info should not |
807 | be the same size as pointers on the target architecture. The | |
808 | macro's value should be the size, in bytes, to use for addresses in | |
809 | the debugging info. | |
810 | ||
811 | Some architectures use word addresses to refer to code locations, | |
812 | but Dwarf 2 info always uses byte addresses. On such machines, | |
813 | Dwarf 2 addresses need to be larger than the architecture's | |
814 | pointers. */ | |
815 | #define DWARF2_ADDR_SIZE 4 | |
816 | ||
4b58290f GK |
817 | \f |
818 | /* Miscellaneous Parameters. */ | |
819 | ||
4b58290f GK |
820 | #define PREDICATE_CODES \ |
821 | {"shift_operator", {ASHIFT, ASHIFTRT, LSHIFTRT }}, \ | |
822 | {"equality_operator", {EQ, NE }}, \ | |
823 | {"inequality_operator", {GE, GT, LE, LT, GEU, GTU, LEU, LTU }}, \ | |
5ee4950e AH |
824 | {"xstormy16_ineqsi_operator", {LT, GE, LTU, GEU }}, \ |
825 | {"nonimmediate_nonstack_operand", {REG, MEM}}, | |
595cac16 | 826 | |
4b58290f GK |
827 | #define CASE_VECTOR_MODE SImode |
828 | ||
4b58290f GK |
829 | #define WORD_REGISTER_OPERATIONS |
830 | ||
4b58290f GK |
831 | #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND |
832 | ||
4b58290f GK |
833 | #define MOVE_MAX 2 |
834 | ||
4b58290f GK |
835 | #define SHIFT_COUNT_TRUNCATED 1 |
836 | ||
4b58290f GK |
837 | #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 |
838 | ||
4b58290f GK |
839 | #define Pmode HImode |
840 | ||
4b58290f GK |
841 | #define FUNCTION_MODE HImode |
842 | ||
4b58290f GK |
843 | #define NO_IMPLICIT_EXTERN_C |
844 | ||
595cac16 | 845 | /* Defined in svr4.h. */ |
32f0ffb3 | 846 | #define HANDLE_SYSV_PRAGMA 1 |
4b58290f | 847 | |
4b58290f GK |
848 | /* Define this if the target system supports the function `atexit' from the |
849 | ANSI C standard. If this is not defined, and `INIT_SECTION_ASM_OP' is not | |
850 | defined, a default `exit' function will be provided to support C++. | |
851 | ||
852 | Defined by svr4.h */ | |
853 | /* #define HAVE_ATEXIT */ | |
854 | ||
4b58290f GK |
855 | /* A C statement which is executed by the Haifa scheduler after it has scheduled |
856 | an insn from the ready list. FILE is either a null pointer, or a stdio stream | |
857 | to write any debug output to. VERBOSE is the verbose level provided by | |
858 | -fsched-verbose-<n>. INSN is the instruction that was scheduled. MORE is the | |
859 | number of instructions that can be issued in the current cycle. This macro | |
b1c9bc51 | 860 | is responsible for updating the value of MORE (typically by (MORE)--). */ |
4b58290f GK |
861 | /* #define MD_SCHED_VARIABLE_ISSUE (FILE, VERBOSE, INSN, MORE) */ |
862 | ||
4b58290f GK |
863 | \f |
864 | /* Define the information needed to generate branch and scc insns. This is | |
865 | stored from the compare operation. Note that we can't use "rtx" here | |
866 | since it hasn't been defined! */ | |
867 | ||
c6243b4c | 868 | extern struct rtx_def *xstormy16_compare_op0, *xstormy16_compare_op1; |
4b58290f | 869 | |
c6243b4c | 870 | /* End of xstormy16.h */ |