📄 ns32k.h
字号:
/* On the 32000 the return value is in R0, or perhaps F0 is there is fp support. */#define LIBCALL_VALUE(MODE) \ gen_rtx_REG (MODE, \ FLOAT_MODE_P(MODE) && TARGET_32081 ? F0_REGNUM: R0_REGNUM)/* Define this if PCC uses the nonreentrant convention for returning structure and union values. */#define PCC_STATIC_STRUCT_RETURN/* 1 if N is a possible register number for a function value. On the 32000, R0 and F0 are the only registers thus used. */#define FUNCTION_VALUE_REGNO_P(N) (((N) & ~8) == 0)/* 1 if N is a possible register number for function argument passing. On the 32000, no registers are used in this way. */#define FUNCTION_ARG_REGNO_P(N) 0/* 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 the ns32k, this is a single integer, which is a 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 ns32k, the offset starts at 0. */#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ ((CUM) = 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))/* 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 32000 all args are pushed, except if -mregparm is specified then the first two words of arguments are passed in r0, r1. *NOTE* -mregparm does not work. It exists only to test register calling conventions. */#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \((TARGET_REGPARM && (CUM) < 8) ? gen_rtx_REG ((MODE), (CUM) / 4) : 0)/* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. THIS DEFINITION FOR THE 32000 IS A GUESS. IT HAS NOT BEEN TESTED. */#define FUNCTION_PROFILER(FILE, LABELNO) \ fprintf (FILE, "\taddr LP%d,r0\n\tbsr mcount\n", (LABELNO))/* 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. We use 0, because using 1 requires hair in output_function_epilogue() that is worse than the stack adjust we could save. *//* #define EXIT_IGNORE_STACK 1 *//* 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) \{ \ int regno; \ int offset = -4; \ for (regno = 0; regno < FRAME_POINTER_REGNUM; regno++) \ if (regs_ever_live[regno] && ! call_used_regs[regno]) \ offset += 4; \ if (flag_pic && current_function_uses_pic_offset_table) \ offset += 4; \ (DEPTH) = (offset + get_frame_size () \ + (get_frame_size () == 0 ? 0 : 4)); \}/* Output assembler code for a block containing the constant parts of a trampoline, leaving space for the variable parts. *//* On the 32k, the trampoline looks like this: addr 0(pc),r2 movd 16(r2),tos movd 12(r2),r1 ret 0 .align 4 .int STATIC .int FUNCTION Putting the data in following data is easier than figuring out how to do stores to memory in reverse byte order (the way immediate operands on the 32k are stored). */#define TRAMPOLINE_TEMPLATE(FILE) \{ \ fprintf (FILE, "\taddr 0(pc),r2\n"); \ fprintf (FILE, "\tmovd 16(r2),tos\n"); \ fprintf (FILE, "\tmovd 12(r2),r1\n"); \ fprintf (FILE, "\tret 0\n"); \ assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \ assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \}/* Length in units of the trampoline for entering a nested function. */#define TRAMPOLINE_SIZE 20/* 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, 12)), CXT); \ emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 16)), FNADDR); \}/* Addressing modes, and classification of registers for them. *//* 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. *//* note that FP and SP cannot be used as an index. What about PC? */#define REGNO_OK_FOR_INDEX_P(REGNO) \((REGNO) < F0_REGNUM || (unsigned)reg_renumber[REGNO] < F0_REGNUM)#define REGNO_OK_FOR_BASE_P(REGNO) \((REGNO) < F0_REGNUM || (unsigned)reg_renumber[REGNO] < F0_REGNUM \ || (REGNO) == FRAME_POINTER_REGNUM || (REGNO) == STACK_POINTER_REGNUM)#define FP_REG_P(X) \ (GET_CODE (X) == REG && REGNO (X) >= F0_REGNUM && REGNO (X) < FRAME_POINTER_REGNUM)/* Maximum number of registers that can appear in a valid memory address. */#define MAX_REGS_PER_ADDRESS 2/* Recognize any constant value that is a valid address. This might not work on future ns32k processors as negative displacements are not officially allowed but a mode reserved to National. This works on processors up to 32532, though, and we don't expect any new ones in the series ;-( */#define CONSTANT_ADDRESS_P(X) \ (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ || GET_CODE (X) == CONST \ || (GET_CODE (X) == CONST_INT \ && NS32K_DISPLACEMENT_P (INTVAL (X))))#define CONSTANT_ADDRESS_NO_LABEL_P(X) \ (GET_CODE (X) == CONST_INT \ && NS32K_DISPLACEMENT_P (INTVAL (X)))/* 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)/* Certain machines have the property that some registers cannot be copied to some other registers without using memory. Define this macro on those machines to be a C expression that is nonzero if objects of mode M in registers of CLASS1 can only be copied to registers of class CLASS2 by storing a register of CLASS1 into memory and loading that memory location into a register of CLASS2. On the ns32k, floating point regs can only be loaded through memory The movdf and movsf insns in ns32k.md copy between general and floating registers using the stack. In principle, we could get better code not allowing that case in the constraints and defining SECONDARY_MEMORY_NEEDED in practice, though the stack slots used are not available for optimization. */#if 0#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, M) \ secondary_memory_needed(CLASS1, CLASS2, M)#endif/* SMALL_REGISTER_CLASSES is a run time option. This should no longer be necessary and should go when we have confidence that we won't run out of spill registers */#define SMALL_REGISTER_CLASSES (target_flags & MASK_SRC)/* A C expression whose value is nonzero if pseudos that have been assigned to registers of class CLASS would likely be spilled because registers of CLASS are needed for spill registers. The default definition won't do because class LONG_FLOAT_REG0 has two registers which are always accessed as a pair */#define CLASS_LIKELY_SPILLED_P(CLASS) \ (reg_class_size[(int) (CLASS)] == 1 || (CLASS) == LONG_FLOAT_REG0)/* Nonzero if the constant value X is a legitimate general operand. It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */#define LEGITIMATE_CONSTANT_P(X) 1/* 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. Most source files want to accept pseudo regs in the hope that they will get allocated to the class that the insn wants them to be in. Source files for reload pass need to be strict. After reload, it makes no difference, since pseudo regs have been eliminated by then. */#ifndef REG_OK_STRICT/* 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) \ (REGNO (X) < F0_REGNUM || REGNO (X) >= FIRST_PSEUDO_REGISTER)/* Nonzero if X is a hard reg that can be used as a base reg of if it is a pseudo reg. */#define REG_OK_FOR_BASE_P(X) (REGNO (X) < F0_REGNUM || REGNO (X) >= FRAME_POINTER_REGNUM)/* Nonzero if X is a floating point reg or a pseudo reg. */#else/* Nonzero if X is a hard reg that can be used as an index. */#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))/* Nonzero if X is a hard reg that can be used as a base reg. */#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))#endif/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression that is a valid memory address for an instruction. The MODE argument is the machine mode for the MEM expression that wants to use this address. The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. *//* 1 if X is an address that we could indirect through. *//***** NOTE ***** There is a bug in the Sequent assembler which fails to fixup addressing information for symbols used as offsets from registers which are not FP or SP (or SB or PC). This makes _x(fp) valid, while _x(r0) is invalid. */#define INDIRECTABLE_1_ADDRESS_P(X) \ (CONSTANT_ADDRESS_P (X) \ || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \ || (GET_CODE (X) == PLUS \ && GET_CODE (XEXP (X, 0)) == REG \ && REG_OK_FOR_BASE_P (XEXP (X, 0)) \ && ((flag_pic || TARGET_HIMEM) ? \ CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1)) \ : \ CONSTANT_ADDRESS_P (XEXP (X, 1))) \ && (GET_CODE (X) != CONST_INT || NS32K_DISPLACEMENT_P (INTVAL (X)))))/* 1 if integer I will fit in a 4 byte displacement field. Strictly speaking, we can't be sure that a symbol will fit this range. But, in practice, it always will. *//* idall@eleceng.adelaide.edu.au says that the 32016 and 32032 can handle the full range of displacements--it is only the addresses that have a limited range. So the following was deleted: (((i) <= 16777215 && (i) >= -16777216) || ((TARGET_32532 || TARGET_32332) && ...)) */#define NS32K_DISPLACEMENT_P(i) \ ((i) < (1 << 29) && (i) >= - (1 << 29))/* Check for frame pointer or stack pointer. */#define MEM_REG(X) \ (GET_CODE (X) == REG && (REGNO (X) == FRAME_POINTER_REGNUM \ || REGNO(X) == STACK_POINTER_REGNUM))/* A memory ref whose address is the FP or SP, with optional integer offset, or (on certain machines) a constant address. */#define INDIRECTABLE_2_ADDRESS_P(X) \ (GET_CODE (X) == MEM \ && (((xfoo0 = XEXP (X, 0), MEM_REG (xfoo0)) \ || (GET_CODE (xfoo0) == PLUS \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -