mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-02 08:46:37 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51937 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3f32d65912
commit
444099f615
@ -1458,8 +1458,8 @@ class ExtractValueInst : public Instruction {
|
|||||||
SmallVector<unsigned, 4> Indices;
|
SmallVector<unsigned, 4> Indices;
|
||||||
|
|
||||||
ExtractValueInst(const ExtractValueInst &EVI);
|
ExtractValueInst(const ExtractValueInst &EVI);
|
||||||
void init(Value *Agg, const unsigned *Idx, unsigned NumIdx);
|
void init(Value *Agg, const unsigned *Idx, unsigned NumIdx, const std::string &Name);
|
||||||
void init(Value *Agg, unsigned Idx);
|
void init(Value *Agg, unsigned Idx, const std::string &Name);
|
||||||
|
|
||||||
template<typename InputIterator>
|
template<typename InputIterator>
|
||||||
void init(Value *Agg, InputIterator IdxBegin, InputIterator IdxEnd,
|
void init(Value *Agg, InputIterator IdxBegin, InputIterator IdxEnd,
|
||||||
@ -1476,10 +1476,8 @@ class ExtractValueInst : public Instruction {
|
|||||||
assert(NumIdx > 0 && "ExtractValueInst must have at least one index");
|
assert(NumIdx > 0 && "ExtractValueInst must have at least one index");
|
||||||
|
|
||||||
// This requires that the iterator points to contiguous memory.
|
// This requires that the iterator points to contiguous memory.
|
||||||
init(Agg, &*IdxBegin, NumIdx); // FIXME: for the general case
|
init(Agg, &*IdxBegin, NumIdx, Name); // FIXME: for the general case
|
||||||
// we have to build an array here
|
// we have to build an array here
|
||||||
|
|
||||||
setName(Name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getIndexedType - Returns the type of the element that would be extracted
|
/// getIndexedType - Returns the type of the element that would be extracted
|
||||||
@ -1667,8 +1665,8 @@ class InsertValueInst : public Instruction {
|
|||||||
|
|
||||||
void *operator new(size_t, unsigned); // Do not implement
|
void *operator new(size_t, unsigned); // Do not implement
|
||||||
InsertValueInst(const InsertValueInst &IVI);
|
InsertValueInst(const InsertValueInst &IVI);
|
||||||
void init(Value *Agg, Value *Val, const unsigned *Idx, unsigned NumIdx);
|
void init(Value *Agg, Value *Val, const unsigned *Idx, unsigned NumIdx, const std::string &Name);
|
||||||
void init(Value *Agg, Value *Val, unsigned Idx);
|
void init(Value *Agg, Value *Val, unsigned Idx, const std::string &Name);
|
||||||
|
|
||||||
template<typename InputIterator>
|
template<typename InputIterator>
|
||||||
void init(Value *Agg, Value *Val,
|
void init(Value *Agg, Value *Val,
|
||||||
@ -1686,10 +1684,8 @@ class InsertValueInst : public Instruction {
|
|||||||
assert(NumIdx > 0 && "InsertValueInst must have at least one index");
|
assert(NumIdx > 0 && "InsertValueInst must have at least one index");
|
||||||
|
|
||||||
// This requires that the iterator points to contiguous memory.
|
// This requires that the iterator points to contiguous memory.
|
||||||
init(Agg, Val, &*IdxBegin, NumIdx); // FIXME: for the general case
|
init(Agg, Val, &*IdxBegin, NumIdx, Name); // FIXME: for the general case
|
||||||
// we have to build an array here
|
// we have to build an array here
|
||||||
|
|
||||||
setName(Name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructors - Create a insertvalue instruction with a base aggregate
|
/// Constructors - Create a insertvalue instruction with a base aggregate
|
||||||
|
@ -1350,21 +1350,24 @@ int ShuffleVectorInst::getMaskValue(unsigned i) const {
|
|||||||
// InsertValueInst Class
|
// InsertValueInst Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
void InsertValueInst::init(Value *Agg, Value *Val,
|
void InsertValueInst::init(Value *Agg, Value *Val, const unsigned *Idx,
|
||||||
const unsigned *Idx, unsigned NumIdx) {
|
unsigned NumIdx, const std::string &Name) {
|
||||||
assert(NumOperands == 2 && "NumOperands not initialized?");
|
assert(NumOperands == 2 && "NumOperands not initialized?");
|
||||||
Op<0>() = Agg;
|
Op<0>() = Agg;
|
||||||
Op<1>() = Val;
|
Op<1>() = Val;
|
||||||
|
|
||||||
Indices.insert(Indices.end(), Idx, Idx + NumIdx);
|
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?");
|
assert(NumOperands == 2 && "NumOperands not initialized?");
|
||||||
Op<0>() = Agg;
|
Op<0>() = Agg;
|
||||||
Op<1>() = Val;
|
Op<1>() = Val;
|
||||||
|
|
||||||
Indices.push_back(Idx);
|
Indices.push_back(Idx);
|
||||||
|
setName(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
InsertValueInst::InsertValueInst(const InsertValueInst &IVI)
|
InsertValueInst::InsertValueInst(const InsertValueInst &IVI)
|
||||||
@ -1373,22 +1376,46 @@ InsertValueInst::InsertValueInst(const InsertValueInst &IVI)
|
|||||||
Indices(IVI.Indices) {
|
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
|
// 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?");
|
assert(NumOperands == 1 && "NumOperands not initialized?");
|
||||||
Op<0>() = Agg;
|
Op<0>() = Agg;
|
||||||
|
|
||||||
Indices.insert(Indices.end(), Idx, Idx + NumIdx);
|
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?");
|
assert(NumOperands == 1 && "NumOperands not initialized?");
|
||||||
Op<0>() = Agg;
|
Op<0>() = Agg;
|
||||||
|
|
||||||
Indices.push_back(Idx);
|
Indices.push_back(Idx);
|
||||||
|
setName(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtractValueInst::ExtractValueInst(const ExtractValueInst &EVI)
|
ExtractValueInst::ExtractValueInst(const ExtractValueInst &EVI)
|
||||||
@ -1424,6 +1451,28 @@ const Type* ExtractValueInst::getIndexedType(const Type *Agg,
|
|||||||
return CurIdx == NumIdx ? Agg : 0;
|
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
|
// BinaryOperator Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
Loading…
Reference in New Issue
Block a user