summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2008-06-04 14:40:55 +0000
committerMatthijs Kooijman <matthijs@stdin.nl>2008-06-04 14:40:55 +0000
commitcfd41dbd5e657f98aaab5687d5dcdad89b732bd1 (patch)
treed0e800060edf762fa1253d0e33165d4dd36db9c0 /llvm/lib/VMCore/Instructions.cpp
parent6301884dc01ad46a3cf8eb4251c5c54591bf531e (diff)
downloadbcm5719-llvm-cfd41dbd5e657f98aaab5687d5dcdad89b732bd1.tar.gz
bcm5719-llvm-cfd41dbd5e657f98aaab5687d5dcdad89b732bd1.zip
Implement the two constructors in InsertValueInst and ExtractValueInst.
Add a Name argment to two init methods in these classes as well to make things a bit more consistent. llvm-svn: 51937
Diffstat (limited to 'llvm/lib/VMCore/Instructions.cpp')
-rw-r--r--llvm/lib/VMCore/Instructions.cpp59
1 files changed, 54 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 656a51b0549..6da04e7178f 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -1350,21 +1350,24 @@ int ShuffleVectorInst::getMaskValue(unsigned i) const {
// InsertValueInst Class
//===----------------------------------------------------------------------===//
-void InsertValueInst::init(Value *Agg, Value *Val,
- const unsigned *Idx, unsigned NumIdx) {
+void InsertValueInst::init(Value *Agg, Value *Val, const unsigned *Idx,
+ unsigned NumIdx, const std::string &Name) {
assert(NumOperands == 2 && "NumOperands not initialized?");
Op<0>() = Agg;
Op<1>() = Val;
Indices.insert(Indices.end(), Idx, Idx + NumIdx);
+ setName(Name);
}
-void InsertValueInst::init(Value *Agg, Value *Val, unsigned Idx) {
+void InsertValueInst::init(Value *Agg, Value *Val, unsigned Idx,
+ const std::string &Name) {
assert(NumOperands == 2 && "NumOperands not initialized?");
Op<0>() = Agg;
Op<1>() = Val;
Indices.push_back(Idx);
+ setName(Name);
}
InsertValueInst::InsertValueInst(const InsertValueInst &IVI)
@@ -1373,22 +1376,46 @@ InsertValueInst::InsertValueInst(const InsertValueInst &IVI)
Indices(IVI.Indices) {
}
+InsertValueInst::InsertValueInst(Value *Agg,
+ Value *Val,
+ unsigned Idx,
+ const std::string &Name,
+ Instruction *InsertBefore)
+ : Instruction(Agg->getType(), InsertValue,
+ OperandTraits<InsertValueInst>::op_begin(this),
+ 2, InsertBefore) {
+ init(Agg, Val, Idx, Name);
+}
+
+InsertValueInst::InsertValueInst(Value *Agg,
+ Value *Val,
+ unsigned Idx,
+ const std::string &Name,
+ BasicBlock *InsertAtEnd)
+ : Instruction(Agg->getType(), InsertValue,
+ OperandTraits<InsertValueInst>::op_begin(this),
+ 2, InsertAtEnd) {
+ init(Agg, Val, Idx, Name);
+}
+
//===----------------------------------------------------------------------===//
// ExtractValueInst Class
//===----------------------------------------------------------------------===//
-void ExtractValueInst::init(Value *Agg, const unsigned *Idx, unsigned NumIdx) {
+void ExtractValueInst::init(Value *Agg, const unsigned *Idx, unsigned NumIdx, const std::string &Name) {
assert(NumOperands == 1 && "NumOperands not initialized?");
Op<0>() = Agg;
Indices.insert(Indices.end(), Idx, Idx + NumIdx);
+ setName(Name);
}
-void ExtractValueInst::init(Value *Agg, unsigned Idx) {
+void ExtractValueInst::init(Value *Agg, unsigned Idx, const std::string &Name) {
assert(NumOperands == 1 && "NumOperands not initialized?");
Op<0>() = Agg;
Indices.push_back(Idx);
+ setName(Name);
}
ExtractValueInst::ExtractValueInst(const ExtractValueInst &EVI)
@@ -1424,6 +1451,28 @@ const Type* ExtractValueInst::getIndexedType(const Type *Agg,
return CurIdx == NumIdx ? Agg : 0;
}
+ExtractValueInst::ExtractValueInst(Value *Agg,
+ unsigned Idx,
+ const std::string &Name,
+ BasicBlock *InsertAtEnd)
+ : Instruction(checkType(getIndexedType(Agg->getType(), &Idx, 1)),
+ ExtractValue,
+ OperandTraits<ExtractValueInst>::op_begin(this),
+ 1, InsertAtEnd) {
+ init(Agg, Idx, Name);
+}
+
+ExtractValueInst::ExtractValueInst(Value *Agg,
+ unsigned Idx,
+ const std::string &Name,
+ Instruction *InsertBefore)
+ : Instruction(checkType(getIndexedType(Agg->getType(), &Idx, 1)),
+ ExtractValue,
+ OperandTraits<ExtractValueInst>::op_begin(this),
+ 1, InsertBefore) {
+ init(Agg, Idx, Name);
+}
+
//===----------------------------------------------------------------------===//
// BinaryOperator Class
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud