summaryrefslogtreecommitdiff
path: root/include/llvm/iMemory.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-08-22 22:47:47 +0000
committerChris Lattner <sabre@nondot.org>2002-08-22 22:47:47 +0000
commitf150b9d984c7a8e3cf7c77bb676731e7abf8359f (patch)
treeabba2b86ee54a885b5f8de5e503ebc400de2b017 /include/llvm/iMemory.h
parentf9355f636b6a7d59993081766dd0481bd08f545d (diff)
downloadllvm-f150b9d984c7a8e3cf7c77bb676731e7abf8359f.tar.gz
llvm-f150b9d984c7a8e3cf7c77bb676731e7abf8359f.tar.bz2
llvm-f150b9d984c7a8e3cf7c77bb676731e7abf8359f.tar.xz
Load and Store now no longer derive from MemAccessInst. Indexing a load or
store is not possible anymore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3482 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/iMemory.h')
-rw-r--r--include/llvm/iMemory.h34
1 files changed, 16 insertions, 18 deletions
diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h
index 3b4a18bed0..fd502315c4 100644
--- a/include/llvm/iMemory.h
+++ b/include/llvm/iMemory.h
@@ -131,8 +131,7 @@ struct FreeInst : public Instruction {
// MemAccessInst Class
//===----------------------------------------------------------------------===//
//
-// MemAccessInst - Common base class of LoadInst, StoreInst, and
-// GetElementPtrInst...
+// MemAccessInst - Common base class of GetElementPtrInst...
//
class MemAccessInst : public Instruction {
protected:
@@ -184,8 +183,7 @@ public:
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const MemAccessInst *) { return true; }
static inline bool classof(const Instruction *I) {
- return I->getOpcode() == Load || I->getOpcode() == Store ||
- I->getOpcode() == GetElementPtr;
+ return I->getOpcode() == GetElementPtr;
}
static inline bool classof(const Value *V) {
return isa<Instruction>(V) && classof(cast<Instruction>(V));
@@ -197,19 +195,18 @@ public:
// LoadInst Class
//===----------------------------------------------------------------------===//
-class LoadInst : public MemAccessInst {
- LoadInst(const LoadInst &LI) : MemAccessInst(LI.getType(), Load) {
- Operands.reserve(LI.Operands.size());
- for (unsigned i = 0, E = LI.Operands.size(); i != E; ++i)
- Operands.push_back(Use(LI.Operands[i], this));
+class LoadInst : public Instruction {
+ LoadInst(const LoadInst &LI) : Instruction(LI.getType(), Load) {
+ Operands.reserve(1);
+ Operands.push_back(Use(LI.Operands[0], this));
}
public:
- LoadInst(Value *Ptr, const std::vector<Value*> &Ix, const std::string & = "");
LoadInst(Value *Ptr, const std::string &Name = "");
virtual Instruction *clone() const { return new LoadInst(*this); }
- virtual unsigned getFirstIndexOperandNumber() const { return 1; }
+ Value *getPointerOperand() { return getOperand(0); }
+ const Value *getPointerOperand() const { return getOperand(0); }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const LoadInst *) { return true; }
@@ -226,19 +223,20 @@ public:
// StoreInst Class
//===----------------------------------------------------------------------===//
-class StoreInst : public MemAccessInst {
- StoreInst(const StoreInst &SI) : MemAccessInst(SI.getType(), Store) {
- Operands.reserve(SI.Operands.size());
- for (unsigned i = 0, E = SI.Operands.size(); i != E; ++i)
- Operands.push_back(Use(SI.Operands[i], this));
+class StoreInst : public Instruction {
+ StoreInst(const StoreInst &SI) : Instruction(SI.getType(), Store) {
+ Operands.reserve(2);
+ Operands.push_back(Use(SI.Operands[0], this));
+ Operands.push_back(Use(SI.Operands[1], this));
}
public:
- StoreInst(Value *Val, Value *Ptr, const std::vector<Value*> &Idx);
StoreInst(Value *Val, Value *Ptr);
virtual Instruction *clone() const { return new StoreInst(*this); }
virtual bool hasSideEffects() const { return true; }
- virtual unsigned getFirstIndexOperandNumber() const { return 2; }
+
+ Value *getPointerOperand() { return getOperand(1); }
+ const Value *getPointerOperand() const { return getOperand(1); }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const StoreInst *) { return true; }