diff options
Diffstat (limited to 'polly/lib/Analysis')
| -rw-r--r-- | polly/lib/Analysis/ScopBuilder.cpp | 31 | ||||
| -rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 57 |
2 files changed, 44 insertions, 44 deletions
diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp index d737621e193..6d1bf88c5af 100644 --- a/polly/lib/Analysis/ScopBuilder.cpp +++ b/polly/lib/Analysis/ScopBuilder.cpp @@ -482,7 +482,7 @@ MemoryAccess *ScopBuilder::addMemoryAccess( BasicBlock *BB, Instruction *Inst, MemoryAccess::AccessType AccType, Value *BaseAddress, Type *ElementType, bool Affine, Value *AccessValue, ArrayRef<const SCEV *> Subscripts, ArrayRef<const SCEV *> Sizes, - ScopArrayInfo::MemoryKind Kind) { + MemoryKind Kind) { ScopStmt *Stmt = scop->getStmtFor(BB); // Do not create a memory access for anything not in the SCoP. It would be @@ -501,9 +501,10 @@ MemoryAccess *ScopBuilder::addMemoryAccess( if (Stmt->isRegionStmt()) { // Accesses that dominate the exit block of a non-affine region are always - // executed. In non-affine regions there may exist MK_Values that do not - // dominate the exit. MK_Values will always dominate the exit and MK_PHIs - // only if there is at most one PHI_WRITE in the non-affine region. + // executed. In non-affine regions there may exist MemoryKind::Values that + // do not dominate the exit. MemoryKind::Values will always dominate the + // exit and MemoryKind::PHIs only if there is at most one PHI_WRITE in the + // non-affine region. if (DT.dominates(BB, Stmt->getRegion()->getExit())) isKnownMustAccess = true; } @@ -511,7 +512,7 @@ MemoryAccess *ScopBuilder::addMemoryAccess( // Non-affine PHI writes do not "happen" at a particular instruction, but // after exiting the statement. Therefore they are guaranteed to execute and // overwrite the old value. - if (Kind == ScopArrayInfo::MK_PHI || Kind == ScopArrayInfo::MK_ExitPHI) + if (Kind == MemoryKind::PHI || Kind == MemoryKind::ExitPHI) isKnownMustAccess = true; if (!isKnownMustAccess && AccType == MemoryAccess::MUST_WRITE) @@ -533,7 +534,7 @@ void ScopBuilder::addArrayAccess( ArrayBasePointers.insert(BaseAddress); addMemoryAccess(MemAccInst->getParent(), MemAccInst, AccType, BaseAddress, ElementType, IsAffine, AccessValue, Subscripts, Sizes, - ScopArrayInfo::MK_Array); + MemoryKind::Array); } void ScopBuilder::ensureValueWrite(Instruction *Inst) { @@ -549,7 +550,7 @@ void ScopBuilder::ensureValueWrite(Instruction *Inst) { addMemoryAccess(Inst->getParent(), Inst, MemoryAccess::MUST_WRITE, Inst, Inst->getType(), true, Inst, ArrayRef<const SCEV *>(), - ArrayRef<const SCEV *>(), ScopArrayInfo::MK_Value); + ArrayRef<const SCEV *>(), MemoryKind::Value); } void ScopBuilder::ensureValueRead(Value *V, BasicBlock *UserBB) { @@ -598,7 +599,7 @@ void ScopBuilder::ensureValueRead(Value *V, BasicBlock *UserBB) { addMemoryAccess(UserBB, nullptr, MemoryAccess::READ, V, V->getType(), true, V, ArrayRef<const SCEV *>(), ArrayRef<const SCEV *>(), - ScopArrayInfo::MK_Value); + MemoryKind::Value); if (ValueInst) ensureValueWrite(ValueInst); } @@ -610,7 +611,7 @@ void ScopBuilder::ensurePHIWrite(PHINode *PHI, BasicBlock *IncomingBlock, // and would be created later anyway. if (IsExitBlock) scop->getOrCreateScopArrayInfo(PHI, PHI->getType(), {}, - ScopArrayInfo::MK_ExitPHI); + MemoryKind::ExitPHI); ScopStmt *IncomingStmt = scop->getStmtFor(IncomingBlock); if (!IncomingStmt) @@ -630,11 +631,11 @@ void ScopBuilder::ensurePHIWrite(PHINode *PHI, BasicBlock *IncomingBlock, return; } - MemoryAccess *Acc = addMemoryAccess( - IncomingStmt->getEntryBlock(), PHI, MemoryAccess::MUST_WRITE, PHI, - PHI->getType(), true, PHI, ArrayRef<const SCEV *>(), - ArrayRef<const SCEV *>(), - IsExitBlock ? ScopArrayInfo::MK_ExitPHI : ScopArrayInfo::MK_PHI); + MemoryAccess *Acc = + addMemoryAccess(IncomingStmt->getEntryBlock(), PHI, + MemoryAccess::MUST_WRITE, PHI, PHI->getType(), true, PHI, + ArrayRef<const SCEV *>(), ArrayRef<const SCEV *>(), + IsExitBlock ? MemoryKind::ExitPHI : MemoryKind::PHI); assert(Acc); Acc->addIncoming(IncomingBlock, IncomingValue); } @@ -642,7 +643,7 @@ void ScopBuilder::ensurePHIWrite(PHINode *PHI, BasicBlock *IncomingBlock, void ScopBuilder::addPHIReadAccess(PHINode *PHI) { addMemoryAccess(PHI->getParent(), PHI, MemoryAccess::READ, PHI, PHI->getType(), true, PHI, ArrayRef<const SCEV *>(), - ArrayRef<const SCEV *>(), ScopArrayInfo::MK_PHI); + ArrayRef<const SCEV *>(), MemoryKind::PHI); } void ScopBuilder::buildScop(Region &R) { diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 3192bedea68..ed74c990f29 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -182,7 +182,7 @@ static const ScopArrayInfo *identifyBasePtrOriginSAI(Scop *S, Value *BasePtr) { return nullptr; return S->getScopArrayInfo(OriginBaseSCEVUnknown->getValue(), - ScopArrayInfo::MK_Array); + MemoryKind::Array); } ScopArrayInfo::ScopArrayInfo(Value *BasePtr, Type *ElementType, isl_ctx *Ctx, @@ -191,13 +191,14 @@ ScopArrayInfo::ScopArrayInfo(Value *BasePtr, Type *ElementType, isl_ctx *Ctx, const char *BaseName) : BasePtr(BasePtr), ElementType(ElementType), Kind(Kind), DL(DL), S(*S) { std::string BasePtrName = - BaseName ? BaseName : getIslCompatibleName("MemRef_", BasePtr, - Kind == MK_PHI ? "__phi" : ""); + BaseName ? BaseName + : getIslCompatibleName("MemRef_", BasePtr, + Kind == MemoryKind::PHI ? "__phi" : ""); Id = isl_id_alloc(Ctx, BasePtrName.c_str(), this); updateSizes(Sizes); - if (!BasePtr || Kind != MK_Array) { + if (!BasePtr || Kind != MemoryKind::Array) { BasePtrOriginSAI = nullptr; return; } @@ -884,7 +885,7 @@ MemoryAccess::MemoryAccess(ScopStmt *Stmt, Instruction *AccessInst, Type *ElementType, bool Affine, ArrayRef<const SCEV *> Subscripts, ArrayRef<const SCEV *> Sizes, Value *AccessValue, - ScopArrayInfo::MemoryKind Kind, StringRef BaseName) + MemoryKind Kind, StringRef BaseName) : Kind(Kind), AccType(AccType), RedType(RT_NONE), Statement(Stmt), InvalidDomain(nullptr), BaseAddr(BaseAddress), BaseName(BaseName), ElementType(ElementType), Sizes(Sizes.begin(), Sizes.end()), @@ -901,10 +902,9 @@ MemoryAccess::MemoryAccess(ScopStmt *Stmt, Instruction *AccessInst, MemoryAccess::MemoryAccess(ScopStmt *Stmt, AccessType AccType, __isl_take isl_map *AccRel) - : Kind(ScopArrayInfo::MemoryKind::MK_Array), AccType(AccType), - RedType(RT_NONE), Statement(Stmt), InvalidDomain(nullptr), - AccessInstruction(nullptr), IsAffine(true), AccessRelation(nullptr), - NewAccessRelation(AccRel) { + : Kind(MemoryKind::Array), AccType(AccType), RedType(RT_NONE), + Statement(Stmt), InvalidDomain(nullptr), AccessInstruction(nullptr), + IsAffine(true), AccessRelation(nullptr), NewAccessRelation(AccRel) { auto *ArrayInfoId = isl_map_get_tuple_id(NewAccessRelation, isl_dim_out); auto *SAI = ScopArrayInfo::getFromId(ArrayInfoId); Sizes.push_back(nullptr); @@ -1146,15 +1146,15 @@ void ScopStmt::buildAccessRelations() { for (MemoryAccess *Access : MemAccs) { Type *ElementType = Access->getElementType(); - ScopArrayInfo::MemoryKind Ty; + MemoryKind Ty; if (Access->isPHIKind()) - Ty = ScopArrayInfo::MK_PHI; + Ty = MemoryKind::PHI; else if (Access->isExitPHIKind()) - Ty = ScopArrayInfo::MK_ExitPHI; + Ty = MemoryKind::ExitPHI; else if (Access->isValueKind()) - Ty = ScopArrayInfo::MK_Value; + Ty = MemoryKind::Value; else - Ty = ScopArrayInfo::MK_Array; + Ty = MemoryKind::Array; auto *SAI = S.getOrCreateScopArrayInfo(Access->getBaseAddr(), ElementType, Access->Sizes, Ty); @@ -1734,12 +1734,12 @@ void ScopStmt::print(raw_ostream &OS) const { void ScopStmt::dump() const { print(dbgs()); } void ScopStmt::removeMemoryAccess(MemoryAccess *MA) { - // Remove the memory accesses from this statement - // together with all scalar accesses that were caused by it. - // MK_Value READs have no access instruction, hence would not be removed by - // this function. However, it is only used for invariant LoadInst accesses, - // its arguments are always affine, hence synthesizable, and therefore there - // are no MK_Value READ accesses to be removed. + // Remove the memory accesses from this statement together with all scalar + // accesses that were caused by it. MemoryKind::Value READs have no access + // instruction, hence would not be removed by this function. However, it is + // only used for invariant LoadInst accesses, its arguments are always affine, + // hence synthesizable, and therefore there are no MemoryKind::Value READ + // accesses to be removed. auto Predicate = [&](MemoryAccess *Acc) { return Acc->getAccessInstruction() == MA->getAccessInstruction(); }; @@ -3344,7 +3344,7 @@ void Scop::updateAccessDimensionality() { if (!Access->isArrayKind()) continue; auto &SAI = ScopArrayInfoMap[std::make_pair(Access->getBaseAddr(), - ScopArrayInfo::MK_Array)]; + MemoryKind::Array)]; if (SAI->getNumberOfDimensions() != 1) continue; unsigned DivisibleSize = SAI->getElemSizeInBytes(); @@ -3688,9 +3688,10 @@ void Scop::hoistInvariantLoads() { isl_union_map_free(Writes); } -const ScopArrayInfo *Scop::getOrCreateScopArrayInfo( - Value *BasePtr, Type *ElementType, ArrayRef<const SCEV *> Sizes, - ScopArrayInfo::MemoryKind Kind, const char *BaseName) { +const ScopArrayInfo * +Scop::getOrCreateScopArrayInfo(Value *BasePtr, Type *ElementType, + ArrayRef<const SCEV *> Sizes, MemoryKind Kind, + const char *BaseName) { assert((BasePtr || BaseName) && "BasePtr and BaseName can not be nullptr at the same time."); assert(!(BasePtr && BaseName) && "BaseName is redundant."); @@ -3723,14 +3724,12 @@ Scop::createScopArrayInfo(Type *ElementType, const std::string &BaseName, else SCEVSizes.push_back(nullptr); - auto *SAI = - getOrCreateScopArrayInfo(nullptr, ElementType, SCEVSizes, - ScopArrayInfo::MK_Array, BaseName.c_str()); + auto *SAI = getOrCreateScopArrayInfo(nullptr, ElementType, SCEVSizes, + MemoryKind::Array, BaseName.c_str()); return SAI; } -const ScopArrayInfo *Scop::getScopArrayInfo(Value *BasePtr, - ScopArrayInfo::MemoryKind Kind) { +const ScopArrayInfo *Scop::getScopArrayInfo(Value *BasePtr, MemoryKind Kind) { auto *SAI = ScopArrayInfoMap[std::make_pair(BasePtr, Kind)].get(); assert(SAI && "No ScopArrayInfo available for this base pointer"); return SAI; |

