From: Sergey Belyashov Date: Tue, 17 Mar 2020 16:55:32 +0000 (+0000) Subject: Fix a small set of Z80 problems. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=68e52bc7ecfbfdc8d5f85716a8ac7668e211f360;p=binutils-gdb.git Fix a small set of Z80 problems. PR 25641 PR 25668 PR 25633 gas Fix disassembling ED+A4/AC/B4/BC opcodes. Fix assembling lines containing colonless label and instruction with first operand inside parentheses. Fix registration of unsupported by target CPU registers. * config/tc-z80.c: See above. * config/tc-z80.h: See above. * testsuite/gas/z80/colonless.d: Update test. * testsuite/gas/z80/colonless.s: Likewise. * testsuite/gas/z80/ez80_adl_all.d: Likewise. * testsuite/gas/z80/ez80_unsup_regs.d: Likewise. * testsuite/gas/z80/ez80_z80_all.d: Likewise. * testsuite/gas/z80/gbz80_unsup_regs.d: Likewise. * testsuite/gas/z80/r800_unsup_regs.d: Likewise. * testsuite/gas/z80/unsup_regs.s: Likewise. * testsuite/gas/z80/z180_unsup_regs.d: Likewise. * testsuite/gas/z80/z80.exp: Likewise. * testsuite/gas/z80/z80_strict_unsup_regs.d: Likewise. * testsuite/gas/z80/z80_unsup_regs.d: Likewise. * testsuite/gas/z80/z80n_unsup_regs.d: Likewise. opcodes * z80-dis.c: Fix disassembling ED+A4/AC/B4/BC opcodes. --- diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c index 713176f76bd..a3ab13de155 100644 --- a/gas/config/tc-z80.c +++ b/gas/config/tc-z80.c @@ -155,7 +155,7 @@ struct match_info static const struct match_info match_cpu_table [] = { - {"z80", INS_Z80, 0, 0, "Zilog Z80 (+infc+xyhl)" }, + {"z80", INS_Z80, 0, 0, "Zilog Z80" }, {"ez80", INS_EZ80, 0, 0, "Zilog eZ80" }, {"gbz80", INS_GBZ80, INS_UNDOC|INS_UNPORT, 0, "GameBoy Z80" }, {"r800", INS_R800, INS_UNPORT, 0, "Ascii R800" }, @@ -428,6 +428,7 @@ struct reg_entry { const char* name; int number; + int isa; }; #define R_STACKABLE (0x80) #define R_ARITH (0x40) @@ -457,28 +458,28 @@ struct reg_entry static const struct reg_entry regtable[] = { - {"a", REG_A }, - {"af", REG_AF }, - {"b", REG_B }, - {"bc", REG_BC }, - {"c", REG_C }, - {"d", REG_D }, - {"de", REG_DE }, - {"e", REG_E }, - {"f", REG_F }, - {"h", REG_H }, - {"hl", REG_HL }, - {"i", REG_I }, - {"ix", REG_IX }, - {"ixh",REG_H | R_IX }, - {"ixl",REG_L | R_IX }, - {"iy", REG_IY }, - {"iyh",REG_H | R_IY }, - {"iyl",REG_L | R_IY }, - {"l", REG_L }, - {"mb", REG_MB }, - {"r", REG_R }, - {"sp", REG_SP }, + {"a", REG_A, INS_ALL }, + {"af", REG_AF, INS_ALL }, + {"b", REG_B, INS_ALL }, + {"bc", REG_BC, INS_ALL }, + {"c", REG_C, INS_ALL }, + {"d", REG_D, INS_ALL }, + {"de", REG_DE, INS_ALL }, + {"e", REG_E, INS_ALL }, + {"f", REG_F, INS_IN_F_C | INS_Z80N | INS_R800 }, + {"h", REG_H, INS_ALL }, + {"hl", REG_HL, INS_ALL }, + {"i", REG_I, INS_NOT_GBZ80 }, + {"ix", REG_IX, INS_NOT_GBZ80 }, + {"ixh", REG_H | R_IX, INS_IDX_HALF | INS_EZ80 | INS_R800 | INS_Z80N }, + {"ixl", REG_L | R_IX, INS_IDX_HALF | INS_EZ80 | INS_R800 | INS_Z80N }, + {"iy", REG_IY, INS_NOT_GBZ80 }, + {"iyh", REG_H | R_IY, INS_IDX_HALF | INS_EZ80 | INS_R800 | INS_Z80N }, + {"iyl", REG_L | R_IY, INS_IDX_HALF | INS_EZ80 | INS_R800 | INS_Z80N }, + {"l", REG_L, INS_ALL }, + {"mb", REG_MB, INS_EZ80 }, + {"r", REG_R, INS_NOT_GBZ80 }, + {"sp", REG_SP, INS_ALL }, } ; #define BUFLEN 8 /* Large enough for any keyword. */ @@ -499,6 +500,8 @@ md_begin (void) reg.X_add_symbol = reg.X_op_symbol = 0; for ( i = 0 ; i < ARRAY_SIZE ( regtable ) ; ++i ) { + if (regtable[i].isa && !(regtable[i].isa & ins_ok)) + continue; reg.X_add_number = regtable[i].number; k = strlen ( regtable[i].name ); buf[k] = 0; @@ -615,7 +618,7 @@ z80_start_line_hook (void) break; } } - /* Check for