public:
ExtractElementInst(Value *Vec, Value *Idx, const std::string &Name = "",
Instruction *InsertBefore = 0);
+ ExtractElementInst(Value *Vec, unsigned Idx, const std::string &Name = "",
+ Instruction *InsertBefore = 0);
ExtractElementInst(Value *Vec, Value *Idx, const std::string &Name,
BasicBlock *InsertAtEnd);
+ ExtractElementInst(Value *Vec, unsigned Idx, const std::string &Name,
+ BasicBlock *InsertAtEnd);
/// isValidOperands - Return true if an extractelement instruction can be
/// formed with the specified operands.
public:
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const std::string &Name = "",Instruction *InsertBefore = 0);
+ InsertElementInst(Value *Vec, Value *NewElt, unsigned Idx,
+ const std::string &Name = "",Instruction *InsertBefore = 0);
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const std::string &Name, BasicBlock *InsertAtEnd);
+ InsertElementInst(Value *Vec, Value *NewElt, unsigned Idx,
+ const std::string &Name, BasicBlock *InsertAtEnd);
/// isValidOperands - Return true if an insertelement instruction can be
/// formed with the specified operands.
Ops[1].init(Index, this);
}
+ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV,
+ const std::string &Name,
+ Instruction *InsertBef)
+ : Instruction(cast<PackedType>(Val->getType())->getElementType(),
+ ExtractElement, Ops, 2, Name, InsertBef) {
+ Constant *Index = ConstantUInt::get(Type::UIntTy, IndexV);
+ assert(isValidOperands(Val, Index) &&
+ "Invalid extractelement instruction operands!");
+ Ops[0].init(Val, this);
+ Ops[1].init(Index, this);
+}
+
+
ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
const std::string &Name,
BasicBlock *InsertAE)
Ops[1].init(Index, this);
}
+ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV,
+ const std::string &Name,
+ BasicBlock *InsertAE)
+ : Instruction(cast<PackedType>(Val->getType())->getElementType(),
+ ExtractElement, Ops, 2, Name, InsertAE) {
+ Constant *Index = ConstantUInt::get(Type::UIntTy, IndexV);
+ assert(isValidOperands(Val, Index) &&
+ "Invalid extractelement instruction operands!");
+
+ Ops[0].init(Val, this);
+ Ops[1].init(Index, this);
+}
+
+
bool ExtractElementInst::isValidOperands(const Value *Val, const Value *Index) {
if (!isa<PackedType>(Val->getType()) || Index->getType() != Type::UIntTy)
return false;
Ops[2].init(Index, this);
}
+InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, unsigned IndexV,
+ const std::string &Name,
+ Instruction *InsertBef)
+ : Instruction(Vec->getType(), InsertElement, Ops, 3, Name, InsertBef) {
+ Constant *Index = ConstantUInt::get(Type::UIntTy, IndexV);
+ assert(isValidOperands(Vec, Elt, Index) &&
+ "Invalid insertelement instruction operands!");
+ Ops[0].init(Vec, this);
+ Ops[1].init(Elt, this);
+ Ops[2].init(Index, this);
+}
+
+
InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, Value *Index,
const std::string &Name,
BasicBlock *InsertAE)
Ops[2].init(Index, this);
}
+InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, unsigned IndexV,
+ const std::string &Name,
+ BasicBlock *InsertAE)
+: Instruction(Vec->getType(), InsertElement, Ops, 3, Name, InsertAE) {
+ Constant *Index = ConstantUInt::get(Type::UIntTy, IndexV);
+ assert(isValidOperands(Vec, Elt, Index) &&
+ "Invalid insertelement instruction operands!");
+
+ Ops[0].init(Vec, this);
+ Ops[1].init(Elt, this);
+ Ops[2].init(Index, this);
+}
+
bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt,
const Value *Index) {
if (!isa<PackedType>(Vec->getType()))