📄 sparc.h
字号:
#define UNITS_PER_WORD (TARGET_ARCH64 ? 8 : 4)#ifdef IN_LIBGCC2#define MIN_UNITS_PER_WORD UNITS_PER_WORD#else#define MIN_UNITS_PER_WORD 4#endif/* Now define the sizes of the C data types. */#define SHORT_TYPE_SIZE 16#define INT_TYPE_SIZE 32#define LONG_TYPE_SIZE (TARGET_ARCH64 ? 64 : 32)#define LONG_LONG_TYPE_SIZE 64#define FLOAT_TYPE_SIZE 32#define DOUBLE_TYPE_SIZE 64#ifdef SPARC_BI_ARCH#define MAX_LONG_TYPE_SIZE 64#endif#if 0/* ??? This does not work in SunOS 4.x, so it is not enabled here. Instead, it is enabled in sol2.h, because it does work under Solaris. *//* Define for support of TFmode long double. SPARC ABI says that long double is 4 words. */#define LONG_DOUBLE_TYPE_SIZE 128#endif/* Width in bits of a pointer. See also the macro `Pmode' defined below. */#define POINTER_SIZE (TARGET_PTR64 ? 64 : 32)/* If we have to extend pointers (only when TARGET_ARCH64 and not TARGET_PTR64), we want to do it unsigned. This macro does nothing if ptr_mode and Pmode are the same. */#define POINTERS_EXTEND_UNSIGNED 1/* A macro to update MODE and UNSIGNEDP when an object whose type is TYPE and which has the specified mode and signedness is to be stored in a register. This macro is only called when TYPE is a scalar type. */#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \if (TARGET_ARCH64 \ && GET_MODE_CLASS (MODE) == MODE_INT \ && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ (MODE) = DImode;/* Define this macro if the promotion described by PROMOTE_MODE should also be done for outgoing function arguments. *//* This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime test for this value. */#define PROMOTE_FUNCTION_ARGS/* Define this macro if the promotion described by PROMOTE_MODE should also be done for the return value of functions. If this macro is defined, FUNCTION_VALUE must perform the same promotions done by PROMOTE_MODE. *//* This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime test for this value. */#define PROMOTE_FUNCTION_RETURN/* Define this macro if the promotion described by PROMOTE_MODE should _only_ be performed for outgoing function arguments or function return values, as specified by PROMOTE_FUNCTION_ARGS and PROMOTE_FUNCTION_RETURN, respectively. *//* This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime test for this value. For TARGET_ARCH64 we need it, as we don't have instructions for arithmetic operations which do zero/sign extension at the same time, so without this we end up with a srl/sra after every assignment to an user variable, which means very very bad code. */#define PROMOTE_FOR_CALL_ONLY/* Allocation boundary (in *bits*) for storing arguments in argument list. */#define PARM_BOUNDARY (TARGET_ARCH64 ? 64 : 32)/* Boundary (in *bits*) on which stack pointer should be aligned. */#define STACK_BOUNDARY (TARGET_ARCH64 ? 128 : 64)/* ALIGN FRAMES on double word boundaries */#define SPARC_STACK_ALIGN(LOC) \ (TARGET_ARCH64 ? (((LOC)+15) & ~15) : (((LOC)+7) & ~7))/* Allocation boundary (in *bits*) for the code of a function. */#define FUNCTION_BOUNDARY 32/* Alignment of field after `int : 0' in a structure. */#define EMPTY_FIELD_BOUNDARY (TARGET_ARCH64 ? 64 : 32)/* Every structure's size must be a multiple of this. */#define STRUCTURE_SIZE_BOUNDARY 8/* A bit-field declared as `int' forces `int' alignment for the struct. */#define PCC_BITFIELD_TYPE_MATTERS 1/* No data type wants to be aligned rounder than this. */#define BIGGEST_ALIGNMENT (TARGET_ARCH64 ? 128 : 64)/* The best alignment to use in cases where we have a choice. */#define FASTEST_ALIGNMENT 64/* Define this macro as an expression for the alignment of a structure (given by STRUCT as a tree node) if the alignment computed in the usual way is COMPUTED and the alignment explicitly specified was SPECIFIED. The default is to use SPECIFIED if it is larger; otherwise, use the smaller of COMPUTED and `BIGGEST_ALIGNMENT' */#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ (TARGET_FASTER_STRUCTS ? \ ((TREE_CODE (STRUCT) == RECORD_TYPE \ || TREE_CODE (STRUCT) == UNION_TYPE \ || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ && TYPE_FIELDS (STRUCT) != 0 \ ? MAX (MAX ((COMPUTED), (SPECIFIED)), BIGGEST_ALIGNMENT) \ : MAX ((COMPUTED), (SPECIFIED))) \ : MAX ((COMPUTED), (SPECIFIED)))/* Make strings word-aligned so strcpy from constants will be faster. */#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ ((TREE_CODE (EXP) == STRING_CST \ && (ALIGN) < FASTEST_ALIGNMENT) \ ? FASTEST_ALIGNMENT : (ALIGN))/* Make arrays of chars word-aligned for the same reasons. */#define DATA_ALIGNMENT(TYPE, ALIGN) \ (TREE_CODE (TYPE) == ARRAY_TYPE \ && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))/* Set this nonzero if move instructions will actually fail to work when given unaligned data. */#define STRICT_ALIGNMENT 1/* Things that must be doubleword aligned cannot go in the text section, because the linker fails to align the text section enough! Put them in the data section. This macro is only used in this file. */#define MAX_TEXT_ALIGN 32/* This forces all variables and constants to the data section when PIC. This is because the SunOS 4 shared library scheme thinks everything in text is a function, and patches the address to point to a loader stub. *//* This is defined to zero for every system which doesn't use the a.out object file format. */#ifndef SUNOS4_SHARED_LIBRARIES#define SUNOS4_SHARED_LIBRARIES 0#endif/* Standard register usage. *//* Number of actual hardware registers. The hardware registers are assigned numbers for the compiler from 0 to just below FIRST_PSEUDO_REGISTER. All registers that the compiler knows about must be given numbers, even those that are not normally considered general registers. SPARC has 32 integer registers and 32 floating point registers. 64 bit SPARC has 32 additional fp regs, but the odd numbered ones are not accessible. We still account for them to simplify register computations (eg: in CLASS_MAX_NREGS). There are also 4 fp condition code registers, so 32+32+32+4 == 100. Register 100 is used as the integer condition code register. Register 101 is used as the soft frame pointer register. */#define FIRST_PSEUDO_REGISTER 102#define SPARC_FIRST_FP_REG 32/* Additional V9 fp regs. */#define SPARC_FIRST_V9_FP_REG 64#define SPARC_LAST_V9_FP_REG 95/* V9 %fcc[0123]. V8 uses (figuratively) %fcc0. */#define SPARC_FIRST_V9_FCC_REG 96#define SPARC_LAST_V9_FCC_REG 99/* V8 fcc reg. */#define SPARC_FCC_REG 96/* Integer CC reg. We don't distinguish %icc from %xcc. */#define SPARC_ICC_REG 100/* Nonzero if REGNO is an fp reg. */#define SPARC_FP_REG_P(REGNO) \((REGNO) >= SPARC_FIRST_FP_REG && (REGNO) <= SPARC_LAST_V9_FP_REG)/* Argument passing regs. */#define SPARC_OUTGOING_INT_ARG_FIRST 8#define SPARC_INCOMING_INT_ARG_FIRST (TARGET_FLAT ? 8 : 24)#define SPARC_FP_ARG_FIRST 32/* 1 for registers that have pervasive standard uses and are not available for the register allocator. On non-v9 systems: g1 is free to use as temporary. g2-g4 are reserved for applications. Gcc normally uses them as temporaries, but this can be disabled via the -mno-app-regs option. g5 through g7 are reserved for the operating system. On v9 systems: g1,g5 are free to use as temporaries, and are free to use between calls if the call is to an external function via the PLT. g4 is free to use as a temporary in the non-embedded case. g4 is reserved in the embedded case. g2-g3 are reserved for applications. Gcc normally uses them as temporaries, but this can be disabled via the -mno-app-regs option. g6-g7 are reserved for the operating system (or application in embedded case). ??? Register 1 is used as a temporary by the 64 bit sethi pattern, so must currently be a fixed register until this pattern is rewritten. Register 1 is also used when restoring call-preserved registers in large stack frames. Registers fixed in arch32 and not arch64 (or vice-versa) are marked in CONDITIONAL_REGISTER_USAGE in order to properly handle -ffixed-.*/#define FIXED_REGISTERS \ {1, 0, 2, 2, 2, 2, 1, 1, \ 0, 0, 0, 0, 0, 0, 1, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 1, 1, \ \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ \ 0, 0, 0, 0, 0, 1}/* 1 for registers not available across function calls. These must include the FIXED_REGISTERS and also any registers that can be used without being saved. The latter must include the registers where values are returned and the register where structure-value addresses are passed. Aside from that, you can include as many other registers as you like. */#define CALL_USED_REGISTERS \ {1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 1, 1, \ \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ \ 1, 1, 1, 1, 1, 1}/* If !TARGET_FPU, then make the fp registers and fp cc regs fixed so that they won't be allocated. */#define CONDITIONAL_REGISTER_USAGE \do \ { \ if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \ { \ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ } \ /* If the user has passed -f{fixed,call-{used,saved}}-g5 */ \ /* then honor it. */ \ if (TARGET_ARCH32 && fixed_regs[5]) \ fixed_regs[5] = 1; \ else if (TARGET_ARCH64 && fixed_regs[5] == 2) \ fixed_regs[5] = 0; \ if (! TARGET_V9) \ { \ int regno; \ for (regno = SPARC_FIRST_V9_FP_REG; \ regno <= SPARC_LAST_V9_FP_REG; \ regno++) \ fixed_regs[regno] = 1; \ /* %fcc0 is used by v8 and v9. */ \ for (regno = SPARC_FIRST_V9_FCC_REG + 1; \ regno <= SPARC_LAST_V9_FCC_REG; \ regno++) \ fixed_regs[regno] = 1; \ } \ if (! TARGET_FPU) \ { \ int regno; \ for (regno = 32; regno < SPARC_LAST_V9_FCC_REG; regno++) \ fixed_regs[regno] = 1; \ } \ /* If the user has passed -f{fixed,call-{used,saved}}-g2 */ \ /* then honor it. Likewise with g3 and g4. */ \ if (fixed_regs[2] == 2) \ fixed_regs[2] = ! TARGET_APP_REGS; \ if (fixed_regs[3] == 2) \ fixed_regs[3] = ! TARGET_APP_REGS; \ if (TARGET_ARCH32 && fixed_regs[4] == 2) \ fixed_regs[4] = ! TARGET_APP_REGS; \ else if (TARGET_CM_EMBMEDANY) \ fixed_regs[4] = 1; \ else if (fixed_regs[4] == 2) \ fixed_regs[4] = 0; \ if (TARGET_FLAT) \ { \ int regno; \ /* Let the compiler believe the frame pointer is still \ %fp, but output it as %i7. */ \ fixed_regs[31] = 1; \ reg_names[HARD_FRAME_POINTER_REGNUM] = "%i7"; \ /* Disable leaf functions */ \ memset (sparc_leaf_regs, 0, FIRST_PSEUDO_REGISTER); \ /* Make LEAF_REG_REMAP a noop. */ \ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \ leaf_reg_remap [regno] = regno; \ } \ } \while (0)/* Return number of consecutive hard regs needed starting at reg REGNO to hold something of mode MODE. This is ordinarily the length in words of a value of mode MODE but can be less for certain modes in special long registers. On SPARC, ordinary registers hold 32 bits worth; this means both integer and floating point registers. On v9, integer regs hold 64 bits worth; floating point regs hold 32 bits worth (this includes the new fp regs as even the odd ones are included in the hard register count). */#define HARD_REGNO_NREGS(REGNO, MODE) \ (TARGET_ARCH64 \ ? ((REGNO) < 32 || (REGNO) == FRAME_POINTER_REGNUM \ ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -