1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

[Tablegen] Use llvm::find_if (NFC)

This commit is contained in:
Kazu Hirata 2021-01-08 18:39:55 -08:00
parent ea45e4cb34
commit 3da3875591
4 changed files with 18 additions and 20 deletions

View File

@ -3701,10 +3701,11 @@ void CodeGenDAGPatterns::parseInstructionPattern(
for (unsigned i = 0; i != NumResults; ++i) {
if (i == CGI.Operands.size()) {
const std::string &OpName =
std::find_if(InstResults.begin(), InstResults.end(),
[](const std::pair<std::string, TreePatternNodePtr> &P) {
return P.second;
})
llvm::find_if(
InstResults,
[](const std::pair<std::string, TreePatternNodePtr> &P) {
return P.second;
})
->first;
I.error("'" + OpName + "' set but does not appear in operand list!");

View File

@ -273,9 +273,8 @@ void GenerateGetKind(const std::vector<Record *> &Records, raw_ostream &OS,
StringRef Enum, const DirectiveLanguage &DirLang,
StringRef Prefix, bool ImplicitAsUnknown) {
auto DefaultIt = std::find_if(Records.begin(), Records.end(), [](Record *R) {
return R->getValueAsBit("isDefault") == true;
});
auto DefaultIt = llvm::find_if(
Records, [](Record *R) { return R->getValueAsBit("isDefault") == true; });
if (DefaultIt == Records.end()) {
PrintError("At least one " + Enum + " must be defined as default.");
@ -312,10 +311,9 @@ void GenerateGetKindClauseVal(const DirectiveLanguage &DirLang,
if (ClauseVals.size() <= 0)
continue;
auto DefaultIt =
std::find_if(ClauseVals.begin(), ClauseVals.end(), [](Record *CV) {
return CV->getValueAsBit("isDefault") == true;
});
auto DefaultIt = llvm::find_if(ClauseVals, [](Record *CV) {
return CV->getValueAsBit("isDefault") == true;
});
if (DefaultIt == ClauseVals.end()) {
PrintError("At least one val in Clause " + C.getFormattedName() +

View File

@ -266,11 +266,10 @@ void GIMatchTreeBuilder::runStep() {
LLVM_DEBUG(dbgs() << "Leaf contains multiple rules, drop after the first "
"fully tested rule\n");
auto FirstFullyTested =
std::find_if(Leaves.begin(), Leaves.end(),
[](const GIMatchTreeBuilderLeafInfo &X) {
return X.isFullyTraversed() && X.isFullyTested() &&
!X.getMatchDag().hasPostMatchPredicate();
});
llvm::find_if(Leaves, [](const GIMatchTreeBuilderLeafInfo &X) {
return X.isFullyTraversed() && X.isFullyTested() &&
!X.getMatchDag().hasPostMatchPredicate();
});
if (FirstFullyTested != Leaves.end())
FirstFullyTested++;

View File

@ -2249,10 +2249,10 @@ public:
}
OperandMatcher &getOperand(unsigned OpIdx) {
auto I = std::find_if(Operands.begin(), Operands.end(),
[&OpIdx](const std::unique_ptr<OperandMatcher> &X) {
return X->getOpIdx() == OpIdx;
});
auto I = llvm::find_if(Operands,
[&OpIdx](const std::unique_ptr<OperandMatcher> &X) {
return X->getOpIdx() == OpIdx;
});
if (I != Operands.end())
return **I;
llvm_unreachable("Failed to lookup operand");