llvm.org GIT mirror llvm / 6227d5c
Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185606 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 6 years ago
29 changed file(s) with 66 addition(s) and 66 deletion(s). Raw diff Collapse all Expand all
150150
151151 uint32_t UnreachableWeight =
152152 std::max(UR_TAKEN_WEIGHT / (unsigned)UnreachableEdges.size(), MIN_WEIGHT);
153 for (SmallVector::iterator I = UnreachableEdges.begin(),
154 E = UnreachableEdges.end();
153 for (SmallVectorImpl::iterator I = UnreachableEdges.begin(),
154 E = UnreachableEdges.end();
155155 I != E; ++I)
156156 setEdgeWeight(BB, *I, UnreachableWeight);
157157
160160 uint32_t ReachableWeight =
161161 std::max(UR_NONTAKEN_WEIGHT / (unsigned)ReachableEdges.size(),
162162 NORMAL_WEIGHT);
163 for (SmallVector::iterator I = ReachableEdges.begin(),
164 E = ReachableEdges.end();
163 for (SmallVectorImpl::iterator I = ReachableEdges.begin(),
164 E = ReachableEdges.end();
165165 I != E; ++I)
166166 setEdgeWeight(BB, *I, ReachableWeight);
167167
250250
251251 uint32_t ColdWeight =
252252 std::max(CC_TAKEN_WEIGHT / (unsigned) ColdEdges.size(), MIN_WEIGHT);
253 for (SmallVector::iterator I = ColdEdges.begin(),
254 E = ColdEdges.end();
253 for (SmallVectorImpl::iterator I = ColdEdges.begin(),
254 E = ColdEdges.end();
255255 I != E; ++I)
256256 setEdgeWeight(BB, *I, ColdWeight);
257257
259259 return true;
260260 uint32_t NormalWeight = std::max(
261261 CC_NONTAKEN_WEIGHT / (unsigned) NormalEdges.size(), NORMAL_WEIGHT);
262 for (SmallVector::iterator I = NormalEdges.begin(),
263 E = NormalEdges.end();
262 for (SmallVectorImpl::iterator I = NormalEdges.begin(),
263 E = NormalEdges.end();
264264 I != E; ++I)
265265 setEdgeWeight(BB, *I, NormalWeight);
266266
325325 if (backWeight < NORMAL_WEIGHT)
326326 backWeight = NORMAL_WEIGHT;
327327
328 for (SmallVector>::iterator EI = BackEdges.begin(),
328 for (SmallVectorImpl>::iterator EI = BackEdges.begin(),
329329 EE = BackEdges.end(); EI != EE; ++EI) {
330330 setEdgeWeight(BB, *EI, backWeight);
331331 }
336336 if (inWeight < NORMAL_WEIGHT)
337337 inWeight = NORMAL_WEIGHT;
338338
339 for (SmallVector>::iterator EI = InEdges.begin(),
339 for (SmallVectorImpl>::iterator EI = InEdges.begin(),
340340 EE = InEdges.end(); EI != EE; ++EI) {
341341 setEdgeWeight(BB, *EI, inWeight);
342342 }
347347 if (exitWeight < MIN_WEIGHT)
348348 exitWeight = MIN_WEIGHT;
349349
350 for (SmallVector>::iterator EI = ExitingEdges.begin(),
350 for (SmallVectorImpl>::iterator EI = ExitingEdges.begin(),
351351 EE = ExitingEdges.end(); EI != EE; ++EI) {
352352 setEdgeWeight(BB, *EI, exitWeight);
353353 }
420420 if (I->second == getValPtr())
421421 ToErase.push_back(*I);
422422 }
423
424 for (SmallVector::iterator I = ToErase.begin(),
423
424 for (SmallVectorImpl::iterator I = ToErase.begin(),
425425 E = ToErase.end(); I != E; ++I)
426426 Parent->OverDefinedCache.erase(*I);
427427
443443 if (I->first == BB)
444444 ToErase.push_back(*I);
445445 }
446
447 for (SmallVector::iterator I = ToErase.begin(),
446
447 for (SmallVectorImpl::iterator I = ToErase.begin(),
448448 E = ToErase.end(); I != E; ++I)
449449 OverDefinedCache.erase(*I);
450450
180180 double incoming = BBWeight;
181181 // Subtract the flow leaving the loop.
182182 std::set ProcessedExits;
183 for (SmallVector>::iterator ei = ExitEdges.begin(),
183 for (SmallVectorImpl>::iterator ei = ExitEdges.begin(),
184184 ee = ExitEdges.end(); ei != ee; ++ei) {
185185 if (ProcessedExits.insert(*ei).second) {
186186 double w = getEdgeWeight(*ei);
215215 // be distributed is split and the rounded, the last edge gets a somewhat
216216 // bigger value, but we are close enough for an estimation.
217217 double fraction = floor(incoming/Edges.size());
218 for (SmallVector>::iterator ei = Edges.begin(), ee = Edges.end();
218 for (SmallVectorImpl>::iterator ei = Edges.begin(), ee = Edges.end();
219219 ei != ee; ++ei) {
220220 double w = 0;
221221 if (ei != (ee-1)) {
288288 double fraction = Edges.size() ? floor(BBWeight/Edges.size()) : 0.0;
289289 // Finally we know what flow is still not leaving the block, distribute this
290290 // flow onto the empty edges.
291 for (SmallVector>::iterator ei = Edges.begin(), ee = Edges.end();
291 for (SmallVectorImpl>::iterator ei = Edges.begin(), ee = Edges.end();
292292 ei != ee; ++ei) {
293293 if (ei != (ee-1)) {
294294 EdgeInformation[BB->getParent()][*ei] += fraction;
117117 }
118118
119119 bool ExecutionEngine::removeModule(Module *M) {
120 for(SmallVector>::iterator I = Modules.begin(),
120 for(SmallVectorImpl>::iterator I = Modules.begin(),
121121 E = Modules.end(); I != E; ++I) {
122122 Module *Found = *I;
123123 if (Found == M) {
479479 addrSpaces.push_back(pib->first);
480480 }
481481 std::sort(addrSpaces.begin(), addrSpaces.end());
482 for (SmallVector>::iterator asb = addrSpaces.begin(),
482 for (SmallVectorImpl>::iterator asb = addrSpaces.begin(),
483483 ase = addrSpaces.end(); asb != ase; ++asb) {
484484 const PointerAlignElem &PI = Pointers.find(*asb)->second;
485485 OS << "-p";
6262
6363 /// dump - Dump GCOVFile content on standard out for debugging purposes.
6464 void GCOVFile::dump() {
65 for (SmallVector>::iterator I = Functions.begin(),
65 for (SmallVectorImpl>::iterator I = Functions.begin(),
6666 E = Functions.end(); I != E; ++I)
6767 (*I)->dump();
6868 }
7070 /// collectLineCounts - Collect line counts. This must be used after
7171 /// reading .gcno and .gcda files.
7272 void GCOVFile::collectLineCounts(FileInfo &FI) {
73 for (SmallVector>::iterator I = Functions.begin(),
73 for (SmallVectorImpl>::iterator I = Functions.begin(),
7474 E = Functions.end(); I != E; ++I)
7575 (*I)->collectLineCounts(FI);
7676 FI.print();
154154 /// dump - Dump GCOVFunction content on standard out for debugging purposes.
155155 void GCOVFunction::dump() {
156156 outs() << "===== " << Name << " @ " << Filename << ":" << LineNumber << "\n";
157 for (SmallVector>::iterator I = Blocks.begin(),
157 for (SmallVectorImpl>::iterator I = Blocks.begin(),
158158 E = Blocks.end(); I != E; ++I)
159159 (*I)->dump();
160160 }
162162 /// collectLineCounts - Collect line counts. This must be used after
163163 /// reading .gcno and .gcda files.
164164 void GCOVFunction::collectLineCounts(FileInfo &FI) {
165 for (SmallVector>::iterator I = Blocks.begin(),
165 for (SmallVectorImpl>::iterator I = Blocks.begin(),
166166 E = Blocks.end(); I != E; ++I)
167167 (*I)->collectLineCounts(FI);
168168 }
196196 outs() << "Block : " << Number << " Counter : " << Counter << "\n";
197197 if (!Edges.empty()) {
198198 outs() << "\tEdges : ";
199 for (SmallVector>::iterator I = Edges.begin(), E = Edges.end();
199 for (SmallVectorImpl>::iterator I = Edges.begin(), E = Edges.end();
200200 I != E; ++I)
201201 outs() << (*I) << ",";
202202 outs() << "\n";
219219 /// reading .gcno and .gcda files.
220220 void GCOVLines::collectLineCounts(FileInfo &FI, StringRef Filename,
221221 uint32_t Count) {
222 for (SmallVector>::iterator I = Lines.begin(),
222 for (SmallVectorImpl>::iterator I = Lines.begin(),
223223 E = Lines.end(); I != E; ++I)
224224 FI.addLineCount(Filename, *I, Count);
225225 }
226226
227227 /// dump - Dump GCOVLines content on standard out for debugging purposes.
228228 void GCOVLines::dump() {
229 for (SmallVector>::iterator I = Lines.begin(),
229 for (SmallVectorImpl>::iterator I = Lines.begin(),
230230 E = Lines.end(); I != E; ++I)
231231 outs() << (*I) << ",";
232232 }
321321 }
322322
323323 bool Input::MapHNode::isValidKey(StringRef Key) {
324 for (SmallVector>::iterator i = ValidKeys.begin(),
324 for (SmallVectorImpl>::iterator i = ValidKeys.begin(),
325325 End = ValidKeys.end(); i != End; ++i) {
326326 if (Key.equals(*i))
327327 return true;
14831483 unsigned &PredReg, ARMCC::CondCodes &Pred,
14841484 bool &isT2);
14851485 bool RescheduleOps(MachineBasicBlock *MBB,
1486 SmallVector> &Ops,
1486 SmallVectorImpl> &Ops,
14871487 unsigned Base, bool isLd,
14881488 DenseMap &MI2LocMap);
14891489 bool RescheduleLoadStoreInstrs(MachineBasicBlock *MBB);
16551655 }
16561656
16571657 bool ARMPreAllocLoadStoreOpt::RescheduleOps(MachineBasicBlock *MBB,
1658 SmallVector> &Ops,
1658 SmallVectorImpl> &Ops,
16591659 unsigned Base, bool isLd,
16601660 DenseMap &MI2LocMap) {
16611661 bool RetVal = false;
18931893 // Re-schedule loads.
18941894 for (unsigned i = 0, e = LdBases.size(); i != e; ++i) {
18951895 unsigned Base = LdBases[i];
1896 SmallVector> &Lds = Base2LdsMap[Base];
1896 SmallVectorImpl> &Lds = Base2LdsMap[Base];
18971897 if (Lds.size() > 1)
18981898 RetVal |= RescheduleOps(MBB, Lds, Base, true, MI2LocMap);
18991899 }
19011901 // Re-schedule stores.
19021902 for (unsigned i = 0, e = StBases.size(); i != e; ++i) {
19031903 unsigned Base = StBases[i];
1904 SmallVector> &Sts = Base2StsMap[Base];
1904 SmallVectorImpl> &Sts = Base2StsMap[Base];
19051905 if (Sts.size() > 1)
19061906 RetVal |= RescheduleOps(MBB, Sts, Base, false, MI2LocMap);
19071907 }
4141 SmallVector, 16> &FR) {
4242 MachineFrameInfo *MFI = MF.getFrameInfo();
4343 MBlazeFunctionInfo *MBlazeFI = MF.getInfo();
44 const SmallVector, 16>::iterator FRB = FR.begin();
45 const SmallVector, 16>::iterator FRE = FR.end();
46
47 SmallVector, 16>::iterator FRI = FRB;
44 const SmallVectorImpl>::iterator FRB = FR.begin();
45 const SmallVectorImpl>::iterator FRE = FR.end();
46
47 SmallVectorImpl>::iterator FRI = FRB;
4848 for (; FRI != FRE; ++FRI) {
4949 MFI->RemoveStackObject(FRI->first);
5050 int NFI = MFI->CreateFixedObject(4, FRI->second, true);
9090
9191 MachineRegisterInfo::livein_iterator LII = MRI.livein_begin();
9292 MachineRegisterInfo::livein_iterator LIE = MRI.livein_end();
93 const SmallVector> &LiveInFI = MBlazeFI->getLiveIn();
93 const SmallVectorImpl> &LiveInFI = MBlazeFI->getLiveIn();
9494 SmallVector EraseInstr;
9595 SmallVector, 16> FrameRelocate;
9696
419419 MF = &F;
420420 initMBBInfo();
421421
422 SmallVector>::iterator I, E = MBBInfos.end();
422 SmallVectorImpl>::iterator I, E = MBBInfos.end();
423423 bool EverMadeChange = false, MadeChange = true;
424424
425425 while (MadeChange) {
2828 public:
2929 ManagedStringPool() {}
3030 ~ManagedStringPool() {
31 SmallVector>::iterator Current = Pool.begin();
31 SmallVectorImpl>::iterator Current = Pool.begin();
3232 while (Current != Pool.end()) {
3333 delete *Current;
3434 Current++;
383383
384384 // Replace the old operands with the new operands.
385385 N->dropAllReferences();
386 for (SmallVector>::iterator I = NewOperands.begin(),
386 for (SmallVectorImpl>::iterator I = NewOperands.begin(),
387387 E = NewOperands.end();
388388 I != E; ++I) {
389389 N->addOperand(*I);
401401 BasicBlock *CountedExitBlock = 0;
402402 const SCEV *ExitCount = 0;
403403 BranchInst *CountedExitBranch = 0;
404 for (SmallVector>::iterator I = ExitingBlocks.begin(),
404 for (SmallVectorImpl>::iterator I = ExitingBlocks.begin(),
405405 IE = ExitingBlocks.end(); I != IE; ++I) {
406406 const SCEV *EC = SE->getExitCount(L, *I);
407407 DEBUG(dbgs() << "Exit Count for " << *L << " from block " <<
309309 // Return true if, under current assumptions, any terminator needs
310310 // to be relaxed.
311311 bool SystemZLongBranch::mustRelaxABranch() {
312 for (SmallVector>::iterator TI = Terminators.begin(),
312 for (SmallVectorImpl>::iterator TI = Terminators.begin(),
313313 TE = Terminators.end(); TI != TE; ++TI)
314314 if (mustRelaxBranch(*TI, TI->Address))
315315 return true;
321321 void SystemZLongBranch::setWorstCaseAddresses() {
322322 SmallVector::iterator TI = Terminators.begin();
323323 BlockPosition Position(MF->getAlignment());
324 for (SmallVector>::iterator BI = MBBs.begin(), BE = MBBs.end();
324 for (SmallVectorImpl>::iterator BI = MBBs.begin(), BE = MBBs.end();
325325 BI != BE; ++BI) {
326326 skipNonTerminators(Position, *BI);
327327 for (unsigned BTI = 0, BTE = BI->NumTerminators; BTI != BTE; ++BTI) {
385385 void SystemZLongBranch::relaxBranches() {
386386 SmallVector::iterator TI = Terminators.begin();
387387 BlockPosition Position(MF->getAlignment());
388 for (SmallVector>::iterator BI = MBBs.begin(), BE = MBBs.end();
388 for (SmallVectorImpl>::iterator BI = MBBs.begin(), BE = MBBs.end();
389389 BI != BE; ++BI) {
390390 skipNonTerminators(Position, *BI);
391391 for (unsigned BTI = 0, BTE = BI->NumTerminators; BTI != BTE; ++BTI) {
353353 NMD->eraseFromParent();
354354 NMD = NULL;
355355
356 for (SmallVector>::iterator I = MDs.begin(),
356 for (SmallVectorImpl>::iterator I = MDs.begin(),
357357 E = MDs.end(); I != E; ++I) {
358358 GlobalVariable *GV = DIGlobalVariable(*I).getGlobal();
359359 if (GV && M.getGlobalVariable(GV->getName(), true)) {
380380 NMD->eraseFromParent();
381381 NMD = NULL;
382382
383 for (SmallVector>::iterator I = MDs.begin(),
383 for (SmallVectorImpl>::iterator I = MDs.begin(),
384384 E = MDs.end(); I != E; ++I) {
385385 bool FnIsLive = false;
386386 if (Function *F = DISubprogram(*I).getFunction())
20412041 continue;
20422042 // If Filter is a subset of LFilter, i.e. every element of Filter is also
20432043 // an element of LFilter, then discard LFilter.
2044 SmallVector>::iterator J = NewClauses.begin() + j;
2044 SmallVectorImpl>::iterator J = NewClauses.begin() + j;
20452045 // If Filter is empty then it is a subset of LFilter.
20462046 if (!FElts) {
20472047 // Discard LFilter.
4242 SmallVector Lines;
4343 SplitString(File.take()->getBuffer(), Lines, "\n\r");
4444 StringMap Regexps;
45 for (SmallVector>::iterator I = Lines.begin(), E = Lines.end();
45 for (SmallVectorImpl>::iterator I = Lines.begin(), E = Lines.end();
4646 I != E; ++I) {
4747 // Ignore empty lines and lines starting with "#"
4848 if (I->empty() || I->startswith("#"))
270270
271271 StringKeySort Sorter;
272272 std::sort(SortedLinesByFile.begin(), SortedLinesByFile.end(), Sorter);
273 for (SmallVector *, 32>::iterator
273 for (SmallVectorImpl *>::iterator
274274 I = SortedLinesByFile.begin(), E = SortedLinesByFile.end();
275275 I != E; ++I)
276276 (*I)->getValue()->writeOut();
8282 I->dropAllReferences();
8383 }
8484
85 for (SmallVector>::iterator I = worklist.begin(),
85 for (SmallVectorImpl>::iterator I = worklist.begin(),
8686 E = worklist.end(); I != E; ++I) {
8787 ++NumRemoved;
8888 (*I)->eraseFromParent();
15541554 return false;
15551555
15561556 // Split critical edges, and update the unavailable predecessors accordingly.
1557 for (SmallVector::iterator I = CriticalEdgePred.begin(),
1557 for (SmallVectorImpl::iterator I = CriticalEdgePred.begin(),
15581558 E = CriticalEdgePred.end(); I != E; I++) {
15591559 BasicBlock *OrigPred = *I;
15601560 BasicBlock *NewPred = splitCriticalEdges(OrigPred, LoadBB);
23512351 if (!AtStart)
23522352 --BI;
23532353
2354 for (SmallVector>::iterator I = InstrsToErase.begin(),
2354 for (SmallVectorImpl>::iterator I = InstrsToErase.begin(),
23552355 E = InstrsToErase.end(); I != E; ++I) {
23562356 DEBUG(dbgs() << "GVN removed: " << **I << '\n');
23572357 if (MD) MD->removeInstruction(*I);
208208 // Move all of the block's children to be children of the preheader, which
209209 // allows us to remove the domtree entry for the block.
210210 ChildNodes.insert(ChildNodes.begin(), DT[*LI]->begin(), DT[*LI]->end());
211 for (SmallVector>::iterator DI = ChildNodes.begin(),
211 for (SmallVectorImpl>::iterator DI = ChildNodes.begin(),
212212 DE = ChildNodes.end(); DI != DE; ++DI) {
213213 DT.changeImmediateDominator(*DI, DT[preheader]);
214214 }
169169 if (DomTreeNode *DTN = DT->getNode(BB)) {
170170 DomTreeNode *PredDTN = DT->getNode(PredBB);
171171 SmallVector Children(DTN->begin(), DTN->end());
172 for (SmallVector>::iterator DI = Children.begin(),
172 for (SmallVectorImpl>::iterator DI = Children.begin(),
173173 DE = Children.end(); DI != DE; ++DI)
174174 DT->changeImmediateDominator(*DI, PredDTN);
175175
276276
277277 DomTreeNode *NewNode = DT->addNewBlock(New, *I);
278278
279 for (SmallVector::iterator I = Children.begin(),
280 E = Children.end(); I != E; ++I)
279 for (SmallVectorImpl::iterator I = Children.begin(),
280 E = Children.end(); I != E; ++I)
281281 DT->changeImmediateDominator(*I, NewNode);
282282 }
283283 }
924924 if (Dbgs.empty())
925925 return false;
926926
927 for (SmallVector>::iterator I = Dbgs.begin(),
927 for (SmallVectorImpl>::iterator I = Dbgs.begin(),
928928 E = Dbgs.end(); I != E; ++I) {
929929 DbgDeclareInst *DDI = *I;
930930 if (AllocaInst *AI = dyn_cast_or_null(DDI->getAddress())) {
646646 // them from the Preds list.
647647 for (unsigned i = 0, e = SomePHI->getNumIncomingValues(); i != e; ++i) {
648648 // Do a log(n) search of the Preds list for the entry we want.
649 SmallVector>::iterator EntIt =
649 SmallVectorImpl>::iterator EntIt =
650650 std::lower_bound(Preds.begin(), Preds.end(),
651651 SomePHI->getIncomingBlock(i));
652652 assert(EntIt != Preds.end() && *EntIt == SomePHI->getIncomingBlock(i)&&
16011601 DenseSet CurrentPairs;
16021602
16031603 bool CanAdd = true;
1604 for (SmallVector>::iterator C2
1604 for (SmallVectorImpl>::iterator C2
16051605 = BestChildren.begin(), E2 = BestChildren.end();
16061606 C2 != E2; ++C2) {
16071607 if (C2->first.first == C->first.first ||
16411641 if (!CanAdd) continue;
16421642
16431643 // And check the queue too...
1644 for (SmallVector>::iterator C2 = Q.begin(),
1644 for (SmallVectorImpl>::iterator C2 = Q.begin(),
16451645 E2 = Q.end(); C2 != E2; ++C2) {
16461646 if (C2->first.first == C->first.first ||
16471647 C2->first.first == C->first.second ||
16901690 // to an already-selected child. Check for this here, and if a
16911691 // conflict is found, then remove the previously-selected child
16921692 // before adding this one in its place.
1693 for (SmallVector>::iterator C2
1693 for (SmallVectorImpl>::iterator C2
16941694 = BestChildren.begin(); C2 != BestChildren.end();) {
16951695 if (C2->first.first == C->first.first ||
16961696 C2->first.first == C->first.second ||
17051705 BestChildren.push_back(ValuePairWithDepth(C->first, C->second));
17061706 }
17071707
1708 for (SmallVector>::iterator C
1708 for (SmallVectorImpl>::iterator C
17091709 = BestChildren.begin(), E2 = BestChildren.end();
17101710 C != E2; ++C) {
17111711 size_t DepthF = getDepthFactor(C->first.first);
14431443 }
14441444
14451445 // Erase all of the instructions that we RAUWed.
1446 for (SmallVector>::iterator v = ToRemove.begin(),
1446 for (SmallVectorImpl>::iterator v = ToRemove.begin(),
14471447 ve = ToRemove.end(); v != ve; ++v) {
14481448 assert((*v)->getNumUses() == 0 && "Can't remove instructions with uses");
14491449 (*v)->eraseFromParent();
2727
2828 virtual ~TestObjectCache() {
2929 // Free any buffers we've allocated.
30 SmallVector>::iterator it, end;
30 SmallVectorImpl>::iterator it, end;
3131 end = AllocatedBuffers.end();
3232 for (it = AllocatedBuffers.begin(); it != end; ++it) {
3333 delete *it;
437437
438438 int OtherIntSize = 0;
439439 int OtherFPSize = 0;
440 for (SmallVector>::iterator TVI =
440 for (SmallVectorImpl>::iterator TVI =
441441 Other.TypeVec.begin();
442442 TVI != Other.TypeVec.end();
443443 /* NULL */) {
495495
496496 int IntSize = 0;
497497 int FPSize = 0;
498 for (SmallVector>::iterator TVI =
498 for (SmallVectorImpl>::iterator TVI =
499499 TypeVec.begin();
500500 TVI != TypeVec.end();
501501 /* NULL */) {