[llvm-commits] [polly] r144231 - in /polly/trunk: include/polly/ScopInfo.h include/polly/TempScopInfo.h lib/Analysis/ScopInfo.cpp lib/Analysis/TempScopInfo.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Wed Nov 9 14:35:10 PST 2011
Author: grosser
Date: Wed Nov 9 16:35:09 2011
New Revision: 144231
URL: http://llvm.org/viewvc/llvm-project?rev=144231&view=rev
Log:
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.
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/include/polly/TempScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/Analysis/TempScopInfo.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=144231&r1=144230&r2=144231&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Wed Nov 9 16:35:09 2011
@@ -48,6 +48,7 @@
namespace polly {
+class IRAccess;
class Scop;
class ScopStmt;
class ScopInfo;
@@ -103,17 +104,17 @@
/// 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();
Modified: polly/trunk/include/polly/TempScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/TempScopInfo.h?rev=144231&r1=144230&r2=144231&view=diff
==============================================================================
--- polly/trunk/include/polly/TempScopInfo.h (original)
+++ polly/trunk/include/polly/TempScopInfo.h Wed Nov 9 16:35:09 2011
@@ -32,46 +32,30 @@
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 @@
/// 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;
//===---------------------------------------------------------------------===//
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=144231&r1=144230&r2=144231&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Nov 9 16:35:09 2011
@@ -324,13 +324,13 @@
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 @@
// 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);
Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=144231&r1=144230&r2=144231&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Wed Nov 9 16:35:09 2011
@@ -87,20 +87,20 @@
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));
}
}
More information about the llvm-commits
mailing list