llvm.org GIT mirror llvm / 24e5cd2
[TableGen] Use llvm::transform to simplify some loops. NFCI git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328032 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 2 years ago
1 changed file(s) with 12 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
13701370 for (ArrayRef::iterator
13711371 I = LastTransitions.begin(), E = LastTransitions.end(); I != E; ++I) {
13721372 IdxVec OperWritesVariant;
1373 for (SmallVectorImpl>::const_iterator
1374 WSI = I->WriteSequences.begin(), WSE = I->WriteSequences.end();
1375 WSI != WSE; ++WSI) {
1376 // Create a new write representing the expanded sequence.
1377 OperWritesVariant.push_back(
1378 SchedModels.findOrInsertRW(*WSI, /*IsRead=*/false));
1379 }
1373 transform(I->WriteSequences, std::back_inserter(OperWritesVariant),
1374 [&SchedModels](ArrayRef WS) {
1375 return SchedModels.findOrInsertRW(WS, /*IsRead=*/false);
1376 });
13801377 IdxVec OperReadsVariant;
1381 for (SmallVectorImpl>::const_iterator
1382 RSI = I->ReadSequences.begin(), RSE = I->ReadSequences.end();
1383 RSI != RSE; ++RSI) {
1384 // Create a new read representing the expanded sequence.
1385 OperReadsVariant.push_back(
1386 SchedModels.findOrInsertRW(*RSI, /*IsRead=*/true));
1387 }
1378 transform(I->ReadSequences, std::back_inserter(OperReadsVariant),
1379 [&SchedModels](ArrayRef RS) {
1380 return SchedModels.findOrInsertRW(RS, /*IsRead=*/true);
1381 });
13881382 IdxVec ProcIndices(I->ProcIndices.begin(), I->ProcIndices.end());
13891383 CodeGenSchedTransition SCTrans;
13901384 SCTrans.ToClassIdx =
13931387 SCTrans.ProcIndices = ProcIndices;
13941388 // The final PredTerm is unique set of predicates guarding the transition.
13951389 RecVec Preds;
1396 for (SmallVectorImpl::const_iterator
1397 PI = I->PredTerm.begin(), PE = I->PredTerm.end(); PI != PE; ++PI) {
1398 Preds.push_back(PI->Predicate);
1399 }
1390 transform(I->PredTerm, std::back_inserter(Preds),
1391 [](const PredCheck &P) {
1392 return P.Predicate;
1393 });
14001394 Preds.erase(std::unique(Preds.begin(), Preds.end()), Preds.end());
14011395 SCTrans.PredTerm = Preds;
14021396 SchedModels.getSchedClass(FromClassIdx).Transitions.push_back(SCTrans);