summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2011-11-09 22:35:09 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2011-11-09 22:35:09 +0000
commite4e2f7b16ec93f680f33bca5adada43c7d287547 (patch)
tree5b4d7cf1d3862a8c29ab01b8eb12e339126e6f80
parent499f0a48d86916fb7d79b5f17e4ed54aaf0403dd (diff)
downloadbcm5719-llvm-e4e2f7b16ec93f680f33bca5adada43c7d287547.tar.gz
bcm5719-llvm-e4e2f7b16ec93f680f33bca5adada43c7d287547.zip
TempScop: Rename SCEVAffFunc to IRAccess
The SCEVAffFunc is now only used to express memory accesses. Give it a proper name and rework the class such that this is obvious. llvm-svn: 144231
-rwxr-xr-xpolly/include/polly/ScopInfo.h15
-rwxr-xr-xpolly/include/polly/TempScopInfo.h46
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp8
-rw-r--r--polly/lib/Analysis/TempScopInfo.cpp10
4 files changed, 32 insertions, 47 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index a8097c78c63..5f167089108 100755
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -48,6 +48,7 @@ struct isl_constraint;
namespace polly {
+class IRAccess;
class Scop;
class ScopStmt;
class ScopInfo;
@@ -103,17 +104,17 @@ private:
/// Updated access relation read from JSCOP file.
isl_map *newAccessRelation;
public:
- // @brief Create an affine memory access.
+ // @brief Create a memory access from an access in LLVM-IR.
//
- // @param AffFunc The access function.
- // @param Statement The Statement that contains this access.
+ // @param Access The memory access.
+ // @param Statement The statement that contains the access.
// @param SE The ScalarEvolution analysis.
- MemoryAccess(const SCEVAffFunc &AffFunc, ScopStmt *Statement);
+ MemoryAccess(const IRAccess &Access, ScopStmt *Statement);
- // @brief Create a read all access.
+ // @brief Create a memory access that reads a complete memory object.
//
- // @param BaseAddress The base address of the memory accessed.
- // @param Statement The Statement that contains this access.
+ // @param BaseAddress The base address of the memory object.
+ // @param Statement The statement that contains this access.
MemoryAccess(const Value *BaseAddress, ScopStmt *Statement);
~MemoryAccess();
diff --git a/polly/include/polly/TempScopInfo.h b/polly/include/polly/TempScopInfo.h
index aaacc0cc5a7..0178937d6f0 100755
--- a/polly/include/polly/TempScopInfo.h
+++ b/polly/include/polly/TempScopInfo.h
@@ -32,46 +32,30 @@ namespace polly {
class MayAliasSetInfo;
//===---------------------------------------------------------------------===//
-/// @brief Affine function represent in llvm SCEV expressions.
-///
-/// A helper class for collect affine function information
-class SCEVAffFunc {
+/// @brief A memory access described by a SCEV expression and the access type.
+class IRAccess {
public:
- // The scalar evolution expression from which we derived this affine
- // expression.
- //
- // We will use it to directly translation from scalar expressions to the
- // corresponding isl objects. As soon as this finished, most of SCEVAffFunc
- // can be removed.
- const SCEV *OriginalSCEV;
+ // The SCEV of this memory access.
+ const SCEV *Scev;
// The type of the scev affine function
- enum SCEVAffFuncType {
- ReadMem,
- WriteMem
- };
+ enum TypeKind { READ, WRITE };
private:
- // The base address of the address SCEV, if the Value is a pointer, this is
- // an array access, otherwise, this is a value access.
- // And the Write/Read modifier
- unsigned ElemBytes : 28;
- SCEVAffFuncType FuncType : 3;
+ unsigned ElemBytes;
+ TypeKind Type;
public:
- /// @brief Create a new SCEV affine function with memory access type or
- /// condition type
- explicit SCEVAffFunc(SCEVAffFuncType Type, const SCEV *OriginalSCEV,
- unsigned elemBytes = 0)
- : OriginalSCEV(OriginalSCEV), ElemBytes(elemBytes), FuncType(Type) {}
+ explicit IRAccess (TypeKind Type, const SCEV *Scev, unsigned elemBytes)
+ : Scev(Scev), ElemBytes(elemBytes), Type(Type) {}
- enum SCEVAffFuncType getType() const { return FuncType; }
+ enum TypeKind getType() const { return Type; }
- unsigned getElemSizeInBytes() const {
- return ElemBytes;
- }
+ const SCEV *getSCEV() const { return Scev; }
+
+ unsigned getElemSizeInBytes() const { return ElemBytes; }
- bool isRead() const { return FuncType == ReadMem; }
+ bool isRead() const { return Type == READ; }
};
class Comparison {
@@ -108,7 +92,7 @@ typedef std::map<const Loop*, const SCEV*> LoopBoundMapType;
/// Mapping BBs to its condition constrains
typedef std::map<const BasicBlock*, BBCond> BBCondMapType;
-typedef std::vector<std::pair<SCEVAffFunc, Instruction*> > AccFuncSetType;
+typedef std::vector<std::pair<IRAccess, Instruction*> > AccFuncSetType;
typedef std::map<const BasicBlock*, AccFuncSetType> AccFuncMapType;
//===---------------------------------------------------------------------===//
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 11c1dbb7f3f..49ff2329d0b 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -324,13 +324,13 @@ isl_basic_map *MemoryAccess::createBasicAccessMap(ScopStmt *Statement) {
return isl_basic_map_universe(Space);
}
-MemoryAccess::MemoryAccess(const SCEVAffFunc &AffFunc, ScopStmt *Statement) {
+MemoryAccess::MemoryAccess(const IRAccess &Access, ScopStmt *Statement) {
newAccessRelation = NULL;
- Type = AffFunc.isRead() ? Read : Write;
+ Type = Access.isRead() ? Read : Write;
statement = Statement;
Value *TmpBaseAddress = NULL;
- isl_pw_aff *Affine = SCEVAffinator::getPwAff(Statement, AffFunc.OriginalSCEV,
+ isl_pw_aff *Affine = SCEVAffinator::getPwAff(Statement, Access.getSCEV(),
&TmpBaseAddress);
BaseAddr = TmpBaseAddress;
@@ -345,7 +345,7 @@ MemoryAccess::MemoryAccess(const SCEVAffFunc &AffFunc, ScopStmt *Statement) {
// again.
isl_int v;
isl_int_init(v);
- isl_int_set_si(v, AffFunc.getElemSizeInBytes());
+ isl_int_set_si(v, Access.getElemSizeInBytes());
Affine = isl_pw_aff_scale_down(Affine, v);
isl_int_clear(v);
diff --git a/polly/lib/Analysis/TempScopInfo.cpp b/polly/lib/Analysis/TempScopInfo.cpp
index ee599f0fa58..07c5325cff8 100644
--- a/polly/lib/Analysis/TempScopInfo.cpp
+++ b/polly/lib/Analysis/TempScopInfo.cpp
@@ -87,20 +87,20 @@ void TempScopInfo::buildAccessFunctions(Region &R, ParamSetType &Parameter,
Instruction &Inst = *I;
if (isa<LoadInst>(&Inst) || isa<StoreInst>(&Inst)) {
unsigned Size;
- enum SCEVAffFunc::SCEVAffFuncType Type;
+ enum IRAccess::TypeKind Type;
if (LoadInst *Load = dyn_cast<LoadInst>(&Inst)) {
Size = TD->getTypeStoreSize(Load->getType());
- Type = SCEVAffFunc::ReadMem;
+ Type = IRAccess::READ;
} else {
StoreInst *Store = cast<StoreInst>(&Inst);
Size = TD->getTypeStoreSize(Store->getValueOperand()->getType());
- Type = SCEVAffFunc::WriteMem;
+ Type = IRAccess::WRITE;
}
const SCEV *AccessFunction = SE->getSCEV(getPointerOperand(Inst));
- Functions.push_back(
- std::make_pair(SCEVAffFunc(Type, AccessFunction, Size), &Inst));
+ Functions.push_back(std::make_pair(IRAccess(Type, AccessFunction, Size),
+ &Inst));
}
}
OpenPOWER on IntegriCloud