From d9e1dbd3765ad465b53d669d77223e0ccfcfa47b Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Tue, 29 Jul 2014 08:36:18 +0000 Subject: [PATCH] [Refactor] Use non-const MemoryAccess base addresses llvm-svn: 214168 --- polly/include/polly/ScopInfo.h | 7 +++++-- polly/include/polly/TempScopInfo.h | 6 +++--- polly/lib/CodeGen/BlockGenerators.cpp | 2 +- polly/lib/CodeGen/CodeGeneration.cpp | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h index 5be9650..e4b9123 100644 --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -103,7 +103,9 @@ private: isl_map *AccessRelation; enum AccessType Type; - const Value *BaseAddr; + /// @brief The base address (e.g., A for A[i+j]). + Value *BaseAddr; + std::string BaseName; isl_basic_map *createBasicAccessMap(ScopStmt *Statement); ScopStmt *Statement; @@ -178,7 +180,8 @@ public: /// @brief Get an isl string representing this access function. std::string getAccessRelationStr() const; - const Value *getBaseAddr() const { return BaseAddr; } + /// @brief Get the base address of this access (e.g. A for A[i+j]). + Value *getBaseAddr() const { return BaseAddr; } const std::string &getBaseName() const { return BaseName; } diff --git a/polly/include/polly/TempScopInfo.h b/polly/include/polly/TempScopInfo.h index 17fa751..e67ba40 100644 --- a/polly/include/polly/TempScopInfo.h +++ b/polly/include/polly/TempScopInfo.h @@ -35,7 +35,7 @@ extern bool PollyDelinearize; /// @brief A memory access described by a SCEV expression and the access type. class IRAccess { public: - const Value *BaseAddress; + Value *BaseAddress; const SCEV *Offset; @@ -53,7 +53,7 @@ private: public: SmallVector Subscripts, Sizes; - explicit IRAccess(TypeKind Type, const Value *BaseAddress, const SCEV *Offset, + explicit IRAccess(TypeKind Type, Value *BaseAddress, const SCEV *Offset, unsigned elemBytes, bool Affine, SmallVector Subscripts, SmallVector Sizes) @@ -62,7 +62,7 @@ public: enum TypeKind getType() const { return Type; } - const Value *getBase() const { return BaseAddress; } + Value *getBase() const { return BaseAddress; } const SCEV *getOffset() const { return Offset; } diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp index 3cfdb4b..7284e24 100644 --- a/polly/lib/CodeGen/BlockGenerators.cpp +++ b/polly/lib/CodeGen/BlockGenerators.cpp @@ -307,7 +307,7 @@ Value *BlockGenerator::generateLocationAccessed(const Instruction *Inst, NewPointer = getNewValue(Pointer, BBMap, GlobalMap, LTS, getLoopForInst(Inst)); } else { - Value *BaseAddress = const_cast(Access.getBaseAddr()); + Value *BaseAddress = Access.getBaseAddr(); NewPointer = getNewAccessOperand(NewAccessRelation, BaseAddress, BBMap, GlobalMap, LTS, getLoopForInst(Inst)); } diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp index 56b2ab3..6b61927 100644 --- a/polly/lib/CodeGen/CodeGeneration.cpp +++ b/polly/lib/CodeGen/CodeGeneration.cpp @@ -667,7 +667,7 @@ SetVector ClastStmtCodeGen::getGPUValues(unsigned &OutputBytes) { // Record the memory reference base addresses. for (ScopStmt *Stmt : *S) { for (MemoryAccess *MA : *Stmt) { - Value *BaseAddr = const_cast(MA->getBaseAddr()); + Value *BaseAddr = MA->getBaseAddr(); Values.insert((BaseAddr)); // FIXME: we assume that there is one and only one array to be written -- 2.7.4