?? tm-pyr.h
字號:
/* 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) ALL_REGS/* The class value for index registers, and the one for base regs. */#define BASE_REG_CLASS ALL_REGS#define INDEX_REG_CLASS ALL_REGS/* Get reg_class from a letter such as appears in the machine description. */#define REG_CLASS_FROM_LETTER(C) NO_REGS/* 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. *//* On the pyramid, this is always the size of MODE in words, since all registers are the same size. */#define CLASS_MAX_NREGS(CLASS, MODE) \ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)/* 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. --> For the Pyramid, 'I' can be used for the 6-bit signed integers --> (-32 to 31) allowed as immediate short operands in many --> instructions. 'J' cane be used for any value that doesn't fit --> in 6 bits. */#define CONST_OK_FOR_LETTER_P(VALUE, C) \ ((C) == 'I' ? (VALUE) >= -32 && (VALUE) < 32 : \ (C) == 'J' ? (VALUE) < -32 || (VALUE) >= 32 : \ (C) == 'K' ? (VALUE) == 0xff || (VALUE) == 0xffff : 0)/* Similar, but for floating constants, and defining letters G and H. Here VALUE is the CONST_DOUBLE rtx itself. */#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1/*** 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. *//* FIXME: this used to work when defined as 0. But that makes gnu stdargs clobber the first arg. What gives?? */#define STARTING_FRAME_OFFSET 0/* Offset of first parameter from the argument pointer register value. */#define FIRST_PARM_OFFSET(FNDECL) 0/* Value is 1 if returning from a function call automatically pops the arguments described by the number-of-args field in the 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. The Pyramid OSx Porting Guide says we are never to do this; using RETD in this way violates the Pyramid calling convention. We may nevertheless provide this as an option. */#define RETURN_POPS_ARGS(FUNTYPE) \ (TARGET_RETD && TREE_CODE (FUNTYPE) != IDENTIFIER_NODE \ && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ || TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) == void_type_node))/* 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. *//* --> Pyramid has register windows. --> The caller sees the return value is in TR0(/TR1) regardless of --> its type. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx (REG, TYPE_MODE (VALTYPE), PYR_TREG(0))/* --> but the callee has to leave it in PR0(/PR1) */#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \ gen_rtx (REG, TYPE_MODE (VALTYPE), PYR_PREG(0))/* Define how to find the value returned by a library function assuming the value has mode MODE. *//* --> On Pyramid the return value is in TR0/TR1 regardless. */#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, PYR_TREG(0))/* 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 as seen by the caller. On the Pyramid, TR0 is the only register thus used. */#define FUNCTION_VALUE_REGNO_P(N) ((N) == PYR_TREG(0))/* 1 if N is a possible register number for function argument passing. On the Pyramid, the first twelve temporary registers are available. *//* FIXME FIXME FIXME it's not clear whether this macro should be defined from the point of view of the caller or the callee. Since it's never actually used in GNU CC, the point is somewhat moot :-). This definition is consistent with register usage in the md's for other register-window architectures (sparc and spur). */#define FUNCTION_ARG_REGNO_P(N) ((PYR_TREG(0) <= (N)) && ((N) <= PYR_TREG(11)))/*** Parameter passing: FUNCTION_ARG and FUNCTION_INCOMING_ARG ***//* 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 Pyramids, each parameter is passed either completely on the stack or completely in registers. No parameter larger than a double may be passed in a register. Also, no struct or union may be passed in a register, even if it would fit. So parameters are not necessarily passed "consecutively". Thus we need a vector data type: one element to record how many parameters have been passed in registers and on the stack, respectively. ((These constraints seem like a gross waste of registers. But if we ignore the constraint about structs & unions, we won`t be able to freely mix gcc-compiled code and pyr cc-compiled code. It looks like better argument passing conventions, and a machine-dependent flag to enable them, might be a win.)) */#define CUMULATIVE_ARGS int/* Define the number of registers that can hold paramters. This macro is used only in other macro definitions below. */#define NPARM_REGS 12/* Decide whether or not a parameter can be put in a register. (We may still have problems with libcalls. GCC doesn't seem to know about anything more than the machine mode. I trust structures are never passed to a libcall... If compiling with -mgnu-stdarg, this definition should make functions using the gcc-supplied stdarg, and calls to such functions (declared with an arglist ending in"..."), work. But such fns won't be able to call pyr cc-compiled varargs fns (eg, printf(), _doprnt.) If compiling with -mnognu-stdarg, this definition should make calls to pyr cc-compiled functions work. Functions using the gcc-supplied stdarg will be utterly broken. There will be no better solution until RMS can be persuaded that one is needed. This macro is used only in other macro definitions below. (well, it may be used in out-pyr.c, because the damn pyramid cc can't handle the macro definition of PARAM_SAFE_FOR_REG_P ! */#define INNER_PARAM_SAFE_HELPER(TYPE) \ ((TARGET_GNU_STDARG ? (! TREE_ADDRESSABLE ((tree)TYPE)): 1) \ && (TREE_CODE ((tree)TYPE) != RECORD_TYPE) \ && (TREE_CODE ((tree)TYPE) != UNION_TYPE))#ifdef __GNUC__#define PARAM_SAFE_HELPER(TYPE) \ INNER_PARAM_SAFE_HELPER((TYPE))#elseextern int inner_param_safe_helper();#define PARAM_SAFE_HELPER(TYPE) \ inner_param_safe_helper((tree)(TYPE))#endif/* Be careful with the expression (long) (TYPE) == 0. Writing it in more obvious/correct forms makes the Pyr cc dump core! */#define PARAM_SAFE_FOR_REG_P(MODE, TYPE, NAMED) \ (((MODE) != BLKmode) \ && ((TARGET_GNU_STDARG) ? (NAMED) : 1) \ && ((((long)(TYPE))==0) || PARAM_SAFE_HELPER((TYPE))))/* 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) \ ((CUM) = (FNTYPE && !flag_pcc_struct_return && aggregate_value_p (FNTYPE)))/* 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). */#define FUNCTION_ARG_HELPER(CUM, MODE, TYPE, NAMED) \(PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \ ? (NPARM_REGS >= ((CUM) \ + ((MODE) == BLKmode \ ? (int_size_in_bytes (TYPE) + 3) / 4 \ : (GET_MODE_SIZE (MODE) + 3) / 4)) \ ? gen_rtx (REG, (MODE), PYR_TREG(CUM)) \ : 0) \ : 0)#ifdef __GNUC__#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ FUNCTION_ARG_HELPER(CUM, MODE, TYPE, NAMED)#else/***************** Avoid bug in Pyramid OSx compiler... ******************/#define FUNCTION_ARG (rtx) pyr_function_argextern void* pyr_function_arg ();#endif/* 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) \(PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \ ? (NPARM_REGS >= ((CUM) \ + ((MODE) == BLKmode \ ? (int_size_in_bytes (TYPE) + 3) / 4 \ : (GET_MODE_SIZE (MODE) + 3) / 4)) \ ? gen_rtx (REG, (MODE), PYR_PREG(CUM)) \ : 0) \ : 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) += (PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \ ? ((MODE) != BLKmode \ ? (GET_MODE_SIZE (MODE) + 3) / 4 \ : (int_size_in_bytes (TYPE) + 3) / 4) \ : 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. */#if FRAME_POINTER_REQUIRED/* We always have frame pointers *//* Don't set up a frame pointer if it's not referenced. */#define FUNCTION_PROLOGUE(FILE, SIZE) \{ \ int _size = (SIZE) + current_function_pretend_args_size; \ if (_size + current_function_args_size != 0 \ || current_function_calls_alloca) \ { \ fprintf (FILE, "\tadsf $%d\n", _size); \ if (current_function_pretend_args_size > 0) \ fprintf (FILE, "\tsubw $%d,cfp\n", \ current_function_pretend_args_size); \ } \}#else /* !FRAME_POINTER_REQUIRED *//* Don't set up a frame pointer if `frame_pointer_needed' tells us there is no need. Also, don't set up a frame pointer if it's not referenced. *//* The definition used to be broken. Write a new one. */#endif /* !FRAME_POINTER_REQUIRED *//* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */#define FUNCTION_PROFILER(FILE, LABELNO) \ fprintf (FILE, "\tmova LP%d,tr0\n\tcall mcount\n", (LABELNO));/* Output assembler code to FILE to initialize this source file's basic block profiling info, if that has not already been done. Don't know if this works on Pyrs. */#if 0 /* don't do basic_block profiling yet */#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ fprintf (FILE, \ "\tmtstw LPBX0,tr0\n\tbne LPI%d\n\tmova LP%d,TR0\n\tcall __bb_init_func\nLPI%d:\n", \ LABELNO, LABELNO);/* Output assembler code to increment the count associated with the basic block number BLOCKNO. Not sure how to do this on pyrs. */#define BLOCK_PROFILER(FILE, BLOCKNO) \ fprintf (FILE, "\taddw", 4 * BLOCKNO)#endif /* don't do basic_block profiling yet *//* When returning from a function, the stack pointer does not matter (as long as there is a frame pointer). *//* This should return non-zero when we really set up a frame pointer. Otherwise, GCC is directed to preserve sp by returning zero. */extern int current_function_pretend_args_size;extern int current_function_args_size;extern int current_function_calls_alloca;#define EXIT_IGNORE_STACK \ (get_frame_size () + current_function_pretend_args_size \ + current_function_args_size != 0 \ || current_function_calls_alloca) \/* 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. */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -