📄 tm-spur.h
字号:
/* On SPUR the value is found in the second "output" register. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx (REG, TYPE_MODE (VALTYPE), 27)/* But the called function leaves it in the second "input" register. */#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \ gen_rtx (REG, TYPE_MODE (VALTYPE), 11)/* 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, 27)/* 1 if N is a possible register number for a function value as seen by the caller. On SPUR, the first "output" reg is the only register thus used. */#define FUNCTION_VALUE_REGNO_P(N) ((N) == 27)/* 1 if N is a possible register number for function argument passing. On SPUR, these are the "output" registers. */#define FUNCTION_ARG_REGNO_P(N) ((N) < 32 && (N) > 26)/* 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 SPUR, this is a single integer, which is a number of words of arguments scanned so far (including the invisible argument, if any, which holds the structure-value-address). Thus 5 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. On SPUR, the offset normally starts at 0, but starts at 4 bytes when the function gets a structure-value-address as an invisible first argument. */#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE) \ ((CUM) = ((FNTYPE) != 0 && aggregate_value_p ((FNTYPE))))/* 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) / 4 \ : (int_size_in_bytes (TYPE) + 3) / 4))/* 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. 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 SPUR the first five words of args are normally in registers and the rest are pushed. But any arg that won't entirely fit in regs is pushed. Also, any non-word-aligned structure is pushed. */#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \(5 >= ((CUM) \ + ((MODE) == BLKmode \ ? (int_size_in_bytes (TYPE) + 3) / 4 \ : (GET_MODE_SIZE (MODE) + 3) / 4)) \ && ((MODE) != BLKmode || (TYPE_ALIGN ((TYPE)) % 32 == 0)) \ ? gen_rtx (REG, (MODE), 27 + (CUM)) \ : 0)/* Define where a function finds its arguments. This is different from FUNCTION_ARG because of register windows. */#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \(5 >= ((CUM) \ + ((MODE) == BLKmode \ ? (int_size_in_bytes (TYPE) + 3) / 4 \ : (GET_MODE_SIZE (MODE) + 3) / 4)) \ && ((MODE) != BLKmode || (TYPE_ALIGN ((TYPE)) % 32 == 0)) \ ? gen_rtx (REG, (MODE), 11 + (CUM)) \ : 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) 0/* This macro generates the assembly code for function entry. FILE is a stdio stream to output the code to. SIZE is an int: how many units of temporary storage to allocate. Refer to the array `regs_ever_live' to determine which registers to save; `regs_ever_live[I]' is nonzero if register number I is ever used in the function. This macro is responsible for knowing which registers should not be saved even if used. *//* On spur, move-double insns between fpu and cpu need an 8-byte block of memory. If any fpu reg is used in the function, we allocate such a block here, at the bottom of the frame, just in case it's needed. */#define FUNCTION_PROLOGUE(FILE, SIZE) \{ \ extern char call_used_regs[]; \ extern int current_function_pretend_args_size; \ int fsize = ((SIZE) + 7) & ~7; \ int nregs, i, fp_used = 0; \ for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \ { \ if (regs_ever_live[i] && ! call_used_regs[i]) \ nregs++; \ if (regs_ever_live[i]) fp_used = 1; \ } \ if (fp_used) fsize += 8; \ fprintf (FILE, "0:\trd_special r24,pc\n"); \ fprintf (FILE, "\tand r24,r24,$~0x3\n"); \ fprintf (FILE, "\tadd_nt r25,r4,$%d\n", \ - current_function_pretend_args_size); \ if (fsize + nregs != 0 || current_function_pretend_args_size > 0)\ { \ int n = - fsize - nregs * 16; \ if (n >= -8192) \ fprintf (FILE, "\tadd_nt r4,r25,$%d\n", n); \ else \ { \ fprintf (FILE, "\tadd_nt r4,r25,$-8192\n"); \ n += 8192; \ while (n < -8192) \ fprintf (FILE, "\tadd_nt r4,r4,$-8192\n"), n += 8192; \ if (n != 0) \ fprintf (FILE, "\tadd_nt r4,r4,$%d\n", n); \ } \ } \ for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \ if (regs_ever_live[i] && ! call_used_regs[i]) \ { \ fprintf (FILE, "\tst_ext1 %s,r4,$%d\n", \ reg_names[i], 8 * nregs++); \ fprintf (FILE, "\tst_ext2 %s,r4,$%d\n", \ reg_names[i], 8 * nregs++); \ } \}/* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */#define FUNCTION_PROFILER(FILE, LABELNO) \ abort ();/* 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. */extern int may_call_alloca;extern int current_function_pretend_args_size;#define EXIT_IGNORE_STACK \ (get_frame_size () != 0 \ || may_call_alloca || current_function_pretend_args_size)/* This macro generates the assembly code for function exit, on machines that need it. If FUNCTION_EPILOGUE is not defined then individual return instructions are generated for each return statement. Args are same as for FUNCTION_PROLOGUE. The function epilogue should not depend on the current stack pointer! It should use the frame pointer only. This is mandatory because of alloca; we also take advantage of it to omit stack adjustments before returning. */#define FUNCTION_EPILOGUE(FILE, SIZE) \{ \ extern char call_used_regs[]; \ extern int may_call_alloca; \ extern int current_function_pretend_args_size; \ int fsize = ((SIZE) + 7) & ~7; \ int nregs, i, fp_used = 0; \ for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \ { \ if (regs_ever_live[i] && ! call_used_regs[i]) \ nregs++; \ if (regs_ever_live[i]) fp_used = 1; \ } \ if (fp_used) fsize += 8; \ if (nregs != 0) \ { \ fprintf (FILE, "\tadd_nt r4,r25,$%d\n", - fsize - nregs * 16); \ for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \ if (regs_ever_live[i] && ! call_used_regs[i]) \ { \ fprintf (FILE, "\tld_ext1 %s,r4,$%d\n\tnop\n", \ reg_names[i], 8 * nregs++); \ fprintf (FILE, "\tld_ext2 %s,r4,$%d\n\tnop\n", \ reg_names[i], 8 * nregs++); \ } \ } \ if (fsize != 0 || nregs != 0 || may_call_alloca \ || current_function_pretend_args_size > 0) \ fprintf (FILE, "\tadd_nt r4,r25,$%d\n", \ current_function_pretend_args_size); \ fprintf (FILE, "\treturn r10,$8\n\tnop\n"); \}/* If the memory address ADDR is relative to the frame pointer, correct it to be relative to the stack pointer instead. This is for when we don't use a frame pointer. ADDR should be a variable name. */#define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) abort ();/* Addressing modes, and classification of registers for them. *//* #define HAVE_POST_INCREMENT *//* #define HAVE_POST_DECREMENT *//* #define HAVE_PRE_DECREMENT *//* #define HAVE_PRE_INCREMENT *//* 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. */#define REGNO_OK_FOR_INDEX_P(REGNO) \((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)#define REGNO_OK_FOR_BASE_P(REGNO) \((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)#define REGNO_OK_FOR_FP_P(REGNO) \(((REGNO) ^ 0x20) < 14 || (unsigned) (reg_renumber[REGNO] ^ 0x20) < 14)/* Now macros that check whether X is a register and also, strictly, whether it is in a specified class. These macros are specific to the SPUR, and may be used only in code for printing assembler insns and in conditions for define_optimization. *//* 1 if X is an fp register. */#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))/* 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. */#define CONSTANT_ADDRESS_P(X) CONSTANT_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. */#define LEGITIMATE_CONSTANT_P(X) \ ((GET_CODE (X) == CONST_INT \ && (unsigned) (INTVAL (X) + 0x2000) < 0x4000)\ || (GET_CODE (X) == SYMBOL_REF && (X)->unchanging))/* 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) (((unsigned) REGNO (X)) - 32 >= 14)/* 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) (((unsigned) REGNO (X)) - 32 >= 14)#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. On SPUR, the actual legitimate addresses must be REG+SMALLINT or REG+REG. Actually, REG+REG is not legitimate for stores, so it is obtained only by combination on loads. We can treat a SYMBOL_REF as legitimate if it is part of this function's constant-pool, because such addresses can actually be output as REG+SMALLINT. */#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \{ if (GET_CODE (X) == REG \ && REG_OK_FOR_BASE_P (X)) \ goto ADDR; \ if (GET_CODE (X) == SYMBOL_REF && (X)->unchanging) \ goto ADDR; \ if (GET_CODE (X) == PLUS \ && GET_CODE (XEXP (X, 0)) == REG \ && REG_OK_FOR_BASE_P (XEXP (X, 0))) \ { \ if (GET_CODE (XEXP (X, 1)) == CONST_INT \ && INTVAL (XEXP (X, 1)) >= -0x2000 \ && INTVAL (XEXP (X, 1)) < 0x2000) \ goto ADDR; \ } \}/* Try machine-dependent ways of modifying an illegitimate address to be legitimate. If we find one, return the new, valid address. This macro is used in only one place: `memory_address' in explow.c. OLDX is the address as it was before break_out_memory_refs was called. In some cases it is useful to look at this to decide what needs to be done. MODE and WIN are passed so that this macro can use GO_IF_LEGITIMATE_ADDRESS.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -