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