Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/mcore/mcore.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 /* Definitions of target machine for GNU compiler, | 1 /* Definitions of target machine for GNU compiler, |
2 for Motorola M*CORE Processor. | 2 for Motorola M*CORE Processor. |
3 Copyright (C) 1993, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, | 3 Copyright (C) 1993, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, |
4 2008, 2009 Free Software Foundation, Inc. | 4 2008, 2009, 2010 Free Software Foundation, 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 it | 8 GCC is free software; you can redistribute it and/or modify it |
9 under the terms of the GNU General Public License as published | 9 under the terms of the GNU General Public License as published |
83 extern char * mcore_current_function_name; | 83 extern char * mcore_current_function_name; |
84 | 84 |
85 /* The MCore ABI says that bitfields are unsigned by default. */ | 85 /* The MCore ABI says that bitfields are unsigned by default. */ |
86 #define CC1_SPEC "-funsigned-bitfields" | 86 #define CC1_SPEC "-funsigned-bitfields" |
87 | 87 |
88 /* What options are we going to default to specific settings when | |
89 -O* happens; the user can subsequently override these settings. | |
90 | |
91 Omitting the frame pointer is a very good idea on the MCore. | |
92 Scheduling isn't worth anything on the current MCore implementation. */ | |
93 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \ | |
94 { \ | |
95 if (LEVEL) \ | |
96 { \ | |
97 flag_no_function_cse = 1; \ | |
98 flag_omit_frame_pointer = 1; \ | |
99 \ | |
100 if (LEVEL >= 2) \ | |
101 { \ | |
102 flag_caller_saves = 0; \ | |
103 flag_schedule_insns = 0; \ | |
104 flag_schedule_insns_after_reload = 0; \ | |
105 } \ | |
106 } \ | |
107 if (SIZE) \ | |
108 { \ | |
109 target_flags &= ~MASK_HARDLIT; \ | |
110 } \ | |
111 } | |
112 | |
113 /* What options are we going to force to specific settings, | |
114 regardless of what the user thought he wanted. | |
115 We also use this for some post-processing of options. */ | |
116 #define OVERRIDE_OPTIONS mcore_override_options () | |
117 | |
118 /* Target machine storage Layout. */ | 88 /* Target machine storage Layout. */ |
119 | 89 |
120 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \ | 90 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \ |
121 if (GET_MODE_CLASS (MODE) == MODE_INT \ | 91 if (GET_MODE_CLASS (MODE) == MODE_INT \ |
122 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ | 92 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ |
134 | 104 |
135 /* Define this if most significant word of a multiword number is the lowest | 105 /* Define this if most significant word of a multiword number is the lowest |
136 numbered. */ | 106 numbered. */ |
137 #define WORDS_BIG_ENDIAN (! TARGET_LITTLE_END) | 107 #define WORDS_BIG_ENDIAN (! TARGET_LITTLE_END) |
138 | 108 |
139 #define LIBGCC2_WORDS_BIG_ENDIAN 1 | |
140 #ifdef __MCORELE__ | |
141 #undef LIBGCC2_WORDS_BIG_ENDIAN | |
142 #define LIBGCC2_WORDS_BIG_ENDIAN 0 | |
143 #endif | |
144 | |
145 #define MAX_BITS_PER_WORD 32 | 109 #define MAX_BITS_PER_WORD 32 |
146 | 110 |
147 /* Width of a word, in units (bytes). */ | 111 /* Width of a word, in units (bytes). */ |
148 #define UNITS_PER_WORD 4 | 112 #define UNITS_PER_WORD 4 |
149 | 113 |
153 #define LONG_LONG_TYPE_SIZE 64 | 117 #define LONG_LONG_TYPE_SIZE 64 |
154 | 118 |
155 /* Allocation boundary (in *bits*) for storing arguments in argument list. */ | 119 /* Allocation boundary (in *bits*) for storing arguments in argument list. */ |
156 #define PARM_BOUNDARY 32 | 120 #define PARM_BOUNDARY 32 |
157 | 121 |
158 /* Doubles must be aligned to an 8 byte boundary. */ | |
159 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \ | |
160 ((MODE != BLKmode && (GET_MODE_SIZE (MODE) == 8)) \ | |
161 ? BIGGEST_ALIGNMENT : PARM_BOUNDARY) | |
162 | |
163 /* Boundary (in *bits*) on which stack pointer should be aligned. */ | 122 /* Boundary (in *bits*) on which stack pointer should be aligned. */ |
164 #define STACK_BOUNDARY (TARGET_8ALIGN ? 64 : 32) | 123 #define STACK_BOUNDARY (TARGET_8ALIGN ? 64 : 32) |
165 | 124 |
166 /* Largest increment in UNITS we allow the stack to grow in a single operation. */ | 125 /* Largest increment in UNITS we allow the stack to grow in a single operation. */ |
167 extern int mcore_stack_increment; | |
168 #define STACK_UNITS_MAXSTEP 4096 | 126 #define STACK_UNITS_MAXSTEP 4096 |
169 | 127 |
170 /* Allocation boundary (in *bits*) for the code of a function. */ | 128 /* Allocation boundary (in *bits*) for the code of a function. */ |
171 #define FUNCTION_BOUNDARY ((TARGET_OVERALIGN_FUNC) ? 32 : 16) | 129 #define FUNCTION_BOUNDARY ((TARGET_OVERALIGN_FUNC) ? 32 : 16) |
172 | 130 |
414 | 372 |
415 /* The class value for index registers, and the one for base regs. */ | 373 /* The class value for index registers, and the one for base regs. */ |
416 #define INDEX_REG_CLASS NO_REGS | 374 #define INDEX_REG_CLASS NO_REGS |
417 #define BASE_REG_CLASS GENERAL_REGS | 375 #define BASE_REG_CLASS GENERAL_REGS |
418 | 376 |
419 /* Get reg_class from a letter such as appears in the machine | 377 /* Convenience wrappers around insn_const_int_ok_for_constraint. */ |
420 description. */ | 378 #define CONST_OK_FOR_I(VALUE) \ |
421 extern const enum reg_class reg_class_from_letter[]; | 379 insn_const_int_ok_for_constraint (VALUE, CONSTRAINT_I) |
422 | 380 #define CONST_OK_FOR_J(VALUE) \ |
423 #define REG_CLASS_FROM_LETTER(C) \ | 381 insn_const_int_ok_for_constraint (VALUE, CONSTRAINT_J) |
424 (ISLOWER (C) ? reg_class_from_letter[(C) - 'a'] : NO_REGS) | 382 #define CONST_OK_FOR_L(VALUE) \ |
425 | 383 insn_const_int_ok_for_constraint (VALUE, CONSTRAINT_L) |
426 /* The letters I, J, K, L, M, N, O, and P in a register constraint string | 384 #define CONST_OK_FOR_K(VALUE) \ |
427 can be used to stand for particular ranges of immediate operands. | 385 insn_const_int_ok_for_constraint (VALUE, CONSTRAINT_K) |
428 This macro defines what the ranges are. | 386 #define CONST_OK_FOR_M(VALUE) \ |
429 C is the letter, and VALUE is a constant value. | 387 insn_const_int_ok_for_constraint (VALUE, CONSTRAINT_M) |
430 Return 1 if VALUE is in the range specified by C. | 388 #define CONST_OK_FOR_N(VALUE) \ |
431 I: loadable by movi (0..127) | 389 insn_const_int_ok_for_constraint (VALUE, CONSTRAINT_N) |
432 J: arithmetic operand 1..32 | 390 #define CONST_OK_FOR_O(VALUE) \ |
433 K: shift operand 0..31 | 391 insn_const_int_ok_for_constraint (VALUE, CONSTRAINT_O) |
434 L: negative arithmetic operand -1..-32 | 392 #define CONST_OK_FOR_P(VALUE) \ |
435 M: powers of two, constants loadable by bgeni | 393 insn_const_int_ok_for_constraint (VALUE, CONSTRAINT_P) |
436 N: powers of two minus 1, constants loadable by bmaski, including -1 | |
437 O: allowed by cmov with two constants +/- 1 of each other | |
438 P: values we will generate 'inline' -- without an 'lrw' | |
439 | |
440 Others defined for use after reload | |
441 Q: constant 1 | |
442 R: a label | |
443 S: 0/1/2 cleared bits out of 32 [for bclri's] | |
444 T: 2 set bits out of 32 [for bseti's] | |
445 U: constant 0 | |
446 xxxS: 1 cleared bit out of 32 (complement of power of 2). for bclri | |
447 xxxT: 2 cleared bits out of 32. for pairs of bclris. */ | |
448 #define CONST_OK_FOR_I(VALUE) (((HOST_WIDE_INT)(VALUE)) >= 0 && ((HOST_WIDE_INT)(VALUE)) <= 0x7f) | |
449 #define CONST_OK_FOR_J(VALUE) (((HOST_WIDE_INT)(VALUE)) > 0 && ((HOST_WIDE_INT)(VALUE)) <= 32) | |
450 #define CONST_OK_FOR_L(VALUE) (((HOST_WIDE_INT)(VALUE)) < 0 && ((HOST_WIDE_INT)(VALUE)) >= -32) | |
451 #define CONST_OK_FOR_K(VALUE) (((HOST_WIDE_INT)(VALUE)) >= 0 && ((HOST_WIDE_INT)(VALUE)) <= 31) | |
452 #define CONST_OK_FOR_M(VALUE) (exact_log2 (VALUE) >= 0 && exact_log2 (VALUE) <= 30) | |
453 #define CONST_OK_FOR_N(VALUE) (((HOST_WIDE_INT)(VALUE)) == -1 || (exact_log2 ((VALUE) + 1) >= 0 && exact_log2 ((VALUE) + 1) <= 30)) | |
454 #define CONST_OK_FOR_O(VALUE) (CONST_OK_FOR_I(VALUE) || \ | |
455 CONST_OK_FOR_M(VALUE) || \ | |
456 CONST_OK_FOR_N(VALUE) || \ | |
457 CONST_OK_FOR_M((HOST_WIDE_INT)(VALUE) - 1) || \ | |
458 CONST_OK_FOR_N((HOST_WIDE_INT)(VALUE) + 1)) | |
459 | |
460 #define CONST_OK_FOR_P(VALUE) (mcore_const_ok_for_inline (VALUE)) | |
461 | |
462 #define CONST_OK_FOR_LETTER_P(VALUE, C) \ | |
463 ((C) == 'I' ? CONST_OK_FOR_I (VALUE) \ | |
464 : (C) == 'J' ? CONST_OK_FOR_J (VALUE) \ | |
465 : (C) == 'L' ? CONST_OK_FOR_L (VALUE) \ | |
466 : (C) == 'K' ? CONST_OK_FOR_K (VALUE) \ | |
467 : (C) == 'M' ? CONST_OK_FOR_M (VALUE) \ | |
468 : (C) == 'N' ? CONST_OK_FOR_N (VALUE) \ | |
469 : (C) == 'P' ? CONST_OK_FOR_P (VALUE) \ | |
470 : (C) == 'O' ? CONST_OK_FOR_O (VALUE) \ | |
471 : 0) | |
472 | |
473 /* Similar, but for floating constants, and defining letters G and H. | |
474 Here VALUE is the CONST_DOUBLE rtx itself. */ | |
475 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ | |
476 ((C) == 'G' ? CONST_OK_FOR_I (CONST_DOUBLE_HIGH (VALUE)) \ | |
477 && CONST_OK_FOR_I (CONST_DOUBLE_LOW (VALUE)) \ | |
478 : 0) | |
479 | |
480 /* Letters in the range `Q' through `U' in a register constraint string | |
481 may be defined in a machine-dependent fashion to stand for arbitrary | |
482 operand types. */ | |
483 #define EXTRA_CONSTRAINT(OP, C) \ | |
484 ((C) == 'R' ? (GET_CODE (OP) == MEM \ | |
485 && GET_CODE (XEXP (OP, 0)) == LABEL_REF) \ | |
486 : (C) == 'S' ? (GET_CODE (OP) == CONST_INT \ | |
487 && mcore_num_zeros (INTVAL (OP)) <= 2) \ | |
488 : (C) == 'T' ? (GET_CODE (OP) == CONST_INT \ | |
489 && mcore_num_ones (INTVAL (OP)) == 2) \ | |
490 : (C) == 'Q' ? (GET_CODE (OP) == CONST_INT \ | |
491 && INTVAL(OP) == 1) \ | |
492 : (C) == 'U' ? (GET_CODE (OP) == CONST_INT \ | |
493 && INTVAL(OP) == 0) \ | |
494 : 0) | |
495 | 394 |
496 /* Given an rtx X being reloaded into a reg required to be | 395 /* Given an rtx X being reloaded into a reg required to be |
497 in class CLASS, return the class of reg to actually use. | 396 in class CLASS, return the class of reg to actually use. |
498 In general this is just CLASS; but on some machines | 397 In general this is just CLASS; but on some machines |
499 in some cases it is preferable to use a more restrictive class. */ | 398 in some cases it is preferable to use a more restrictive class. */ |
537 increase the stack frame size by this amount. */ | 436 increase the stack frame size by this amount. */ |
538 #define ACCUMULATE_OUTGOING_ARGS 1 | 437 #define ACCUMULATE_OUTGOING_ARGS 1 |
539 | 438 |
540 /* Offset of first parameter from the argument pointer register value. */ | 439 /* Offset of first parameter from the argument pointer register value. */ |
541 #define FIRST_PARM_OFFSET(FNDECL) 0 | 440 #define FIRST_PARM_OFFSET(FNDECL) 0 |
542 | |
543 /* Value is the number of byte of arguments automatically | |
544 popped when returning from a subroutine call. | |
545 FUNTYPE is the data type of the function (as a tree), | |
546 or for a library call it is an identifier node for the subroutine name. | |
547 SIZE is the number of bytes of arguments passed on the stack. | |
548 | |
549 On the MCore, the callee does not pop any of its arguments that were passed | |
550 on the stack. */ | |
551 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 | |
552 | 441 |
553 /* Define how to find the value returned by a function. | 442 /* Define how to find the value returned by a function. |
554 VALTYPE is the data type of the value (as a tree). | 443 VALTYPE is the data type of the value (as a tree). |
555 If the precise function being called is known, FUNC is its FUNCTION_DECL; | 444 If the precise function being called is known, FUNC is its FUNCTION_DECL; |
556 otherwise, FUNC is 0. */ | 445 otherwise, FUNC is 0. */ |
603 | 492 |
604 On MCore, the offset always starts at 0: the first parm reg is always | 493 On MCore, the offset always starts at 0: the first parm reg is always |
605 the same reg. */ | 494 the same reg. */ |
606 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ | 495 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ |
607 ((CUM) = 0) | 496 ((CUM) = 0) |
608 | |
609 /* Update the data in CUM to advance over an argument | |
610 of mode MODE and data type TYPE. | |
611 (TYPE is null for libcalls where that information may not be | |
612 available.) */ | |
613 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ | |
614 ((CUM) = (ROUND_REG ((CUM), (MODE)) \ | |
615 + ((NAMED) * mcore_num_arg_regs (MODE, TYPE)))) \ | |
616 | |
617 /* Define where to put the arguments to a function. */ | |
618 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ | |
619 mcore_function_arg (CUM, MODE, TYPE, NAMED) | |
620 | 497 |
621 /* Call the function profiler with a given profile label. */ | 498 /* Call the function profiler with a given profile label. */ |
622 #define FUNCTION_PROFILER(STREAM,LABELNO) \ | 499 #define FUNCTION_PROFILER(STREAM,LABELNO) \ |
623 { \ | 500 { \ |
624 fprintf (STREAM, " trap 1\n"); \ | 501 fprintf (STREAM, " trap 1\n"); \ |
754 #define CASE_VECTOR_MODE SImode | 631 #define CASE_VECTOR_MODE SImode |
755 | 632 |
756 /* 'char' is signed by default. */ | 633 /* 'char' is signed by default. */ |
757 #define DEFAULT_SIGNED_CHAR 0 | 634 #define DEFAULT_SIGNED_CHAR 0 |
758 | 635 |
759 /* The type of size_t unsigned int. */ | 636 #undef SIZE_TYPE |
760 #define SIZE_TYPE "unsigned int" | 637 #define SIZE_TYPE "unsigned int" |
638 | |
639 #undef PTRDIFF_TYPE | |
640 #define PTRDIFF_TYPE "int" | |
641 | |
642 #undef WCHAR_TYPE | |
643 #define WCHAR_TYPE "long int" | |
644 | |
645 #undef WCHAR_TYPE_SIZE | |
646 #define WCHAR_TYPE_SIZE BITS_PER_WORD | |
761 | 647 |
762 /* Max number of bytes we can move from memory to memory | 648 /* Max number of bytes we can move from memory to memory |
763 in one reasonably fast instruction. */ | 649 in one reasonably fast instruction. */ |
764 #define MOVE_MAX 4 | 650 #define MOVE_MAX 4 |
765 | 651 |
814 #define DATA_SECTION_ASM_OP "\t.data" | 700 #define DATA_SECTION_ASM_OP "\t.data" |
815 | 701 |
816 /* Switch into a generic section. */ | 702 /* Switch into a generic section. */ |
817 #undef TARGET_ASM_NAMED_SECTION | 703 #undef TARGET_ASM_NAMED_SECTION |
818 #define TARGET_ASM_NAMED_SECTION mcore_asm_named_section | 704 #define TARGET_ASM_NAMED_SECTION mcore_asm_named_section |
705 | |
706 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (SImode, LK_REG) | |
819 | 707 |
820 /* This is how to output an insn to push a register on the stack. | 708 /* This is how to output an insn to push a register on the stack. |
821 It need not be very fast code. */ | 709 It need not be very fast code. */ |
822 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ | 710 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ |
823 fprintf (FILE, "\tsubi\t %s,%d\n\tstw\t %s,(%s)\n", \ | 711 fprintf (FILE, "\tsubi\t %s,%d\n\tstw\t %s,(%s)\n", \ |
958 assemble_name ((FILE), (NAME)); \ | 846 assemble_name ((FILE), (NAME)); \ |
959 fprintf ((FILE), ",%d,%d\n", (int)(SIZE), (ALIGN) / BITS_PER_UNIT);\ | 847 fprintf ((FILE), ",%d,%d\n", (int)(SIZE), (ALIGN) / BITS_PER_UNIT);\ |
960 } \ | 848 } \ |
961 while (0) | 849 while (0) |
962 | 850 |
963 /* Print operand X (an rtx) in assembler syntax to file FILE. | |
964 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. | |
965 For `%' followed by punctuation, CODE is the punctuation and X is null. */ | |
966 #define PRINT_OPERAND(STREAM, X, CODE) mcore_print_operand (STREAM, X, CODE) | |
967 | |
968 /* Print a memory address as an operand to reference that memory location. */ | |
969 #define PRINT_OPERAND_ADDRESS(STREAM,X) mcore_print_operand_address (STREAM, X) | |
970 | |
971 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \ | |
972 ((CHAR)=='.' || (CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^' || (CHAR) == '!') | |
973 | |
974 #endif /* ! GCC_MCORE_H */ | 851 #endif /* ! GCC_MCORE_H */ |