[Polly][NFC] Use factory pattern (#190456)
To (theoretically) reduce coupling of Scop and ScopBuilder.
This commit is contained in:
parent
6565e08c1e
commit
47d8003948
@ -1868,17 +1868,12 @@ private:
|
||||
ScopDetection::DetectionContext &DC, OptimizationRemarkEmitter &ORE,
|
||||
int ID);
|
||||
|
||||
//@}
|
||||
|
||||
/// Return the access for the base ptr of @p MA if any.
|
||||
MemoryAccess *lookupBasePtrAccess(MemoryAccess *MA);
|
||||
|
||||
/// Create an id for @p Param and store it in the ParameterIds map.
|
||||
void createParameterId(const SCEV *Param);
|
||||
|
||||
/// Build the Context of the Scop.
|
||||
void buildContext();
|
||||
|
||||
/// Add the bounds of the parameters to the context.
|
||||
void addParameterBounds();
|
||||
|
||||
@ -1942,6 +1937,12 @@ public:
|
||||
Scop &operator=(const Scop &) = delete;
|
||||
~Scop();
|
||||
|
||||
/// Factory pattern for creating a new (empty) SCoP.
|
||||
static std::unique_ptr<Scop> makeScop(Region &R, ScalarEvolution &SE,
|
||||
LoopInfo &LI, DominatorTree &DT,
|
||||
ScopDetection::DetectionContext &DC,
|
||||
OptimizationRemarkEmitter &ORE, int ID);
|
||||
|
||||
/// Increment actual number of aliasing assumptions taken
|
||||
///
|
||||
/// @param Step Number of new aliasing assumptions which should be added to
|
||||
|
||||
@ -3653,8 +3653,8 @@ static void verifyUses(Scop *S, LoopInfo &LI, DominatorTree &DT) {
|
||||
#endif
|
||||
|
||||
void ScopBuilder::buildScop(Region &R, AssumptionCache &AC) {
|
||||
scop.reset(new Scop(R, SE, LI, DT, *SD.getDetectionContext(&R), ORE,
|
||||
SD.getNextID()));
|
||||
scop = Scop::makeScop(R, SE, LI, DT, *SD.getDetectionContext(&R), ORE,
|
||||
SD.getNextID());
|
||||
|
||||
buildStmts(R);
|
||||
|
||||
|
||||
@ -1492,14 +1492,6 @@ bool Scop::isDominatedBy(const DominatorTree &DT, BasicBlock *BB) const {
|
||||
return DT.dominates(BB, getEntry());
|
||||
}
|
||||
|
||||
void Scop::buildContext() {
|
||||
isl::space Space = isl::space::params_alloc(getIslCtx(), 0);
|
||||
Context = isl::set::universe(Space);
|
||||
InvalidContext = isl::set::empty(Space);
|
||||
AssumedContext = isl::set::universe(Space);
|
||||
DefinedBehaviorContext = isl::set::universe(Space);
|
||||
}
|
||||
|
||||
void Scop::addParameterBounds() {
|
||||
unsigned PDim = 0;
|
||||
for (auto *Parameter : Parameters) {
|
||||
@ -1630,8 +1622,20 @@ Scop::Scop(Region &R, ScalarEvolution &ScalarEvolution, LoopInfo &LI,
|
||||
IslParseFlags);
|
||||
|
||||
if (IslOnErrorAbort)
|
||||
isl_options_set_on_error(getIslCtx().get(), ISL_ON_ERROR_ABORT);
|
||||
buildContext();
|
||||
isl_options_set_on_error(IslCtx.get(), ISL_ON_ERROR_ABORT);
|
||||
|
||||
isl::space Space = isl::space::params_alloc(getIslCtx(), 0);
|
||||
Context = isl::set::universe(Space);
|
||||
InvalidContext = isl::set::empty(Space);
|
||||
AssumedContext = isl::set::universe(Space);
|
||||
DefinedBehaviorContext = isl::set::universe(Space);
|
||||
}
|
||||
|
||||
std::unique_ptr<Scop> Scop::makeScop(Region &R, ScalarEvolution &SE,
|
||||
LoopInfo &LI, DominatorTree &DT,
|
||||
ScopDetection::DetectionContext &DC,
|
||||
OptimizationRemarkEmitter &ORE, int ID) {
|
||||
return std::unique_ptr<Scop>{new Scop(R, SE, LI, DT, DC, ORE, ID)};
|
||||
}
|
||||
|
||||
Scop::~Scop() = default;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user