X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FiMemory.h;h=09c94a2c77db62203120acfa34f89a2d66a5b43a;hb=9fff7e194a2d8aa3abe92efa506b1fbe83583f53;hp=e2a1e1bd64e46fd061f0316c8b4ee0700b6bf046;hpb=3a8b0f00e6d23ae57fee93f7f2c18fe8e6b45c3c;p=oota-llvm.git diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h index e2a1e1bd64e..09c94a2c77d 100644 --- a/include/llvm/iMemory.h +++ b/include/llvm/iMemory.h @@ -63,13 +63,15 @@ public: // MallocInst Class //===----------------------------------------------------------------------===// -struct MallocInst : public AllocationInst { +class MallocInst : public AllocationInst { + MallocInst(const MallocInst &MI); +public: MallocInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "", Instruction *InsertBefore = 0) : AllocationInst(Ty, ArraySize, Malloc, Name, InsertBefore) {} virtual Instruction *clone() const { - return new MallocInst((Type*)getType(), (Value*)Operands[0].get()); + return new MallocInst(*this); } // Methods for support type inquiry through isa, cast, and dyn_cast: @@ -87,13 +89,15 @@ struct MallocInst : public AllocationInst { // AllocaInst Class //===----------------------------------------------------------------------===// -struct AllocaInst : public AllocationInst { +class AllocaInst : public AllocationInst { + AllocaInst(const AllocaInst &); +public: AllocaInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "", Instruction *InsertBefore = 0) : AllocationInst(Ty, ArraySize, Alloca, Name, InsertBefore) {} virtual Instruction *clone() const { - return new AllocaInst((Type*)getType(), (Value*)Operands[0].get()); + return new AllocaInst(*this); } // Methods for support type inquiry through isa, cast, and dyn_cast: @@ -116,7 +120,7 @@ struct FreeInst : public Instruction { virtual Instruction *clone() const { return new FreeInst(Operands[0]); } - virtual bool hasSideEffects() const { return true; } + virtual bool mayWriteToMemory() const { return true; } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const FreeInst *) { return true; } @@ -146,6 +150,7 @@ public: Value *getPointerOperand() { return getOperand(0); } const Value *getPointerOperand() const { return getOperand(0); } + static unsigned getPointerOperandIndex() { return 0U; } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const LoadInst *) { return true; } @@ -172,10 +177,11 @@ public: StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore = 0); virtual Instruction *clone() const { return new StoreInst(*this); } - virtual bool hasSideEffects() const { return true; } + virtual bool mayWriteToMemory() const { return true; } Value *getPointerOperand() { return getOperand(1); } const Value *getPointerOperand() const { return getOperand(1); } + static unsigned getPointerOperandIndex() { return 1U; } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const StoreInst *) { return true; } @@ -234,7 +240,10 @@ public: const Value *getPointerOperand() const { return getOperand(0); } - + static unsigned getPointerOperandIndex() { + return 0U; // get index for modifying correct operand + } + inline unsigned getNumIndices() const { // Note: always non-negative return getNumOperands() - 1; }