aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorRobert Bocchino <bocchino@illinois.edu>2006-01-17 20:07:22 +0000
committerRobert Bocchino <bocchino@illinois.edu>2006-01-17 20:07:22 +0000
commitc152f9cd26e7cb32352c513389a18ffd892ecaec (patch)
treeb584bdb434f8a0cca75c8606eb3d151239aa04fa /lib/VMCore/Instructions.cpp
parent956fd7254f976581a27ba0ee73d7707ff484d2c3 (diff)
VMCore support for the insertelement operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 06fbcf712c..0bd55c9151 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -800,7 +800,7 @@ const Type* GetElementPtrInst::getIndexedType(const Type *Ptr, Value *Idx) {
//===----------------------------------------------------------------------===//
ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
- const std::string &Name, Instruction *InsertBef)
+ const std::string &Name, Instruction *InsertBef)
: Instruction(cast<PackedType>(Val->getType())->getElementType(),
ExtractElement, Ops, 2, Name, InsertBef) {
Ops[0].init(Val, this);
@@ -808,7 +808,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
}
ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
- const std::string &Name, BasicBlock *InsertAE)
+ const std::string &Name, BasicBlock *InsertAE)
: Instruction(cast<PackedType>(Val->getType())->getElementType(),
ExtractElement, Ops, 2, Name, InsertAE) {
Ops[0].init(Val, this);
@@ -816,6 +816,26 @@ ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
}
//===----------------------------------------------------------------------===//
+// InsertElementInst Implementation
+//===----------------------------------------------------------------------===//
+
+InsertElementInst::InsertElementInst(Value *Val, Value *Elt, Value *Index,
+ const std::string &Name, Instruction *InsertBef)
+ : Instruction(Val->getType(), InsertElement, Ops, 3, Name, InsertBef) {
+ Ops[0].init(Val, this);
+ Ops[1].init(Elt, this);
+ Ops[2].init(Index, this);
+}
+
+InsertElementInst::InsertElementInst(Value *Val, Value *Elt, Value *Index,
+ const std::string &Name, BasicBlock *InsertAE)
+ : Instruction(Val->getType(), InsertElement, Ops, 3, Name, InsertAE) {
+ Ops[0].init(Val, this);
+ Ops[1].init(Elt, this);
+ Ops[2].init(Index, this);
+}
+
+//===----------------------------------------------------------------------===//
// BinaryOperator Class
//===----------------------------------------------------------------------===//
@@ -1176,6 +1196,7 @@ ShiftInst *ShiftInst::clone() const { return new ShiftInst(*this); }
SelectInst *SelectInst::clone() const { return new SelectInst(*this); }
VAArgInst *VAArgInst::clone() const { return new VAArgInst(*this); }
ExtractElementInst *ExtractElementInst::clone() const {return new ExtractElementInst(*this); }
+InsertElementInst *InsertElementInst::clone() const {return new InsertElementInst(*this); }
PHINode *PHINode::clone() const { return new PHINode(*this); }
ReturnInst *ReturnInst::clone() const { return new ReturnInst(*this); }
BranchInst *BranchInst::clone() const { return new BranchInst(*this); }