Skip to content

Commit 2c96e18

Browse files
committed
Require that the generated functions return DecodeStatus
1 parent 909086a commit 2c96e18

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

llvm/lib/Target/M68k/Disassembler/M68kDisassembler.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,16 @@ static DecodeStatus DecodeFPCSCRegisterClass(MCInst &Inst, uint64_t RegNo,
107107
}
108108
#define DecodeFPICRegisterClass DecodeFPCSCRegisterClass
109109

110-
static void DecodeCCRCRegisterClass(MCInst &Inst,
111-
const MCDisassembler *Decoder) {
110+
static DecodeStatus DecodeCCRCRegisterClass(MCInst &Inst,
111+
const MCDisassembler *Decoder) {
112112
Inst.addOperand(MCOperand::createReg(M68k::CCR));
113+
return DecodeStatus::Success;
113114
}
114115

115-
static void DecodeSRCRegisterClass(MCInst &Inst,
116-
const MCDisassembler *Decoder) {
116+
static DecodeStatus DecodeSRCRegisterClass(MCInst &Inst,
117+
const MCDisassembler *Decoder) {
117118
Inst.addOperand(MCOperand::createReg(M68k::SR));
119+
return DecodeStatus::Success;
118120
}
119121

120122
static DecodeStatus DecodeImm32(MCInst &Inst, uint64_t Imm, uint64_t Address,

llvm/utils/TableGen/DecoderEmitter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,8 @@ void DecoderTableBuilder::emitBinaryParser(raw_ostream &OS, indent Indent,
11091109
if (IgnoreNonDecodableOperands)
11101110
return;
11111111
assert(!OpInfo.Decoder.empty());
1112-
OS << Indent << OpInfo.Decoder << "(MI, Decoder);\n";
1112+
OS << Indent << "if (!Check(S, " << OpInfo.Decoder << "(MI, Decoder)))\n"
1113+
<< Indent << " return MCDisassembler::Fail;\n";
11131114
return;
11141115
}
11151116

0 commit comments

Comments
 (0)