mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
* Change code to use a static_cast instead of reinterpret_cast
* Add comments * Add two new gep ctors for the very common case of creating a two operand GEP instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14820 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
32caa8de62
commit
b757f160fc
@ -273,18 +273,31 @@ public:
|
|||||||
///
|
///
|
||||||
class GetElementPtrInst : public Instruction {
|
class GetElementPtrInst : public Instruction {
|
||||||
GetElementPtrInst(const GetElementPtrInst &EPI)
|
GetElementPtrInst(const GetElementPtrInst &EPI)
|
||||||
: Instruction(reinterpret_cast<const Type*>(EPI.getType()), GetElementPtr) {
|
: Instruction((static_cast<const Instruction*>(&EPI)->getType()),
|
||||||
|
GetElementPtr) {
|
||||||
Operands.reserve(EPI.Operands.size());
|
Operands.reserve(EPI.Operands.size());
|
||||||
for (unsigned i = 0, E = EPI.Operands.size(); i != E; ++i)
|
for (unsigned i = 0, E = EPI.Operands.size(); i != E; ++i)
|
||||||
Operands.push_back(Use(EPI.Operands[i], this));
|
Operands.push_back(Use(EPI.Operands[i], this));
|
||||||
}
|
}
|
||||||
void init(Value *Ptr, const std::vector<Value*> &Idx);
|
void init(Value *Ptr, const std::vector<Value*> &Idx);
|
||||||
|
void init(Value *Ptr, Value *Idx0, Value *Idx1);
|
||||||
public:
|
public:
|
||||||
|
/// Constructors - Create a getelementptr instruction with a base pointer an
|
||||||
|
/// list of indices. The first ctor can optionally insert before an existing
|
||||||
|
/// instruction, the second appends the new instruction to the specified
|
||||||
|
/// BasicBlock.
|
||||||
GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx,
|
GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx,
|
||||||
const std::string &Name = "", Instruction *InsertBefore =0);
|
const std::string &Name = "", Instruction *InsertBefore =0);
|
||||||
GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx,
|
GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx,
|
||||||
const std::string &Name, BasicBlock *InsertAtEnd);
|
const std::string &Name, BasicBlock *InsertAtEnd);
|
||||||
|
|
||||||
|
/// Constructors - These two constructors are convenience methods because two
|
||||||
|
/// index getelementptr instructions are so common.
|
||||||
|
GetElementPtrInst(Value *Ptr, Value *Idx0, Value *Idx1,
|
||||||
|
const std::string &Name = "", Instruction *InsertBefore =0);
|
||||||
|
GetElementPtrInst(Value *Ptr, Value *Idx0, Value *Idx1,
|
||||||
|
const std::string &Name, BasicBlock *InsertAtEnd);
|
||||||
|
|
||||||
virtual Instruction *clone() const { return new GetElementPtrInst(*this); }
|
virtual Instruction *clone() const { return new GetElementPtrInst(*this); }
|
||||||
|
|
||||||
// getType - Overload to return most specific pointer type...
|
// getType - Overload to return most specific pointer type...
|
||||||
@ -301,6 +314,8 @@ public:
|
|||||||
static const Type *getIndexedType(const Type *Ptr,
|
static const Type *getIndexedType(const Type *Ptr,
|
||||||
const std::vector<Value*> &Indices,
|
const std::vector<Value*> &Indices,
|
||||||
bool AllowStructLeaf = false);
|
bool AllowStructLeaf = false);
|
||||||
|
static const Type *getIndexedType(const Type *Ptr, Value *Idx0, Value *Idx1,
|
||||||
|
bool AllowStructLeaf = false);
|
||||||
|
|
||||||
inline op_iterator idx_begin() { return op_begin()+1; }
|
inline op_iterator idx_begin() { return op_begin()+1; }
|
||||||
inline const_op_iterator idx_begin() const { return op_begin()+1; }
|
inline const_op_iterator idx_begin() const { return op_begin()+1; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user