[llvm] [NFC][DecoderEmitter] Remove unused emitPredicateMatchAux (PR #158771)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 20:47:36 PDT 2025
https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/158771
None
>From dcf73e2bc1fcf7973a9045c94b41c11e91965ad5 Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Mon, 15 Sep 2025 20:46:55 -0700
Subject: [PATCH] [NFC][DecoderEmitter] Remove unused emitPredicateMatchAux
---
llvm/utils/TableGen/DecoderEmitter.cpp | 37 --------------------------
1 file changed, 37 deletions(-)
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