[polly] r214168 - [Refactor] Use non-const MemoryAccess base addresses

Johannes Doerfert jdoerfert at codeaurora.org
Tue Jul 29 01:36:18 PDT 2014


Author: jdoerfert
Date: Tue Jul 29 03:36:18 2014
New Revision: 214168

URL: http://llvm.org/viewvc/llvm-project?rev=214168&view=rev
Log:
[Refactor] Use non-const MemoryAccess base addresses

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/include/polly/TempScopInfo.h
    polly/trunk/lib/CodeGen/BlockGenerators.cpp
    polly/trunk/lib/CodeGen/CodeGeneration.cpp

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=214168&r1=214167&r2=214168&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Tue Jul 29 03:36:18 2014
@@ -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; }
 

Modified: polly/trunk/include/polly/TempScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/TempScopInfo.h?rev=214168&r1=214167&r2=214168&view=diff
==============================================================================
--- polly/trunk/include/polly/TempScopInfo.h (original)
+++ polly/trunk/include/polly/TempScopInfo.h Tue Jul 29 03:36:18 2014
@@ -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<const SCEV *, 4> 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<const SCEV *, 4> Subscripts,
                     SmallVector<const SCEV *, 4> 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; }
 

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=214168&r1=214167&r2=214168&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Tue Jul 29 03:36:18 2014
@@ -307,7 +307,7 @@ Value *BlockGenerator::generateLocationA
     NewPointer =
         getNewValue(Pointer, BBMap, GlobalMap, LTS, getLoopForInst(Inst));
   } else {
-    Value *BaseAddress = const_cast<Value *>(Access.getBaseAddr());
+    Value *BaseAddress = Access.getBaseAddr();
     NewPointer = getNewAccessOperand(NewAccessRelation, BaseAddress, BBMap,
                                      GlobalMap, LTS, getLoopForInst(Inst));
   }

Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=214168&r1=214167&r2=214168&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Tue Jul 29 03:36:18 2014
@@ -667,7 +667,7 @@ SetVector<Value *> ClastStmtCodeGen::get
   // Record the memory reference base addresses.
   for (ScopStmt *Stmt : *S) {
     for (MemoryAccess *MA : *Stmt) {
-      Value *BaseAddr = const_cast<Value *>(MA->getBaseAddr());
+      Value *BaseAddr = MA->getBaseAddr();
       Values.insert((BaseAddr));
 
       // FIXME: we assume that there is one and only one array to be written





More information about the llvm-commits mailing list