aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/DecoderEmitter.cpp
diff options
context:
space:
mode:
authorSergei Barannikov <barannikov88@gmail.com>2025-08-17 08:20:31 +0300
committerSergei Barannikov <barannikov88@gmail.com>2025-08-17 08:20:31 +0300
commit05827e7ccb4e1295648e38b11ebdbb8fd817177b (patch)
treefd738b9a80b85ee70710ed435051f6953b68e699 /llvm/utils/TableGen/DecoderEmitter.cpp
parent3d83dbb73610c6cfb1b67252bd2d519a0aa5e308 (diff)
downloadllvm-05827e7ccb4e1295648e38b11ebdbb8fd817177b.zip
llvm-05827e7ccb4e1295648e38b11ebdbb8fd817177b.tar.gz
llvm-05827e7ccb4e1295648e38b11ebdbb8fd817177b.tar.bz2
[TableGen][DecoderEmitter] Dump conflicts earlier
Dump a conflict as soon as we discover it, no need to wait until we start building the decoder table. This improves debugging experience.
Diffstat (limited to 'llvm/utils/TableGen/DecoderEmitter.cpp')
-rw-r--r--llvm/utils/TableGen/DecoderEmitter.cpp43
1 files changed, 19 insertions, 24 deletions
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index daa3062..7803509 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -1771,32 +1771,9 @@ void FilterChooser::doFilter() {
filterProcessor(BitAttrs, /*AllowMixed=*/true, /*Greedy=*/false))
return;
- // If we come to here, the instruction decoding has failed.
- assert(!BestFilter);
-}
-
-// emitTableEntries - Emit state machine entries to decode our share of
-// instructions.
-void FilterChooser::emitTableEntries(DecoderTableInfo &TableInfo) const {
- if (Opcodes.size() == 1) {
- // There is only one instruction in the set, which is great!
- // Call emitSingletonDecoder() to see whether there are any remaining
- // encodings bits.
- emitSingletonTableEntry(TableInfo, Opcodes[0]);
- return;
- }
-
- // Choose the best filter to do the decodings!
- if (BestFilter) {
- if (BestFilter->getNumFiltered() == 1)
- emitSingletonTableEntry(TableInfo, *BestFilter);
- else
- BestFilter->emitTableEntry(TableInfo);
- return;
- }
-
// We don't know how to decode these instructions! Dump the
// conflict set and bail.
+ assert(!BestFilter);
// Print out useful conflict information for postmortem analysis.
errs() << "Decoding Conflict:\n";
@@ -1812,6 +1789,24 @@ void FilterChooser::emitTableEntries(DecoderTableInfo &TableInfo) const {
PrintFatalError("Decoding conflict encountered");
}
+// emitTableEntries - Emit state machine entries to decode our share of
+// instructions.
+void FilterChooser::emitTableEntries(DecoderTableInfo &TableInfo) const {
+ if (Opcodes.size() == 1) {
+ // There is only one instruction in the set, which is great!
+ // Call emitSingletonDecoder() to see whether there are any remaining
+ // encodings bits.
+ emitSingletonTableEntry(TableInfo, Opcodes[0]);
+ return;
+ }
+
+ // Use the best filter to do the decoding!
+ if (BestFilter->getNumFiltered() == 1)
+ emitSingletonTableEntry(TableInfo, *BestFilter);
+ else
+ BestFilter->emitTableEntry(TableInfo);
+}
+
static std::string findOperandDecoderMethod(const Record *Record) {
std::string Decoder;