📄 h8300.h
字号:
this says how many the stack pointer really advances by. On the H8/300, @-sp really pushes a byte if you ask it to - but that's dangerous, so we claim that it always pushes a word, then we catch the mov.b rx,@-sp and turn it into a mov.w rx,@-sp on output. On the H8/300h, we simplify TARGET_QUICKCALL by setting this to 4 and doing a similar thing. */#define PUSH_ROUNDING(BYTES) \ (((BYTES) + PARM_BOUNDARY/8 - 1) & -PARM_BOUNDARY/8)/* Offset of first parameter from the argument pointer register value. *//* Is equal to the size of the saved fp + pc, even if an fp isn't saved since the value is used before we know. */#define FIRST_PARM_OFFSET(FNDECL) 0/* Value is the number of bytes of arguments automatically popped when returning from a subroutine call. FUNDECL is the declaration node of the function (as a tree), 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. SIZE is the number of bytes of arguments passed on the stack. On the H8 the return does not pop anything. */#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0/* Definitions for register eliminations. This is an array of structures. Each structure initializes one pair of eliminable registers. The "from" register number is given first, followed by "to". Eliminations of the same "from" register are listed in order of preference. We have two registers that can be eliminated on the h8300. First, the frame pointer register can often be eliminated in favor of the stack pointer register. Secondly, the argument pointer register can always be eliminated; it is replaced with either the stack or frame pointer. */#define ELIMINABLE_REGS \{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}/* Given FROM and TO register numbers, say whether this elimination is allowed. Frame pointer elimination is automatically handled. For the h8300, if frame pointer elimination is being done, we would like to convert ap into sp, not fp. All other eliminations are valid. */#define CAN_ELIMINATE(FROM, TO) \ ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \ ? ! frame_pointer_needed \ : 1)/* Define the offset between two registers, one to be eliminated, and the other its replacement, at the start of a routine. */#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ OFFSET = initial_offset (FROM, TO)/* 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. On the H8 the return value is in R0/R1. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx (REG, TYPE_MODE (VALTYPE), 0)/* Define how to find the value returned by a library function assuming the value has mode MODE. *//* On the h8 the return value is in R0/R1 */#define LIBCALL_VALUE(MODE) \ gen_rtx (REG, MODE, 0)/* 1 if N is a possible register number for a function value. On the H8, R0 is the only register thus used. */#define FUNCTION_VALUE_REGNO_P(N) ((N) == 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 function argument passing. On the H8, no registers are used in this way. *//* ??? What about TARGET_QUICKCALL? */#define FUNCTION_ARG_REGNO_P(N) 0/* Register in which address to store a structure value is passed to a function. */#define STRUCT_VALUE 0/* Return true if X should be returned in memory. *//* ??? This will return small structs in regs. */#define RETURN_IN_MEMORY(X) (GET_MODE_SIZE (TYPE_MODE (X)) > 4)/* When defined, the compiler allows registers explicitly used in the rtl to be used as spill registers but prevents the compiler from extending the lifetime of these registers. */#define SMALL_REGISTER_CLASSES/* 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 H8/300, this is a two item struct, the first is the number of bytes scanned so far and the second is the rtx of the called library function if any. */#define CUMULATIVE_ARGS struct cum_argstruct cum_arg { int nbytes; struct rtx_def * libcall; };/* 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 H8/300, the offset starts at 0. */#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \ ((CUM).nbytes = 0, (CUM).libcall = LIBNAME)/* 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).nbytes += ((MODE) != BLKmode \ ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD \ : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD))/* 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 H8/300 all normal args are pushed, unless -mquickcall in which case the first 3 arguments are passed in registers. See function `function_arg'. */struct rtx_def *function_arg();#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ function_arg (&CUM, MODE, TYPE, NAMED)/* Perform any needed actions needed for a function that is receiving a variable number of arguments. */extern int current_function_anonymous_args;#define SETUP_INCOMING_VARARGS(ASF, MODE, TYPE, PAS, ST) \ current_function_anonymous_args = 1;/* Generate assembly output for the start of a function. */#define FUNCTION_PROLOGUE(FILE, SIZE) \ function_prologue (FILE, SIZE)/* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */#define FUNCTION_PROFILER(FILE, LABELNO) \ fprintf (FILE, "\t%s\t#LP%d,%s\n\tjsr @mcount\n", \ h8_mov_op, (LABELNO), h8_reg_names[0]);/* Output assembler code to FILE to initialize this source file's basic block profiling info, if that has not already been done. *//* ??? @LPBX0 is moved into r0 twice. */#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ fprintf (FILE, "\t%s\t%s\n\t%s\t@LPBX0,%s\n\tbne LPI%d\n\t%s\t@LPBX0,%s\n\t%s\t%s\n\tjsr\t@__bb_init_func\nLPI%d:\t%s\t%s\n", \ h8_push_op, h8_reg_names[0], \ h8_mov_op, h8_reg_names[0], \ (LABELNO), \ h8_mov_op, h8_reg_names[0], \ h8_push_op, h8_reg_names[0], \ (LABELNO), \ h8_pop_op, h8_reg_names[0]);/* Output assembler code to FILE to increment the entry-count for the BLOCKNO'th basic block in this source file. This is a real pain in the sphincter on a VAX, since we do not want to change any of the bits in the processor status word. The way it is done here, it is pushed onto the stack before any flags have changed, and then the stack is fixed up to account for the fact that the instruction to restore the flags only reads a word. It may seem a bit clumsy, but at least it works. *//* ??? This one needs work. */#define BLOCK_PROFILER(FILE, BLOCKNO) \ fprintf (FILE, "\tmovpsl -(sp)\n\tmovw (sp),2(sp)\n\taddl2 $2,sp\n\taddl2 $1,LPBX2+%d\n\tbicpsw $255\n\tbispsw (sp)+\n", \ 4 * BLOCKNO)/* 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 0/* 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. */#define FUNCTION_EPILOGUE(FILE, SIZE) \ function_epilogue (FILE, SIZE)/* Output assembler code for a block containing the constant parts of a trampoline, leaving space for the variable parts. H8/300 vvvv context 1 0000 7900xxxx mov.w #0x1234,r3 2 0004 5A00xxxx jmp @0x1234 ^^^^ function H8/300H vvvvvvvv context 2 0000 7A00xxxxxxxx mov.l #0x12345678,er3 3 0006 5Axxxxxx jmp @0x123456 ^^^^^^ function*/#define TRAMPOLINE_TEMPLATE(FILE) \ do { \ if (TARGET_H8300) \ { \ fprintf (FILE, "\tmov.w #0x1234,r3\n"); \ fprintf (FILE, "\tjmp @0x1234\n"); \ } \ else \ { \ fprintf (FILE, "\tmov.l #0x12345678,er3\n"); \ fprintf (FILE, "\tjmp @0x123456\n"); \ } \ } while (0)/* Length in units of the trampoline for entering a nested function. */#define TRAMPOLINE_SIZE (TARGET_H8300 ? 8 : 12)/* 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) \{ \ enum machine_mode mode = TARGET_H8300H ? SImode : HImode; \ emit_move_insn (gen_rtx (MEM, mode, plus_constant ((TRAMP), 2)), CXT); \ emit_move_insn (gen_rtx (MEM, mode, plus_constant ((TRAMP), 6)), FNADDR); \ if (TARGET_H8300H) \ emit_move_insn (gen_rtx (MEM, QImode, plus_constant ((TRAMP), 6)), GEN_INT (0x5A)); \}/* 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) 0#define REGNO_OK_FOR_BASE_P(regno) \ ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)/* Maximum number of registers that can appear in a valid memory address. */#define MAX_REGS_PER_ADDRESS 1/* 1 if X is an rtx for a constant that is a valid address. */#define CONSTANT_ADDRESS_P(X) \ (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ || (GET_CODE (X) == CONST_INT \ /* We handle signed and unsigned offsets here. */ \ && INTVAL (X) > (TARGET_H8300 ? -0x10000 : -0x1000000) \ && INTVAL (X) < (TARGET_H8300 ? 0x10000 : 0x1000000)) \ || GET_CODE (X) == CONST \ || GET_CODE (X) == HIGH)/* 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_DOUBLE)/* 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) 0/* 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) 1#define REG_OK_FOR_INDEX_P_STRICT(X) REGNO_OK_FOR_INDEX_P (REGNO (X))#define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X))#define STRICT 0#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))#define STRICT 1#endif/* Extra constraints - 'U' if for an operand valid for a bset destination; i.e. a register or register indirect target. */#define OK_FOR_U(OP) \ ((GET_CODE (OP) == REG && REG_OK_FOR_BASE_P (OP)) \ || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \ && REG_OK_FOR_BASE_P (XEXP (OP, 0)))) #define EXTRA_CONSTRAINT(OP, C) \ ((C) == 'U' ? OK_FOR_U (OP) : 0)/* 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, except for CONSTANT_ADDRESS_P which is actually machine-independent. On the H8/300, a legitimate address has the form REG, REG+CONSTANT_ADDRESS or CONSTANT_ADDRESS. *//* Accept either REG or SUBREG where a register is valid. */ #define RTX_OK_FOR_BASE_P(X) \ ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \ || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \ && REG_OK_FOR_BASE_P (SUBREG_REG (X))))#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ if (RTX_OK_FOR_BASE_P (X)) goto ADDR; \ if (CONSTANT_ADDRESS_P (X)) goto ADDR; \ if (GET_CODE (X) == PLUS \ && CONSTANT_ADDRESS_P (XEXP (X, 1)) \ && RTX_OK_FOR_BASE_P (XEXP (X, 0))) 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. It is always safe for this macro to do nothing. It exists to recognize opportunities to optimize the output. For the H8/300, don't do anything. */#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}/* Go to LABEL if ADDR (a legitimate address expression) has an effect that depends on the machine mode it is used for. On the H8/300, the predecrement and postincrement address depend thus (the amount of decrement or increment being the length of the operand) and all indexed address depend thus (because the index scale factor is the length of the operand). */#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \ if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL;/* Specify the machine mode that this machine uses for the index in the tablejump instruction. */#define CASE_VECTOR_MODE Pmode/* Define this if the case instruction expects the table to contain offsets from the address of the table. Do not define this if the table should contain absolute addresses. *//*#define CASE_VECTOR_PC_RELATIVE*//* Define this if the case instruction drops through after the table when the index is out of range. Don't define it if the case insn jumps to the default label instead. */#define CASE_DROPS_THROUGH/* Specify the tree operation to be used to convert reals to integers. */#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR/* This is the kind of divide that is easiest to do in the general case. */#define EASY_DIV_EXPR TRUNC_DIV_EXPR/* Define this as 1 if `char' should by default be signed; else as 0.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -