diff options
author | Chris Lattner <sabre@nondot.org> | 2001-11-14 11:27:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-11-14 11:27:58 +0000 |
commit | 65ea171409e8c25db20806fb09e820f46e3d11a2 (patch) | |
tree | 081a79420f9555f0962134e7cd6d1fd2696c93db /include | |
parent | c2ae4f6d3b72d153272b244fc1c8701ee89cbddb (diff) | |
download | external_llvm-65ea171409e8c25db20806fb09e820f46e3d11a2.zip external_llvm-65ea171409e8c25db20806fb09e820f46e3d11a2.tar.gz external_llvm-65ea171409e8c25db20806fb09e820f46e3d11a2.tar.bz2 |
Remove much cruft from the MemAccessInst instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1298 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/iMemory.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h index 2951868..1dbc1db 100644 --- a/include/llvm/iMemory.h +++ b/include/llvm/iMemory.h @@ -182,16 +182,19 @@ public: const vector<ConstPoolVal*> &Indices, bool AllowStructLeaf = false); - const vector<ConstPoolVal*> &getIndices() const { return indexVec; } - - inline bool hasIndices() const { return !indexVec.empty(); } - - virtual Value *getPtrOperand() = 0; + Value *getPointerOperand() { + return getOperand(getFirstIndexOperandNumber()-1); + } const Value *getPointerOperand() const { - return ((MemAccessInst*)this)->getPtrOperand(); + return getOperand(getFirstIndexOperandNumber()-1); } - virtual int getFirstOffsetIdx() const = 0; + virtual unsigned getFirstIndexOperandNumber() const = 0; + + const vector<ConstPoolVal*> &getIndices() const { return indexVec; } + inline bool hasIndices() const { + return getNumOperands() <= getFirstIndexOperandNumber(); + } }; @@ -213,8 +216,8 @@ public: virtual Instruction *clone() const { return new LoadInst(*this); } virtual const char *getOpcodeName() const { return "load"; } - virtual Value *getPtrOperand() { return this->getOperand(0); } - virtual int getFirstOffsetIdx() const { return (this->getNumOperands() > 1)? 1 : -1; } + + virtual unsigned getFirstIndexOperandNumber() const { return 1; } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const LoadInst *) { return true; } @@ -247,8 +250,7 @@ public: virtual const char *getOpcodeName() const { return "store"; } virtual bool hasSideEffects() const { return true; } - virtual Value *getPtrOperand() { return this->getOperand(1); } - virtual int getFirstOffsetIdx() const { return (this->getNumOperands() > 2)? 2 : -1;} + virtual unsigned getFirstIndexOperandNumber() const { return 2; } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const StoreInst *) { return true; } @@ -277,8 +279,7 @@ public: const string &Name = ""); virtual Instruction *clone() const { return new GetElementPtrInst(*this); } virtual const char *getOpcodeName() const { return "getelementptr"; } - virtual Value *getPtrOperand() { return this->getOperand(0); } - virtual int getFirstOffsetIdx() const { return (this->getNumOperands() > 1)? 1 : -1;} + virtual unsigned getFirstIndexOperandNumber() const { return 1; } inline bool isArraySelector() const { return !isStructSelector(); } bool isStructSelector() const; |