[polly] r308836 - Move MemoryAccess::id to isl++
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 22 21:08:11 PDT 2017
Author: grosser
Date: Sat Jul 22 21:08:11 2017
New Revision: 308836
URL: http://llvm.org/viewvc/llvm-project?rev=308836&view=rev
Log:
Move MemoryAccess::id to isl++
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/DependenceInfo.cpp
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/CodeGen/BlockGenerators.cpp
polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=308836&r1=308835&r2=308836&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Sat Jul 22 21:08:11 2017
@@ -500,7 +500,7 @@ private:
///
/// The identifier is unique between all memory accesses belonging to the same
/// scop statement.
- isl_id *Id;
+ isl::id Id;
/// What is modeled by this MemoryAccess.
/// @see MemoryKind
@@ -858,7 +858,7 @@ public:
Value *getOriginalBaseAddr() const { return BaseAddr; }
/// Get the detection-time base array isl_id for this access.
- __isl_give isl_id *getOriginalArrayId() const;
+ isl_id *getOriginalArrayId() const;
/// Get the base array isl_id for this access, modifiable through
/// setNewAccessRelation().
@@ -1101,7 +1101,7 @@ public:
///
/// This identifier is unique for all accesses that belong to the same scop
/// statement.
- __isl_give isl_id *getId() const;
+ isl::id getId() const;
/// Print the MemoryAccess.
///
Modified: polly/trunk/lib/Analysis/DependenceInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/DependenceInfo.cpp?rev=308836&r1=308835&r2=308836&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/DependenceInfo.cpp (original)
+++ polly/trunk/lib/Analysis/DependenceInfo.cpp Sat Jul 22 21:08:11 2017
@@ -105,7 +105,7 @@ static __isl_give isl_map *tag(__isl_tak
return tag(Relation, MA->getArrayId());
if (TagLevel == Dependences::AL_Access)
- return tag(Relation, MA->getId());
+ return tag(Relation, MA->getId().release());
// No need to tag at the statement level.
return Relation;
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=308836&r1=308835&r2=308836&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sat Jul 22 21:08:11 2017
@@ -641,7 +641,6 @@ static MemoryAccess::ReductionType getRe
}
MemoryAccess::~MemoryAccess() {
- isl_id_free(Id);
isl_set_free(InvalidDomain);
isl_map_free(AccessRelation);
isl_map_free(NewAccessRelation);
@@ -962,7 +961,7 @@ void MemoryAccess::buildAccessRelation(c
InvalidDomain = isl_set_empty(isl_set_get_space(StmtInvalidDomain));
isl_set_free(StmtInvalidDomain);
- isl_ctx *Ctx = isl_id_get_ctx(Id);
+ isl_ctx *Ctx = Id.get_ctx().release();
isl_id *BaseAddrId = SAI->getBasePtrId().release();
if (getAccessInstruction() && isa<MemIntrinsic>(getAccessInstruction())) {
@@ -1020,7 +1019,7 @@ MemoryAccess::MemoryAccess(ScopStmt *Stm
const std::string Access = TypeStrings[AccType] + utostr(Stmt->size());
std::string IdName = Stmt->getBaseName() + Access;
- Id = isl_id_alloc(Stmt->getParent()->getIslCtx(), IdName.c_str(), this);
+ Id = isl::id::alloc(Stmt->getParent()->getIslCtx(), IdName.c_str(), this);
}
MemoryAccess::MemoryAccess(ScopStmt *Stmt, AccessType AccType,
@@ -1040,7 +1039,7 @@ MemoryAccess::MemoryAccess(ScopStmt *Stm
const std::string Access = TypeStrings[AccType] + utostr(Stmt->size());
std::string IdName = Stmt->getBaseName() + Access;
- Id = isl_id_alloc(Stmt->getParent()->getIslCtx(), IdName.c_str(), this);
+ Id = isl::id::alloc(Stmt->getParent()->getIslCtx(), IdName.c_str(), this);
}
void MemoryAccess::realignParams() {
@@ -1053,7 +1052,7 @@ const std::string MemoryAccess::getReduc
return MemoryAccess::getReductionOperatorStr(getReductionType());
}
-__isl_give isl_id *MemoryAccess::getId() const { return isl_id_copy(Id); }
+isl::id MemoryAccess::getId() const { return Id; }
raw_ostream &polly::operator<<(raw_ostream &OS,
MemoryAccess::ReductionType RT) {
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=308836&r1=308835&r2=308836&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Sat Jul 22 21:08:11 2017
@@ -249,7 +249,7 @@ BlockGenerator::generateLocationAccessed
return generateLocationAccessed(
Stmt, getLoopForStmt(Stmt),
Inst.isNull() ? nullptr : Inst.getPointerOperand(), BBMap, LTS,
- NewAccesses, MA.getId(), MA.getAccessValue()->getType());
+ NewAccesses, MA.getId().release(), MA.getAccessValue()->getType());
}
Value *BlockGenerator::generateLocationAccessed(
@@ -286,7 +286,7 @@ BlockGenerator::getImplicitAddress(Memor
__isl_keep isl_id_to_ast_expr *NewAccesses) {
if (Access.isLatestArrayKind())
return generateLocationAccessed(*Access.getStatement(), L, nullptr, BBMap,
- LTS, NewAccesses, Access.getId(),
+ LTS, NewAccesses, Access.getId().release(),
Access.getAccessValue()->getType());
return getOrCreateAlloca(Access);
@@ -320,9 +320,9 @@ void BlockGenerator::generateArrayStore(
isl_id_to_ast_expr *NewAccesses) {
MemoryAccess &MA = Stmt.getArrayAccessFor(Store);
isl::set AccDom = give(isl_map_domain(MA.getAccessRelation()));
- const char *Subject = isl_id_get_name(give(MA.getId()).keep());
+ std::string Subject = MA.getId().get_name();
- generateConditionalExecution(Stmt, AccDom, Subject, [&, this]() {
+ generateConditionalExecution(Stmt, AccDom, Subject.c_str(), [&, this]() {
Value *NewPointer =
generateLocationAccessed(Stmt, Store, BBMap, LTS, NewAccesses);
Value *ValueOperand = getNewValue(Stmt, Store->getValueOperand(), BBMap,
@@ -646,37 +646,39 @@ void BlockGenerator::generateScalarStore
continue;
isl::set AccDom = give(isl_map_domain(MA->getAccessRelation()));
- const char *Subject = isl_id_get_name(give(MA->getId()).keep());
+ std::string Subject = MA->getId().get_name();
- generateConditionalExecution(Stmt, AccDom, Subject, [&, this, MA]() {
- Value *Val = MA->getAccessValue();
- if (MA->isAnyPHIKind()) {
- assert(
- MA->getIncoming().size() >= 1 &&
- "Block statements have exactly one exiting block, or multiple but "
- "with same incoming block and value");
- assert(std::all_of(MA->getIncoming().begin(), MA->getIncoming().end(),
- [&](std::pair<BasicBlock *, Value *> p) -> bool {
- return p.first == Stmt.getBasicBlock();
- }) &&
- "Incoming block must be statement's block");
- Val = MA->getIncoming()[0].second;
- }
- auto Address = getImplicitAddress(*MA, getLoopForStmt(Stmt), LTS, BBMap,
- NewAccesses);
-
- Val = getNewValue(Stmt, Val, BBMap, LTS, L);
- assert((!isa<Instruction>(Val) ||
- DT.dominates(cast<Instruction>(Val)->getParent(),
- Builder.GetInsertBlock())) &&
- "Domination violation");
- assert((!isa<Instruction>(Address) ||
- DT.dominates(cast<Instruction>(Address)->getParent(),
- Builder.GetInsertBlock())) &&
- "Domination violation");
- Builder.CreateStore(Val, Address);
+ generateConditionalExecution(
+ Stmt, AccDom, Subject.c_str(), [&, this, MA]() {
+ Value *Val = MA->getAccessValue();
+ if (MA->isAnyPHIKind()) {
+ assert(MA->getIncoming().size() >= 1 &&
+ "Block statements have exactly one exiting block, or "
+ "multiple but "
+ "with same incoming block and value");
+ assert(std::all_of(MA->getIncoming().begin(),
+ MA->getIncoming().end(),
+ [&](std::pair<BasicBlock *, Value *> p) -> bool {
+ return p.first == Stmt.getBasicBlock();
+ }) &&
+ "Incoming block must be statement's block");
+ Val = MA->getIncoming()[0].second;
+ }
+ auto Address = getImplicitAddress(*MA, getLoopForStmt(Stmt), LTS,
+ BBMap, NewAccesses);
+
+ Val = getNewValue(Stmt, Val, BBMap, LTS, L);
+ assert((!isa<Instruction>(Val) ||
+ DT.dominates(cast<Instruction>(Val)->getParent(),
+ Builder.GetInsertBlock())) &&
+ "Domination violation");
+ assert((!isa<Instruction>(Address) ||
+ DT.dominates(cast<Instruction>(Address)->getParent(),
+ Builder.GetInsertBlock())) &&
+ "Domination violation");
+ Builder.CreateStore(Val, Address);
- });
+ });
}
}
@@ -1569,22 +1571,23 @@ void RegionGenerator::generateScalarStor
continue;
isl::set AccDom = give(isl_map_domain(MA->getAccessRelation()));
- const char *Subject = isl_id_get_name(give(MA->getId()).keep());
- generateConditionalExecution(Stmt, AccDom, Subject, [&, this, MA]() {
-
- Value *NewVal = getExitScalar(MA, LTS, BBMap);
- Value *Address = getImplicitAddress(*MA, getLoopForStmt(Stmt), LTS, BBMap,
- NewAccesses);
- assert((!isa<Instruction>(NewVal) ||
- DT.dominates(cast<Instruction>(NewVal)->getParent(),
- Builder.GetInsertBlock())) &&
- "Domination violation");
- assert((!isa<Instruction>(Address) ||
- DT.dominates(cast<Instruction>(Address)->getParent(),
- Builder.GetInsertBlock())) &&
- "Domination violation");
- Builder.CreateStore(NewVal, Address);
- });
+ std::string Subject = MA->getId().get_name();
+ generateConditionalExecution(
+ Stmt, AccDom, Subject.c_str(), [&, this, MA]() {
+
+ Value *NewVal = getExitScalar(MA, LTS, BBMap);
+ Value *Address = getImplicitAddress(*MA, getLoopForStmt(Stmt), LTS,
+ BBMap, NewAccesses);
+ assert((!isa<Instruction>(NewVal) ||
+ DT.dominates(cast<Instruction>(NewVal)->getParent(),
+ Builder.GetInsertBlock())) &&
+ "Domination violation");
+ assert((!isa<Instruction>(Address) ||
+ DT.dominates(cast<Instruction>(Address)->getParent(),
+ Builder.GetInsertBlock())) &&
+ "Domination violation");
+ Builder.CreateStore(NewVal, Address);
+ });
}
}
Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=308836&r1=308835&r2=308836&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Sat Jul 22 21:08:11 2017
@@ -831,7 +831,8 @@ IslNodeBuilder::createNewAccesses(ScopSt
}
auto AccessExpr = isl_ast_build_access_from_pw_multi_aff(Build, PWAccRel);
- NewAccesses = isl_id_to_ast_expr_set(NewAccesses, MA->getId(), AccessExpr);
+ NewAccesses =
+ isl_id_to_ast_expr_set(NewAccesses, MA->getId().release(), AccessExpr);
}
return NewAccesses;
@@ -884,9 +885,10 @@ void IslNodeBuilder::generateCopyStmt(
"Accesses use the same data type");
assert((*ReadAccess)->isArrayKind() && (*WriteAccess)->isArrayKind());
auto *AccessExpr =
- isl_id_to_ast_expr_get(NewAccesses, (*ReadAccess)->getId());
+ isl_id_to_ast_expr_get(NewAccesses, (*ReadAccess)->getId().release());
auto *LoadValue = ExprBuilder.create(AccessExpr);
- AccessExpr = isl_id_to_ast_expr_get(NewAccesses, (*WriteAccess)->getId());
+ AccessExpr =
+ isl_id_to_ast_expr_get(NewAccesses, (*WriteAccess)->getId().release());
auto *StoreAddr = ExprBuilder.createAccessAddress(AccessExpr);
Builder.CreateStore(LoadValue, StoreAddr);
}
Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=308836&r1=308835&r2=308836&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Sat Jul 22 21:08:11 2017
@@ -275,7 +275,7 @@ static __isl_give isl_id_to_ast_expr *po
for (MemoryAccess *Acc : *Stmt) {
isl_map *AddrFunc = Acc->getAddressFunction();
AddrFunc = isl_map_intersect_domain(AddrFunc, Stmt->getDomain());
- isl_id *RefId = Acc->getId();
+ isl_id *RefId = Acc->getId().release();
isl_pw_multi_aff *PMA = isl_pw_multi_aff_from_map(AddrFunc);
isl_multi_pw_aff *MPA = isl_multi_pw_aff_from_pw_multi_aff(PMA);
MPA = isl_multi_pw_aff_coalesce(MPA);
@@ -2369,7 +2369,8 @@ public:
isl_space *Space = isl_map_get_space(Relation);
Space = isl_space_range(Space);
Space = isl_space_from_range(Space);
- Space = isl_space_set_tuple_id(Space, isl_dim_in, Acc->getId());
+ Space =
+ isl_space_set_tuple_id(Space, isl_dim_in, Acc->getId().release());
isl_map *Universe = isl_map_universe(Space);
Relation = isl_map_domain_product(Relation, Universe);
Accesses = isl_union_map_add_map(Accesses, Relation);
@@ -2510,12 +2511,12 @@ public:
isl_space *Space = isl_map_get_space(Access->access);
Space = isl_space_range(Space);
Space = isl_space_from_range(Space);
- Space = isl_space_set_tuple_id(Space, isl_dim_in, Acc->getId());
+ Space = isl_space_set_tuple_id(Space, isl_dim_in, Acc->getId().release());
isl_map *Universe = isl_map_universe(Space);
Access->tagged_access =
isl_map_domain_product(Acc->getAccessRelation(), Universe);
Access->exact_write = !Acc->isMayWrite();
- Access->ref_id = Acc->getId();
+ Access->ref_id = Acc->getId().release();
Access->next = Accesses;
Access->n_index = Acc->getScopArrayInfo()->getNumberOfDimensions();
Accesses = Access;
More information about the llvm-commits
mailing list