Index: include/polly/ScopInfo.h =================================================================== --- include/polly/ScopInfo.h +++ include/polly/ScopInfo.h @@ -64,7 +64,7 @@ class MemoryAccess; class Scop; class ScopStmt; -class ScopInfo; +class ScopBuilder; //===---------------------------------------------------------------------===// @@ -482,7 +482,7 @@ /// sum[i+j] = sum[i] + 3; /// /// Here not all iterations access the same memory location, but iterations - /// for which j = 0 holds do. After lifting the equality check in ScopInfo, + /// for which j = 0 holds do. After lifting the equality check in ScopBuilder, /// subsequent transformations do not only need check if a statement is /// reduction like, but they also need to verify that that the reduction /// property is only exploited for statement instances that load from and @@ -1503,7 +1503,7 @@ /// @brief List of invariant accesses. InvariantEquivClassesTy InvariantEquivClasses; - /// @brief Scop constructor; invoked from ScopInfo::buildScop. + /// @brief Scop constructor; invoked from ScopBuilder::buildScop. Scop(Region &R, ScalarEvolution &SE, LoopInfo &LI, ScopDetection::DetectionContext &DC); @@ -1513,7 +1513,7 @@ } //@} - /// @brief Initialize this ScopInfo . + /// @brief Initialize this ScopBuilder. void init(AliasAnalysis &AA, AssumptionCache &AC, DominatorTree &DT, LoopInfo &LI); @@ -1814,7 +1814,7 @@ void printAliasAssumptions(raw_ostream &OS) const; //@} - friend class ScopInfo; + friend class ScopBuilder; public: ~Scop(); @@ -2247,10 +2247,10 @@ } /// @brief Build the Polly IR (Scop and ScopStmt) on a Region. -class ScopInfo { +class ScopBuilder { //===-------------------------------------------------------------------===// - ScopInfo(const ScopInfo &) = delete; - const ScopInfo &operator=(const ScopInfo &) = delete; + ScopBuilder(const ScopBuilder &) = delete; + const ScopBuilder &operator=(const ScopBuilder &) = delete; /// @brief The AliasAnalysis to build AliasSetTracker. AliasAnalysis &AA; @@ -2468,10 +2468,10 @@ void addPHIReadAccess(PHINode *PHI); public: - explicit ScopInfo(Region *R, AssumptionCache &AC, AliasAnalysis &AA, - const DataLayout &DL, DominatorTree &DT, LoopInfo &LI, - ScopDetection &SD, ScalarEvolution &SE); - ~ScopInfo() {} + explicit ScopBuilder(Region *R, AssumptionCache &AC, AliasAnalysis &AA, + const DataLayout &DL, DominatorTree &DT, LoopInfo &LI, + ScopDetection &SD, ScalarEvolution &SE); + ~ScopBuilder() {} /// @brief Try to build the Polly IR of static control part on the current /// SESE-Region. @@ -2486,8 +2486,8 @@ /// @brief The legacy pass manager's analysis pass to compute scop information /// for a region. class ScopInfoRegionPass : public RegionPass { - /// @brief The ScopInfo pointer which is used to construct a Scop. - std::unique_ptr SI; + /// @brief The ScopBuilder pointer which is used to construct a Scop. + std::unique_ptr SI; public: static char ID; // Pass identification, replacement for typeid @@ -2495,8 +2495,8 @@ ScopInfoRegionPass() : RegionPass(ID) {} ~ScopInfoRegionPass() {} - /// @brief Build ScopInfo object, which constructs Polly IR of static control - /// part for the current SESE-Region. + /// @brief Build ScopBuilder object, which constructs Polly IR of static + /// control part for the current SESE-Region. /// /// @return Return Scop for the current Region. Scop *getScop() { Index: lib/Analysis/ScopInfo.cpp =================================================================== --- lib/Analysis/ScopInfo.cpp +++ lib/Analysis/ScopInfo.cpp @@ -4236,8 +4236,8 @@ return L->getLoopDepth() - OuterLoop->getLoopDepth(); } -void ScopInfo::buildPHIAccesses(PHINode *PHI, Region *NonAffineSubRegion, - bool IsExitBlock) { +void ScopBuilder::buildPHIAccesses(PHINode *PHI, Region *NonAffineSubRegion, + bool IsExitBlock) { // PHI nodes that are in the exit block of the region, hence if IsExitBlock is // true, are not modeled as ordinary PHI nodes as they are not part of the @@ -4272,7 +4272,7 @@ } } -void ScopInfo::buildScalarDependences(Instruction *Inst) { +void ScopBuilder::buildScalarDependences(Instruction *Inst) { assert(!isa(Inst)); // Pull-in required operands. @@ -4280,7 +4280,7 @@ ensureValueRead(Op.get(), Inst->getParent()); } -void ScopInfo::buildEscapingDependences(Instruction *Inst) { +void ScopBuilder::buildEscapingDependences(Instruction *Inst) { // Check for uses of this instruction outside the scop. Because we do not // iterate over such instructions and therefore did not "ensure" the existence // of a write, we must determine such use here. @@ -4307,7 +4307,7 @@ } } -bool ScopInfo::buildAccessMultiDimFixed(MemAccInst Inst, Loop *L) { +bool ScopBuilder::buildAccessMultiDimFixed(MemAccInst Inst, Loop *L) { Value *Val = Inst.getValueOperand(); Type *ElementType = Val->getType(); Value *Address = Inst.getPointerOperand(); @@ -4374,7 +4374,7 @@ return true; } -bool ScopInfo::buildAccessMultiDimParam(MemAccInst Inst, Loop *L) { +bool ScopBuilder::buildAccessMultiDimParam(MemAccInst Inst, Loop *L) { if (!PollyDelinearize) return false; @@ -4416,7 +4416,7 @@ return true; } -bool ScopInfo::buildAccessMemIntrinsic(MemAccInst Inst, Loop *L) { +bool ScopBuilder::buildAccessMemIntrinsic(MemAccInst Inst, Loop *L) { auto *MemIntr = dyn_cast_or_null(Inst); if (MemIntr == nullptr) @@ -4480,7 +4480,7 @@ return true; } -bool ScopInfo::buildAccessCallInst(MemAccInst Inst, Loop *L) { +bool ScopBuilder::buildAccessCallInst(MemAccInst Inst, Loop *L) { auto *CI = dyn_cast_or_null(Inst); if (CI == nullptr) @@ -4523,7 +4523,7 @@ return true; } -void ScopInfo::buildAccessSingleDim(MemAccInst Inst, Loop *L) { +void ScopBuilder::buildAccessSingleDim(MemAccInst Inst, Loop *L) { Value *Address = Inst.getPointerOperand(); Value *Val = Inst.getValueOperand(); Type *ElementType = Val->getType(); @@ -4563,7 +4563,7 @@ {AccessFunction}, {}, Val); } -void ScopInfo::buildMemoryAccess(MemAccInst Inst, Loop *L) { +void ScopBuilder::buildMemoryAccess(MemAccInst Inst, Loop *L) { if (buildAccessMemIntrinsic(Inst, L)) return; @@ -4580,7 +4580,7 @@ buildAccessSingleDim(Inst, L); } -void ScopInfo::buildAccessFunctions(Region &SR) { +void ScopBuilder::buildAccessFunctions(Region &SR) { if (scop->isNonAffineSubRegion(&SR)) { for (BasicBlock *BB : SR.blocks()) @@ -4595,7 +4595,7 @@ buildAccessFunctions(*I->getNodeAs()); } -void ScopInfo::buildStmts(Region &SR) { +void ScopBuilder::buildStmts(Region &SR) { if (scop->isNonAffineSubRegion(&SR)) { scop->addScopStmt(nullptr, &SR); @@ -4609,8 +4609,9 @@ scop->addScopStmt(I->getNodeAs(), nullptr); } -void ScopInfo::buildAccessFunctions(BasicBlock &BB, Region *NonAffineSubRegion, - bool IsExitBlock) { +void ScopBuilder::buildAccessFunctions(BasicBlock &BB, + Region *NonAffineSubRegion, + bool IsExitBlock) { // We do not build access functions for error blocks, as they may contain // instructions we can not model. if (isErrorBlock(BB, scop->getRegion(), LI, DT) && !IsExitBlock) @@ -4645,13 +4646,11 @@ } } -MemoryAccess *ScopInfo::addMemoryAccess(BasicBlock *BB, Instruction *Inst, - MemoryAccess::AccessType AccType, - Value *BaseAddress, Type *ElementType, - bool Affine, Value *AccessValue, - ArrayRef Subscripts, - ArrayRef Sizes, - ScopArrayInfo::MemoryKind Kind) { +MemoryAccess *ScopBuilder::addMemoryAccess( + BasicBlock *BB, Instruction *Inst, MemoryAccess::AccessType AccType, + Value *BaseAddress, Type *ElementType, bool Affine, Value *AccessValue, + ArrayRef Subscripts, ArrayRef Sizes, + ScopArrayInfo::MemoryKind Kind) { ScopStmt *Stmt = scop->getStmtFor(BB); // Do not create a memory access for anything not in the SCoP. It would be @@ -4693,19 +4692,17 @@ return &AccList.back(); } -void ScopInfo::addArrayAccess(MemAccInst MemAccInst, - MemoryAccess::AccessType AccType, - Value *BaseAddress, Type *ElementType, - bool IsAffine, ArrayRef Subscripts, - ArrayRef Sizes, - Value *AccessValue) { +void ScopBuilder::addArrayAccess( + MemAccInst MemAccInst, MemoryAccess::AccessType AccType, Value *BaseAddress, + Type *ElementType, bool IsAffine, ArrayRef Subscripts, + ArrayRef Sizes, Value *AccessValue) { ArrayBasePointers.insert(BaseAddress); addMemoryAccess(MemAccInst->getParent(), MemAccInst, AccType, BaseAddress, ElementType, IsAffine, AccessValue, Subscripts, Sizes, ScopArrayInfo::MK_Array); } -void ScopInfo::ensureValueWrite(Instruction *Inst) { +void ScopBuilder::ensureValueWrite(Instruction *Inst) { ScopStmt *Stmt = scop->getStmtFor(Inst); // Inst not defined within this SCoP. @@ -4721,7 +4718,7 @@ ArrayRef(), ScopArrayInfo::MK_Value); } -void ScopInfo::ensureValueRead(Value *V, BasicBlock *UserBB) { +void ScopBuilder::ensureValueRead(Value *V, BasicBlock *UserBB) { // There cannot be an "access" for literal constants. BasicBlock references // (jump destinations) also never change. @@ -4776,8 +4773,8 @@ ensureValueWrite(ValueInst); } -void ScopInfo::ensurePHIWrite(PHINode *PHI, BasicBlock *IncomingBlock, - Value *IncomingValue, bool IsExitBlock) { +void ScopBuilder::ensurePHIWrite(PHINode *PHI, BasicBlock *IncomingBlock, + Value *IncomingValue, bool IsExitBlock) { // As the incoming block might turn out to be an error statement ensure we // will create an exit PHI SAI object. It is needed during code generation // and would be created later anyway. @@ -4812,13 +4809,13 @@ Acc->addIncoming(IncomingBlock, IncomingValue); } -void ScopInfo::addPHIReadAccess(PHINode *PHI) { +void ScopBuilder::addPHIReadAccess(PHINode *PHI) { addMemoryAccess(PHI->getParent(), PHI, MemoryAccess::READ, PHI, PHI->getType(), true, PHI, ArrayRef(), ArrayRef(), ScopArrayInfo::MK_PHI); } -void ScopInfo::buildScop(Region &R, AssumptionCache &AC) { +void ScopBuilder::buildScop(Region &R, AssumptionCache &AC) { scop.reset(new Scop(R, SE, LI, *SD.getDetectionContext(&R))); buildStmts(R); @@ -4845,9 +4842,9 @@ scop->init(AA, AC, DT, LI); } -ScopInfo::ScopInfo(Region *R, AssumptionCache &AC, AliasAnalysis &AA, - const DataLayout &DL, DominatorTree &DT, LoopInfo &LI, - ScopDetection &SD, ScalarEvolution &SE) +ScopBuilder::ScopBuilder(Region *R, AssumptionCache &AC, AliasAnalysis &AA, + const DataLayout &DL, DominatorTree &DT, LoopInfo &LI, + ScopDetection &SD, ScalarEvolution &SE) : AA(AA), DL(DL), DT(DT), LI(LI), SD(SD), SE(SE) { Function *F = R->getEntry()->getParent(); @@ -4874,7 +4871,7 @@ emitOptimizationRemarkAnalysis(F->getContext(), DEBUG_TYPE, *F, End, Msg); } -void ScopInfo::clear() { scop.reset(); } +void ScopBuilder::clear() { scop.reset(); } //===----------------------------------------------------------------------===// void ScopInfoRegionPass::getAnalysisUsage(AnalysisUsage &AU) const { @@ -4902,7 +4899,7 @@ auto &DT = getAnalysis().getDomTree(); auto &AC = getAnalysis().getAssumptionCache(*F); - SI.reset(new ScopInfo(R, AC, AA, DL, DT, LI, SD, SE)); + SI.reset(new ScopBuilder(R, AC, AA, DL, DT, LI, SD, SE)); return false; }