Skip to content

Commit 05827e7

Browse files
committed
[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.
1 parent 3d83dbb commit 05827e7

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

llvm/utils/TableGen/DecoderEmitter.cpp

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,32 +1771,9 @@ void FilterChooser::doFilter() {
17711771
filterProcessor(BitAttrs, /*AllowMixed=*/true, /*Greedy=*/false))
17721772
return;
17731773

1774-
// If we come to here, the instruction decoding has failed.
1775-
assert(!BestFilter);
1776-
}
1777-
1778-
// emitTableEntries - Emit state machine entries to decode our share of
1779-
// instructions.
1780-
void FilterChooser::emitTableEntries(DecoderTableInfo &TableInfo) const {
1781-
if (Opcodes.size() == 1) {
1782-
// There is only one instruction in the set, which is great!
1783-
// Call emitSingletonDecoder() to see whether there are any remaining
1784-
// encodings bits.
1785-
emitSingletonTableEntry(TableInfo, Opcodes[0]);
1786-
return;
1787-
}
1788-
1789-
// Choose the best filter to do the decodings!
1790-
if (BestFilter) {
1791-
if (BestFilter->getNumFiltered() == 1)
1792-
emitSingletonTableEntry(TableInfo, *BestFilter);
1793-
else
1794-
BestFilter->emitTableEntry(TableInfo);
1795-
return;
1796-
}
1797-
17981774
// We don't know how to decode these instructions! Dump the
17991775
// conflict set and bail.
1776+
assert(!BestFilter);
18001777

18011778
// Print out useful conflict information for postmortem analysis.
18021779
errs() << "Decoding Conflict:\n";
@@ -1812,6 +1789,24 @@ void FilterChooser::emitTableEntries(DecoderTableInfo &TableInfo) const {
18121789
PrintFatalError("Decoding conflict encountered");
18131790
}
18141791

1792+
// emitTableEntries - Emit state machine entries to decode our share of
1793+
// instructions.
1794+
void FilterChooser::emitTableEntries(DecoderTableInfo &TableInfo) const {
1795+
if (Opcodes.size() == 1) {
1796+
// There is only one instruction in the set, which is great!
1797+
// Call emitSingletonDecoder() to see whether there are any remaining
1798+
// encodings bits.
1799+
emitSingletonTableEntry(TableInfo, Opcodes[0]);
1800+
return;
1801+
}
1802+
1803+
// Use the best filter to do the decoding!
1804+
if (BestFilter->getNumFiltered() == 1)
1805+
emitSingletonTableEntry(TableInfo, *BestFilter);
1806+
else
1807+
BestFilter->emitTableEntry(TableInfo);
1808+
}
1809+
18151810
static std::string findOperandDecoderMethod(const Record *Record) {
18161811
std::string Decoder;
18171812

0 commit comments

Comments
 (0)