[Refactor] Use non-const MemoryAccess base addresses

llvm-svn: 214168
This commit is contained in:
Johannes Doerfert 2014-07-29 08:36:18 +00:00
parent a87e3e49ce
commit d9e1dbd376
4 changed files with 10 additions and 7 deletions

View File

@ -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; }

View File

@ -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; }

View File

@ -307,7 +307,7 @@ Value *BlockGenerator::generateLocationAccessed(const Instruction *Inst,
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));
}

View File

@ -667,7 +667,7 @@ SetVector<Value *> ClastStmtCodeGen::getGPUValues(unsigned &OutputBytes) {
// 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