comparison gcc/config/stormy16/stormy16.h @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents b7f97abdc517
children 04ced10e8804
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
1 /* Xstormy16 cpu description. 1 /* Xstormy16 cpu description.
2 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007,
3 2008, 2009, 2010 Free Software Foundation, Inc. 3 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
4 Contributed by Red Hat, Inc. 4 Contributed by Red Hat, Inc.
5 5
6 This file is part of GCC. 6 This file is part of GCC.
7 7
8 GCC is free software; you can redistribute it and/or modify 8 GCC is free software; you can redistribute it and/or modify
22 22
23 /* Driver configuration. */ 23 /* Driver configuration. */
24 24
25 #undef ASM_SPEC 25 #undef ASM_SPEC
26 #define ASM_SPEC "" 26 #define ASM_SPEC ""
27
28 #undef LINK_SPEC
29 #define LINK_SPEC "%{h*} %{v:-V} \
30 %{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic}"
27 31
28 /* For xstormy16: 32 /* For xstormy16:
29 - If -msim is specified, everything is built and linked as for the sim. 33 - If -msim is specified, everything is built and linked as for the sim.
30 - If -T is specified, that linker script is used, and it should provide 34 - If -T is specified, that linker script is used, and it should provide
31 appropriate libraries. 35 appropriate libraries.
51 builtin_assert ("cpu=xstormy16"); \ 55 builtin_assert ("cpu=xstormy16"); \
52 } \ 56 } \
53 while (0) 57 while (0)
54 58
55 #define TARGET_VERSION fprintf (stderr, " (xstormy16 cpu core)"); 59 #define TARGET_VERSION fprintf (stderr, " (xstormy16 cpu core)");
56
57 #define CAN_DEBUG_WITHOUT_FP
58 60
59 /* Storage Layout. */ 61 /* Storage Layout. */
60 62
61 #define BITS_BIG_ENDIAN 1 63 #define BITS_BIG_ENDIAN 1
62 64
115 #define DEFAULT_SIGNED_CHAR 0 117 #define DEFAULT_SIGNED_CHAR 0
116 118
117 #define SIZE_TYPE "unsigned int" 119 #define SIZE_TYPE "unsigned int"
118 120
119 #define PTRDIFF_TYPE "int" 121 #define PTRDIFF_TYPE "int"
122
123 #undef WCHAR_TYPE
124 #define WCHAR_TYPE "long int"
120 125
121 #undef WCHAR_TYPE_SIZE 126 #undef WCHAR_TYPE_SIZE
122 #define WCHAR_TYPE_SIZE 32 127 #define WCHAR_TYPE_SIZE 32
123 128
124 129
218 223
219 #define BASE_REG_CLASS GENERAL_REGS 224 #define BASE_REG_CLASS GENERAL_REGS
220 225
221 #define INDEX_REG_CLASS GENERAL_REGS 226 #define INDEX_REG_CLASS GENERAL_REGS
222 227
223 /* The following letters are unavailable, due to being used as
224 constraints:
225 '0'..'9'
226 '<', '>'
227 'E', 'F', 'G', 'H'
228 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P'
229 'Q', 'R', 'S', 'T', 'U'
230 'V', 'X'
231 'g', 'i', 'm', 'n', 'o', 'p', 'r', 's'. */
232
233 #define REG_CLASS_FROM_LETTER(CHAR) \
234 ( (CHAR) == 'a' ? R0_REGS \
235 : (CHAR) == 'b' ? R1_REGS \
236 : (CHAR) == 'c' ? R2_REGS \
237 : (CHAR) == 'd' ? R8_REGS \
238 : (CHAR) == 'e' ? EIGHT_REGS \
239 : (CHAR) == 't' ? TWO_REGS \
240 : (CHAR) == 'z' ? ICALL_REGS \
241 : NO_REGS)
242
243 #define REGNO_OK_FOR_BASE_P(NUM) 1 228 #define REGNO_OK_FOR_BASE_P(NUM) 1
244 229
245 #define REGNO_OK_FOR_INDEX_P(NUM) REGNO_OK_FOR_BASE_P (NUM) 230 #define REGNO_OK_FOR_INDEX_P(NUM) REGNO_OK_FOR_BASE_P (NUM)
246
247 #define PREFERRED_RELOAD_CLASS(X, CLASS) \
248 xstormy16_preferred_reload_class (X, CLASS)
249
250 #define PREFERRED_OUTPUT_RELOAD_CLASS(X, CLASS) \
251 xstormy16_preferred_reload_class (X, CLASS)
252 231
253 /* This chip has the interesting property that only the first eight 232 /* This chip has the interesting property that only the first eight
254 registers can be moved to/from memory. */ 233 registers can be moved to/from memory. */
255 #define SECONDARY_RELOAD_CLASS(CLASS, MODE, X) \ 234 #define SECONDARY_RELOAD_CLASS(CLASS, MODE, X) \
256 xstormy16_secondary_reload_class (CLASS, MODE, X) 235 xstormy16_secondary_reload_class (CLASS, MODE, X)
257 236
258 #define CLASS_MAX_NREGS(CLASS, MODE) \ 237 #define CLASS_MAX_NREGS(CLASS, MODE) \
259 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) 238 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
260
261 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
262 ( (C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 3 \
263 : (C) == 'J' ? exact_log2 (VALUE) != -1 \
264 : (C) == 'K' ? exact_log2 (~(VALUE)) != -1 \
265 : (C) == 'L' ? (VALUE) >= 0 && (VALUE) <= 255 \
266 : (C) == 'M' ? (VALUE) >= -255 && (VALUE) <= 0 \
267 : (C) == 'N' ? (VALUE) >= -3 && (VALUE) <= 0 \
268 : (C) == 'O' ? (VALUE) >= 1 && (VALUE) <= 4 \
269 : (C) == 'P' ? (VALUE) >= -4 && (VALUE) <= -1 \
270 : 0 )
271
272 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
273
274 #define EXTRA_CONSTRAINT(VALUE, C) \
275 xstormy16_extra_constraint_p (VALUE, C)
276 239
277 240
278 /* Basic Stack Layout. */ 241 /* Basic Stack Layout. */
279 242
280 /* We want to use post-increment instructions to push things on the stack, 243 /* We want to use post-increment instructions to push things on the stack,
326 289
327 /* Passing Function Arguments on the Stack. */ 290 /* Passing Function Arguments on the Stack. */
328 291
329 #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1) 292 #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
330 293
331 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
332
333 294
334 /* Function Arguments in Registers. */ 295 /* Function Arguments in Registers. */
335 296
336 #define NUM_ARGUMENT_REGISTERS 6 297 #define NUM_ARGUMENT_REGISTERS 6
337 #define FIRST_ARGUMENT_REGISTER 2 298 #define FIRST_ARGUMENT_REGISTER 2
339 #define XSTORMY16_WORD_SIZE(TYPE, MODE) \ 300 #define XSTORMY16_WORD_SIZE(TYPE, MODE) \
340 ((((TYPE) ? int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE)) \ 301 ((((TYPE) ? int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE)) \
341 + 1) \ 302 + 1) \
342 / 2) 303 / 2)
343 304
344 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
345 xstormy16_function_arg (CUM, MODE, TYPE, NAMED)
346
347 /* For this platform, the value of CUMULATIVE_ARGS is the number of words 305 /* For this platform, the value of CUMULATIVE_ARGS is the number of words
348 of arguments that have been passed in registers so far. */ 306 of arguments that have been passed in registers so far. */
349 #define CUMULATIVE_ARGS int 307 #define CUMULATIVE_ARGS int
350 308
351 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ 309 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
352 (CUM) = 0 310 (CUM) = 0
353 311
354 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
355 ((CUM) = xstormy16_function_arg_advance (CUM, MODE, TYPE, NAMED))
356
357 #define FUNCTION_ARG_REGNO_P(REGNO) \ 312 #define FUNCTION_ARG_REGNO_P(REGNO) \
358 ((REGNO) >= FIRST_ARGUMENT_REGISTER \ 313 ((REGNO) >= FIRST_ARGUMENT_REGISTER \
359 && (REGNO) < FIRST_ARGUMENT_REGISTER + NUM_ARGUMENT_REGISTERS) 314 && (REGNO) < FIRST_ARGUMENT_REGISTER + NUM_ARGUMENT_REGISTERS)
360 315
361 316
362 /* How Scalar Function Values are Returned. */ 317 /* How Scalar Function Values are Returned. */
363 318
364 /* The number of the hard register that is used to return a scalar value from a 319 /* The number of the hard register that is used to return a scalar value from a
365 function call. */ 320 function call. */
366 #define RETURN_VALUE_REGNUM FIRST_ARGUMENT_REGISTER 321 #define RETURN_VALUE_REGNUM FIRST_ARGUMENT_REGISTER
367
368 #define FUNCTION_VALUE(VALTYPE, FUNC) \
369 xstormy16_function_value (VALTYPE, FUNC)
370
371 #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, RETURN_VALUE_REGNUM)
372
373 #define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM)
374 322
375 323
376 /* Function Entry and Exit. */ 324 /* Function Entry and Exit. */
377 325
378 #define EPILOGUE_USES(REGNO) \ 326 #define EPILOGUE_USES(REGNO) \
399 347
400 #define HAVE_PRE_DECREMENT 1 348 #define HAVE_PRE_DECREMENT 1
401 349
402 #define MAX_REGS_PER_ADDRESS 1 350 #define MAX_REGS_PER_ADDRESS 1
403 351
404 #ifdef REG_OK_STRICT
405 #define REG_OK_FOR_BASE_P(X) \
406 (REGNO_OK_FOR_BASE_P (REGNO (X)) && (REGNO (X) < FIRST_PSEUDO_REGISTER))
407 #else
408 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
409 #endif
410
411 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
412
413 /* On this chip, this is true if the address is valid with an offset
414 of 0 but not of 6, because in that case it cannot be used as an
415 address for DImode or DFmode, or if the address is a post-increment
416 or pre-decrement address. */
417 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
418 if (xstormy16_mode_dependent_address_p (ADDR)) \
419 goto LABEL
420
421 #define LEGITIMATE_CONSTANT_P(X) 1 352 #define LEGITIMATE_CONSTANT_P(X) 1
422 353
423 354
424 /* Describing Relative Costs of Operations. */ 355 /* Describing Relative Costs of Operations. */
425
426 #define REGISTER_MOVE_COST(MODE, FROM, TO) 2
427
428 #define MEMORY_MOVE_COST(M,C,I) (5 + memory_move_secondary_cost (M, C, I))
429 356
430 #define BRANCH_COST(speed_p, predictable_p) 5 357 #define BRANCH_COST(speed_p, predictable_p) 5
431 358
432 #define SLOW_BYTE_ACCESS 0 359 #define SLOW_BYTE_ACCESS 0
433 360
511 438
512 #define ADDITIONAL_REGISTER_NAMES \ 439 #define ADDITIONAL_REGISTER_NAMES \
513 { { "r14", 14 }, \ 440 { { "r14", 14 }, \
514 { "r15", 15 } } 441 { "r15", 15 } }
515 442
516 #define PRINT_OPERAND(STREAM, X, CODE) xstormy16_print_operand (STREAM, X, CODE)
517
518 #define PRINT_OPERAND_ADDRESS(STREAM, X) xstormy16_print_operand_address (STREAM, X)
519
520 /* USER_LABEL_PREFIX is defined in svr4.h. */
521 #define REGISTER_PREFIX "" 443 #define REGISTER_PREFIX ""
522 #define LOCAL_LABEL_PREFIX "." 444 #define LOCAL_LABEL_PREFIX "."
523 #define USER_LABEL_PREFIX "" 445 #define USER_LABEL_PREFIX ""
524 #define IMMEDIATE_PREFIX "#" 446 #define IMMEDIATE_PREFIX "#"
525 447
557 fprintf ((STREAM), "\t.p2align %d\n", (POWER)) 479 fprintf ((STREAM), "\t.p2align %d\n", (POWER))
558 480
559 481
560 /* Macros Affecting all Debug Formats. */ 482 /* Macros Affecting all Debug Formats. */
561 483
562 /* Defined in svr4.h. */
563 #undef PREFERRED_DEBUGGING_TYPE 484 #undef PREFERRED_DEBUGGING_TYPE
564 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG 485 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
565 486
566 487
567 /* Macros for SDB and Dwarf Output. */ 488 /* Macros for SDB and Dwarf Output. */
595 #define Pmode HImode 516 #define Pmode HImode
596 517
597 #define FUNCTION_MODE HImode 518 #define FUNCTION_MODE HImode
598 519
599 #define NO_IMPLICIT_EXTERN_C 520 #define NO_IMPLICIT_EXTERN_C
600
601 #define HANDLE_SYSV_PRAGMA 1