I->getOpcode() == Instruction::Load ||
I->getOpcode() == Instruction::VAArg ||
I->getOpcode() == Instruction::GetResult ||
I->getOpcode() == Instruction::Load ||
I->getOpcode() == Instruction::VAArg ||
I->getOpcode() == Instruction::GetResult ||
+ I->getOpcode() == Instruction::ExtractValue ||
(I->getOpcode() >= CastOpsBegin && I->getOpcode() < CastOpsEnd);
}
static inline bool classof(const Value *V) {
(I->getOpcode() >= CastOpsBegin && I->getOpcode() < CastOpsEnd);
}
static inline bool classof(const Value *V) {
/// ExtractValueInst - This instruction extracts a struct member or array
/// element value from an aggregate value.
///
/// ExtractValueInst - This instruction extracts a struct member or array
/// element value from an aggregate value.
///
-class ExtractValueInst : public Instruction {
+class ExtractValueInst : public UnaryInstruction {
SmallVector<unsigned, 4> Indices;
ExtractValueInst(const ExtractValueInst &EVI);
SmallVector<unsigned, 4> Indices;
ExtractValueInst(const ExtractValueInst &EVI);
Instruction *InsertBefore = 0);
ExtractValueInst(Value *Agg, unsigned Idx,
const std::string &Name, BasicBlock *InsertAtEnd);
Instruction *InsertBefore = 0);
ExtractValueInst(Value *Agg, unsigned Idx,
const std::string &Name, BasicBlock *InsertAtEnd);
// allocate space for exactly one operand
void *operator new(size_t s) {
return User::operator new(s, 1);
}
// allocate space for exactly one operand
void *operator new(size_t s) {
return User::operator new(s, 1);
}
template<typename InputIterator>
static ExtractValueInst *Create(Value *Agg, InputIterator IdxBegin,
InputIterator IdxEnd,
template<typename InputIterator>
static ExtractValueInst *Create(Value *Agg, InputIterator IdxBegin,
InputIterator IdxEnd,
virtual ExtractValueInst *clone() const;
virtual ExtractValueInst *clone() const;
- /// Transparently provide more efficient getOperand methods.
- DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-
// getType - Overload to return most specific pointer type...
const PointerType *getType() const {
return reinterpret_cast<const PointerType*>(Instruction::getType());
// getType - Overload to return most specific pointer type...
const PointerType *getType() const {
return reinterpret_cast<const PointerType*>(Instruction::getType());
-template <>
-struct OperandTraits<ExtractValueInst> : FixedNumOperandTraits<1> {
-};
-
template<typename InputIterator>
ExtractValueInst::ExtractValueInst(Value *Agg,
InputIterator IdxBegin,
InputIterator IdxEnd,
const std::string &Name,
Instruction *InsertBefore)
template<typename InputIterator>
ExtractValueInst::ExtractValueInst(Value *Agg,
InputIterator IdxBegin,
InputIterator IdxEnd,
const std::string &Name,
Instruction *InsertBefore)
- : Instruction(checkType(getIndexedType(Agg->getType(), IdxBegin, IdxEnd)),
- ExtractValue,
- OperandTraits<ExtractValueInst>::op_begin(this),
- 1, InsertBefore) {
+ : UnaryInstruction(checkType(getIndexedType(Agg->getType(),
+ IdxBegin, IdxEnd)),
+ ExtractValue, Agg, InsertBefore) {
init(Agg, IdxBegin, IdxEnd, Name,
typename std::iterator_traits<InputIterator>::iterator_category());
}
init(Agg, IdxBegin, IdxEnd, Name,
typename std::iterator_traits<InputIterator>::iterator_category());
}
InputIterator IdxEnd,
const std::string &Name,
BasicBlock *InsertAtEnd)
InputIterator IdxEnd,
const std::string &Name,
BasicBlock *InsertAtEnd)
- : Instruction(checkType(getIndexedType(Agg->getType(), IdxBegin, IdxEnd)),
- ExtractValue,
- OperandTraits<ExtractValueInst>::op_begin(this),
- 1, InsertAtEnd) {
+ : UnaryInstruction(checkType(getIndexedType(Agg->getType(),
+ IdxBegin, IdxEnd)),
+ ExtractValue, Agg, InsertAtEnd) {
init(Agg, IdxBegin, IdxEnd, Name,
typename std::iterator_traits<InputIterator>::iterator_category());
}
init(Agg, IdxBegin, IdxEnd, Name,
typename std::iterator_traits<InputIterator>::iterator_category());
}
-DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractValueInst, Value)
-
//===----------------------------------------------------------------------===//
// InsertValueInst Class
//===----------------------------------------------------------------------===//
// InsertValueInst Class
return cast<PointerType>(Val->getType())->getAddressSpace();
}
return cast<PointerType>(Val->getType())->getAddressSpace();
}
-void GetElementPtrInst::init(Value *Ptr, Value* const *Idx, unsigned NumIdx, const std::string &Name) {
+void GetElementPtrInst::init(Value *Ptr, Value* const *Idx, unsigned NumIdx,
+ const std::string &Name) {
assert(NumOperands == 1+NumIdx && "NumOperands not initialized?");
Use *OL = OperandList;
OL[0] = Ptr;
assert(NumOperands == 1+NumIdx && "NumOperands not initialized?");
Use *OL = OperandList;
OL[0] = Ptr;
// ExtractValueInst Class
//===----------------------------------------------------------------------===//
// ExtractValueInst Class
//===----------------------------------------------------------------------===//
-void ExtractValueInst::init(Value *Agg, const unsigned *Idx, unsigned NumIdx, const std::string &Name) {
+void ExtractValueInst::init(Value *Agg, const unsigned *Idx, unsigned NumIdx,
+ const std::string &Name) {
assert(NumOperands == 1 && "NumOperands not initialized?");
Op<0>() = Agg;
assert(NumOperands == 1 && "NumOperands not initialized?");
Op<0>() = Agg;
}
ExtractValueInst::ExtractValueInst(const ExtractValueInst &EVI)
}
ExtractValueInst::ExtractValueInst(const ExtractValueInst &EVI)
- : Instruction(reinterpret_cast<const Type*>(EVI.getType()), ExtractValue,
- OperandTraits<ExtractValueInst>::op_begin(this), 1),
+ : UnaryInstruction(EVI.getType(), ExtractValue, EVI.getOperand(0)),
unsigned Idx,
const std::string &Name,
BasicBlock *InsertAtEnd)
unsigned Idx,
const std::string &Name,
BasicBlock *InsertAtEnd)
- : Instruction(checkType(getIndexedType(Agg->getType(), &Idx, 1)),
- ExtractValue,
- OperandTraits<ExtractValueInst>::op_begin(this),
- 1, InsertAtEnd) {
+ : UnaryInstruction(checkType(getIndexedType(Agg->getType(), &Idx, 1)),
+ ExtractValue, Agg, InsertAtEnd) {
unsigned Idx,
const std::string &Name,
Instruction *InsertBefore)
unsigned Idx,
const std::string &Name,
Instruction *InsertBefore)
- : Instruction(checkType(getIndexedType(Agg->getType(), &Idx, 1)),
- ExtractValue,
- OperandTraits<ExtractValueInst>::op_begin(this),
- 1, InsertBefore) {
+ : UnaryInstruction(checkType(getIndexedType(Agg->getType(), &Idx, 1)),
+ ExtractValue, Agg, InsertBefore) {