AMDGPU: AsmParser boilerplate for missing features
The management of subtarget dependent assembler errors
is currently ignoring the reported issues from MatchInstructionImpl.
Move code around to try making use of it.
diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index fc46f2b..522aae0 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -1391,6 +1391,7 @@
#define GET_ASSEMBLER_HEADER
#include "AMDGPUGenAsmMatcher.inc"
+#undef GET_ASSEMBLER_HEADER
/// }
@@ -2023,6 +2024,12 @@
ParseStatus parseVOPD(OperandVector &Operands);
};
+// TODO: define GET_SUBTARGET_FEATURE_NAME
+#define GET_REGISTER_MATCHER
+#include "AMDGPUGenAsmMatcher.inc"
+#undef GET_REGISTER_MATCHER
+#undef GET_SUBTARGET_FEATURE_NAME
+
} // end anonymous namespace
// May be called with integer type with equivalent bitwidth.
@@ -5838,10 +5845,14 @@
MCInst Inst;
Inst.setLoc(IDLoc);
unsigned Result = Match_Success;
+ FeatureBitset MissingFeatures;
+
for (auto Variant : getMatchedVariants()) {
uint64_t EI;
- auto R = MatchInstructionImpl(Operands, Inst, EI, MatchingInlineAsm,
- Variant);
+ auto R = MatchInstructionImpl(Operands, Inst, EI, MissingFeatures,
+ MatchingInlineAsm, Variant);
+
+ // TODO: Emit diagnostic from MissingFeatures.
// We order match statuses from least to most specific. We use most specific
// status as resulting
// Match_MnemonicFail < Match_InvalidOperand < Match_MissingFeature
@@ -10497,7 +10508,6 @@
RegisterMCAsmParser<AMDGPUAsmParser> B(getTheGCNTarget());
}
-#define GET_REGISTER_MATCHER
#define GET_MATCHER_IMPLEMENTATION
#define GET_MNEMONIC_SPELL_CHECKER
#define GET_MNEMONIC_CHECKER