📄 sgs.h
字号:
#undef ASM_OUTPUT_DOUBLE_OPERAND#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \ do { long l[2]; \ REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \ asm_fprintf ((FILE), "%I0x%x%08x", l[0], l[1]); \ } while (0)/* How to output a block of SIZE zero bytes. Note that the `space' pseudo, when used in the text segment, causes SGS assemblers to output nop insns rather than 0s, so we set ASM_NO_SKIP_IN_TEXT to prevent this. */#define ASM_NO_SKIP_IN_TEXT 1#undef ASM_OUTPUT_SKIP#define ASM_OUTPUT_SKIP(FILE,SIZE) \ fprintf (FILE, "\t%s %u\n", SPACE_ASM_OP, (SIZE))/* Translate Motorola opcodes such as `jbeq' into SGS opcodes such as `beq.w'. Delete the `e' in `move...' and `fmove'. Change `ftst' to `ftest'. Change `fbne' to `fbneq' Change `fsne' to `fsneq' Change `divsl' to `tdivs' (32/32 -> 32r:32q) Change `divul' to `tdivu' (32/32 -> 32r:32q) Optionally change swap to swap.w. */#ifdef SGS_SWAP_W#define ASM_OUTPUT_OPCODE(FILE, PTR) \{ \ extern int flag_pic; \ if (!strncmp ((PTR), "jbsr", 4)) \ { if (flag_pic) \ fprintf ((FILE), "bsr"); \ else \ fprintf ((FILE), "jsr"); \ (PTR) += 4; } \ else if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \ { ++(PTR); \ while (*(PTR) != ' ') \ { putc (*(PTR), (FILE)); ++(PTR); } \ fprintf ((FILE), ".w"); } \ else if ((PTR)[0] == 's') \ { \ if (!strncmp ((PTR), "swap", 4)) \ { fprintf ((FILE), "swap.w"); (PTR) += 4; } \ } \/* FMOVE ==> FMOV, (and F%& F%$ translations) */ \ else if ((PTR)[0] == 'f') \ { \ if (!strncmp ((PTR), "fmove", 5)) \ { fprintf ((FILE), "fmov"); (PTR) += 5; } \ else if (!strncmp ((PTR), "ftst", 4)) \ { fprintf ((FILE), "ftest"); (PTR) += 4; } \ else if (!strncmp ((PTR), "fbne", 4)) \ { fprintf ((FILE), "fbneq"); (PTR) += 4; } \ else if (!strncmp ((PTR), "fsne", 4)) \ { fprintf ((FILE), "fsneq"); (PTR) += 4; } \ else if (!strncmp ((PTR), "f%$move", 7)) \ { (PTR) += 7; \ if (TARGET_68040_ONLY) \ fprintf ((FILE), "fsmov"); \ else fprintf ((FILE), "fmov"); } \ else if (!strncmp ((PTR), "f%&move", 7)) \ { (PTR) += 7; \ if (TARGET_68040_ONLY) \ fprintf ((FILE), "fdmov"); \ else fprintf ((FILE), "fmov"); } \ } \/* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \ else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \ && (PTR)[2] == 'v' && (PTR)[3] == 'e') \ { fprintf ((FILE), "mov"); (PTR) += 4; \ if ((PTR)[0] == 'q' || (PTR)[0] == 'a' \ || (PTR)[0] == 'c') (PTR)++; } \/* SUB, SUBQ, SUBA, SUBI ==> SUB */ \ else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \ && (PTR)[2] == 'b') \ { fprintf ((FILE), "sub"); (PTR) += 3; \ if ((PTR)[0] == 'q' || (PTR)[0] == 'i' \ || (PTR)[0] == 'a') (PTR)++; } \/* CMP, CMPA, CMPI, CMPM ==> CMP */ \ else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \ && (PTR)[2] == 'p') \ { fprintf ((FILE), "cmp"); (PTR) += 3; \ if ((PTR)[0] == 'a' || (PTR)[0] == 'i' \ || (PTR)[0] == 'm') (PTR)++; } \/* DIVSL ==> TDIVS */ \ else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \ && (PTR)[2] == 'v' && (PTR)[3] == 's' \ && (PTR)[4] == 'l') \ { fprintf ((FILE), "tdivs"); (PTR) += 5; } \/* DIVUL ==> TDIVU */ \ else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \ && (PTR)[2] == 'v' && (PTR)[3] == 'u' \ && (PTR)[4] == 'l') \ { fprintf ((FILE), "tdivu"); (PTR) += 5; } \}#else /* not SGS_SWAP_W */#define ASM_OUTPUT_OPCODE(FILE, PTR) \{ \ extern int flag_pic; \ if (!strncmp ((PTR), "jbsr", 4)) \ { if (flag_pic) \ fprintf ((FILE), "bsr"); \ else \ fprintf ((FILE), "jsr"); \ (PTR) += 4; } \ else if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \ { ++(PTR); \ while (*(PTR) != ' ') \ { putc (*(PTR), (FILE)); ++(PTR); } \ fprintf ((FILE), ".w"); } \/* FMOVE ==> FMOV, (and F%& F%$ translations) */ \ else if ((PTR)[0] == 'f') \ { \ if (!strncmp ((PTR), "fmove", 5)) \ { fprintf ((FILE), "fmov"); (PTR) += 5; } \ else if (!strncmp ((PTR), "ftst", 4)) \ { fprintf ((FILE), "ftest"); (PTR) += 4; } \ else if (!strncmp ((PTR), "fbne", 4)) \ { fprintf ((FILE), "fbneq"); (PTR) += 4; } \ else if (!strncmp ((PTR), "fsne", 4)) \ { fprintf ((FILE), "fsneq"); (PTR) += 4; } \ else if (!strncmp ((PTR), "f%$move", 7)) \ { (PTR) += 7; \ if (TARGET_68040_ONLY) \ fprintf ((FILE), "fsmov"); \ else fprintf ((FILE), "fmov"); } \ else if (!strncmp ((PTR), "f%&move", 7)) \ { (PTR) += 7; \ if (TARGET_68040_ONLY) \ fprintf ((FILE), "fdmov"); \ else fprintf ((FILE), "fmov"); } \ } \/* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \ else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \ && (PTR)[2] == 'v' && (PTR)[3] == 'e') \ { fprintf ((FILE), "mov"); (PTR) += 4; \ if ((PTR)[0] == 'q' || (PTR)[0] == 'a' \ || (PTR)[0] == 'c') (PTR)++; } \/* SUB, SUBQ, SUBA, SUBI ==> SUB */ \ else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \ && (PTR)[2] == 'b') \ { fprintf ((FILE), "sub"); (PTR) += 3; \ if ((PTR)[0] == 'q' || (PTR)[0] == 'i' \ || (PTR)[0] == 'a') (PTR)++; } \/* CMP, CMPA, CMPI, CMPM ==> CMP */ \ else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \ && (PTR)[2] == 'p') \ { fprintf ((FILE), "cmp"); (PTR) += 3; \ if ((PTR)[0] == 'a' || (PTR)[0] == 'i' \ || (PTR)[0] == 'm') (PTR)++; } \/* DIVSL ==> TDIVS */ \ else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \ && (PTR)[2] == 'v' && (PTR)[3] == 's' \ && (PTR)[4] == 'l') \ { fprintf ((FILE), "tdivs"); (PTR) += 5; } \/* DIVUL ==> TDIVU */ \ else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \ && (PTR)[2] == 'v' && (PTR)[3] == 'u' \ && (PTR)[4] == 'l') \ { fprintf ((FILE), "tdivu"); (PTR) += 5; } \}#endif /* not SGS_SWAP_W *//* This macro outputs the label at the start of a switch table. The ".swbeg <N>" is an assembler directive that causes the switch table size to be inserted into the object code so that disassemblers, for example, can identify that it is the start of a switch table. */#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ fprintf ((FILE), "\t%s &%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ do { \ ASM_OUTPUT_BEFORE_CASE_LABEL((FILE),(PREFIX),(NUM),(TABLE)); \ ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \ } while (0)/* At end of a switch table, define LDnnn iff the symbol LInnn was defined. Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)" fails to assemble. Luckily "LDnnn(pc,d0.l*2)" produces the results we want. This difference can be accommodated by making the assembler define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other string, as necessary. This is accomplished via the ASM_OUTPUT_CASE_END macro. */#undef ASM_OUTPUT_CASE_END#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \{ if (switch_table_difference_label_flag) \ asm_fprintf (FILE, "\t%s %LLD%d,%LL%d-%LLI%d-2.b\n",\ SET_ASM_OP, (NUM), (NUM), (NUM)); \ switch_table_difference_label_flag = 0; }extern int switch_table_difference_label_flag;/* This is how to output an element of a case-vector that is relative. */#undef ASM_OUTPUT_ADDR_DIFF_ELT#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ asm_fprintf (FILE, "\t%s %LL%d-%LL%d\n", WORD_ASM_OP, VALUE, REL)/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to keep switch tables in the text section. */ #define JUMP_TABLES_IN_TEXT_SECTION 1/* Store in OUTPUT a string (made with alloca) containing an assembler-name for a local static variable named NAME. LABELNO is an integer which is different for each call. */#undef ASM_FORMAT_PRIVATE_NAME#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ sprintf ((OUTPUT), ASM_PN_FORMAT, (NAME), (LABELNO)))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -