[llvm] c72bd38 - [NFC][DecoderEmitter] Remove unused `emitPredicateMatchAux` (#158771)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 22:00:38 PDT 2025
Author: Rahul Joshi
Date: 2025-09-15T22:00:34-07:00
New Revision: c72bd381fca75b3284fd7a45eb125c3c3181b9bb
URL: https://github.com/llvm/llvm-project/commit/c72bd381fca75b3284fd7a45eb125c3c3181b9bb
DIFF: https://github.com/llvm/llvm-project/commit/c72bd381fca75b3284fd7a45eb125c3c3181b9bb.diff
LOG: [NFC][DecoderEmitter] Remove unused `emitPredicateMatchAux` (#158771)
Added:
Modified:
llvm/utils/TableGen/DecoderEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index 97a6b58e1bd99..a54e6d05dd60e 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -515,9 +515,6 @@ class DecoderTableBuilder {
unsigned getPredicateIndex(StringRef P) const;
- bool emitPredicateMatchAux(const Init &Val, bool ParenIfBinOp,
- raw_ostream &OS) const;
-
bool emitPredicateMatch(raw_ostream &OS, unsigned EncodingID) const;
void emitPredicateTableEntry(unsigned EncodingID) const;
@@ -1099,40 +1096,6 @@ unsigned DecoderTableBuilder::getDecoderIndex(unsigned EncodingID) const {
return std::distance(Decoders.begin(), P);
}
-// If ParenIfBinOp is true, print a surrounding () if Val uses && or ||.
-bool DecoderTableBuilder::emitPredicateMatchAux(const Init &Val,
- bool ParenIfBinOp,
- raw_ostream &OS) const {
- if (const auto *D = dyn_cast<DefInit>(&Val)) {
- if (!D->getDef()->isSubClassOf("SubtargetFeature"))
- return true;
- OS << "Bits[" << Target.getName() << "::" << D->getAsString() << "]";
- return false;
- }
- if (const auto *D = dyn_cast<DagInit>(&Val)) {
- std::string Op = D->getOperator()->getAsString();
- if (Op == "not" && D->getNumArgs() == 1) {
- OS << '!';
- return emitPredicateMatchAux(*D->getArg(0), true, OS);
- }
- if ((Op == "any_of" || Op == "all_of") && D->getNumArgs() > 0) {
- bool Paren = D->getNumArgs() > 1 && std::exchange(ParenIfBinOp, true);
- if (Paren)
- OS << '(';
- ListSeparator LS(Op == "any_of" ? " || " : " && ");
- for (auto *Arg : D->getArgs()) {
- OS << LS;
- if (emitPredicateMatchAux(*Arg, ParenIfBinOp, OS))
- return true;
- }
- if (Paren)
- OS << ')';
- return false;
- }
- }
- return true;
-}
-
// Returns true if there was any predicate emitted.
bool DecoderTableBuilder::emitPredicateMatch(raw_ostream &OS,
unsigned EncodingID) const {
More information about the llvm-commits
mailing list