📄 mcore.h
字号:
/* Maximum number of registers that can appear in a valid memory address. */#define MAX_REGS_PER_ADDRESS 1/* Recognize any constant value that is a valid address. */#define CONSTANT_ADDRESS_P(X) (GET_CODE (X) == LABEL_REF)/* Nonzero if the constant value X is a legitimate general operand. It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. On the MCore, allow anything but a 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. */#ifndef REG_OK_STRICT/* 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) \ (REGNO (X) <= 16 || REGNO (X) >= FIRST_PSEUDO_REGISTER)/* 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#else/* 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))/* Nonzero if X is a hard reg that can be used as an index. */#define REG_OK_FOR_INDEX_P(X) 0#endif/* 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. */#define BASE_REGISTER_RTX_P(X) \ (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))#define INDEX_REGISTER_RTX_P(X) \ (GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))/* Jump to LABEL if X is a valid address RTX. This must also take REG_OK_STRICT into account when deciding about valid registers, but it uses the above macros so we are in luck. Allow REG REG+disp A legitimate index for a QI is 0..15, for HI is 0..30, for SI is 0..60, and for DI is 0..56 because we use two SI loads, etc. */#define GO_IF_LEGITIMATE_INDEX(MODE, REGNO, OP, LABEL) \ do \ { \ if (GET_CODE (OP) == CONST_INT) \ { \ if (GET_MODE_SIZE (MODE) >= 4 \ && (((unsigned)INTVAL (OP)) % 4) == 0 \ && ((unsigned)INTVAL (OP)) <= 64 - GET_MODE_SIZE (MODE)) \ goto LABEL; \ if (GET_MODE_SIZE (MODE) == 2 \ && (((unsigned)INTVAL (OP)) % 2) == 0 \ && ((unsigned)INTVAL (OP)) <= 30) \ goto LABEL; \ if (GET_MODE_SIZE (MODE) == 1 \ && ((unsigned)INTVAL (OP)) <= 15) \ goto LABEL; \ } \ } \ while (0)#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \{ \ if (BASE_REGISTER_RTX_P (X)) \ goto LABEL; \ else if (GET_CODE (X) == PLUS || GET_CODE (X) == LO_SUM) \ { \ rtx xop0 = XEXP (X,0); \ rtx xop1 = XEXP (X,1); \ if (BASE_REGISTER_RTX_P (xop0)) \ GO_IF_LEGITIMATE_INDEX (MODE, REGNO (xop0), xop1, LABEL); \ if (BASE_REGISTER_RTX_P (xop1)) \ GO_IF_LEGITIMATE_INDEX (MODE, REGNO (xop1), xop0, LABEL); \ } \} /* Go to LABEL if ADDR (a legitimate address expression) has an effect that depends on the machine mode it is used for. */#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \{ \ if ( GET_CODE (ADDR) == PRE_DEC || GET_CODE (ADDR) == POST_DEC \ || GET_CODE (ADDR) == PRE_INC || GET_CODE (ADDR) == POST_INC) \ goto LABEL; \}/* Specify the machine mode that this machine uses for the index in the tablejump instruction. */#define CASE_VECTOR_MODE SImode/* 'char' is signed by default. */#define DEFAULT_SIGNED_CHAR 0/* The type of size_t unsigned int. */#define SIZE_TYPE "unsigned int"/* Max number of bytes we can move from memory to memory in one reasonably fast instruction. */#define MOVE_MAX 4/* Define if operations between registers always perform the operation on the full register even if a narrower mode is specified. */#define WORD_REGISTER_OPERATIONS/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD will either zero-extend or sign-extend. The value of this macro should be the code that says which one of the two operations is implicitly done, UNKNOWN if none. */#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND/* Nonzero if access to memory by bytes is slow and undesirable. */#define SLOW_BYTE_ACCESS TARGET_SLOW_BYTES/* Immediate shift counts are truncated by the output routines (or was it the assembler?). Shift counts in a register are truncated by ARM. Note that the native compiler puts too large (> 32) immediate shift counts into a register and shifts by the register, letting the ARM decide what to do instead of doing that itself. */#define SHIFT_COUNT_TRUNCATED 1/* All integers have the same format so truncation is easy. */#define TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) 1/* Define this if addresses of constant functions shouldn't be put through pseudo regs where they can be cse'd. Desirable on machines where ordinary constants are expensive but a CALL with constant address is cheap. *//* Why is this defined??? -- dac */#define NO_FUNCTION_CSE 1/* The machine modes of pointers and functions. */#define Pmode SImode#define FUNCTION_MODE Pmode/* Compute extra cost of moving data between one register class and another. All register moves are cheap. */#define REGISTER_MOVE_COST(MODE, SRCCLASS, DSTCLASS) 2#define WORD_REGISTER_OPERATIONS/* Assembler output control. */#define ASM_COMMENT_START "\t//"#define ASM_APP_ON "// inline asm begin\n"#define ASM_APP_OFF "// inline asm end\n"#define FILE_ASM_OP "\t.file\n"/* Switch to the text or data segment. */#define TEXT_SECTION_ASM_OP "\t.text"#define DATA_SECTION_ASM_OP "\t.data"#undef EXTRA_SECTIONS#define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS#undef EXTRA_SECTION_FUNCTIONS#define EXTRA_SECTION_FUNCTIONS \ SUBTARGET_EXTRA_SECTION_FUNCTIONS \ SWITCH_SECTION_FUNCTION/* Switch to SECTION (an `enum in_section'). ??? This facility should be provided by GCC proper. The problem is that we want to temporarily switch sections in ASM_DECLARE_OBJECT_NAME and then switch back to the original section afterwards. */#define SWITCH_SECTION_FUNCTION \static void switch_to_section (enum in_section, tree); \static void \switch_to_section (enum in_section section, tree decl) \{ \ switch (section) \ { \ case in_text: text_section (); break; \ case in_unlikely_executed_text: unlikely_text_section (); break; \ case in_data: data_section (); break; \ case in_named: named_section (decl, NULL, 0); break; \ SUBTARGET_SWITCH_SECTIONS \ default: abort (); break; \ } \}/* Switch into a generic section. */#undef TARGET_ASM_NAMED_SECTION#define TARGET_ASM_NAMED_SECTION mcore_asm_named_section/* This is how to output an insn to push a register on the stack. It need not be very fast code. */#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ fprintf (FILE, "\tsubi\t %s,%d\n\tstw\t %s,(%s)\n", \ reg_names[STACK_POINTER_REGNUM], \ (STACK_BOUNDARY / BITS_PER_UNIT), \ reg_names[REGNO], \ reg_names[STACK_POINTER_REGNUM])/* Length in instructions of the code output by ASM_OUTPUT_REG_PUSH. */#define REG_PUSH_LENGTH 2/* This is how to output an insn to pop a register from the stack. */#define ASM_OUTPUT_REG_POP(FILE,REGNO) \ fprintf (FILE, "\tldw\t %s,(%s)\n\taddi\t %s,%d\n", \ reg_names[REGNO], \ reg_names[STACK_POINTER_REGNUM], \ reg_names[STACK_POINTER_REGNUM], \ (STACK_BOUNDARY / BITS_PER_UNIT)) /* Output a reference to a label. */#undef ASM_OUTPUT_LABELREF#define ASM_OUTPUT_LABELREF(STREAM, NAME) \ fprintf (STREAM, "%s%s", USER_LABEL_PREFIX, \ (* targetm.strip_name_encoding) (NAME))/* This is how to output an assembler line that says to advance the location counter to a multiple of 2**LOG bytes. */#define ASM_OUTPUT_ALIGN(FILE,LOG) \ if ((LOG) != 0) \ fprintf (FILE, "\t.align\t%d\n", LOG)#ifndef ASM_DECLARE_RESULT#define ASM_DECLARE_RESULT(FILE, RESULT)#endif#define MULTIPLE_SYMBOL_SPACES 1#define SUPPORTS_ONE_ONLY 1/* A pair of macros to output things for the callgraph data. VALUE means (to the tools that reads this info later): 0 a call from src to dst 1 the call is special (e.g. dst is "unknown" or "alloca") 2 the call is special (e.g., the src is a table instead of routine) Frame sizes are augmented with timestamps to help later tools differentiate between static entities with same names in different files. */extern long mcore_current_compilation_timestamp;#define ASM_OUTPUT_CG_NODE(FILE,SRCNAME,VALUE) \ do \ { \ if (mcore_current_compilation_timestamp == 0) \ mcore_current_compilation_timestamp = time (0); \ fprintf ((FILE),"\t.equ\t__$frame$size$_%s_$_%08lx,%d\n", \ (SRCNAME), mcore_current_compilation_timestamp, (VALUE)); \ } \ while (0)#define ASM_OUTPUT_CG_EDGE(FILE,SRCNAME,DSTNAME,VALUE) \ do \ { \ fprintf ((FILE),"\t.equ\t__$function$call$_%s_$_%s,%d\n", \ (SRCNAME), (DSTNAME), (VALUE)); \ } \ while (0)/* Globalizing directive for a label. */#define GLOBAL_ASM_OP "\t.export\t"/* The prefix to add to user-visible assembler symbols. */#undef USER_LABEL_PREFIX#define USER_LABEL_PREFIX ""/* Make an internal label into a string. */#undef ASM_GENERATE_INTERNAL_LABEL#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \ sprintf (STRING, "*.%s%ld", PREFIX, (long) NUM)/* Jump tables must be 32 bit aligned. */#undef ASM_OUTPUT_CASE_LABEL#define ASM_OUTPUT_CASE_LABEL(STREAM,PREFIX,NUM,TABLE) \ fprintf (STREAM, "\t.align 2\n.%s%d:\n", PREFIX, NUM);/* Output a relative address. Not needed since jump tables are absolute but we must define it anyway. */#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM,BODY,VALUE,REL) \ fputs ("- - - ASM_OUTPUT_ADDR_DIFF_ELT called!\n", STREAM)/* Output an element of a dispatch table. */#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE) \ fprintf (STREAM, "\t.long\t.L%d\n", VALUE)/* Output various types of constants. *//* This is how to output an assembler line that says to advance the location counter by SIZE bytes. */#undef ASM_OUTPUT_SKIP#define ASM_OUTPUT_SKIP(FILE,SIZE) \ fprintf (FILE, "\t.fill %d, 1\n", (int)(SIZE))/* This says how to output an assembler line to define a global common symbol, with alignment information. *//* XXX - for now we ignore the alignment. */ #undef ASM_OUTPUT_ALIGNED_COMMON#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ do \ { \ if (mcore_dllexport_name_p (NAME)) \ MCORE_EXPORT_NAME (FILE, NAME) \ if (! mcore_dllimport_name_p (NAME)) \ { \ fputs ("\t.comm\t", FILE); \ assemble_name (FILE, NAME); \ fprintf (FILE, ",%lu\n", (unsigned long)(SIZE)); \ } \ } \ while (0)/* This says how to output an assembler line to define a local common symbol.... */#undef ASM_OUTPUT_LOCAL#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ (fputs ("\t.lcomm\t", FILE), \ assemble_name (FILE, NAME), \ fprintf (FILE, ",%d\n", (int)SIZE))/* ... and how to define a local common symbol whose alignment we wish to specify. ALIGN comes in as bits, we have to turn it into bytes. */#undef ASM_OUTPUT_ALIGNED_LOCAL#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ do \ { \ fputs ("\t.bss\t", (FILE)); \ assemble_name ((FILE), (NAME)); \ fprintf ((FILE), ",%d,%d\n", (int)(SIZE), (ALIGN) / BITS_PER_UNIT);\ } \ while (0)/* Print operand X (an rtx) in assembler syntax to file FILE. CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. For `%' followed by punctuation, CODE is the punctuation and X is null. */#define PRINT_OPERAND(STREAM, X, CODE) mcore_print_operand (STREAM, X, CODE)/* Print a memory address as an operand to reference that memory location. */#define PRINT_OPERAND_ADDRESS(STREAM,X) mcore_print_operand_address (STREAM, X)#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \ ((CHAR)=='.' || (CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^' || (CHAR) == '!')#define PREDICATE_CODES \ { "mcore_arith_reg_operand", { REG, SUBREG }}, \ { "mcore_general_movsrc_operand", { MEM, CONST_INT, REG, SUBREG }},\ { "mcore_general_movdst_operand", { MEM, CONST_INT, REG, SUBREG }},\ { "mcore_reload_operand", { MEM, REG, SUBREG }}, \ { "mcore_arith_J_operand", { CONST_INT, REG, SUBREG }}, \ { "mcore_arith_K_operand", { CONST_INT, REG, SUBREG }}, \ { "mcore_arith_K_operand_not_0", { CONST_INT, REG, SUBREG }}, \ { "mcore_arith_M_operand", { CONST_INT, REG, SUBREG }}, \ { "mcore_arith_K_S_operand", { CONST_INT, REG, SUBREG }}, \ { "mcore_arith_O_operand", { CONST_INT, REG, SUBREG }}, \ { "mcore_arith_imm_operand", { CONST_INT, REG, SUBREG }}, \ { "mcore_arith_any_imm_operand", { CONST_INT, REG, SUBREG }}, \ { "mcore_literal_K_operand", { CONST_INT }}, \ { "mcore_addsub_operand", { CONST_INT, REG, SUBREG }}, \ { "mcore_compare_operand", { CONST_INT, REG, SUBREG }}, \ { "mcore_load_multiple_operation", { PARALLEL }}, \ { "mcore_store_multiple_operation", { PARALLEL }}, \ { "mcore_call_address_operand", { REG, SUBREG, CONST_INT }}, \#endif /* ! GCC_MCORE_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -