summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2014-08-31 16:10:31 +0000
committerTobias Grosser <tobias@grosser.es>2014-08-31 16:10:31 +0000
commit1fee67d6f85bf7532bdb43f86cc6d1172b1cd566 (patch)
tree0cd0e6ff8724511d1f572715f915c67b4058bef2 /polly/lib/CodeGen
parent3a1469ea042877a77cb2e3bced0ed42af94d7872 (diff)
downloadbcm5719-llvm-1fee67d6f85bf7532bdb43f86cc6d1172b1cd566.tar.gz
bcm5719-llvm-1fee67d6f85bf7532bdb43f86cc6d1172b1cd566.zip
Use range based for loops
llvm-svn: 216842
Diffstat (limited to 'polly/lib/CodeGen')
-rw-r--r--polly/lib/CodeGen/CodeGeneration.cpp51
1 files changed, 19 insertions, 32 deletions
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index 29f36c30c5c..a44672575fc 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -478,9 +478,8 @@ void ClastStmtCodeGen::codegen(const clast_user_stmt *u,
if (IVS) {
assert(u->substitutions && "Substitutions expected!");
int i = 0;
- for (std::vector<Value *>::iterator II = IVS->begin(), IE = IVS->end();
- II != IE; ++II) {
- ClastVars[iterator] = *II;
+ for (Value *IV : *IVS) {
+ ClastVars[iterator] = IV;
codegenSubstitutions(u->substitutions, Statement, i, &VectorMap, &VLTS);
i++;
}
@@ -562,9 +561,8 @@ SetVector<Value *> ClastStmtCodeGen::getOMPValues(const clast_stmt *Body) {
SetVector<Value *> Values;
// The clast variables
- for (CharMapT::iterator I = ClastVars.begin(), E = ClastVars.end(); I != E;
- I++)
- Values.insert(I->second);
+ for (auto I : ClastVars)
+ Values.insert(I.second);
// Find the temporaries that are referenced in the clast statements'
// basic blocks but are not defined by these blocks (e.g., references
@@ -573,9 +571,7 @@ SetVector<Value *> ClastStmtCodeGen::getOMPValues(const clast_stmt *Body) {
ParameterVisitor Params;
Params.visit(Body);
- for (ParameterVisitor::const_iterator PI = Params.begin(), PE = Params.end();
- PI != PE; ++PI) {
- Value *V = *PI;
+ for (Value *V : Params) {
Values.insert(V);
DEBUG(dbgs() << "Adding temporary for OMP copy-in: " << *V << "\n");
}
@@ -587,19 +583,16 @@ void
ClastStmtCodeGen::updateWithValueMap(OMPGenerator::ValueToValueMapTy &VMap) {
std::set<Value *> Inserted;
- for (CharMapT::iterator I = ClastVars.begin(), E = ClastVars.end(); I != E;
- I++) {
- ClastVars[I->first] = VMap[I->second];
- Inserted.insert(I->second);
+ for (auto I : ClastVars) {
+ ClastVars[I.first] = VMap[I.second];
+ Inserted.insert(I.second);
}
- for (OMPGenerator::ValueToValueMapTy::iterator I = VMap.begin(),
- E = VMap.end();
- I != E; ++I) {
- if (Inserted.count(I->first))
+ for (auto I : VMap) {
+ if (Inserted.count(I.first))
continue;
- ValueMap[I->first] = I->second;
+ ValueMap[I.first] = I.second;
}
}
@@ -609,9 +602,8 @@ static void clearDomtree(Function *F, DominatorTree &DT) {
for (po_iterator<DomTreeNode *> I = po_begin(N), E = po_end(N); I != E; ++I)
Nodes.push_back(I->getBlock());
- for (std::vector<BasicBlock *>::iterator I = Nodes.begin(), E = Nodes.end();
- I != E; ++I)
- DT.eraseNode(*I);
+ for (BasicBlock *BB : Nodes)
+ DT.eraseNode(BB);
}
void ClastStmtCodeGen::codegenForOpenMP(const clast_for *For) {
@@ -796,13 +788,10 @@ void ClastStmtCodeGen::codegenForGPGPU(const clast_for *F) {
// following codes to avoid affecting other parts of Polly. This should be
// fixed later.
Function *FN = Builder.GetInsertBlock()->getParent();
- for (unsigned j = 0; j < Values.size(); j++) {
- Value *baseAddr = Values[j];
- for (Function::iterator B = FN->begin(); B != FN->end(); ++B) {
- for (BasicBlock::iterator I = B->begin(); I != B->end(); ++I)
- I->replaceUsesOfWith(baseAddr, ValueMap[baseAddr]);
- }
- }
+ for (Value *BaseAddr : Values)
+ for (BasicBlock *BB: *FN)
+ for (Instruction *Inst : *BB)
+ Inst->replaceUsesOfWith(BaseAddr, ValueMap[BaseAddr]);
Builder.SetInsertPoint(AfterLoop);
PTXGen.setLaunchingParameters(NumIterations[0], NumIterations[1],
NumIterations[2], NumIterations[3]);
@@ -1071,10 +1060,8 @@ public:
}
virtual void printScop(raw_ostream &OS) const {
- for (std::vector<std::string>::const_iterator PI = ParallelLoops.begin(),
- PE = ParallelLoops.end();
- PI != PE; ++PI)
- OS << "Parallel loop with iterator '" << *PI << "' generated\n";
+ for (auto PI : ParallelLoops)
+ OS << "Parallel loop with iterator '" << PI << "' generated\n";
}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
OpenPOWER on IntegriCloud