[polly] r214169 - Added base array id's to Memory Accesses
Johannes Doerfert
jdoerfert at codeaurora.org
Tue Jul 29 01:37:55 PDT 2014
Author: jdoerfert
Date: Tue Jul 29 03:37:55 2014
New Revision: 214169
URL: http://llvm.org/viewvc/llvm-project?rev=214169&view=rev
Log:
Added base array id's to Memory Accesses
These id's allow us to cread id -> array base value mappings.
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=214169&r1=214168&r2=214169&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Tue Jul 29 03:37:55 2014
@@ -183,6 +183,9 @@ public:
/// @brief Get the base address of this access (e.g. A for A[i+j]).
Value *getBaseAddr() const { return BaseAddr; }
+ /// @brief Get the base array isl_id for this access.
+ __isl_give isl_id *getArrayId() const;
+
const std::string &getBaseName() const { return BaseName; }
const Instruction *getAccessInstruction() const { return Inst; }
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=214169&r1=214168&r2=214169&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Tue Jul 29 03:37:55 2014
@@ -309,6 +309,10 @@ MemoryAccess::~MemoryAccess() {
isl_map_free(newAccessRelation);
}
+isl_id *MemoryAccess::getArrayId() const {
+ return isl_map_get_tuple_id(AccessRelation, isl_dim_out);
+}
+
isl_map *MemoryAccess::getAccessRelation() const {
return isl_map_copy(AccessRelation);
}
@@ -327,7 +331,6 @@ isl_map *MemoryAccess::getNewAccessRelat
isl_basic_map *MemoryAccess::createBasicAccessMap(ScopStmt *Statement) {
isl_space *Space = isl_space_set_alloc(Statement->getIslCtx(), 0, 1);
- Space = isl_space_set_tuple_name(Space, isl_dim_set, getBaseName().c_str());
Space = isl_space_align_params(Space, Statement->getDomainSpace());
return isl_basic_map_from_domain_and_range(
@@ -399,8 +402,10 @@ MemoryAccess::MemoryAccess(const IRAcces
ScopStmt *Statement)
: Statement(Statement), Inst(AccInst), newAccessRelation(nullptr) {
+ isl_ctx *Ctx = Statement->getIslCtx();
BaseAddr = Access.getBase();
BaseName = getIslCompatibleName("MemRef_", getBaseAddr(), "");
+ isl_id *BaseAddrId = isl_id_alloc(Ctx, getBaseName().c_str(), nullptr);
if (!Access.isAffine()) {
// We overapproximate non-affine accesses with a possible access to the
@@ -408,14 +413,15 @@ MemoryAccess::MemoryAccess(const IRAcces
// access must or may happen. However, for write accesses it is important to
// differentiate between writes that must happen and writes that may happen.
AccessRelation = isl_map_from_basic_map(createBasicAccessMap(Statement));
+ AccessRelation =
+ isl_map_set_tuple_id(AccessRelation, isl_dim_out, BaseAddrId);
Type = Access.isRead() ? READ : MAY_WRITE;
return;
}
Type = Access.isRead() ? READ : MUST_WRITE;
- isl_space *Space = isl_space_alloc(Statement->getIslCtx(), 0,
- Statement->getNumIterators(), 0);
+ isl_space *Space = isl_space_alloc(Ctx, 0, Statement->getNumIterators(), 0);
AccessRelation = isl_map_universe(Space);
for (int i = 0, Size = Access.Subscripts.size(); i < Size; ++i) {
@@ -431,9 +437,7 @@ MemoryAccess::MemoryAccess(const IRAcces
// two subsequent values of 'i' index two values that are stored next to
// each other in memory. By this division we make this characteristic
// obvious again.
- isl_val *v;
- v = isl_val_int_from_si(isl_pw_aff_get_ctx(Affine),
- Access.getElemSizeInBytes());
+ isl_val *v = isl_val_int_from_si(Ctx, Access.getElemSizeInBytes());
Affine = isl_pw_aff_scale_down_val(Affine, v);
}
@@ -445,10 +449,11 @@ MemoryAccess::MemoryAccess(const IRAcces
Space = Statement->getDomainSpace();
AccessRelation = isl_map_set_tuple_id(
AccessRelation, isl_dim_in, isl_space_get_tuple_id(Space, isl_dim_set));
- isl_space_free(Space);
- AccessRelation = isl_map_set_tuple_name(AccessRelation, isl_dim_out,
- getBaseName().c_str());
+ AccessRelation =
+ isl_map_set_tuple_id(AccessRelation, isl_dim_out, BaseAddrId);
+
assumeNoOutOfBound(Access);
+ isl_space_free(Space);
}
void MemoryAccess::realignParams() {
More information about the llvm-commits
mailing list