From 2ca15ec5a619d3233089cc36e6b85a434155f948 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 28 Feb 2021 10:59:21 -0800 Subject: [PATCH] [TableGen] Use ListSeparator (NFC) --- utils/TableGen/FixedLenDecoderEmitter.cpp | 11 ++--------- utils/TableGen/SubtargetFeatureInfo.cpp | 11 ++--------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/utils/TableGen/FixedLenDecoderEmitter.cpp b/utils/TableGen/FixedLenDecoderEmitter.cpp index b5a280ba1a5..1c03296fe41 100644 --- a/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/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/utils/TableGen/SubtargetFeatureInfo.cpp b/utils/TableGen/SubtargetFeatureInfo.cpp index 105ed82c9d0..33a22776f2d 100644 --- a/utils/TableGen/SubtargetFeatureInfo.cpp +++ b/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)