📄 a29k.h
字号:
hold integer or floating-point values, and the accumulators cannot hold integer values. DImode and larger values should start at an even register just like DFmode values, even though the instruction set doesn't require it, in order to prevent reload from aborting due to a modes_equiv_for_class_p failure. (I'd like to use the "?:" syntax to make this more readable, but Sun's compiler doesn't seem to accept it.) */#define HARD_REGNO_MODE_OK(REGNO, MODE) \ (((REGNO) >= R_ACC (0) \ && (GET_MODE_CLASS (MODE) == MODE_FLOAT \ || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)) \ || ((REGNO) >= R_BP && (REGNO) <= R_CR \ && GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT) \ || ((REGNO) >= R_Q && (REGNO) < R_ACC (0) \ && GET_MODE_CLASS (MODE) != MODE_FLOAT \ && GET_MODE_CLASS (MODE) != MODE_COMPLEX_FLOAT) \ || ((REGNO) < R_BP \ && ((((REGNO) & 1) == 0) \ || GET_MODE_UNIT_SIZE (MODE) <= UNITS_PER_WORD)))/* 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. On the 29k, normally we'd just have problems with DFmode because of the even alignment. However, we also have to be a bit concerned about the special register's restriction to non-floating and the floating-point accumulator's restriction to only floating. This probably won't cause any great inefficiencies in practice. */#define MODES_TIEABLE_P(MODE1, MODE2) \ ((MODE1) == (MODE2) \ || (GET_MODE_CLASS (MODE1) == MODE_INT \ && GET_MODE_CLASS (MODE2) == MODE_INT))/* Specify the registers used for certain standard purposes. The values of these macros are register numbers. *//* 29k pc isn't overloaded on a register that the compiler knows about. *//* #define PC_REGNUM *//* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM R_GR (125)/* Base register for access to local variables of the function. */#define FRAME_POINTER_REGNUM R_FP/* 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 0/* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM R_FP/* Register in which static-chain is passed to a function. */#define STATIC_CHAIN_REGNUM R_SLP/* Register in which address to store a structure value is passed to a function. */#define STRUCT_VALUE_REGNUM R_LRP/* Define the classes of registers for register constraints in the machine description. Also define ranges of constants. One of the classes must always be named ALL_REGS and include all hard regs. If there is more than one class, another class must be named NO_REGS and contain no registers. The name GENERAL_REGS must be the name of a class (or an alias for another name such as ALL_REGS). This is the class of registers that is allowed by "g" or "r" in a register constraint. Also, registers outside this class are allocated only when instructions express preferences for them. The classes must be numbered in nondecreasing order; that is, a larger-numbered class must never be contained completely in a smaller-numbered class. For any two classes, it is very desirable that there be another class that represents their union. The 29k has nine registers classes: LR0_REGS, GENERAL_REGS, SPECIAL_REGS, BP_REGS, FC_REGS, CR_REGS, Q_REGS, ACCUM_REGS, and ACCUM0_REGS. LR0_REGS, BP_REGS, FC_REGS, CR_REGS, and Q_REGS contain just the single register. The latter two classes are used to represent the floating-point accumulator registers in the 29050. We also define the union class FLOAT_REGS to represent any register that can be used to hold a floating-point value. The union of SPECIAL_REGS and ACCUM_REGS isn't useful as the former cannot contain floating-point and the latter can only contain floating-point. */enum reg_class { NO_REGS, LR0_REGS, GENERAL_REGS, BP_REGS, FC_REGS, CR_REGS, Q_REGS, SPECIAL_REGS, ACCUM0_REGS, ACCUM_REGS, FLOAT_REGS, ALL_REGS, LIM_REG_CLASSES };#define N_REG_CLASSES (int) LIM_REG_CLASSES/* Give names of register classes as strings for dump file. */#define REG_CLASS_NAMES \ {"NO_REGS", "LR0_REGS", "GENERAL_REGS", "BP_REGS", "FC_REGS", "CR_REGS", \ "Q_REGS", "SPECIAL_REGS", "ACCUM0_REGS", "ACCUM_REGS", "FLOAT_REGS", \ "ALL_REGS" }/* Define which registers fit in which classes. This is an initializer for a vector of HARD_REG_SET of length N_REG_CLASSES. */#define REG_CLASS_CONTENTS \ { {0, 0, 0, 0, 0, 0, 0}, \ {0, 1, 0, 0, 0, 0, 0}, \ {~0, ~0, ~0, ~0, ~0, ~ 0xfffe0000, 0}, \ {0, 0, 0, 0, 0, 0x20000, 0}, \ {0, 0, 0, 0, 0, 0x40000, 0}, \ {0, 0, 0, 0, 0, 0x80000, 0}, \ {0, 0, 0, 0, 0, 0x100000, 0}, \ {0, 0, 0, 0, 0, 0xfffe0000, 0xff}, \ {0, 0, 0, 0, 0, 0, 0x100}, \ {0, 0, 0, 0, 0, 0, 0xf00}, \ {~0, ~0, ~0, ~0, ~0, ~ 0xfffe0000, 0xf00}, \ {~0, ~0, ~0, ~0, ~0, ~0, ~0} }/* The same information, inverted: Return the class number of the smallest class containing reg number REGNO. This could be a conditional expression or could index an array. */#define REGNO_REG_CLASS(REGNO) \ ((REGNO) == R_BP ? BP_REGS \ : (REGNO) == R_FC ? FC_REGS \ : (REGNO) == R_CR ? CR_REGS \ : (REGNO) == R_Q ? Q_REGS \ : (REGNO) > R_BP && (REGNO) <= R_EXO ? SPECIAL_REGS \ : (REGNO) == R_ACC (0) ? ACCUM0_REGS \ : (REGNO) > R_ACC (0) ? ACCUM_REGS \ : (REGNO) == R_LR (0) ? LR0_REGS \ : GENERAL_REGS)/* The class value for index registers, and the one for base regs. */#define INDEX_REG_CLASS NO_REGS#define BASE_REG_CLASS GENERAL_REGS/* Get reg_class from a letter such as appears in the machine description. */#define REG_CLASS_FROM_LETTER(C) \ ((C) == 'r' ? GENERAL_REGS \ : (C) == 'l' ? LR0_REGS \ : (C) == 'b' ? BP_REGS \ : (C) == 'f' ? FC_REGS \ : (C) == 'c' ? CR_REGS \ : (C) == 'q' ? Q_REGS \ : (C) == 'h' ? SPECIAL_REGS \ : (C) == 'a' ? ACCUM_REGS \ : (C) == 'A' ? ACCUM0_REGS \ : (C) == 'f' ? FLOAT_REGS \ : NO_REGS)/* Define this macro to change register usage conditional on target flags. On the 29k, we use this to change the register names for kernel mapping. */#define CONDITIONAL_REGISTER_USAGE \ { \ static char *kernel_names[] = {"gr64", "gr65", "gr66", "gr67", \ "gr68", "gr69", "gr70", "gr71", \ "gr72", "gr73", "gr74", "gr75", \ "gr76", "gr77", "gr78", "gr79", \ "gr80", "gr81", "gr82", "gr83", \ "gr84", "gr85", "gr86", "gr87", \ "gr88", "gr89", "gr90", "gr91", \ "gr92", "gr93", "gr94", "gr95"}; \ int i; \ \ if (TARGET_KERNEL_REGISTERS) \ for (i = 0; i < 32; i++) \ reg_names[i] = kernel_names[i]; \ }/* 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 29k: `I' is used for the range of constants most insns can contain. `J' is for the few 16-bit insns. `K' is a constant whose high-order 24 bits are all one `L' is a HImode constant whose high-order 8 bits are all one `M' is a 32-bit constant whose high-order 16 bits are all one (for CONSTN) `N' is a 32-bit constant whose negative is 8 bits `O' is the 32-bit constant 0x80000000, any constant with low-order 16 bits zero for 29050. `P' is a HImode constant whose negative is 8 bits */#define CONST_OK_FOR_LETTER_P(VALUE, C) \ ((C) == 'I' ? (unsigned) (VALUE) < 0x100 \ : (C) == 'J' ? (unsigned) (VALUE) < 0x10000 \ : (C) == 'K' ? ((VALUE) & 0xffffff00) == 0xffffff00 \ : (C) == 'L' ? ((VALUE) & 0xff00) == 0xff00 \ : (C) == 'M' ? ((VALUE) & 0xffff0000) == 0xffff0000 \ : (C) == 'N' ? ((VALUE) < 0 && (VALUE) > -256) \ : (C) == 'O' ? ((VALUE) == 0x80000000 \ || (TARGET_29050 && ((VALUE) & 0xffff) == 0)) \ : (C) == 'P' ? (((VALUE) | 0xffff0000) < 0 \ && ((VALUE) | 0xffff0000) > -256) \ : 0)/* Similar, but for floating constants, and defining letters G and H. Here VALUE is the CONST_DOUBLE rtx itself. All floating-point constants are valid on 29k. */#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1/* Given an rtx X being reloaded into a reg required to be in class CLASS, return the class of reg to actually use. In general this is just CLASS; but on some machines in some cases it is preferable to use a more restrictive class. */#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS/* Return the register class of a scratch register needed to copy IN into or out of a register in CLASS in MODE. If it can be done directly, NO_REGS is returned. */#define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \ secondary_reload_class (CLASS, MODE, IN)/* This function is used to get the address of an object. */extern struct rtx_def *a29k_get_reloaded_address ();/* Return the maximum number of consecutive registers needed to represent mode MODE in a register of class CLASS. On 29k, this is the size of MODE in words except that the floating-point accumulators only require one word for anything they can hold. */#define CLASS_MAX_NREGS(CLASS, MODE) \ (((CLASS) == ACCUM_REGS || (CLASS) == ACCUM0_REGS) ? 1 \ : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)/* Define the cost of moving between registers of various classes. Everything involving a general register is cheap, but moving between the other types (even within a class) is two insns. */#define REGISTER_MOVE_COST(CLASS1, CLASS2) \ ((CLASS1) == GENERAL_REGS || (CLASS2) == GENERAL_REGS ? 2 : 4)/* A C statement (sans semicolon) to update the integer variable COST based on the relationship between INSN that is dependent on DEP_INSN through the dependence LINK. The default is to make no adjustment to COST. On the a29k, ignore the cost of anti- and output-dependencies. */#define ADJUST_COST(INSN,LINK,DEP_INSN,COST) \ if (REG_NOTE_KIND (LINK) != 0) \ (COST) = 0; /* Anti or output dependence. *//* Stack layout; function entry, exit and calling. *//* Define this if pushing a word on the stack makes the stack pointer a smaller address. */#define STACK_GROWS_DOWNWARD/* Define this if the nominal address of the stack frame is at the high-address end of the local variables; that is, each additional local variable allocated goes at a more negative offset in the frame. */#define FRAME_GROWS_DOWNWARD/* Offset within stack frame to start allocating local variables at. If FRAME_GROWS_DOWNWARD, this is the offset to the END of the first local allocated. Otherwise, it is the offset to the BEGINNING of the first local allocated. */#define STARTING_FRAME_OFFSET (- current_function_pretend_args_size)/* If we generate an insn to push BYTES bytes, this says how many the stack pointer really advances by. On 29k, don't define this because there are no push insns. *//* #define PUSH_ROUNDING(BYTES) *//* Define this if the maximum size of all the outgoing args is to be accumulated and pushed during the prologue. The amount can be found in the variable current_function_outgoing_args_size. */#define ACCUMULATE_OUTGOING_ARGS/* Offset of first parameter from the argument pointer register value. */#define FIRST_PARM_OFFSET(FNDECL) (- current_function_pretend_args_size)/* Define this if stack space is still allocated for a parameter passed in a register. *//* #define REG_PARM_STACK_SPACE *//* Value is the number of bytes of arguments automatically popped when returning from a subroutine call. FUNTYPE is the data type of the function (as a tree), or for a library call it is an identifier node for the subroutine name. SIZE is the number of bytes of arguments passed on the stack. */#define RETURN_POPS_ARGS(FUNTYPE,SIZE) 0/* Define how to find the value returned by a function. VALTYPE is the data type of the value (as a tree). If the precise function being called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. On 29k the value is found in gr96. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx (REG, TYPE_MODE (VALTYPE), R_GR (96))/* Define how to find the value returned by a library function assuming the value has mode MODE. */#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, R_GR (96))/* 1 if N is a possible register number for a function value as seen by the caller. On 29k, gr96-gr111 are used. */#define FUNCTION_VALUE_REGNO_P(N) ((N) < R_GR (112))/* 1 if N is a possible register number for function argument passing. On 29k, these are lr2-lr17. */#define FUNCTION_ARG_REGNO_P(N) ((N) <= R_LR (17) && (N) >= R_LR (2))/* Define a data type for recording info about an argument list during the scan of that argument list. This data type should hold all necessary information about the function itself and about the args processed so far, enough to enable macros such as FUNCTION_ARG to determine where the next arg should go. On 29k, this is a single integer, which is a number of words of arguments scanned so far. Thus 16 or more means all following args should go on the stack. */#define CUMULATIVE_ARGS int/* Initialize a variable CUM of type CUMULATIVE_ARGS for a call to a function whose data type is FNTYPE. For a library call, FNTYPE is 0. */#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) (CUM) = 0/* Same, but called for incoming args. On the 29k, we use this to set all argument registers to fixed and set the last 16 local regs (lr112-lr127) to available. Some will later be changed to call-saved by FUNCTION_INCOMING_ARG. */#define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,IGNORE) \{ int i; \ for (i = R_AR (0); i < R_AR (16); i++) \ { \ fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 1; \ SET_HARD_REG_BIT (fixed_reg_set, i); \ SET_HARD_REG_BIT (call_used_reg_set, i); \ SET_HARD_REG_BIT (call_fixed_reg_set, i); \ } \ for (i = R_LR (112); i < R_LR (128); i++) \ { \ fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 0; \ CLEAR_HARD_REG_BIT (fixed_reg_set, i); \ CLEAR_HARD_REG_BIT (call_used_reg_set, i); \ CLEAR_HARD_REG_BIT (call_fixed_reg_set, i); \ } \ (CUM) = 0; \ }/* Define intermediate macro to compute the size (in registers) of an argument for the 29k. */#define A29K_ARG_SIZE(MODE, TYPE, NAMED) \(! (NAMED) ? 0 \ : (MODE) != BLKmode \ ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \ : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)/* Update the data in CUM to advance over an argument of mode MODE and data type TYPE. (TYPE is null for libcalls where that information may not be available.) */#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ if (MUST_PASS_IN_STACK (MODE, TYPE)) \ (CUM) = 16; \ else \ (CUM) += A29K_ARG_SIZE (MODE, TYPE, NAMED)/* Determine where to put an argument to a function. Value is zero to push the argument on the stack, or a hard register in which to store the argument.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -