1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[TableGen] Fix crash when using HwModes in CodeEmitterGen

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.

llvm-svn: 374150
This commit is contained in:
James Molloy 2019-10-09 09:15:34 +00:00
parent 9a982602b3
commit b8dff35c25
2 changed files with 11 additions and 1 deletions

View File

@ -56,6 +56,15 @@ def bar: Instruction {
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[] =

View File

@ -367,7 +367,8 @@ void CodeEmitterGen::emitInstructionBaseValues(
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");