forked from OSchip/llvm-project
[REFACTOR] Replace Pass* from BlockGen by the DomTree
llvm-svn: 230220
This commit is contained in:
parent
8198cfd8a7
commit
b4f08eb671
|
@ -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
|
||||
|
|
|
@ -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 <S) {
|
||||
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());
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
|
Loading…
Reference in New Issue