📄 fr30.h
字号:
&& (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \ || TREE_CODE (TYPE) == RECORD_TYPE \ || TREE_CODE (TYPE) == UNION_TYPE \ || TREE_CODE (TYPE) == QUAL_UNION_TYPE \ || TREE_ADDRESSABLE (TYPE))))/* The number of register assigned to holding function arguments. */ #define FR30_NUM_ARG_REGS 4/* A C expression that controls whether a function argument is passed in a register, and which register. The usual way to make the ANSI library `stdarg.h' work on a machine where some arguments are usually passed in registers, is to cause nameless arguments to be passed on the stack instead. This is done by making `FUNCTION_ARG' return 0 whenever NAMED is 0. You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the definition of this macro to determine if this argument is of a type that must be passed in the stack. If `REG_PARM_STACK_SPACE' is not defined and `FUNCTION_ARG' returns nonzero for such an argument, the compiler will abort. If `REG_PARM_STACK_SPACE' is defined, the argument will be computed in the stack and then loaded into a register. */ #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ ( (NAMED) == 0 ? NULL_RTX \ : MUST_PASS_IN_STACK (MODE, TYPE) ? NULL_RTX \ : (CUM) >= FR30_NUM_ARG_REGS ? NULL_RTX \ : gen_rtx (REG, MODE, CUM + FIRST_ARG_REGNUM))/* 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. There is no need to record in `CUMULATIVE_ARGS' anything about the arguments that have been passed on the stack. The compiler has other variables to keep track of that. For target machines on which all arguments are passed on the stack, there is no need to store anything in `CUMULATIVE_ARGS'; however, the data structure must exist and should not be empty, so use `int'. *//* On the FR30 this value is an accumulating count of the number of argument registers that have been filled with argument values, as opposed to say, the number of bytes of argument accumulated so far. */#define CUMULATIVE_ARGS int/* A C expression for the number of words, at the beginning of an argument, must be put in registers. The value must be zero for arguments that are passed entirely in registers or that are entirely pushed on the stack. On some machines, certain arguments must be passed partially in registers and partially in memory. On these machines, typically the first N words of arguments are passed in registers, and the rest on the stack. If a multi-word argument (a `double' or a structure) crosses that boundary, its first few words must be passed in registers and the rest must be pushed. This macro tells the compiler when this occurs, and how many of the words should go in registers. `FUNCTION_ARG' for these arguments should return the first register to be used by the caller for this argument; likewise `FUNCTION_INCOMING_ARG', for the called function. */#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ fr30_function_arg_partial_nregs (CUM, MODE, TYPE, NAMED)/* A C expression that indicates when an argument must be passed by reference. If nonzero for an argument, a copy of that argument is made in memory and a pointer to the argument is passed instead of the argument itself. The pointer is passed in whatever way is appropriate for passing a pointer to that type. On machines where `REG_PARM_STACK_SPACE' is not defined, a suitable definition of this macro might be: #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ MUST_PASS_IN_STACK (MODE, TYPE) */#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ MUST_PASS_IN_STACK (MODE, TYPE)/* A C statement (sans semicolon) for initializing the variable CUM for the state at the beginning of the argument list. The variable has type `CUMULATIVE_ARGS'. The value of FNTYPE is the tree node for the data type of the function which will receive the args, or 0 if the args are to a compiler support library function. The value of INDIRECT is nonzero when processing an indirect call, for example a call through a function pointer. The value of INDIRECT is zero for a call to an explicitly named function, a library function call, or when `INIT_CUMULATIVE_ARGS' is used to find arguments for the function being compiled. When processing a call to a compiler support library function, LIBNAME identifies which one. It is a `symbol_ref' rtx which contains the name of the function, as a string. LIBNAME is 0 when an ordinary C function call is being processed. Thus, each time this macro is called, either LIBNAME or FNTYPE is nonzero, but never both of them at once. */#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) (CUM) = 0/* A C statement (sans semicolon) to update the summarizer variable CUM to advance past an argument in the argument list. The values MODE, TYPE and NAMED describe that argument. Once this is done, the variable CUM is suitable for analyzing the *following* argument with `FUNCTION_ARG', etc. This macro need not do anything if the argument in question was passed on the stack. The compiler knows how to track the amount of stack space used for arguments without any special help. */#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ (CUM) += (NAMED) * fr30_num_arg_regs (MODE, TYPE)/* A C expression that is nonzero if REGNO is the number of a hard register in which function arguments are sometimes passed. This does *not* include implicit arguments such as the static chain and the structure-value address. On many machines, no registers can be used for this purpose since all function arguments are pushed on the stack. */#define FUNCTION_ARG_REGNO_P(REGNO) \ ((REGNO) >= FIRST_ARG_REGNUM && ((REGNO) < FIRST_ARG_REGNUM + FR30_NUM_ARG_REGS))/*}}}*/ /*{{{ How Scalar Function Values are Returned. */ /* A C expression to create an RTX representing the place where a function returns a value of data type VALTYPE. VALTYPE is a tree node representing a data type. Write `TYPE_MODE (VALTYPE)' to get the machine mode used to represent that type. On many machines, only the mode is relevant. (Actually, on most machines, scalar values are returned in the same place regardless of mode). If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same promotion rules specified in `PROMOTE_MODE' if VALTYPE is a scalar type. If the precise function being called is known, FUNC is a tree node (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This makes it possible to use a different value-returning convention for specific functions when all their calls are known. `FUNCTION_VALUE' is not used for return vales with aggregate data types, because these are returned in another way. See `STRUCT_VALUE_REGNUM' and related macros, below. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx_REG (TYPE_MODE (VALTYPE), RETURN_VALUE_REGNUM)/* A C expression to create an RTX representing the place where a library function returns a value of mode MODE. If the precise function being called is known, FUNC is a tree node (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This makes it possible to use a different value-returning convention for specific functions when all their calls are known. Note that "library function" in this context means a compiler support routine, used to perform arithmetic, whose name is known specially by the compiler and was not mentioned in the C code being compiled. The definition of `LIBRARY_VALUE' need not be concerned aggregate data types, because none of the library functions returns such types. */#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, RETURN_VALUE_REGNUM)/* A C expression that is nonzero if REGNO is the number of a hard register in which the values of called function may come back. */#define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM)/*}}}*/ /*{{{ How Large Values are Returned. */ /* Define this macro to be 1 if all structure and union return values must be in memory. Since this results in slower code, this should be defined only if needed for compatibility with other compilers or with an ABI. If you define this macro to be 0, then the conventions used for structure and union return values are decided by the `RETURN_IN_MEMORY' macro. If not defined, this defaults to the value 1. */#define DEFAULT_PCC_STRUCT_RETURN 1/* If the structure value address is not passed in a register, define `STRUCT_VALUE' as an expression returning an RTX for the place where the address is passed. If it returns 0, the address is passed as an "invisible" first argument. */#define STRUCT_VALUE 0/*}}}*/ /*{{{ Generating Code for Profiling. */ /* A C statement or compound statement to output to FILE some assembler code to call the profiling subroutine `mcount'. Before calling, the assembler code must load the address of a counter variable into a register where `mcount' expects to find the address. The name of this variable is `LP' followed by the number LABELNO, so you would generate the name using `LP%d' in a `fprintf'. The details of how the address should be passed to `mcount' are determined by your operating system environment, not by GNU CC. To figure them out, compile a small program for profiling using the system's installed C compiler and look at the assembler code that results. */#define FUNCTION_PROFILER(FILE, LABELNO) \{ \ fprintf (FILE, "\t mov rp, r1\n" ); \ fprintf (FILE, "\t ldi:32 mcount, r0\n" ); \ fprintf (FILE, "\t call @r0\n" ); \ fprintf (FILE, ".word\tLP%d\n", LABELNO); \}/*}}}*/ /*{{{ Implementing the VARARGS Macros. */ /* This macro offers an alternative to using `__builtin_saveregs' and defining the macro `EXPAND_BUILTIN_SAVEREGS'. Use it to store the anonymous register arguments into the stack so that all the arguments appear to have been passed consecutively on the stack. Once this is done, you can use the standard implementation of varargs that works for machines that pass all their arguments on the stack. The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure, containing the values that obtain after processing of the named arguments. The arguments MODE and TYPE describe the last named argument--its machine mode and its data type as a tree node. The macro implementation should do two things: first, push onto the stack all the argument registers *not* used for the named arguments, and second, store the size of the data thus pushed into the `int'-valued variable whose name is supplied as the argument PRETEND_ARGS_SIZE. The value that you store here will serve as additional offset for setting up the stack frame. Because you must generate code to push the anonymous arguments at compile time without knowing their data types, `SETUP_INCOMING_VARARGS' is only useful on machines that have just a single category of argument register and use it uniformly for all data types. If the argument SECOND_TIME is nonzero, it means that the arguments of the function are being analyzed for the second time. This happens for an inline function, which is not actually compiled until the end of the source file. The macro `SETUP_INCOMING_VARARGS' should not generate any instructions in this case. */#define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_ARGS_SIZE, SECOND_TIME) \ if (! SECOND_TIME) \ fr30_setup_incoming_varargs (ARGS_SO_FAR, MODE, TYPE, & PRETEND_ARGS_SIZE)/* Define this macro if the location where a function argument is passed depends on whether or not it is a named argument. This macro controls how the NAMED argument to `FUNCTION_ARG' is set for varargs and stdarg functions. With this macro defined, the NAMED argument is always true for named arguments, and false for unnamed arguments. If this is not defined, but `SETUP_INCOMING_VARARGS' is defined, then all arguments are treated as named. Otherwise, all named arguments except the last are treated as named. */#define STRICT_ARGUMENT_NAMING 0/*}}}*/ /*{{{ Trampolines for Nested Functions. */ /* On the FR30, the trampoline is: nop ldi:32 STATIC, r12 nop ldi:32 FUNCTION, r0 jmp @r0 The no-ops are to guarantee that the static chain and final target are 32 bit ailgned within the trampoline. That allows us to initialize those locations with simple SImode stores. The alternative would be to use HImode stores. */ /* A C statement to output, on the stream FILE, assembler code for a block of data that contains the constant parts of a trampoline. This code should not include a label--the label is taken care of automatically. */#define TRAMPOLINE_TEMPLATE(FILE) \{ \ fprintf (FILE, "\tnop\n"); \ fprintf (FILE, "\tldi:32\t#0, %s\n", reg_names [STATIC_CHAIN_REGNUM]); \ fprintf (FILE, "\tnop\n"); \ fprintf (FILE, "\tldi:32\t#0, %s\n", reg_names [COMPILER_SCRATCH_REGISTER]); \ fprintf (FILE, "\tjmp\t@%s\n", reg_names [COMPILER_SCRATCH_REGISTER]); \}/* A C expression for the size in bytes of the trampoline, as an integer. */#define TRAMPOLINE_SIZE 18/* We want the trampoline to be aligned on a 32bit boundary so that we can make sure the location of the static chain & target function within the trampoline is also aligned on a 32bit boundary. */#define TRAMPOLINE_ALIGNMENT 32/* A C statement to initialize the variable parts of a trampoline. ADDR is an RTX for the address of the trampoline; FNADDR is an RTX for the address of the nested function; STATIC_CHAIN is an RTX for the static chain value that should be passed to the function when it is called. */#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \do \{ \ emit_move_insn (gen_rtx (MEM, SImode, plus_constant (ADDR, 4)), STATIC_CHAIN);\ emit_move_insn (gen_rtx (MEM, SImode, plus_constant (ADDR, 12)), FNADDR); \} while (0);/*}}}*/ /*{{{ Addressing Modes. */ /* A C expression that is 1 if the RTX X is a constant which is a valid address. On most machines, this can be defined as `CONSTANT_P (X)', but a few machines are more restrictive in which constant addresses are supported. `CONSTANT_P' accepts integer-values expressions whose values are not explicitly known, such as `symbol_ref', `label_ref', and `high' expressions and `const' arithmetic expressions, in addition to `const_int' and `const_double' expressions. */#define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)/* A number, the maximum number of registers that can appear in a valid memory address. Note that it is up to you to specify a value equal to the maximum number that `GO_IF_LEGITIMATE_ADDRESS' would ever accept. */#define MAX_REGS_PER_ADDRESS 1/* A C compound statement with a conditional `goto LABEL;' executed if X (an RTX) is a legitimate memory address on the target machine for a memory operand of mode MODE. *//* On the FR30 we only have one real addressing mode - an address in a register. There are three special cases however: * indexed addressing using small positive offsets from the stack pointer * indexed addressing using small signed offsets from the frame pointer * register plus register addressing using R13 as the base register. At the moment we only support the first two of these special cases. */ #ifdef REG_OK_STRICT#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ do \ { \ if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \ goto LABEL; \ if (GET_CODE (X) == PLUS \ && ((MODE) == SImode || (MODE) == SFmode) \ && XEXP (X, 0) == stack_pointer_rtx \ && GET_CODE (XEXP (X, 1)) == CONST_INT \ && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 << 6) - 4)) \ goto LABEL; \ if (GET_CODE (X) == PLUS \ && ((MODE) == SImode || (MODE) == SFmode) \ && XEXP (X, 0) == frame_pointer_rtx \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -