Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: src/IceRegAlloc.cpp

Issue 819403002: Subzero: Use range-based for loops with llvm::ilist<Inst> lists. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceOperand.cpp ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceRegAlloc.cpp
diff --git a/src/IceRegAlloc.cpp b/src/IceRegAlloc.cpp
index d2bc8fb7a822c09534ba83b21019c4c8edd1a511..d65b3b6737a7486088405772f9df81116dc02485 100644
--- a/src/IceRegAlloc.cpp
+++ b/src/IceRegAlloc.cpp
@@ -109,11 +109,10 @@ void LinearScan::initForGlobal() {
// Build the (ordered) list of FakeKill instruction numbers.
Kills.clear();
for (CfgNode *Node : Func->getNodes()) {
- for (auto I = Node->getInsts().begin(), E = Node->getInsts().end(); I != E;
- ++I) {
- if (auto Kill = llvm::dyn_cast<InstFakeKill>(I)) {
+ for (Inst &I : Node->getInsts()) {
+ if (auto Kill = llvm::dyn_cast<InstFakeKill>(&I)) {
if (!Kill->isDeleted() && !Kill->getLinked()->isDeleted())
- Kills.push_back(I->getNumber());
+ Kills.push_back(I.getNumber());
}
}
}
@@ -160,25 +159,24 @@ void LinearScan::initForInfOnly() {
std::vector<InstNumberT> LRBegin(Vars.size(), Inst::NumberSentinel);
std::vector<InstNumberT> LREnd(Vars.size(), Inst::NumberSentinel);
for (CfgNode *Node : Func->getNodes()) {
- for (auto Inst = Node->getInsts().begin(), E = Node->getInsts().end();
- Inst != E; ++Inst) {
- if (Inst->isDeleted())
+ for (Inst &Inst : Node->getInsts()) {
+ if (Inst.isDeleted())
continue;
- if (const Variable *Var = Inst->getDest()) {
+ if (const Variable *Var = Inst.getDest()) {
if (Var->hasReg() || Var->getWeight() == RegWeight::Inf) {
if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) {
- LRBegin[Var->getIndex()] = Inst->getNumber();
+ LRBegin[Var->getIndex()] = Inst.getNumber();
++NumVars;
}
}
}
- for (SizeT I = 0; I < Inst->getSrcSize(); ++I) {
- Operand *Src = Inst->getSrc(I);
+ for (SizeT I = 0; I < Inst.getSrcSize(); ++I) {
+ Operand *Src = Inst.getSrc(I);
SizeT NumVars = Src->getNumVars();
for (SizeT J = 0; J < NumVars; ++J) {
const Variable *Var = Src->getVar(J);
if (Var->hasReg() || Var->getWeight() == RegWeight::Inf)
- LREnd[Var->getIndex()] = Inst->getNumber();
+ LREnd[Var->getIndex()] = Inst.getNumber();
}
}
}
« no previous file with comments | « src/IceOperand.cpp ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698