📄 cris.h
字号:
{"no-data-align", -TARGET_MASK_DATA_ALIGN, \ N_("Do not tune writable data alignment")}, \ {"const-align", TARGET_MASK_CONST_ALIGN, ""}, \ {"no-const-align", -TARGET_MASK_CONST_ALIGN, \ N_("Do not tune code and read-only data alignment")}, \ {"32-bit", (TARGET_MASK_STACK_ALIGN \ + TARGET_MASK_CONST_ALIGN \ + TARGET_MASK_DATA_ALIGN \ + TARGET_MASK_ALIGN_BY_32), ""}, \ {"32bit", (TARGET_MASK_STACK_ALIGN \ + TARGET_MASK_CONST_ALIGN \ + TARGET_MASK_DATA_ALIGN \ + TARGET_MASK_ALIGN_BY_32), \ N_("Align code and data to 32 bits")}, \ {"16-bit", (TARGET_MASK_STACK_ALIGN \ + TARGET_MASK_CONST_ALIGN \ + TARGET_MASK_DATA_ALIGN), ""}, \ {"16bit", (TARGET_MASK_STACK_ALIGN \ + TARGET_MASK_CONST_ALIGN \ + TARGET_MASK_DATA_ALIGN), ""}, \ {"8-bit", -(TARGET_MASK_STACK_ALIGN \ + TARGET_MASK_CONST_ALIGN \ + TARGET_MASK_DATA_ALIGN), ""}, \ {"8bit", -(TARGET_MASK_STACK_ALIGN \ + TARGET_MASK_CONST_ALIGN \ + TARGET_MASK_DATA_ALIGN), \ N_("Don't align items in code or data")}, \ {"prologue-epilogue", TARGET_MASK_PROLOGUE_EPILOGUE, ""}, \ {"no-prologue-epilogue", -TARGET_MASK_PROLOGUE_EPILOGUE, \ N_("Do not emit function prologue or epilogue")}, \ /* We have to handle this m-option here since we can't wash it off in \ both CC1_SPEC and CC1PLUS_SPEC. */ \ {"best-lib-options", 0, \ N_("Use the most feature-enabling options allowed by other options")}, \ \ /* We must call it "override-" since calling it "no-" will cause \ gcc.c to forget it, if there's a "later" -mbest-lib-options. \ Kludgy, but needed for some multilibbed files. */ \ {"override-best-lib-options", 0, \ N_("Override -mbest-lib-options")}, \ CRIS_SUBTARGET_SWITCHES \ {"", TARGET_DEFAULT | CRIS_SUBTARGET_DEFAULT, ""}} \/* For the cris-*-elf subtarget. */#define CRIS_SUBTARGET_SWITCHES \ {"elf", 0, ""},/* Default target_flags if no switches specified. */#ifndef TARGET_DEFAULT# define TARGET_DEFAULT \ (TARGET_MASK_SIDE_EFFECT_PREFIXES + TARGET_MASK_STACK_ALIGN \ + TARGET_MASK_CONST_ALIGN + TARGET_MASK_DATA_ALIGN \ + TARGET_MASK_PROLOGUE_EPILOGUE)#endif/* For the cris-*-elf subtarget. */#define CRIS_SUBTARGET_DEFAULT TARGET_MASK_ELF#define CRIS_CPU_BASE 0#define CRIS_CPU_ETRAX4 3 /* Just lz added. */#define CRIS_CPU_SVINTO 8 /* Added swap, jsrc & Co., 32-bit accesses. */#define CRIS_CPU_NG 10 /* Added mul[su]. *//* Local, providing a default for cris_cpu_version. */#define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_BASE#define TARGET_HAS_MUL_INSNS (cris_cpu_version >= CRIS_CPU_NG)#define TARGET_OPTIONS \ {{"cpu=", &cris_cpu_str, ""}, \ {"arch=", &cris_cpu_str, \ N_("Generate code for the specified chip or CPU version")}, \ {"tune=", &cris_tune_str, \ N_("Tune alignment for the specified chip or CPU version")}, \ {"max-stackframe=", &cris_max_stackframe_str, \ N_("Warn when a stackframe is larger than the specified size")}, \ CRIS_SUBTARGET_LONG_OPTIONS \ {"ax-stackframe=", &cris_max_stackframe_str, ""}}#define CRIS_SUBTARGET_LONG_OPTIONS/* Print subsidiary information on the compiler version in use. Do not use VD.D syntax (D=digit), since this will cause confusion with the base gcc version among users, when we ask which version of gcc-cris they are using. Please use some flavor of "R<number>" for the version (no need for major.minor versions, I believe). */#define TARGET_VERSION \ fprintf (stderr, " [Axis CRIS%s]", CRIS_SUBTARGET_VERSION)/* For the cris-*-elf subtarget. */#define CRIS_SUBTARGET_VERSION " - generic ELF"#define OVERRIDE_OPTIONS cris_override_options ()/* The following gives optimal code for gcc-2.7.2, but *may* be subject to change. Omitting flag_force_addr gives .1-.7% faster code for gcc *only*, but 1.3% larger code. On ipps it gives 5.3-10.6% slower code(!) and 0.3% larger code. For products, images gets .1-1.8% larger. Do not set strict aliasing from optimization options. */#define OPTIMIZATION_OPTIONS(OPTIMIZE, SIZE) \ do \ { \ if ((OPTIMIZE) >= 2 || (SIZE)) \ { \ flag_force_addr = 1; \ flag_omit_frame_pointer = 1; \ } \ } \ while (0)/* Node: Storage Layout */#define BITS_BIG_ENDIAN 0#define BYTES_BIG_ENDIAN 0/* WORDS_BIG_ENDIAN is not defined in the hardware, but for consistency, we use little-endianness, and we may also be able to use post-increment on DImode indirect. */#define WORDS_BIG_ENDIAN 0#define UNITS_PER_WORD 4/* A combination of defining PROMOTE_MODE, PROMOTE_FUNCTION_ARGS, PROMOTE_FOR_CALL_ONLY and *not* defining PROMOTE_PROTOTYPES gives the best code size and speed for gcc, ipps and products in gcc-2.7.2. */#define CRIS_PROMOTED_MODE(MODE, UNSIGNEDP, TYPE) \ (GET_MODE_CLASS (MODE) == MODE_INT && GET_MODE_SIZE (MODE) < 4) \ ? SImode : MODE#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ (MODE) = CRIS_PROMOTED_MODE (MODE, UNSIGNEDP, TYPE)#define PROMOTE_FUNCTION_ARGS/* Defining PROMOTE_FUNCTION_RETURN in gcc-2.7.2 uncovers bug 981110 (even if defining FUNCTION_VALUE with MODE as PROMOTED_MODE ;-) FIXME: Report this when cris.h is part of GCC, so others can easily see the problem. Maybe check other systems that define PROMOTE_FUNCTION_RETURN. */#define PROMOTE_FOR_CALL_ONLY/* We will be using prototype promotion, so they will be 32 bit. */#define PARM_BOUNDARY 32/* Stack boundary is guided by -mstack-align, -mno-stack-align, -malign. Old comment: (2.1: still valid in 2.7.2?) Note that to make this macro affect the alignment of stack locals, a fix was required, and special precautions when handling the stack pointer in various other macros (TARGET_ASM_FUNCTION_PROLOGUE et al) were required. See file "function.c". If you would just define this macro, it would only affect the builtin alloca and variable local data (non-ANSI, non-K&R, Gnu C extension). */#define STACK_BOUNDARY \ (TARGET_STACK_ALIGN ? (TARGET_ALIGN_BY_32 ? 32 : 16) : 8)#define FUNCTION_BOUNDARY 16/* Do not change BIGGEST_ALIGNMENT (when optimizing), as it will affect strange places, at least in 2.1. */#define BIGGEST_ALIGNMENT 8/* If -m16bit, -m16-bit, -malign or -mdata-align, align everything to 16 bit. */#define DATA_ALIGNMENT(TYPE, BASIC_ALIGN) \ (TARGET_DATA_ALIGN \ ? (TARGET_ALIGN_BY_32 \ ? (BASIC_ALIGN < 32 ? 32 : BASIC_ALIGN) \ : (BASIC_ALIGN < 16 ? 16 : BASIC_ALIGN)) : BASIC_ALIGN)/* Note that CONSTANT_ALIGNMENT has the effect of making gcc believe that ALL references to constant stuff (in code segment, like strings) has this alignment. That is a rather rushed assumption. Luckily we do not care about the "alignment" operand to builtin memcpy (only place where it counts), so it doesn't affect any bad spots. */#define CONSTANT_ALIGNMENT(CONSTANT, BASIC_ALIGN) \ (TARGET_CONST_ALIGN \ ? (TARGET_ALIGN_BY_32 \ ? (BASIC_ALIGN < 32 ? 32 : BASIC_ALIGN) \ : (BASIC_ALIGN < 16 ? 16 : BASIC_ALIGN)) : BASIC_ALIGN)/* FIXME: Define LOCAL_ALIGNMENT for word and dword or arrays and structures (if -mstack-align=), and check that it is good. */#define EMPTY_FIELD_BOUNDARY 8#define STRUCTURE_SIZE_BOUNDARY 8#define STRICT_ALIGNMENT 0/* Remove any previous definition (elfos.h). ??? If it wasn't for all the other stuff that affects layout of structures and bit-fields, this could presumably cause incompatibility with other GNU/Linux ports (i.e. elfos.h users). */#undef PCC_BITFIELD_TYPE_MATTERS/* This is only used for non-scalars. Strange stuff happens to structs (FIXME: What?) if we use anything larger than largest actually used datum size, so lets make it 32. The type "long long" will still work as usual. We can still have DImode insns, but they will only be used for scalar data (i.e. long long). */#define MAX_FIXED_MODE_SIZE 32/* Node: Type Layout *//* Note that DOUBLE_TYPE_SIZE is not defined anymore, since the default value gives a 64-bit double, which is what we now use. *//* For compatibility and historical reasons, a char should be signed. */#define DEFAULT_SIGNED_CHAR 1/* No DEFAULT_SHORT_ENUMS, please. *//* Note that WCHAR_TYPE_SIZE is used in cexp.y, where TARGET_SHORT is not available. */#undef WCHAR_TYPE#define WCHAR_TYPE "long int"#undef WCHAR_TYPE_SIZE#define WCHAR_TYPE_SIZE 32/* Node: Register Basics *//* We count all 16 non-special registers, SRP and a faked argument pointer register. */#define FIRST_PSEUDO_REGISTER (16 + 1 + 1)/* For CRIS, these are r15 (pc) and r14 (sp). Register r8 is used as a frame-pointer, but is not fixed. SRP is not included in general registers and will not be used automatically. All other special registers are fixed at the moment. The faked argument pointer register is fixed too. */#define FIXED_REGISTERS \ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1}/* Register r9 is used for structure-address, r10-r13 for parameters, r10- for return values. */#define CALL_USED_REGISTERS \ {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1}#define CONDITIONAL_REGISTER_USAGE cris_conditional_register_usage ()/* Node: Allocation Order *//* We need this on CRIS, because call-used regs should be used first, (so we don't need to push). Else start using registers from r0 and up. This preference is mainly because if we put call-used-regs from r0 and up, then we can't use movem to push the rest, (which have to be saved if we use them, and movem has to start with r0). Change here if you change which registers to use as call registers. The actual need to explicitly prefer call-used registers improved the situation a lot for 2.1, but might not actually be needed anymore. Still, this order reflects what GCC should find out by itself, so it probably does not hurt. Order of preference: Call-used-regs first, then r0 and up, last fp & sp & pc as fillers. Call-used regs in opposite order, so they will cause less conflict if a function has few args (<= 3) and it wants a scratch reg. Use struct-return address first, since very few functions use structure return values so it is likely to be available. */#define REG_ALLOC_ORDER \ {9, 13, 12, 11, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15, 16, 17}/* Node: Values in Registers *//* The VOIDmode test is so we can omit mode on anonymous insns. FIXME: Still needed in 2.9x, at least for Axis-20000319. */#define HARD_REGNO_NREGS(REGNO, MODE) \ (MODE == VOIDmode \ ? 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))/* CRIS permits all registers to hold all modes. */#define HARD_REGNO_MODE_OK(REGNO, MODE) 1#define MODES_TIEABLE_P(MODE1, MODE2) 1/* Node: Leaf Functions *//* (no definitions) *//* Node: Stack Registers *//* (no definitions) *//* Node: Register Classes *//* CRIS has only one kind of registers, so NO_REGS and ALL_REGS are the only classes. FIXME: It actually makes sense to have another class for special registers, and yet another class for the multiply-overflow register in v10; then a class for the return register also makes sense. */enum reg_class {NO_REGS, ALL_REGS, LIM_REG_CLASSES};#define N_REG_CLASSES (int) LIM_REG_CLASSES#define REG_CLASS_NAMES {"NO_REGS", "ALL_REGS"}#define GENERAL_REGS ALL_REGS/* Count in the faked argument register in GENERAL_REGS. Keep out SRP. */#define REG_CLASS_CONTENTS {{0}, {0x2ffff}}#define REGNO_REG_CLASS(REGNO) GENERAL_REGS#define BASE_REG_CLASS GENERAL_REGS#define INDEX_REG_CLASS GENERAL_REGS/* Get reg_class from a letter such as appears in the machine description. No letters are used, since 'r' is used for any register. */#define REG_CLASS_FROM_LETTER(C) NO_REGS/* Since it uses reg_renumber, it is safe only once reg_renumber has been allocated, which happens in local-alloc.c. */#define REGNO_OK_FOR_BASE_P(REGNO) \ ((REGNO) <= CRIS_LAST_GENERAL_REGISTER \ || (REGNO) == ARG_POINTER_REGNUM \ || (unsigned) reg_renumber[REGNO] <= CRIS_LAST_GENERAL_REGISTER \ || (unsigned) reg_renumber[REGNO] == ARG_POINTER_REGNUM)/* See REGNO_OK_FOR_BASE_P. */#define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P(REGNO)/* It seems like gcc (2.7.2 and 2.9x of 2000-03-22) may send "NO_REGS" as the class for a constant (testcase: __Mul in arit.c). To avoid forcing out a constant into the constant pool, we will trap this case and return something a bit more sane. FIXME: Check if this is a bug. */#define PREFERRED_RELOAD_CLASS(X, CLASS) \ ((CLASS) == NO_REGS ? GENERAL_REGS : (CLASS))/* For CRIS, this is always the size of MODE in words, since all registers are the same size. To use omitted modes in patterns with reload constraints, you must say the widest size which is allowed for VOIDmode. FIXME: Does that still apply for gcc-2.9x? Keep poisoned until such patterns are added back. News: 2001-03-16: Happens as early as the underscore-test. */#define CLASS_MAX_NREGS(CLASS, MODE) \ ((MODE) == VOIDmode \ ? 1 /* + cris_fatal ("CLASS_MAX_NREGS with VOIDmode") */ \ : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))/* We are now out of letters; we could use ten more. This forces us to use C-code in the 'md' file. FIXME: Use some EXTRA_CONSTRAINTS. */#define CONST_OK_FOR_LETTER_P(VALUE, C) \ ( \ /* MOVEQ, CMPQ, ANDQ, ORQ. */ \ (C) == 'I' ? (VALUE) >= -32 && (VALUE) <= 31 : \ /* ADDQ, SUBQ. */ \ (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63 : \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -