mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
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
This commit is contained in:
parent
f9355f636b
commit
f150b9d984
@ -131,8 +131,7 @@ struct FreeInst : public Instruction {
|
|||||||
// MemAccessInst Class
|
// MemAccessInst Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// MemAccessInst - Common base class of LoadInst, StoreInst, and
|
// MemAccessInst - Common base class of GetElementPtrInst...
|
||||||
// GetElementPtrInst...
|
|
||||||
//
|
//
|
||||||
class MemAccessInst : public Instruction {
|
class MemAccessInst : public Instruction {
|
||||||
protected:
|
protected:
|
||||||
@ -184,8 +183,7 @@ public:
|
|||||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const MemAccessInst *) { return true; }
|
static inline bool classof(const MemAccessInst *) { return true; }
|
||||||
static inline bool classof(const Instruction *I) {
|
static inline bool classof(const Instruction *I) {
|
||||||
return I->getOpcode() == Load || I->getOpcode() == Store ||
|
return I->getOpcode() == GetElementPtr;
|
||||||
I->getOpcode() == GetElementPtr;
|
|
||||||
}
|
}
|
||||||
static inline bool classof(const Value *V) {
|
static inline bool classof(const Value *V) {
|
||||||
return isa<Instruction>(V) && classof(cast<Instruction>(V));
|
return isa<Instruction>(V) && classof(cast<Instruction>(V));
|
||||||
@ -197,19 +195,18 @@ public:
|
|||||||
// LoadInst Class
|
// LoadInst Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
class LoadInst : public MemAccessInst {
|
class LoadInst : public Instruction {
|
||||||
LoadInst(const LoadInst &LI) : MemAccessInst(LI.getType(), Load) {
|
LoadInst(const LoadInst &LI) : Instruction(LI.getType(), Load) {
|
||||||
Operands.reserve(LI.Operands.size());
|
Operands.reserve(1);
|
||||||
for (unsigned i = 0, E = LI.Operands.size(); i != E; ++i)
|
Operands.push_back(Use(LI.Operands[0], this));
|
||||||
Operands.push_back(Use(LI.Operands[i], this));
|
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
LoadInst(Value *Ptr, const std::vector<Value*> &Ix, const std::string & = "");
|
|
||||||
LoadInst(Value *Ptr, const std::string &Name = "");
|
LoadInst(Value *Ptr, const std::string &Name = "");
|
||||||
|
|
||||||
virtual Instruction *clone() const { return new LoadInst(*this); }
|
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:
|
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const LoadInst *) { return true; }
|
static inline bool classof(const LoadInst *) { return true; }
|
||||||
@ -226,19 +223,20 @@ public:
|
|||||||
// StoreInst Class
|
// StoreInst Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
class StoreInst : public MemAccessInst {
|
class StoreInst : public Instruction {
|
||||||
StoreInst(const StoreInst &SI) : MemAccessInst(SI.getType(), Store) {
|
StoreInst(const StoreInst &SI) : Instruction(SI.getType(), Store) {
|
||||||
Operands.reserve(SI.Operands.size());
|
Operands.reserve(2);
|
||||||
for (unsigned i = 0, E = SI.Operands.size(); i != E; ++i)
|
Operands.push_back(Use(SI.Operands[0], this));
|
||||||
Operands.push_back(Use(SI.Operands[i], this));
|
Operands.push_back(Use(SI.Operands[1], this));
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
StoreInst(Value *Val, Value *Ptr, const std::vector<Value*> &Idx);
|
|
||||||
StoreInst(Value *Val, Value *Ptr);
|
StoreInst(Value *Val, Value *Ptr);
|
||||||
virtual Instruction *clone() const { return new StoreInst(*this); }
|
virtual Instruction *clone() const { return new StoreInst(*this); }
|
||||||
|
|
||||||
virtual bool hasSideEffects() const { return true; }
|
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:
|
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const StoreInst *) { return true; }
|
static inline bool classof(const StoreInst *) { return true; }
|
||||||
|
@ -75,21 +75,9 @@ const Type* MemAccessInst::getIndexedType(const Type *Ptr,
|
|||||||
// LoadInst Implementation
|
// LoadInst Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
LoadInst::LoadInst(Value *Ptr, const std::vector<Value*> &Idx,
|
|
||||||
const std::string &Name)
|
|
||||||
: MemAccessInst(checkType(getIndexedType(Ptr->getType(), Idx)), Load, Name) {
|
|
||||||
assert(getIndexedType(Ptr->getType(), Idx) && "Load operands invalid!");
|
|
||||||
Operands.reserve(1+Idx.size());
|
|
||||||
Operands.push_back(Use(Ptr, this));
|
|
||||||
|
|
||||||
for (unsigned i = 0, E = Idx.size(); i != E; ++i)
|
|
||||||
Operands.push_back(Use(Idx[i], this));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadInst::LoadInst(Value *Ptr, const std::string &Name)
|
LoadInst::LoadInst(Value *Ptr, const std::string &Name)
|
||||||
: MemAccessInst(cast<PointerType>(Ptr->getType())->getElementType(),
|
: Instruction(cast<PointerType>(Ptr->getType())->getElementType(),
|
||||||
Load, Name) {
|
Load, Name) {
|
||||||
Operands.reserve(1);
|
Operands.reserve(1);
|
||||||
Operands.push_back(Use(Ptr, this));
|
Operands.push_back(Use(Ptr, this));
|
||||||
}
|
}
|
||||||
@ -99,20 +87,8 @@ LoadInst::LoadInst(Value *Ptr, const std::string &Name)
|
|||||||
// StoreInst Implementation
|
// StoreInst Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
StoreInst::StoreInst(Value *Val, Value *Ptr, const std::vector<Value*> &Idx)
|
|
||||||
: MemAccessInst(Type::VoidTy, Store, "") {
|
|
||||||
assert(getIndexedType(Ptr->getType(), Idx) && "Store operands invalid!");
|
|
||||||
|
|
||||||
Operands.reserve(2+Idx.size());
|
|
||||||
Operands.push_back(Use(Val, this));
|
|
||||||
Operands.push_back(Use(Ptr, this));
|
|
||||||
|
|
||||||
for (unsigned i = 0, E = Idx.size(); i != E; ++i)
|
|
||||||
Operands.push_back(Use(Idx[i], this));
|
|
||||||
}
|
|
||||||
|
|
||||||
StoreInst::StoreInst(Value *Val, Value *Ptr)
|
StoreInst::StoreInst(Value *Val, Value *Ptr)
|
||||||
: MemAccessInst(Type::VoidTy, Store, "") {
|
: Instruction(Type::VoidTy, Store, "") {
|
||||||
|
|
||||||
Operands.reserve(2);
|
Operands.reserve(2);
|
||||||
Operands.push_back(Use(Val, this));
|
Operands.push_back(Use(Val, this));
|
||||||
|
Loading…
Reference in New Issue
Block a user