📄 h8300.h
字号:
#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 || TARGET_H8300S? 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 || TARGET_H8300S) \ 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 1/*#define HAVE_POST_DECREMENT 0 */#define HAVE_PRE_DECREMENT 1/*#define HAVE_PRE_INCREMENT 0 *//* 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 && regno != 8) || 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) == HIGH || GET_CODE (X) == CONST) \ && TARGET_H8300))/* 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. *//* Don't use REGNO_OK_FOR_BASE_P here because it uses reg_renumber. */#define REG_OK_FOR_BASE_P(X) \ (REGNO (X) >= FIRST_PSEUDO_REGISTER || REGNO (X) != 8)#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, register indirect, or the eightbit memory region (a SYMBOL_REF with an SYMBOL_REF_FLAG set). On the H8/S 'U' can also be a 16bit or 32bit absolute. */#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))) \ || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \ && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (OP, 0)))) \ || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == CONST \ && GET_CODE (XEXP (XEXP (OP, 0), 0)) == PLUS \ && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 0)) == SYMBOL_REF \ && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 1)) == CONST_INT) \ && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (XEXP (OP, 0), 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). */#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 as C expression which evaluates to nonzero if the tablejump 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 1 *//* 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. On the H8/300, sign extension is expensive, so we'll say that chars are unsigned. */#define DEFAULT_SIGNED_CHAR 0/* This flag, if defined, says the same insns that convert to a signed fixnum also convert validly to an unsigned one. */#define FIXUNS_TRUNC_LIKE_FIX_TRUNC/* Max number of bytes we can move from memory to memory in one reasonably fast instruction. */#define MOVE_MAX (TARGET_H8300H || TARGET_H8300S ? 4 : 2)#define MAX_MOVE_MAX 4/* Define this if zero-extension is slow (more than one real instruction). *//* #define SLOW_ZERO_EXTEND *//* Nonzero if access to memory by bytes is slow and undesirable. */#define SLOW_BYTE_ACCESS TARGET_SLOWBYTE/* Define if shifts truncate the shift count which implies one can omit a sign-extension or zero-extension of a shift count. *//* #define SHIFT_COUNT_TRUNCATED *//* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits is done just by pretending it is already truncated. */#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1/* Specify the machine mode that pointers have. After generation of rtl, the compiler makes no further distinction between pointers and any other objects of this machine mode. */#define Pmode (TARGET_H8300H || TARGET_H8300S ? SImode : HImode)/* ANSI C types. We use longs for the 300h because ints can be 16 or 32. GCC requires SIZE_TYPE to be the same size as pointers. */#define NO_BUILTIN_SIZE_TYPE#define NO_BUILTIN_PTRDIFF_TYPE#define SIZE_TYPE (TARGET_H8300 ? "unsigned int" : "long unsigned int")#define PTRDIFF_TYPE (TARGET_H8300 ? "int" : "long int")#define WCHAR_TYPE "short unsigned int"#define WCHAR_TYPE_SIZE 16#define MAX_WCHAR_TYPE_SIZE 16/* A function address in a call instruction is a byte address (for indexing purposes) so give the MEM rtx a byte's mode. */#define FUNCTION_MODE QImode/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS is a valid machine specific attribute for DECL. The attributes in ATTRIBUTES have previously been assigned to DECL. */extern int h8300_valid_machine_decl_attribute ();#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \h8300_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)#define ADJUST_INSN_LENGTH(INSN, LENGTH) \ LENGTH += h8300_adjust_insn_length (INSN, LENGTH);/* Compute the cost of computing a constant rtl expression RTX whose rtx-code is CODE. The body of this macro is a portion of a switch statement. If the code is computed here, return it with a return statement. Otherwise, break from the switch. */#define DEFAULT_RTX_COSTS(RTX,CODE,OUTER_CODE) \ return (const_costs (RTX, CODE));#define BRANCH_COST 0/* We say that MOD and DIV are so cheap because otherwise we'll generate some really horrible code for division of a power of two. *//* Provide the costs of a rtl expression. This is in the body of a switch on CODE. *//* ??? Shifts need to have a *much* higher cost than this. */#define RTX_COSTS(RTX,CODE,OUTER_CODE) \ case MOD: \ case DIV: \ return 60; \ case MULT: \ return 20; \ case ASHIFT: \ case ASHIFTRT: \ case LSHIFTRT: \ case ROTATE: \ case ROTATERT: \ if (GET_MODE (RTX) == HImode) return 2; \ return 8; /* Tell final.c how to eliminate redundant test instructions. *//* Here we define machine-dependent flags and fields in cc_status (see `conditions.h'). No extra ones are needed for the h8300. *//* Store in cc_status the expressions that the condition codes will describe after execution of an instruction whose pattern is EXP. Do not alter them if the instruction would not alter the cc's. */#define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)/* The add insns don't set overflow in a usable way. */#define CC_OVERFLOW_UNUSABLE 01000/* The mov,and,or,xor insns don't set carry. That's ok though as the Z bit is all we need when doing unsigned comparisons on the result of these insns (since they're always with 0). However, conditions.h has CC_NO_OVERFLOW defined for this purpose. Rename it to something more understandable. */#define CC_NO_CARRY CC_NO_OVERFLOW/* Control the assembler format that we output. */#define ASM_IDENTIFY_GCC /* nothing *//* Output at beginning/end of assembler file. */#define ASM_FILE_START(FILE) asm_file_start(FILE)#define ASM_FILE_END(FILE) asm_file_end(FILE)/* Output to assembler file text saying following lines may contain character constants, extra white space, comments, etc. */#define ASM_APP_ON "; #APP\n"/* Output to assembler file text saying following lines no longer contain unusual constructs. */#define ASM_APP_OFF "; #NO_APP\n"#define FILE_ASM_OP "\t.file\n"#define IDENT_ASM_OP "\t.ident\n"/* The assembler op to get a word, 2 bytes for the H8/300, 4 for H8/300H. */#define ASM_WORD_OP (TARGET_H8300 ? ".word" : ".long")/* We define a readonly data section solely to remove readonly data from the instruction stream. This can improve relaxing in two significant ways. First it's more likely that references to readonly data can be done with a 16bit absolute address since they'll be in low memory. Second, it's more likely that jsr instructions can be turned into bsr instructions since read-only data is not in the instruction stream. */#define READONLY_DATA_SECTION readonly_data#define TEXT_SECTION_ASM_OP "\t.section .text"#define DATA_SECTION_ASM_OP "\t.section .data"#define BSS_SECTION_ASM_OP "\t.section .bss"#define INIT_SECTION_ASM_OP "\t.section .init"#define CTORS_SECTION_ASM_OP "\t.section .ctors"#define DTORS_SECTION_ASM_OP "\t.section .dtors"#define READONLY_DATA_SECTION_ASM_OP "\t.section .rodata"#define EXTRA_SECTIONS in_ctors, in_dtors, in_readonly_data#define EXTRA_SECTION_FUNCTIONS \ \void \ctors_section() \{ \ if (in_section != in_ctors) \ { \ fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ in_section = in_ctors; \ } \} \ \void \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -