Skip to content

Commit de4185f

Browse files
committed
Require that the generated functions return DecodeStatus
1 parent f321cd1 commit de4185f

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
@@ -1127,7 +1127,8 @@ void DecoderTableBuilder::emitBinaryParser(raw_ostream &OS, indent Indent,
11271127
if (IgnoreNonDecodableOperands)
11281128
return;
11291129
assert(!OpInfo.Decoder.empty());
1130-
OS << Indent << OpInfo.Decoder << "(MI, Decoder);\n";
1130+
OS << Indent << "if (!Check(S, " << OpInfo.Decoder << "(MI, Decoder)))\n"
1131+
<< Indent << " return MCDisassembler::Fail;\n";
11311132
return;
11321133
}
11331134

0 commit comments

Comments
 (0)