From: Kazu Hirata Date: Sun, 28 Feb 2021 18:59:21 +0000 (-0800) Subject: [TableGen] Use ListSeparator (NFC) X-Git-Tag: llvmorg-14-init~13818 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=87360d6ff71a36704b4fa5ccab2dedd6e70f10e2;p=platform%2Fupstream%2Fllvm.git [TableGen] Use ListSeparator (NFC) --- diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp index b5a280b..1c03296 100644 --- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -1210,14 +1210,9 @@ bool FilterChooser::emitPredicateMatch(raw_ostream &o, unsigned &Indentation, if (IsOr) o << "("; - bool First = true; + ListSeparator LS(IsOr ? " || " : " && "); for (auto *Arg : D->getArgs()) { - if (!First) { - if (IsOr) - o << " || "; - else - o << " && "; - } + o << LS; if (auto *NotArg = dyn_cast(Arg)) { if (NotArg->getOperator()->getAsString() != "not" || NotArg->getNumArgs() != 1) @@ -1230,8 +1225,6 @@ bool FilterChooser::emitPredicateMatch(raw_ostream &o, unsigned &Indentation, PrintFatalError(Pred->getLoc(), "Invalid AssemblerCondDag!"); o << "Bits[" << Emitter->PredicateNamespace << "::" << Arg->getAsString() << "]"; - - First = false; } if (IsOr) diff --git a/llvm/utils/TableGen/SubtargetFeatureInfo.cpp b/llvm/utils/TableGen/SubtargetFeatureInfo.cpp index 105ed82..33a2277 100644 --- a/llvm/utils/TableGen/SubtargetFeatureInfo.cpp +++ b/llvm/utils/TableGen/SubtargetFeatureInfo.cpp @@ -130,14 +130,9 @@ void SubtargetFeatureInfo::emitComputeAssemblerAvailableFeatures( if (IsOr) OS << "("; - bool First = true; + ListSeparator LS(IsOr ? " || " : " && "); for (auto *Arg : D->getArgs()) { - if (!First) { - if (IsOr) - OS << " || "; - else - OS << " && "; - } + OS << LS; if (auto *NotArg = dyn_cast(Arg)) { if (NotArg->getOperator()->getAsString() != "not" || NotArg->getNumArgs() != 1) @@ -149,8 +144,6 @@ void SubtargetFeatureInfo::emitComputeAssemblerAvailableFeatures( !cast(Arg)->getDef()->isSubClassOf("SubtargetFeature")) PrintFatalError(SFI.TheDef->getLoc(), "Invalid AssemblerCondDag!"); OS << "FB[" << TargetName << "::" << Arg->getAsString() << "]"; - - First = false; } if (IsOr)