?? arm.h
字號:
/* The letters I, J, K, L and M 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. I: immediate arithmetic operand (i.e. 8 bits shifted as required). J: valid indexing constants. */#define CONST_OK_FOR_LETTER_P(VALUE, C) \ ((C) == 'I' ? const_ok_for_arm (VALUE) : \ (C) == 'J' ? (abs (VALUE) < 4096) : 0)/* Constant letter 'G' for the FPU immediate constants. */#define CONST_DOUBLE_OK_FOR_LETTER_P(X,C) \ ((C) == 'G' ? const_double_rtx_ok_for_fpu (X) : 0)/* 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 maximum number of consecutive registers needed to represent mode MODE in a register of class CLASS. ARM regs are UNITS_PER_WORD bits while FPU regs can hold any FP mode */#define CLASS_MAX_NREGS(CLASS, MODE) \ ((CLASS) == FPU_REGS ? 1 \ : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))/* Moves between FPU_REGS and GENERAL_REGS are two insns. */#define REGISTER_MOVE_COST(CLASS1, CLASS2) \ ((((CLASS1) == FPU_REGS && (CLASS2) != FPU_REGS) \ || ((CLASS2) == FPU_REGS && (CLASS1) != FPU_REGS)) \ ? 4 : 2)/* 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 1/* 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 1/* 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 0/* If we generate an insn to push BYTES bytes, this says how many the stack pointer really advances by. */#define PUSH_ROUNDING(NPUSHED) (((NPUSHED) + 3) & ~3)/* Offset of first parameter from the argument pointer register value. */#define FIRST_PARM_OFFSET(FNDECL) 4/* Value is the number of byte 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. On the ARM, the caller does not pop any of its arguments that were 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. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ (GET_MODE_CLASS (TYPE_MODE (VALTYPE)) == MODE_FLOAT \ ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16) \ : gen_rtx (REG, TYPE_MODE (VALTYPE), 0))/* Define how to find the value returned by a library function assuming the value has mode MODE. */#define LIBCALL_VALUE(MODE) \ (GET_MODE_CLASS (MODE) == MODE_FLOAT \ ? gen_rtx (REG, MODE, 16) \ : gen_rtx (REG, MODE, 0))/* 1 if N is a possible register number for a function value. On the ARM, only r0 and f0 can return results. */#define FUNCTION_VALUE_REGNO_P(REGNO) \ ((REGNO) == 0 || (REGNO) == 16)/* Define where to put the arguments to a function. Value is zero to push the argument on the stack, or a hard register in which to store the argument. MODE is the argument's machine mode. TYPE is the data type of the argument (as a tree). This is null for libcalls where that information may not be available. CUM is a variable of type CUMULATIVE_ARGS which gives info about the preceding args and about the function being called. NAMED is nonzero if this argument is a named parameter (otherwise it is an extra parameter matching an ellipsis). On the ARM, normally the first 16 bytes are passed in registers r0-r3; all other arguments are passed on the stack. If (NAMED == 0) (which happens only in assign_parms, since SETUP_INCOMING_VARARGS is defined), say it is passed in the stack (function_prologue will indeed make it pass in the stack if necessary). */#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ ((NAMED) \ ? ((CUM) >= 16 ? 0 : gen_rtx (REG, MODE, (CUM) / 4)) \ : 0)/* For an arg passed partly in registers and partly in memory, this is the number of registers used. For args passed entirely in registers or entirely in memory, zero. */#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ ((CUM) < 16 && 16 < (CUM) + ((MODE) != BLKmode \ ? GET_MODE_SIZE (MODE) \ : int_size_in_bytes (TYPE)) \ ? 4 - (CUM) / 4 : 0)/* A C type for declaring a variable that is used as the first argument of `FUNCTION_ARG' and other related values. For some target machines, the type `int' suffices and can hold the number of bytes of argument so far. On the ARM, this is the number of bytes of arguments scanned so far. */#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. On the ARM, the offset starts at 0. */#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME) \ ((CUM) = (((FNTYPE) && aggregate_value_p (FNTYPE)) ? 4 : 0))/* 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) \ (CUM) += ((MODE) != BLKmode \ ? (GET_MODE_SIZE (MODE) + 3) & ~3 \ : (int_size_in_bytes (TYPE) + 3) & ~3) \/* 1 if N is a possible register number for function argument passing. On the ARM, r0-r3 are used to pass args. */#define FUNCTION_ARG_REGNO_P(REGNO) \ ((REGNO) >= 0 && (REGNO) <= 3)/* Perform any actions needed for a function that is receiving a variable number of arguments. CUM is as above. MODE and TYPE are the mode and type of the current parameter. PRETEND_SIZE is a variable that should be set to the amount of stack that must be pushed by the prolog to pretend that our caller pushed it. Normally, this macro will push all remaining incoming registers on the stack and set PRETEND_SIZE to the length of the registers pushed. On the ARM, PRETEND_SIZE is set in order to have the prologue push the last named arg and all anonymous args onto the stack. XXX I know the prologue shouldn't be pushing registers, but it is faster that way. */#define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PRETEND_SIZE, NO_RTL) \{ \ extern int current_function_anonymous_args; \ current_function_anonymous_args = 1; \ if ((CUM) < 16) \ (PRETEND_SIZE) = 16 - (CUM); \}/* Generate assembly output for the start of a function. */#define FUNCTION_PROLOGUE(STREAM, SIZE) \ output_prologue ((STREAM), (SIZE))/* Call the function profiler with a given profile label. The Acorn compiler puts this BEFORE the prolog but gcc pust it afterwards. The ``mov ip,lr'' seems like a good idea to stick with cc convention. ``prof'' doesn't seem to mind about this! */#define FUNCTION_PROFILER(STREAM,LABELNO) \{ \ fprintf(STREAM, "\tmov\tip, lr\n"); \ fprintf(STREAM, "\tbl\tmcount\n"); \ fprintf(STREAM, "\t.word\tLP%d\n", (LABELNO)); \ arm_increase_location (12); \}/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, the stack pointer does not matter. The value is tested only in functions that have frame pointers. No definition is equivalent to always zero. On the ARM, the function epilogue recovers the stack pointer from the frame. */#define EXIT_IGNORE_STACK 1/* Generate the assembly code for function exit. */#define FUNCTION_EPILOGUE(STREAM, SIZE) \ output_epilogue ((STREAM), (SIZE))/* Determine if the epilogue should be output as RTL. You should override this if you define FUNCTION_EXTRA_EPILOGUE. *//* #define USE_RETURN_INSN use_return_insn () *//* Store in the variable DEPTH the initial difference between the frame pointer reg contents and the stack pointer reg contents, as of the start of the function body. This depends on the layout of the fixed parts of the stack frame and on how registers are saved. */#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \ (DEPTH) = (get_frame_size () + 3) & ~3;/* Output assembler code for a block containing the constant parts of a trampoline, leaving space for the variable parts. On the ARM, (if r8 is the static chain regnum, and remembering that referencing pc adds an offset of 8) the trampoline looks like: ldr r8, [pc, #0] ldr pc, [pc] .word static chain value .word function's address */#define TRAMPOLINE_TEMPLATE(FILE) \{ \ fprintf ((FILE), "\tldr\tr8, [pc, #0]\n"); \ fprintf ((FILE), "\tldr\tpc, [pc, #0]\n"); \ fprintf ((FILE), "\t.word\t0\n"); \ fprintf ((FILE), "\t.word\t0\n"); \}/* Length in units of the trampoline for entering a nested function. */#define TRAMPOLINE_SIZE 16/* Alignment required for a trampoline in units. */#define TRAMPOLINE_ALIGN 4/* Emit RTL insns to initialize the variable parts of a trampoline. FNADDR is an RTX for the address of the function's pure code. CXT is an RTX for the static chain value for the function. */#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \{ \ emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 8)), \ (CXT)); \ emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 12)), \ (FNADDR)); \}/* Call the function profiler with a given profile label. The Acorn compiler puts this BEFORE the prolog but gcc pust it afterwards. The ``mov ip,lr'' seems like a good idea to stick with cc convention. ``prof'' doesn't seem to mind about this! */#define FUNCTION_PROFILER(STREAM,LABELNO) \{ \ fprintf(STREAM, "\tmov\tip, lr\n"); \ fprintf(STREAM, "\tbl\tmcount\n"); \ fprintf(STREAM, "\t.word\tLP%d\n", (LABELNO)); \ arm_increase_location (12); \}/* Addressing modes, and classification of registers for them. */#define HAVE_POST_INCREMENT 1#define HAVE_PRE_INCREMENT 1#define HAVE_POST_DECREMENT 1#define HAVE_PRE_DECREMENT 1/* Macros to check register numbers against specific register classes. *//* These assume that REGNO is a hard or pseudo reg number. They give nonzero only if REGNO is a hard reg of the suitable class or a pseudo reg currently allocated to a suitable hard reg. Since they use reg_renumber, they are safe only once reg_renumber has been allocated, which happens in local-alloc.c. On the ARM, don't allow the pc to be used. */#define REGNO_OK_FOR_BASE_P(REGNO) \ ((REGNO) < 15 || (unsigned) reg_renumber[(REGNO)] < 15)#define REGNO_OK_FOR_INDEX_P(REGNO) \ REGNO_OK_FOR_BASE_P(REGNO)/* Maximum number of registers that can appear in a valid memory address. The addressing mode [ra,rb, <shift> rc] uses the greatest number of registers. */#define MAX_REGS_PER_ADDRESS 3/* Recognize any constant value that is a valid address. *//* XXX We can address any constant, eventually... */#if 0#define CONSTANT_ADDRESS_P(X) \ ( GET_CODE(X) == LABEL_REF \ || GET_CODE(X) == SYMBOL_REF \ || GET_CODE(X) == CONST_INT \ || GET_CODE(X) == CONST )#endif#define CONSTANT_ADDRESS_P(X) \ (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X))/* Nonzero if the constant value X is a legitimate general operand. It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. On the ARM, allow any integer (invalid ones are removed later by insn patterns), nice doubles and symbol_refs which refer to the function's constant pool XXX. */#define LEGITIMATE_CONSTANT_P(X) \ (GET_CODE (X) == CONST_INT \ || (GET_CODE (X) == CONST_DOUBLE \ && const_double_rtx_ok_for_fpu (X)))#if 0 || GET_CODE(X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P(X))#endif/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check its validity for a certain class. We have two alternate definitions for each of them. The usual definition accepts all pseudo regs; the other rejects them unless they have been allocated suitable hard regs. The symbol REG_OK_STRICT causes the latter definition to be used. */#ifndef REG_OK_STRICT/* Nonzero if X is a hard reg that can be used as a base reg or if it is a pseudo reg. */#define REG_OK_FOR_BASE_P(X) \ (REGNO (X) < 16 || REGNO (X) >= 24)/* Nonzero if X is a hard reg that can be used as an index or if it is a pseudo reg. */#define REG_OK_FOR_INDEX_P(X) \ REG_OK_FOR_BASE_P(X)#define REG_OK_FOR_PRE_POST_P(X) \ (REGNO (X) < 16 || REGNO (X) >= FIRST_PSEUDO_REGISTER)#else
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -