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
|
/// @param Builder The LLVM-IR Builder used to generate the statement. The
|
||||||
/// code is generated at the location, the Builder points
|
/// code is generated at the location, the Builder points
|
||||||
/// to.
|
/// 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 LI The loop info for the current function
|
||||||
/// @param SE The scalar evolution 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.
|
/// @param ExprBuilder An expression builder to generate new access functions.
|
||||||
BlockGenerator(PollyIRBuilder &Builder, Pass *P, LoopInfo &LI,
|
BlockGenerator(PollyIRBuilder &Builder, LoopInfo &LI, ScalarEvolution &SE,
|
||||||
ScalarEvolution &SE, IslExprBuilder *ExprBuilder = nullptr);
|
DominatorTree &DT, IslExprBuilder *ExprBuilder = nullptr);
|
||||||
|
|
||||||
/// @brief Copy the basic block.
|
/// @brief Copy the basic block.
|
||||||
///
|
///
|
||||||
|
@ -94,11 +93,13 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PollyIRBuilder &Builder;
|
PollyIRBuilder &Builder;
|
||||||
Pass *P;
|
|
||||||
LoopInfo &LI;
|
LoopInfo &LI;
|
||||||
ScalarEvolution &SE;
|
ScalarEvolution &SE;
|
||||||
IslExprBuilder *ExprBuilder;
|
IslExprBuilder *ExprBuilder;
|
||||||
|
|
||||||
|
/// @brief The dominator tree of this function.
|
||||||
|
DominatorTree &DT;
|
||||||
|
|
||||||
/// @brief Get the new version of a value.
|
/// @brief Get the new version of a value.
|
||||||
///
|
///
|
||||||
/// Given an old value, we first check if a new version of this value is
|
/// 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockGenerator::BlockGenerator(PollyIRBuilder &B, Pass *P, LoopInfo &LI,
|
BlockGenerator::BlockGenerator(PollyIRBuilder &B, LoopInfo &LI,
|
||||||
ScalarEvolution &SE, IslExprBuilder *ExprBuilder)
|
ScalarEvolution &SE, DominatorTree &DT,
|
||||||
: Builder(B), P(P), LI(LI), SE(SE), ExprBuilder(ExprBuilder) {}
|
IslExprBuilder *ExprBuilder)
|
||||||
|
: Builder(B), LI(LI), SE(SE), ExprBuilder(ExprBuilder), DT(DT) {}
|
||||||
|
|
||||||
Value *BlockGenerator::getNewValue(ScopStmt &Stmt, const Value *Old,
|
Value *BlockGenerator::getNewValue(ScopStmt &Stmt, const Value *Old,
|
||||||
ValueMapT &BBMap, ValueMapT &GlobalMap,
|
ValueMapT &BBMap, ValueMapT &GlobalMap,
|
||||||
|
@ -285,12 +286,9 @@ void BlockGenerator::copyInstruction(ScopStmt &Stmt, const Instruction *Inst,
|
||||||
|
|
||||||
void BlockGenerator::copyBB(ScopStmt &Stmt, ValueMapT &GlobalMap,
|
void BlockGenerator::copyBB(ScopStmt &Stmt, ValueMapT &GlobalMap,
|
||||||
LoopToScevMapT <S) {
|
LoopToScevMapT <S) {
|
||||||
auto *DTWP = P->getAnalysisIfAvailable<DominatorTreeWrapperPass>();
|
|
||||||
auto *DT = DTWP ? &DTWP->getDomTree() : nullptr;
|
|
||||||
|
|
||||||
BasicBlock *BB = Stmt.getBasicBlock();
|
BasicBlock *BB = Stmt.getBasicBlock();
|
||||||
BasicBlock *CopyBB =
|
BasicBlock *CopyBB =
|
||||||
SplitBlock(Builder.GetInsertBlock(), Builder.GetInsertPoint(), DT, &LI);
|
SplitBlock(Builder.GetInsertBlock(), Builder.GetInsertPoint(), &DT, &LI);
|
||||||
CopyBB->setName("polly.stmt." + BB->getName());
|
CopyBB->setName("polly.stmt." + BB->getName());
|
||||||
Builder.SetInsertPoint(CopyBB->begin());
|
Builder.SetInsertPoint(CopyBB->begin());
|
||||||
|
|
||||||
|
@ -623,12 +621,9 @@ void VectorBlockGenerator::copyInstruction(ScopStmt &Stmt,
|
||||||
}
|
}
|
||||||
|
|
||||||
void VectorBlockGenerator::copyBB(ScopStmt &Stmt) {
|
void VectorBlockGenerator::copyBB(ScopStmt &Stmt) {
|
||||||
auto *DTWP = P->getAnalysisIfAvailable<DominatorTreeWrapperPass>();
|
|
||||||
auto *DT = DTWP ? &DTWP->getDomTree() : nullptr;
|
|
||||||
|
|
||||||
BasicBlock *BB = Stmt.getBasicBlock();
|
BasicBlock *BB = Stmt.getBasicBlock();
|
||||||
BasicBlock *CopyBB =
|
BasicBlock *CopyBB =
|
||||||
SplitBlock(Builder.GetInsertBlock(), Builder.GetInsertPoint(), DT, &LI);
|
SplitBlock(Builder.GetInsertBlock(), Builder.GetInsertPoint(), &DT, &LI);
|
||||||
CopyBB->setName("polly.stmt." + BB->getName());
|
CopyBB->setName("polly.stmt." + BB->getName());
|
||||||
Builder.SetInsertPoint(CopyBB->begin());
|
Builder.SetInsertPoint(CopyBB->begin());
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ public:
|
||||||
: S(S), Builder(Builder), Annotator(Annotator),
|
: S(S), Builder(Builder), Annotator(Annotator),
|
||||||
Rewriter(new SCEVExpander(SE, "polly")),
|
Rewriter(new SCEVExpander(SE, "polly")),
|
||||||
ExprBuilder(Builder, IDToValue, *Rewriter),
|
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) {}
|
SE(SE), DT(DT) {}
|
||||||
|
|
||||||
~IslNodeBuilder() { delete Rewriter; }
|
~IslNodeBuilder() { delete Rewriter; }
|
||||||
|
|
Loading…
Reference in New Issue