[REFACTOR] Replace Pass* from BlockGen by the DomTree

llvm-svn: 230220
This commit is contained in:
Johannes Doerfert 2015-02-23 13:51:35 +00:00
parent 8198cfd8a7
commit b4f08eb671
3 changed files with 13 additions and 17 deletions

View File

@ -72,13 +72,12 @@ public:
/// @param Builder The LLVM-IR Builder used to generate the statement. The
/// code is generated at the location, the Builder points
/// to.
/// @param P A reference to the pass this function is called from.
/// The pass is needed to update other analysis.
/// @param LI The loop info for the current function
/// @param SE The scalar evolution info for the current function
/// @param DT The dominator tree of this function.
/// @param ExprBuilder An expression builder to generate new access functions.
BlockGenerator(PollyIRBuilder &Builder, Pass *P, LoopInfo &LI,
ScalarEvolution &SE, IslExprBuilder *ExprBuilder = nullptr);
BlockGenerator(PollyIRBuilder &Builder, LoopInfo &LI, ScalarEvolution &SE,
DominatorTree &DT, IslExprBuilder *ExprBuilder = nullptr);
/// @brief Copy the basic block.
///
@ -94,11 +93,13 @@ public:
protected:
PollyIRBuilder &Builder;
Pass *P;
LoopInfo &LI;
ScalarEvolution &SE;
IslExprBuilder *ExprBuilder;
/// @brief The dominator tree of this function.
DominatorTree &DT;
/// @brief Get the new version of a value.
///
/// Given an old value, we first check if a new version of this value is

View File

@ -76,9 +76,10 @@ bool polly::isIgnoredIntrinsic(const Value *V) {
return false;
}
BlockGenerator::BlockGenerator(PollyIRBuilder &B, Pass *P, LoopInfo &LI,
ScalarEvolution &SE, IslExprBuilder *ExprBuilder)
: Builder(B), P(P), LI(LI), SE(SE), ExprBuilder(ExprBuilder) {}
BlockGenerator::BlockGenerator(PollyIRBuilder &B, LoopInfo &LI,
ScalarEvolution &SE, DominatorTree &DT,
IslExprBuilder *ExprBuilder)
: Builder(B), LI(LI), SE(SE), ExprBuilder(ExprBuilder), DT(DT) {}
Value *BlockGenerator::getNewValue(ScopStmt &Stmt, const Value *Old,
ValueMapT &BBMap, ValueMapT &GlobalMap,
@ -285,12 +286,9 @@ void BlockGenerator::copyInstruction(ScopStmt &Stmt, const Instruction *Inst,
void BlockGenerator::copyBB(ScopStmt &Stmt, ValueMapT &GlobalMap,
LoopToScevMapT &LTS) {
auto *DTWP = P->getAnalysisIfAvailable<DominatorTreeWrapperPass>();
auto *DT = DTWP ? &DTWP->getDomTree() : nullptr;
BasicBlock *BB = Stmt.getBasicBlock();
BasicBlock *CopyBB =
SplitBlock(Builder.GetInsertBlock(), Builder.GetInsertPoint(), DT, &LI);
SplitBlock(Builder.GetInsertBlock(), Builder.GetInsertPoint(), &DT, &LI);
CopyBB->setName("polly.stmt." + BB->getName());
Builder.SetInsertPoint(CopyBB->begin());
@ -623,12 +621,9 @@ void VectorBlockGenerator::copyInstruction(ScopStmt &Stmt,
}
void VectorBlockGenerator::copyBB(ScopStmt &Stmt) {
auto *DTWP = P->getAnalysisIfAvailable<DominatorTreeWrapperPass>();
auto *DT = DTWP ? &DTWP->getDomTree() : nullptr;
BasicBlock *BB = Stmt.getBasicBlock();
BasicBlock *CopyBB =
SplitBlock(Builder.GetInsertBlock(), Builder.GetInsertPoint(), DT, &LI);
SplitBlock(Builder.GetInsertBlock(), Builder.GetInsertPoint(), &DT, &LI);
CopyBB->setName("polly.stmt." + BB->getName());
Builder.SetInsertPoint(CopyBB->begin());

View File

@ -65,7 +65,7 @@ public:
: S(S), Builder(Builder), Annotator(Annotator),
Rewriter(new SCEVExpander(SE, "polly")),
ExprBuilder(Builder, IDToValue, *Rewriter),
BlockGen(Builder, P, LI, SE, &ExprBuilder), P(P), DL(DL), LI(LI),
BlockGen(Builder, LI, SE, DT, &ExprBuilder), P(P), DL(DL), LI(LI),
SE(SE), DT(DT) {}
~IslNodeBuilder() { delete Rewriter; }