--- gcc/config/m68k/m68k.h 2018/04/24 18:10:24 1.1 +++ gcc/config/m68k/m68k.h 2018/04/24 18:14:35 1.1.1.2 @@ -121,9 +121,19 @@ extern int target_flags; { "68030", -01400}, \ { "68030", 5}, \ { "68040", 01007}, \ + { "68851", 0}, /* Affects *_SPEC and/or GAS. */ \ + { "no-68851", 0}, /* Affects *_SPEC and/or GAS. */ \ + { "68302", 0}, /* Affects *_SPEC and/or GAS. */ \ + { "no-68302", 0}, /* Affects *_SPEC and/or GAS. */ \ + { "68332", 0}, /* Affects *_SPEC and/or GAS. */ \ + { "no-68332", 0}, /* Affects *_SPEC and/or GAS. */ \ + SUBTARGET_SWITCHES \ { "", TARGET_DEFAULT}} /* TARGET_DEFAULT is defined in sun*.h and isi.h, etc. */ +/* This is meant to be redefined in the host dependent files */ +#define SUBTARGET_SWITCHES + #ifdef SUPPORT_SUN_FPA /* Blow away 68881 flag silently on TARGET_FPA (since we can't clear any bits in TARGET_SWITCHES above) */ @@ -132,14 +142,19 @@ extern int target_flags; if (TARGET_FPA) target_flags &= ~2; \ if (! TARGET_68020 && flag_pic == 2) \ error("-fPIC is not currently supported on the 68000 or 68010\n"); \ + SUBTARGET_OVERRIDE_OPTIONS \ } #else #define OVERRIDE_OPTIONS \ { \ if (! TARGET_68020 && flag_pic == 2) \ error("-fPIC is not currently supported on the 68000 or 68010\n"); \ + SUBTARGET_OVERRIDE_OPTIONS \ } #endif /* defined SUPPORT_SUN_FPA */ + +/* This is meant to be redefined in the host dependent files */ +#define SUBTARGET_OVERRIDE_OPTIONS /* target machine storage layout */ @@ -1120,14 +1135,23 @@ __transfer_from_trampoline () \ The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */ +/* Allow SUBREG everywhere we allow REG. This results in better code. It + also makes function inlining work when inline functions are called with + arguments that are SUBREGs. */ + +#define LEGITIMATE_BASE_REG_P(X) \ + ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \ + || (GET_CODE (X) == SUBREG \ + && GET_CODE (SUBREG_REG (X)) == REG \ + && REG_OK_FOR_BASE_P (SUBREG_REG (X)))) + #define INDIRECTABLE_1_ADDRESS_P(X) \ ((CONSTANT_ADDRESS_P (X) && (!flag_pic || LEGITIMATE_PIC_OPERAND_P (X))) \ - || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \ + || LEGITIMATE_BASE_REG_P (X) \ || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \ - && REG_P (XEXP (X, 0)) \ - && REG_OK_FOR_BASE_P (XEXP (X, 0))) \ + && LEGITIMATE_BASE_REG_P (XEXP (X, 0))) \ || (GET_CODE (X) == PLUS \ - && REG_P (XEXP (X, 0)) && REG_OK_FOR_BASE_P (XEXP (X, 0)) \ + && LEGITIMATE_BASE_REG_P (XEXP (X, 0)) \ && GET_CODE (XEXP (X, 1)) == CONST_INT \ && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000) \ || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx \ @@ -1156,7 +1180,7 @@ __transfer_from_trampoline () \ && (GET_CODE (PATTERN (temp)) == ADDR_VEC \ || GET_CODE (PATTERN (temp)) == ADDR_DIFF_VEC)) \ goto ADDR; \ - if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; } + if (LEGITIMATE_BASE_REG_P (X)) goto ADDR; } #define GO_IF_INDEXING(X, ADDR) \ { if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0))) \ @@ -1179,7 +1203,10 @@ __transfer_from_trampoline () \ || (GET_CODE (X) == SIGN_EXTEND \ && GET_CODE (XEXP (X, 0)) == REG \ && GET_MODE (XEXP (X, 0)) == HImode \ - && REG_OK_FOR_INDEX_P (XEXP (X, 0)))) + && REG_OK_FOR_INDEX_P (XEXP (X, 0))) \ + || (GET_CODE (X) == SUBREG \ + && GET_CODE (SUBREG_REG (X)) == REG \ + && REG_OK_FOR_INDEX_P (SUBREG_REG (X)))) #define LEGITIMATE_INDEX_P(X) \ (LEGITIMATE_INDEX_REG_P (X) \ @@ -1190,9 +1217,19 @@ __transfer_from_trampoline () \ || INTVAL (XEXP (X, 1)) == 4 \ || INTVAL (XEXP (X, 1)) == 8))) -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ GO_IF_NONINDEXED_ADDRESS (X, ADDR); \ - GO_IF_INDEXED_ADDRESS (X, ADDR); } +/* If pic, we accept INDEX+LABEL, which is what do_tablejump makes. */ +#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ +{ GO_IF_NONINDEXED_ADDRESS (X, ADDR); \ + GO_IF_INDEXED_ADDRESS (X, ADDR); \ + if (flag_pic && MODE == CASE_VECTOR_MODE && GET_CODE (X) == PLUS \ + && LEGITIMATE_INDEX_P (XEXP (X, 0)) \ + && GET_CODE (XEXP (X, 1)) == LABEL_REF) \ + goto ADDR; } + +/* Don't call memory_address_noforce for the address to fetch + the switch offset. This address is ok as it stands (see above), + but memory_address_noforce would alter it. */ +#define PIC_CASE_VECTOR_ADDRESS(index) index /* Try machine-dependent ways of modifying an illegitimate address to be legitimate. If we find one, return the new, valid address. @@ -1365,24 +1402,10 @@ __transfer_from_trampoline () \ return COSTS_N_INSNS (3); /* lsr #i,dn */ \ break; \ case MULT: \ - if (GET_CODE (XEXP (x, 1)) == CONST_INT \ - && exact_log2 (INTVAL (XEXP (x, 1))) >= 0) \ - { \ - /* A shift by a big integer takes an extra instruction. */ \ - if (GET_CODE (XEXP (X, 1)) == CONST_INT \ - && (INTVAL (XEXP (X, 1)) == (1 << 16))) \ - return COSTS_N_INSNS (2); /* clrw;swap */ \ - if (GET_CODE (XEXP (X, 1)) == CONST_INT \ - && !(INTVAL (XEXP (X, 1)) > 1 \ - && INTVAL (XEXP (X, 1)) <= 256)) \ - return COSTS_N_INSNS (3); /* lsr #i,dn */ \ - break; \ - } \ - else if (GET_MODE (X) == QImode || GET_MODE (X) == HImode) \ + if (GET_MODE (X) == QImode || GET_MODE (X) == HImode) \ return COSTS_N_INSNS (MULW_COST); \ else \ return COSTS_N_INSNS (MULL_COST); \ - break; \ case DIV: \ case UDIV: \ case MOD: \ @@ -1772,6 +1795,154 @@ do { long l; \ #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR) +/* Definitions for generating bytecode */ + +/* Just so it's known this target is supported by the bytecode generator. + If this define isn't found anywhere in the target config files, then + dummy stubs are supplied by bytecode.h, and any attempt to use + -fbytecode will result in an error message. */ + +#define TARGET_SUPPORTS_BYTECODE + +/* Minimal segment alignment within sections is 8 units. */ +#define MACHINE_SEG_ALIGN 3 + +/* Integer alignment is two units. */ +#define INT_ALIGN 2 + +/* Pointer alignment is eight units. */ +#define PTR_ALIGN 3 + +/* Global symbols begin with `_' */ +#define NAMES_HAVE_UNDERSCORES + +/* BC_xxx below are similar to their ASM_xxx counterparts above. */ +#define BC_GLOBALIZE_LABEL(FP, NAME) bc_globalize_label(NAME) + +#define BC_OUTPUT_COMMON(FP, NAME, SIZE, ROUNDED) \ + do { bc_emit_common(NAME, ROUNDED); bc_globalize_label(NAME); } while (0) + +#define BC_OUTPUT_LOCAL(FP, NAME, SIZE, ROUNDED) \ + bc_emit_common(NAME, ROUNDED) + +#define BC_OUTPUT_ALIGN(FP, ALIGN) bc_align(ALIGN) + +#define BC_OUTPUT_LABEL(FP, NAME) bc_emit_labeldef(NAME) + +#define BC_OUTPUT_SKIP(FP, SIZE) bc_emit_skip(SIZE) + +#define BC_OUTPUT_LABELREF(FP, NAME) \ + do { \ + char *foo = (char *) xmalloc(strlen(NAME) + 2); \ + strcpy(foo, "_"); \ + strcat(foo, NAME); \ + bc_emit_labelref (foo); \ + free (foo); \ + } while (0) + +#define BC_OUTPUT_FLOAT(FP, VAL) \ + do { \ + float F = VAL; \ + bc_emit ((char *) &F, sizeof F); \ + } while (0) + +#define BC_OUTPUT_DOUBLE(FP, VAL) \ + do { \ + double D = VAL; \ + bc_emit ((char *) &D, sizeof D); \ + } while (0) + +#define BC_OUTPUT_BYTE(FP, VAL) \ + do { \ + char C = VAL; \ + bc_emit (&C, 1); \ + } while (0) + + +#define BC_OUTPUT_FILE ASM_OUTPUT_FILE +#define BC_OUTPUT_ASCII ASM_OUTPUT_ASCII +#define BC_OUTPUT_IDENT ASM_OUTPUT_IDENT + +/* Same as XSTR, but for bytecode */ +#define BCXSTR(RTX) ((RTX)->bc_label) + + +/* Flush bytecode buffer onto file */ +#define BC_WRITE_FILE(FP) \ +{ \ + fprintf (FP, ".text\n"); \ + bc_seg_write (bc_text_seg, FP); \ + fprintf(FP, "\n.data\n"); \ + bc_seg_write (bc_data_seg, FP); \ + bc_sym_write (FP); /* do .globl, .bss, etc. */ \ +} + +/* Write one symbol */ +#define BC_WRITE_SEGSYM(SEGSYM, FP) \ +{ \ + prsym (FP, (SEGSYM)->sym->name); \ + fprintf (FP, ":\n"); \ +} + + +/* Write one reloc entry */ +#define BC_WRITE_RELOC_ENTRY(SEGRELOC, FP, OFFSET) \ +{ \ + fprintf (FP, "\t.long "); \ + prsym (FP, (SEGRELOC)->sym->name); \ + fprintf (FP, " + %d\n", OFFSET); \ +} + +/* Start new line of bytecodes */ +#define BC_START_BYTECODE_LINE(FP) \ +{ \ + fprintf (FP, "\t.byte"); \ +} + +/* Write one bytecode */ +#define BC_WRITE_BYTECODE(SEP, VAL, FP) \ +{ \ + fprintf (FP, "%c0x%02X", (SEP), (VAL) & 0xff); \ +} + +/* Write one bytecode RTL entry */ +#define BC_WRITE_RTL(R, FP) \ +{ \ + fprintf (FP, "%s+%d/0x%08X\n", (R)->label, (R)->offset, (R)->bc_label); \ +} + + +/* Emit function entry trampoline */ +#define BC_EMIT_TRAMPOLINE(TRAMPSEG, CALLINFO) \ +{ \ + short insn; \ + \ + /* Push a reference to the callinfo structure. */ \ + insn = 0x4879; /* pea xxx.L */ \ + seg_data (TRAMPSEG, (char *) &insn, sizeof insn); \ + seg_refsym (TRAMPSEG, CALLINFO, 0); \ + \ + /* Call __interp, pop arguments, and return. */ \ + insn = 0x4eb9; /* jsr xxx.L */ \ + seg_data (TRAMPSEG, (char *) &insn, sizeof insn); \ + seg_refsym (TRAMPSEG, "__callint", 0); \ + insn = 0x588f; /* addql #4, sp */ \ + seg_data (TRAMPSEG, (char *) &insn, sizeof insn); \ + insn = 0x4e75; /* rts */ \ + seg_data (TRAMPSEG, (char *) &insn, sizeof insn); \ +} + + + +#if 0 +#define VALIDATE_STACK() if (stack_depth < 0) abort (); +#else +#if 0 +#define VALIDATE_STACK() \ + fprintf (stderr, " %%%d%%", stack_depth); +#endif +#endif + /* Define functions defined in aux-output.c and used in templates. */ extern char *output_move_double ();