[mips] Improve diagnostics for instruction mapping
This patch improves diagnostic for case when mapped instruction
does not contain a field listed under RowFields.
Differential Revision: https://reviews.llvm.org/D41778
llvm-svn: 322004
diff --git a/llvm/utils/TableGen/CodeGenMapTable.cpp b/llvm/utils/TableGen/CodeGenMapTable.cpp
index 43348b6..e5b0426 100644
--- a/llvm/utils/TableGen/CodeGenMapTable.cpp
+++ b/llvm/utils/TableGen/CodeGenMapTable.cpp
@@ -243,7 +243,12 @@
std::vector<Init*> KeyValue;
ListInit *RowFields = InstrMapDesc.getRowFields();
for (Init *RowField : RowFields->getValues()) {
- Init *CurInstrVal = CurInstr->getValue(RowField)->getValue();
+ RecordVal *RecVal = CurInstr->getValue(RowField);
+ if (RecVal == nullptr)
+ PrintFatalError(CurInstr->getLoc(), "No value " +
+ RowField->getAsString() + " found in \"" +
+ CurInstr->getName() + "\" instruction description.");
+ Init *CurInstrVal = RecVal->getValue();
KeyValue.push_back(CurInstrVal);
}