📄 tm-ns32k.h
字号:
#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) \ ((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)/* 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) \((TARGET_REGPARM && (CUM) < 8 \ && 8 < ((CUM) + ((MODE) == BLKmode \ ? int_size_in_bytes (TYPE) \ : GET_MODE_SIZE (MODE)))) \ ? 2 - (CUM) / 4 : 0)#ifndef MAIN_FUNCTION_PROLOGUE#define MAIN_FUNCTION_PROLOGUE#endif/* 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. */#define FUNCTION_PROLOGUE(FILE, SIZE) \{ register int regno; \ int used_regs_buf[8], *bufp = used_regs_buf; \ int used_fregs_buf[8], *fbufp = used_fregs_buf; \ extern char call_used_regs[]; \ MAIN_FUNCTION_PROLOGUE; \ for (regno = 0; regno < 8; regno++) \ if (regs_ever_live[regno] && !call_used_regs[regno]) { \ *bufp++ = regno; \ } \ *bufp = -1; \ for (; regno < 16; regno++) \ if (regs_ever_live[regno] && !call_used_regs[regno]) { \ *fbufp++ = regno; \ } \ *fbufp = -1; \ bufp = used_regs_buf; \ if (frame_pointer_needed) \ { \ fprintf (FILE, "\tenter ["); \ while (*bufp >= 0) \ { \ fprintf (FILE, "r%d", *bufp++); \ if (*bufp >= 0) \ fputc (',', FILE); \ } \ fprintf (FILE, "],%d\n", SIZE); \ } \ else while (*bufp >= 0) \ fprintf (FILE, "\tmovd r%d,tos\n", *bufp++); \ fbufp = used_fregs_buf; \ while (*fbufp >= 0) \ { \ if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1)) \ fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8); \ else \ { \ fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8); \ fbufp += 2; \ } \ } \}/* 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. *//* #define EXIT_IGNORE_STACK *//* 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 int current_function_pops_args; \ extern int current_function_args_size; \ register int regno; \ int used_regs_buf[8], *bufp = used_regs_buf; \ int used_fregs_buf[8], *fbufp = used_fregs_buf; \ extern char call_used_regs[]; \ *fbufp++ = -2; \ for (regno = 8; regno < 16; regno++) \ if (regs_ever_live[regno] && !call_used_regs[regno]) { \ *fbufp++ = regno; \ } \ fbufp--; \ while (fbufp > used_fregs_buf) \ { \ if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1) \ { \ fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8); \ fbufp -= 2; \ } \ else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8); \ } \ for (regno = 0; regno < 8; regno++) \ if (regs_ever_live[regno] && ! call_used_regs[regno]) \ *bufp++ = regno; \ if (frame_pointer_needed) \ { \ fprintf (FILE, "\texit ["); \ while (bufp > used_regs_buf) \ { \ fprintf (FILE, "r%d", *--bufp); \ if (bufp > used_regs_buf) \ fputc (',', FILE); \ } \ fprintf (FILE, "]\n"); \ } \ else \ { \ while (bufp > used_regs_buf) \ fprintf (FILE, "\tmovd tos,r%d\n", *--bufp); \ } \ if (current_function_pops_args && current_function_args_size) \ fprintf (FILE, "\tret %d\n", current_function_args_size); \ else fprintf (FILE, "\tret 0\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. */#if 0#define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \{ int offset = -1; \ if (GET_CODE (ADDR) == REG && REGNO (ADDR) == FRAME_POINTER_REGNUM) \ offset = 0; \ else if (GET_CODE (ADDR) == PLUS && GET_CODE (XEXP (ADDR, 0)) == REG \ && REGNO (XEXP (ADDR, 0)) == FRAME_POINTER_REGNUM \ && GET_CODE (XEXP (ADDR, 1)) == CONST_INT) \ offset = INTVAL (XEXP (ADDR, 1)); \ if (offset >= 0) \ { int regno; \ extern char call_used_regs[]; \ for (regno = 0; regno < 8; regno++) \ if (regs_ever_live[regno] && ! call_used_regs[regno]) \ offset += 4; \ offset -= 4; \ ADDR = plus_constant (gen_rtx (REG, Pmode, STACK_POINTER_REGNUM), \ offset + (DEPTH)); } }#else#define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \ if (check_reg(ADDR, FRAME_POINTER_REGNUM)) { \ register int regno, offset = (DEPTH) - 4; \ extern char call_used_regs[]; \ for (regno = 0; regno < 16; regno++) \ if (regs_ever_live[regno] && ! call_used_regs[regno]) \ offset += 4; \ if (GET_CODE (ADDR) == REG && REGNO (ADDR) == FRAME_POINTER_REGNUM) \ ADDR = plus_constant(stack_pointer_rtx, offset); \ else if (GET_CODE(ADDR) == PLUS) { \ register rtx a0 = XEXP(ADDR, 0); \ if (GET_CODE(a0) == REG && REGNO(a0) == FRAME_POINTER_REGNUM) \ if (GET_CODE(XEXP(ADDR, 1)) == CONST_INT) \ ADDR = plus_constant(stack_pointer_rtx, \ offset + INTVAL(XEXP(ADDR, 1))); \ else \ ADDR = plus_constant(gen_rtx(PLUS, Pmode, \ stack_pointer_rtx, XEXP (ADDR, 1)), \ offset); \ else if (GET_CODE(a0) == MEM) { \ register rtx a1 = XEXP(a0, 0); \ if (GET_CODE(a1) == REG && REGNO(a1) == FRAME_POINTER_REGNUM) \ ADDR = gen_rtx(PLUS, Pmode, \ gen_rtx(MEM, Pmode, \ plus_constant(stack_pointer_rtx, offset)), \ XEXP(ADDR, 1)); \ else if (GET_CODE(a1) == PLUS && GET_CODE(XEXP(a1, 0)) == REG \ && REGNO(XEXP(a1, 0)) == FRAME_POINTER_REGNUM) \ ADDR = gen_rtx(PLUS, Pmode, \ gen_rtx(MEM, Pmode, \ plus_constant(stack_pointer_rtx, \ offset+INTVAL(XEXP(a1, 1)))),\ XEXP(ADDR, 1)); \ else \ abort(); \ } else if (GET_CODE(XEXP(ADDR, 1)) == MEM) { \ register rtx a1 = XEXP(XEXP(ADDR, 1), 0); \ if (GET_CODE(a1) == REG && REGNO(a1) == FRAME_POINTER_REGNUM) \ ADDR = gen_rtx(PLUS, Pmode, \ XEXP(ADDR, 0), \ gen_rtx(MEM, Pmode, \ plus_constant(stack_pointer_rtx, \ offset))); \ else if (GET_CODE(a1) == PLUS && GET_CODE(XEXP(a1, 0)) == REG \ && REGNO(XEXP(a1, 0)) == FRAME_POINTER_REGNUM) \ ADDR = gen_rtx(PLUS, Pmode, \ XEXP(ADDR, 0), \ gen_rtx(MEM, Pmode, \ plus_constant(stack_pointer_rtx, \ offset+INTVAL(XEXP(a1, 1)))));\ else \ abort(); \ } else \ abort(); \ } else if (GET_CODE(ADDR) == MEM) { \ register rtx a0 = XEXP(ADDR, 0); \ if (GET_CODE (a0) == REG && REGNO (a0) == FRAME_POINTER_REGNUM) \ ADDR = gen_rtx(MEM, Pmode, \ plus_constant(stack_pointer_rtx, offset)); \ else if (GET_CODE(a0) == PLUS && GET_CODE(XEXP(a0, 0)) == REG \ && REGNO(XEXP(a0, 0)) == FRAME_POINTER_REGNUM \ && GET_CODE(XEXP(a0, 1)) == CONST_INT) \ ADDR = gen_rtx(MEM, Pmode, \ plus_constant(stack_pointer_rtx, \ offset + INTVAL(XEXP(a0, 1)))); \ else \ abort(); \ } else \ abort(); \ }#endif/* 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. *//* note that FP and SP cannot be used as an index. What about PC? */#define REGNO_OK_FOR_INDEX_P(REGNO) \((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8)#define REGNO_OK_FOR_BASE_P(REGNO) \((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8 \ || (REGNO) == FRAME_POINTER_REGNUM || (REGNO) == STACK_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. */#define CONSTANT_ADDRESS_P(X) \ (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ || GET_CODE (X) == CONST \ || (GET_CODE (X) == CONST_INT \ && ((unsigned)INTVAL (X) >= 0xe0000000 \ || (unsigned)INTVAL (X) < 0x20000000)))#define CONSTANT_ADDRESS_NO_LABEL_P(X) \ (GET_CODE (X) == CONST_INT \ && ((unsigned)INTVAL (X) >= 0xe0000000 \ || (unsigned)INTVAL (X) < 0x20000000))/* 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) < 8 || 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) < 8 || REGNO (X) >= FRAME_POINTER_REGNUM)/* Nonzero if X is a floating point reg or a pseudo reg. */#else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -