diff options
| author | Hongbin Zheng <etherzhhb@gmail.com> | 2013-06-29 06:31:39 +0000 |
|---|---|---|
| committer | Hongbin Zheng <etherzhhb@gmail.com> | 2013-06-29 06:31:39 +0000 |
| commit | b5f24a665ea717badb9e9574c78c111cff3ec656 (patch) | |
| tree | 9e3ed879dca9f21b92a0d625aac1af2a5e35508c | |
| parent | f4adf0fc44c9759a23f920863d9500ab9f281b69 (diff) | |
| download | bcm5719-llvm-b5f24a665ea717badb9e9574c78c111cff3ec656.tar.gz bcm5719-llvm-b5f24a665ea717badb9e9574c78c111cff3ec656.zip | |
Refactor memory access getting code in ScopStmt.
1. Do not allow creating new memory access record in the InstructionToAccess map
on the fly in function getAccessFor.
2. Do not allow user to modify the memory accesses returned by getAccessFor
during the code generation process.
llvm-svn: 185253
| -rwxr-xr-x | polly/include/polly/ScopInfo.h | 6 | ||||
| -rw-r--r-- | polly/lib/CodeGen/BlockGenerators.cpp | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h index d7f608b5804..9fc370ce5ce 100755 --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -340,8 +340,10 @@ public: /// @return The BasicBlock represented by this ScopStmt. BasicBlock *getBasicBlock() const { return BB; } - MemoryAccess &getAccessFor(const Instruction *Inst) { - return *InstructionToAccess[Inst]; + const MemoryAccess &getAccessFor(const Instruction *Inst) const { + MemoryAccess *A = lookupAccessFor(Inst); + assert(A && "Cannot get memory access because it does not exist!"); + return *A; } MemoryAccess *lookupAccessFor(const Instruction *Inst) const { diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp index c5cd612aa40..a89de743a2c 100644 --- a/polly/lib/CodeGen/BlockGenerators.cpp +++ b/polly/lib/CodeGen/BlockGenerators.cpp @@ -281,7 +281,7 @@ Value *BlockGenerator::generateLocationAccessed(const Instruction *Inst, ValueMapT &BBMap, ValueMapT &GlobalMap, LoopToScevMapT <S) { - MemoryAccess &Access = Statement.getAccessFor(Inst); + const MemoryAccess &Access = Statement.getAccessFor(Inst); isl_map *CurrentAccessRelation = Access.getAccessRelation(); isl_map *NewAccessRelation = Access.getNewAccessRelation(); @@ -494,7 +494,7 @@ void VectorBlockGenerator::generateLoad(const LoadInst *Load, return; } - MemoryAccess &Access = Statement.getAccessFor(Load); + const MemoryAccess &Access = Statement.getAccessFor(Load); Value *NewLoad; if (Access.isStrideZero(isl_map_copy(Schedule))) @@ -542,7 +542,7 @@ void VectorBlockGenerator::copyStore(const StoreInst *Store, VectorValueMapT &ScalarMaps) { int VectorWidth = getVectorWidth(); - MemoryAccess &Access = Statement.getAccessFor(Store); + const MemoryAccess &Access = Statement.getAccessFor(Store); const Value *Pointer = Store->getPointerOperand(); Value *Vector = getVectorValue(Store->getValueOperand(), VectorMap, |

