When an instruction has an encoding definition for only a subset of
the available HwModes, ensure we just avoid generating an encoding
rather than crash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374150
91177308-0d34-0410-b5e6-
96231b3b80d8
let Inst{1-0} = 0b10;
let AsmString = "bar $factor";
}
+
+def baz : Instruction {
+ let InOperandList = (ins i32imm:$factor);
+ bits<32> Inst;
+ let EncodingInfos = EncodingByHwMode<
+ [ModeB], [fooTypeEncA]
+ >;
+ let AsmString = "foo $factor";
+}
}
// DECODER-LABEL: DecoderTable_ModeA32[] =
if (const RecordVal *RV = R->getValue("EncodingInfos")) {
if (auto *DI = dyn_cast_or_null<DefInit>(RV->getValue())) {
EncodingInfoByHwMode EBM(DI->getDef(), HWM);
- EncodingDef = EBM.get(HwMode);
+ if (EBM.hasMode(HwMode))
+ EncodingDef = EBM.get(HwMode);
}
}
BitsInit *BI = EncodingDef->getValueAsBitsInit("Inst");