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(&Val)) { - if (!D->getDef()->isSubClassOf("SubtargetFeature")) - return true; - OS << "Bits[" << Target.getName() << "::" << D->getAsString() << "]"; - return false; - } - if (const auto *D = dyn_cast(&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 {