forked from OSchip/llvm-project
[ScopInfo] Introduce list of statements in Scop::StmtMap. NFC.
Once statements are split, a BasicBlock will comprise of multiple statements. To prepare for this change in future, we introduce a list of statements in the statement map. Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in> Differential Revision: https://reviews.llvm.org/D35301 llvm-svn: 308318
This commit is contained in:
parent
fad872fc2d
commit
4dfa732750
|
@ -1670,8 +1670,9 @@ private:
|
|||
/// delete the last object that creates isl objects with the context.
|
||||
std::shared_ptr<isl_ctx> IslCtx;
|
||||
|
||||
/// A map from basic blocks to SCoP statements.
|
||||
DenseMap<BasicBlock *, ScopStmt *> StmtMap;
|
||||
/// A map from basic blocks to vector of SCoP statements. Currently this
|
||||
/// vector comprises only of a single statement.
|
||||
DenseMap<BasicBlock *, std::vector<ScopStmt *>> StmtMap;
|
||||
|
||||
/// A map from basic blocks to their domains.
|
||||
DenseMap<BasicBlock *, isl::set> DomainMap;
|
||||
|
|
|
@ -4748,7 +4748,7 @@ void Scop::addScopStmt(BasicBlock *BB, Loop *SurroundingLoop,
|
|||
assert(BB && "Unexpected nullptr!");
|
||||
Stmts.emplace_back(*this, *BB, SurroundingLoop, Instructions);
|
||||
auto *Stmt = &Stmts.back();
|
||||
StmtMap[BB] = Stmt;
|
||||
StmtMap[BB].push_back(Stmt);
|
||||
}
|
||||
|
||||
void Scop::addScopStmt(Region *R, Loop *SurroundingLoop) {
|
||||
|
@ -4756,7 +4756,7 @@ void Scop::addScopStmt(Region *R, Loop *SurroundingLoop) {
|
|||
Stmts.emplace_back(*this, *R, SurroundingLoop);
|
||||
auto *Stmt = &Stmts.back();
|
||||
for (BasicBlock *BB : R->blocks())
|
||||
StmtMap[BB] = Stmt;
|
||||
StmtMap[BB].push_back(Stmt);
|
||||
}
|
||||
|
||||
ScopStmt *Scop::addScopStmt(__isl_take isl_map *SourceRel,
|
||||
|
@ -4908,7 +4908,8 @@ ScopStmt *Scop::getStmtFor(BasicBlock *BB) const {
|
|||
auto StmtMapIt = StmtMap.find(BB);
|
||||
if (StmtMapIt == StmtMap.end())
|
||||
return nullptr;
|
||||
return StmtMapIt->second;
|
||||
assert(StmtMapIt->second.size() == 1);
|
||||
return StmtMapIt->second.front();
|
||||
}
|
||||
|
||||
ScopStmt *Scop::getStmtFor(RegionNode *RN) const {
|
||||
|
|
Loading…
Reference in New Issue