Split ScopInfo::addScopStmt into two versions. NFC

One for adding statement for region, another one for BB

llvm-svn: 287566
This commit is contained in:
Hongbin Zheng 2016-11-21 20:09:40 +00:00
parent 1c57007ec8
commit a8fb73fc0b
3 changed files with 27 additions and 19 deletions

View File

@ -1858,14 +1858,21 @@ private:
/// @return The representing SCEV for invariant loads or @p S if none.
const SCEV *getRepresentingInvariantLoadSCEV(const SCEV *S);
/// Create a new SCoP statement for either @p BB or @p R.
/// Create a new SCoP statement for either @p BB.
///
/// Either @p BB or @p R should be non-null. A new statement for the non-null
/// argument will be created and added to the statement vector and map.
/// A new statement for @p BB will be created and added to the statement vector
/// and map.
///
/// @param BB The basic block we build the statement for (or null)
/// @param R The region we build the statement for (or null).
void addScopStmt(BasicBlock *BB, Region *R);
/// @param BB The basic block we build the statement for.
void addScopStmt(BasicBlock *BB);
/// Create a new SCoP statement for either @p R.
///
/// A new statement for @p R will be created and added to the statement vector
/// and map.
///
/// @param R The region we build the statement for.
void addScopStmt(Region *R);
/// @param Update access dimensionalities.
///

View File

@ -430,7 +430,7 @@ void ScopBuilder::buildAccessFunctions(Region &SR) {
void ScopBuilder::buildStmts(Region &SR) {
if (scop->isNonAffineSubRegion(&SR)) {
scop->addScopStmt(nullptr, &SR);
scop->addScopStmt(&SR);
return;
}
@ -438,7 +438,7 @@ void ScopBuilder::buildStmts(Region &SR) {
if (I->isSubRegion())
buildStmts(*I->getNodeAs<Region>());
else
scop->addScopStmt(I->getNodeAs<BasicBlock>(), nullptr);
scop->addScopStmt(I->getNodeAs<BasicBlock>());
}
void ScopBuilder::buildAccessFunctions(BasicBlock &BB,

View File

@ -4206,18 +4206,19 @@ mapToDimension(__isl_take isl_union_set *USet, int N) {
return isl_multi_union_pw_aff_from_union_pw_multi_aff(Data.Res);
}
void Scop::addScopStmt(BasicBlock *BB, Region *R) {
if (BB) {
Stmts.emplace_back(*this, *BB);
auto *Stmt = &Stmts.back();
void Scop::addScopStmt(BasicBlock *BB) {
assert(BB && "Unexpected nullptr!");
Stmts.emplace_back(*this, *BB);
auto *Stmt = &Stmts.back();
StmtMap[BB] = Stmt;
}
void Scop::addScopStmt(Region *R) {
assert(R && "Unexpected nullptr!");
Stmts.emplace_back(*this, *R);
auto *Stmt = &Stmts.back();
for (BasicBlock *BB : R->blocks())
StmtMap[BB] = Stmt;
} else {
assert(R && "Either basic block or a region expected.");
Stmts.emplace_back(*this, *R);
auto *Stmt = &Stmts.back();
for (BasicBlock *BB : R->blocks())
StmtMap[BB] = Stmt;
}
}
ScopStmt *Scop::addScopStmt(__isl_take isl_map *SourceRel,