📄 xtensa.h
字号:
/* An argument declared as 'char' or 'short' in a prototype should actually be passed as an 'int'. */#define PROMOTE_PROTOTYPES 1/* Operations between registers always perform the operation on the full register even if a narrower mode is specified. */#define WORD_REGISTER_OPERATIONS/* Xtensa loads are zero-extended by default. */#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND/* 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. The fake frame pointer and argument pointer will never appear in the generated code, since they will always be eliminated and replaced by either the stack pointer or the hard frame pointer. 0 - 15 AR[0] - AR[15] 16 FRAME_POINTER (fake = initial sp) 17 ARG_POINTER (fake = initial sp + framesize) 18 BR[0] for floating-point CC 19 - 34 FR[0] - FR[15] 35 MAC16 accumulator */#define FIRST_PSEUDO_REGISTER 36/* Return the stabs register number to use for REGNO. */#define DBX_REGISTER_NUMBER(REGNO) xtensa_dbx_register_number (REGNO)/* 1 for registers that have pervasive standard uses and are not available for the register allocator. */#define FIXED_REGISTERS \{ \ 1, 1, 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, \}/* 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, 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, \}/* For non-leaf procedures on Xtensa processors, the allocation order is as specified below by REG_ALLOC_ORDER. For leaf procedures, we want to use the lowest numbered registers first to minimize register window overflows. However, local-alloc is not smart enough to consider conflicts with incoming arguments. If an incoming argument in a2 is live throughout the function and local-alloc decides to use a2, then the incoming argument must either be spilled or copied to another register. To get around this, we define ORDER_REGS_FOR_LOCAL_ALLOC to redefine reg_alloc_order for leaf functions such that lowest numbered registers are used first with the exception that the incoming argument registers are not used until after other register choices have been exhausted. */#define REG_ALLOC_ORDER \{ 8, 9, 10, 11, 12, 13, 14, 15, 7, 6, 5, 4, 3, 2, \ 18, \ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, \ 0, 1, 16, 17, \ 35, \}#define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()/* For Xtensa, the only point of this is to prevent GCC from otherwise giving preference to call-used registers. To minimize window overflows for the AR registers, we want to give preference to the lower-numbered AR registers. For other register files, which are not windowed, we still prefer call-used registers, if there are any. */extern const char xtensa_leaf_regs[FIRST_PSEUDO_REGISTER];#define LEAF_REGISTERS xtensa_leaf_regs/* For Xtensa, no remapping is necessary, but this macro must be defined if LEAF_REGISTERS is defined. */#define LEAF_REG_REMAP(REGNO) (REGNO)/* this must be declared if LEAF_REGISTERS is set */extern int leaf_function;/* Internal macros to classify a register number. *//* 16 address registers + fake registers */#define GP_REG_FIRST 0#define GP_REG_LAST 17#define GP_REG_NUM (GP_REG_LAST - GP_REG_FIRST + 1)/* Coprocessor registers */#define BR_REG_FIRST 18#define BR_REG_LAST 18 #define BR_REG_NUM (BR_REG_LAST - BR_REG_FIRST + 1)/* 16 floating-point registers */#define FP_REG_FIRST 19#define FP_REG_LAST 34#define FP_REG_NUM (FP_REG_LAST - FP_REG_FIRST + 1)/* MAC16 accumulator */#define ACC_REG_FIRST 35#define ACC_REG_LAST 35#define ACC_REG_NUM (ACC_REG_LAST - ACC_REG_FIRST + 1)#define GP_REG_P(REGNO) ((unsigned) ((REGNO) - GP_REG_FIRST) < GP_REG_NUM)#define BR_REG_P(REGNO) ((unsigned) ((REGNO) - BR_REG_FIRST) < BR_REG_NUM)#define FP_REG_P(REGNO) ((unsigned) ((REGNO) - FP_REG_FIRST) < FP_REG_NUM)#define ACC_REG_P(REGNO) ((unsigned) ((REGNO) - ACC_REG_FIRST) < ACC_REG_NUM)/* Return number of consecutive hard regs needed starting at reg REGNO to hold something of mode MODE. */#define HARD_REGNO_NREGS(REGNO, MODE) \ (FP_REG_P (REGNO) ? \ ((GET_MODE_SIZE (MODE) + UNITS_PER_FPREG - 1) / UNITS_PER_FPREG) : \ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */extern char xtensa_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];#define HARD_REGNO_MODE_OK(REGNO, MODE) \ xtensa_hard_regno_mode_ok[(int) (MODE)][(REGNO)]/* Value is 1 if it is a good idea to tie two pseudo registers when one has mode MODE1 and one has mode MODE2. If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, for any hard reg, then this must be 0 for correct output. */#define MODES_TIEABLE_P(MODE1, MODE2) \ ((GET_MODE_CLASS (MODE1) == MODE_FLOAT || \ GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \ == (GET_MODE_CLASS (MODE2) == MODE_FLOAT || \ GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT))/* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM (GP_REG_FIRST + 1)/* Base register for access to local variables of the function. */#define HARD_FRAME_POINTER_REGNUM (GP_REG_FIRST + 7)/* The register number of the frame pointer register, which is used to access automatic variables in the stack frame. For Xtensa, this register never appears in the output. It is always eliminated to either the stack pointer or the hard frame pointer. */#define FRAME_POINTER_REGNUM (GP_REG_FIRST + 16)/* Value should be nonzero if functions must have frame pointers. Zero means the frame pointer need not be set up (and parms may be accessed via the stack pointer) in functions that seem suitable. This is computed in 'reload', in reload1.c. */#define FRAME_POINTER_REQUIRED xtensa_frame_pointer_required ()/* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM (GP_REG_FIRST + 17)/* If the static chain is passed in memory, these macros provide rtx giving 'mem' expressions that denote where they are stored. 'STATIC_CHAIN' and 'STATIC_CHAIN_INCOMING' give the locations as seen by the calling and called functions, respectively. */#define STATIC_CHAIN \ gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, -5 * UNITS_PER_WORD))#define STATIC_CHAIN_INCOMING \ gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, -5 * UNITS_PER_WORD))/* For now we don't try to use the full set of boolean registers. Without software pipelining of FP operations, there's not much to gain and it's a real pain to get them reloaded. */#define FPCC_REGNUM (BR_REG_FIRST + 0)/* Pass structure value address as an "invisible" first argument. */#define STRUCT_VALUE 0/* It is as good or better to call a constant function address than to call an address kept in a register. */#define NO_FUNCTION_CSE 1/* It is as good or better for a function to call itself with an explicit address than to call an address kept in a register. */#define NO_RECURSIVE_FUNCTION_CSE 1/* Xtensa processors have "register windows". GCC does not currently take advantage of the possibility for variable-sized windows; instead, we use a fixed window size of 8. */#define INCOMING_REGNO(OUT) \ ((GP_REG_P (OUT) && \ ((unsigned) ((OUT) - GP_REG_FIRST) >= WINDOW_SIZE)) ? \ (OUT) - WINDOW_SIZE : (OUT))#define OUTGOING_REGNO(IN) \ ((GP_REG_P (IN) && \ ((unsigned) ((IN) - GP_REG_FIRST) < WINDOW_SIZE)) ? \ (IN) + WINDOW_SIZE : (IN))/* Define the classes of registers for register constraints in the machine description. */enum reg_class{ NO_REGS, /* no registers in set */ BR_REGS, /* coprocessor boolean registers */ FP_REGS, /* floating point registers */ ACC_REG, /* MAC16 accumulator */ SP_REG, /* sp register (aka a1) */ RL_REGS, /* preferred reload regs (not sp or fp) */ GR_REGS, /* integer registers except sp */ AR_REGS, /* all integer registers */ ALL_REGS, /* all registers */ LIM_REG_CLASSES /* max value + 1 */};#define N_REG_CLASSES (int) LIM_REG_CLASSES#define GENERAL_REGS AR_REGS/* An initializer containing the names of the register classes as C string constants. These names are used in writing some of the debugging dumps. */#define REG_CLASS_NAMES \{ \ "NO_REGS", \ "BR_REGS", \ "FP_REGS", \ "ACC_REG", \ "SP_REG", \ "RL_REGS", \ "GR_REGS", \ "AR_REGS", \ "ALL_REGS" \}/* Contents of the register classes. The Nth integer specifies the contents of class N. The way the integer MASK is interpreted is that register R is in the class if 'MASK & (1 << R)' is 1. */#define REG_CLASS_CONTENTS \{ \ { 0x00000000, 0x00000000 }, /* no registers */ \ { 0x00040000, 0x00000000 }, /* coprocessor boolean registers */ \ { 0xfff80000, 0x00000007 }, /* floating-point registers */ \ { 0x00000000, 0x00000008 }, /* MAC16 accumulator */ \ { 0x00000002, 0x00000000 }, /* stack pointer register */ \ { 0x0000ff7d, 0x00000000 }, /* preferred reload registers */ \ { 0x0000fffd, 0x00000000 }, /* general-purpose registers */ \ { 0x0003ffff, 0x00000000 }, /* integer registers */ \ { 0xffffffff, 0x0000000f } /* all registers */ \}/* A C expression whose value is a register class containing hard register REGNO. In general there is more that one such class; choose a class which is "minimal", meaning that no smaller class also contains the register. */extern const enum reg_class xtensa_regno_to_class[FIRST_PSEUDO_REGISTER];#define REGNO_REG_CLASS(REGNO) xtensa_regno_to_class[ (REGNO) ]/* Use the Xtensa AR register file for base registers. No index registers. */#define BASE_REG_CLASS AR_REGS#define INDEX_REG_CLASS NO_REGS/* SMALL_REGISTER_CLASSES is required for Xtensa, because all of the 16 AR registers may be explicitly used in the RTL, as either incoming or outgoing arguments. */#define SMALL_REGISTER_CLASSES 1/* REGISTER AND CONSTANT CLASSES *//* Get reg_class from a letter such as appears in the machine description. Available letters: a-f,h,j-l,q,t-z,A-D,W,Y-Z DEFINED REGISTER CLASSES: 'a' general-purpose registers except sp 'q' sp (aka a1) 'D' general-purpose registers (only if density option enabled) 'd' general-purpose registers, including sp (only if density enabled) 'A' MAC16 accumulator (only if MAC16 option enabled) 'B' general-purpose registers (only if sext instruction enabled) 'C' general-purpose registers (only if mul16 option enabled) 'b' coprocessor boolean registers 'f' floating-point registers*/extern enum reg_class xtensa_char_to_class[256];#define REG_CLASS_FROM_LETTER(C) xtensa_char_to_class[ (int) (C) ]/* The letters I, J, K, L, M, N, O, and P in a register constraint string can be used to stand for particular ranges of immediate operands. This macro defines what the ranges are. C is the letter, and VALUE is a constant value. Return 1 if VALUE is in the range specified by C. For Xtensa: I = 12-bit signed immediate for movi J = 8-bit signed immediate for addi K = 4-bit value in (b4const U {0}) L = 4-bit value in b4constu M = 7-bit value in simm7 N = 8-bit unsigned immediate shifted left by 8 bits for addmi O = 4-bit value in ai4const P = valid immediate mask value for extui */#define CONST_OK_FOR_LETTER_P(VALUE, C) \ ((C) == 'I' ? (xtensa_simm12b (VALUE)) \ : (C) == 'J' ? (xtensa_simm8 (VALUE)) \ : (C) == 'K' ? (((VALUE) == 0) || xtensa_b4const (VALUE)) \ : (C) == 'L' ? (xtensa_b4constu (VALUE)) \ : (C) == 'M' ? (xtensa_simm7 (VALUE)) \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -