📄 cris.h
字号:
/* We pull a little trick to register the _fini function with atexit, after (presumably) registering the eh frame info, since we don't handle _fini (a.k.a. ___fini_start) in crt0 or have a crti for "pure" ELF. If you change this, don't forget that you can't have library function references (e.g. to atexit) in crtend.o, since those won't be resolved to libraries; those are linked in *before* crtend.o. */#ifdef CRT_BEGIN# define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \static void __attribute__((__used__)) \call_ ## FUNC (void) \{ \ asm (SECTION_OP); \ FUNC (); \ if (__builtin_strcmp (#FUNC, "frame_dummy") == 0) \ { \ extern void __fini__start (void); \ atexit (__fini__start); \ } \ asm (TEXT_SECTION_ASM_OP); \}#endif/* Node: PIC */#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 0 : INVALID_REGNUM)#define LEGITIMATE_PIC_OPERAND_P(X) cris_legitimate_pic_operand (X)/* Node: File Framework *//* NO_APP *only at file start* means faster assembly. It also means comments are not allowed. In some cases comments will be output for debugging purposes. Make sure they are allowed then. *//* Override previous definitions (elfos.h). */#undef ASM_FILE_START#define ASM_FILE_START(STREAM) \ do \ { \ if (TARGET_PDEBUG || flag_print_asm_name) \ fprintf ((STREAM), "#APP\n"); \ else \ fprintf ((STREAM), "#NO_APP\n"); \ if (TARGET_ELF) \ output_file_directive ((STREAM), main_input_filename); \ } \ while (0)/* Override previous definitions (elfos.h). */#undef ASM_FILE_END#define ASM_FILE_END(STREAM)/* We don't want an .ident for gcc. To avoid that but still support #ident, we override ASM_OUTPUT_IDENT and, since the gcc .ident is its only use besides ASM_OUTPUT_IDENT, undef IDENT_ASM_OP from elfos.h. */#undef IDENT_ASM_OP#undef ASM_OUTPUT_IDENT#define ASM_OUTPUT_IDENT(FILE, NAME) \ fprintf (FILE, "%s\"%s\"\n", "\t.ident\t", NAME);#define ASM_APP_ON "#APP\n"#define ASM_APP_OFF "#NO_APP\n"/* Node: Data Output */#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) (C) == '@'/* Node: Uninitialized Data *//* Remember to round off odd values if we want data alignment, since we cannot do that with an .align directive. Using .comm causes the space not to be reserved in .bss, but by tricks with the symbol type. Not good if other tools than binutils are used on the object files. Since ".global ... .lcomm ..." works, we use that. Use .._ALIGNED_COMMON, since gcc whines when we only have ..._COMMON, and we prefer to whine ourselves; BIGGEST_ALIGNMENT is not the one to check. This done for a.out only. *//* FIXME: I suspect a bug in gcc with alignment. Do not warn until investigated; it mucks up the testsuite results. */#define CRIS_ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN, LOCAL) \ do \ { \ int align_ = (ALIGN) / BITS_PER_UNIT; \ if (TARGET_DATA_ALIGN && TARGET_ALIGN_BY_32 && align_ < 4) \ align_ = 4; \ else if (TARGET_DATA_ALIGN && align_ < 2) \ align_ = 2; \ /* FIXME: Do we need this? */ \ else if (align_ < 1) \ align_ = 1; \ \ if (TARGET_ELF) \ { \ if (LOCAL) \ { \ fprintf ((FILE), "%s", LOCAL_ASM_OP); \ assemble_name ((FILE), (NAME)); \ fprintf ((FILE), "\n"); \ } \ fprintf ((FILE), "%s", COMMON_ASM_OP); \ assemble_name ((FILE), (NAME)); \ fprintf ((FILE), ",%u,%u\n", (SIZE), align_); \ } \ else \ { \ /* We can't tell a one-only or weak COMM from a "global \ COMM" so just make all non-locals weak. */ \ if (! (LOCAL)) \ ASM_WEAKEN_LABEL (FILE, NAME); \ fputs ("\t.lcomm ", (FILE)); \ assemble_name ((FILE), (NAME)); \ fprintf ((FILE), ",%u\n", \ ((SIZE) + (align_ - 1)) & ~(align_ - 1)); \ } \ } \ while (0)#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ CRIS_ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN, 0)#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \ CRIS_ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN, 1)/* FIXME: define ASM_OUTPUT_SHARED_COMMON and emit an error when it is used with -melinux and a.out. *//* Node: Label Output *//* Globalizing directive for a label. */#define GLOBAL_ASM_OP "\t.global "#define SUPPORTS_WEAK 1/* FIXME: This macro isn't documented, but this would probably be an appropriate location. It's only used in crtstuff.c, else we'd have to handle (to #undef or ignore it) in a.out. */#define HAVE_GAS_HIDDEN 1#undef ASM_OUTPUT_INTERNAL_LABEL#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \ do \ { \ asm_fprintf (FILE, "%L%s%d:\n", PREFIX, NUM); \ } \ while (0)/* Remove any previous definition (elfos.h). */#undef ASM_GENERATE_INTERNAL_LABEL#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ sprintf (LABEL, "*%s%s%ld", LOCAL_LABEL_PREFIX, PREFIX, (long) NUM)#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ do \ { \ (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10); \ sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)); \ } \ while (0)/* Node: Initialization *//* (no definitions) *//* Node: Macros for Initialization *//* (no definitions) *//* Node: Instruction Output */#define REGISTER_NAMES \ {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \ "r9", "r10", "r11", "r12", "r13", "sp", "pc", "srp", "faked_ap"}#define ADDITIONAL_REGISTER_NAMES \ {{"r14", 14}, {"r15", 15}}#define PRINT_OPERAND(FILE, X, CODE) \ cris_print_operand (FILE, X, CODE)/* For delay-slot handling. */#define PRINT_OPERAND_PUNCT_VALID_P(CODE) (CODE == '#')#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ cris_print_operand_address (FILE, ADDR)/* Output an empty line to illustrate the presence of the delay slot. */#define DBR_OUTPUT_SEQEND(FILE) \ fprintf (FILE, "\n")#define LOCAL_LABEL_PREFIX (TARGET_ELF ? "." : "")/* cppinit.c initializes a const array from this, so it must be constant, can't have it different based on options. Luckily, the prefix is always allowed, so let's have it on all GCC-generated code. Note that we have this verbatim everywhere in the back-end, not using %R or %s or such. */#define REGISTER_PREFIX "$"/* Remove any previous definition (elfos.h). *//* We use -fno-leading-underscore to remove it, when necessary. */#undef USER_LABEL_PREFIX#define USER_LABEL_PREFIX "_"#define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \ fprintf (FILE, "\tpush $%s\n", reg_names[REGNO])#define ASM_OUTPUT_REG_POP(FILE, REGNO) \ fprintf (FILE, "\tpop $%s\n", reg_names[REGNO])/* Node: Dispatch Tables */#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ asm_fprintf (FILE, "\t.word %LL%d-%LL%d\n", VALUE, REL)#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ asm_fprintf (FILE, "\t.dword %LL%d\n", VALUE)/* Defined to also emit an .align in elfos.h. We don't want that. */#undef ASM_OUTPUT_CASE_LABEL/* Since the "bound" insn loads the comparison value if the compared< value (register) is out of bounds (0..comparison value-1), we need to output another case to catch it. The way to find it is to look for the label_ref at the else-arm inside the expanded casesi core-insn. FIXME: Check this construct when changing to new version of gcc. */#define ASM_OUTPUT_CASE_END(STREAM, NUM, TABLE) \ do \ { \ asm_fprintf (STREAM, "\t.word %LL%d-%LL%d%s\n", \ CODE_LABEL_NUMBER \ (XEXP (XEXP (XEXP \ (XVECEXP \ (PATTERN (PREV_INSN (PREV_INSN \ (TABLE))), \ 0, 0), 1), 2), 0)), \ NUM, \ (TARGET_PDEBUG ? "; default" : "")); \ } \ while (0)/* Node: Exception Region Output *//* (no definitions) *//* FIXME: Fill in with our own optimized layout. *//* Node: Alignment Output */#define ASM_OUTPUT_ALIGN(FILE, LOG) \ fprintf (FILE, "\t.align %d\n", (LOG))/* Node: All Debuggers */#define DBX_REGISTER_NUMBER(REGNO) \ ((REGNO) == CRIS_SRP_REGNUM ? CRIS_CANONICAL_SRP_REGNUM : (REGNO))/* FIXME: Investigate DEBUGGER_AUTO_OFFSET, DEBUGGER_ARG_OFFSET. *//* Node: DBX Options *//* Is this correct? Check later. */#define DBX_NO_XREFS#define DBX_CONTIN_LENGTH 0/* FIXME: Is this needed when we have 0 DBX_CONTIN_LENGTH? */#define DBX_CONTIN_CHAR '?'/* Node: DBX Hooks *//* (no definitions) *//* Node: File names and DBX *//* (no definitions) *//* Node: SDB and DWARF *//* (no definitions) *//* Node: Misc *//* FIXME: Check this one more time. */#define PREDICATE_CODES \ {"cris_orthogonal_operator", \ {PLUS, MINUS, IOR, AND, UMIN}}, \ {"cris_commutative_orth_op", \ {PLUS, IOR, AND, UMIN}}, \ {"cris_operand_extend_operator", \ {PLUS, MINUS, UMIN}}, \ {"cris_additive_operand_extend_operator", \ {PLUS, MINUS}}, \ {"cris_extend_operator", \ {ZERO_EXTEND, SIGN_EXTEND}}, \ {"cris_plus_or_bound_operator", \ {PLUS, UMIN}}, \ {"cris_bdap_operand", \ {SUBREG, REG, LABEL_REF, SYMBOL_REF, MEM, CONST_INT, \ CONST_DOUBLE, CONST, SIGN_EXTEND}}, \ {"cris_bdap_biap_operand", \ {SUBREG, REG, LABEL_REF, SYMBOL_REF, MEM, CONST_INT, \ CONST_DOUBLE, CONST, SIGN_EXTEND, MULT}}, \ {"cris_general_operand_or_gotless_symbol", \ {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \ LABEL_REF, SUBREG, REG, MEM}}, \ {"cris_general_operand_or_symbol", \ {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \ LABEL_REF, SUBREG, REG, MEM}}, \ {"cris_general_operand_or_plt_symbol", \ {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \ LABEL_REF, SUBREG, REG, MEM}}, \ {"cris_mem_call_operand", \ {MEM}},/* A combination of the bound (umin) insn together with a sign-extended add via the table to PC seems optimal. If the table overflows, the assembler will take care of it. Theoretically, in extreme cases (uncertain if they occur), an error will be emitted, so FIXME: Check how large case-tables are emitted, possible add an option to emit SImode case-tables. */#define CASE_VECTOR_MODE HImode#define CASE_VECTOR_PC_RELATIVE 1/* FIXME: Investigate CASE_VECTOR_SHORTEN_MODE to make sure HImode is not used when broken-.word could possibly fail (plus test-case). */#define FIXUNS_TRUNC_LIKE_FIX_TRUNC/* This is the number of bytes that can be moved in one reasonably fast instruction sequence. For CRIS, this is two instructions: mem => reg, reg => mem. */#define MOVE_MAX 4/* Maybe SHIFT_COUNT_TRUNCATED is safe to define? FIXME: Check later. */#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1#define STORE_FLAG_VALUE 1#define Pmode SImode#define FUNCTION_MODE QImode#define NO_IMPLICIT_EXTERN_C/* * Local variables: * eval: (c-set-style "gnu") * indent-tabs-mode: t * End: */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -