mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-27 14:34:58 +00:00
Use ArrayRef in the (protected) constructors of ConstantArray, ConstantStruct and ConstantVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135905 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a9203109f4
commit
166579e287
@ -329,7 +329,7 @@ class ConstantArray : public Constant {
|
||||
std::vector<Constant*> >;
|
||||
ConstantArray(const ConstantArray &); // DO NOT IMPLEMENT
|
||||
protected:
|
||||
ConstantArray(ArrayType *T, const std::vector<Constant*> &Val);
|
||||
ConstantArray(ArrayType *T, ArrayRef<Constant *> Val);
|
||||
public:
|
||||
// ConstantArray accessors
|
||||
static Constant *get(ArrayType *T, ArrayRef<Constant*> V);
|
||||
@ -400,7 +400,7 @@ class ConstantStruct : public Constant {
|
||||
std::vector<Constant*> >;
|
||||
ConstantStruct(const ConstantStruct &); // DO NOT IMPLEMENT
|
||||
protected:
|
||||
ConstantStruct(StructType *T, const std::vector<Constant*> &Val);
|
||||
ConstantStruct(StructType *T, ArrayRef<Constant *> Val);
|
||||
public:
|
||||
// ConstantStruct accessors
|
||||
static Constant *get(StructType *T, ArrayRef<Constant*> V);
|
||||
@ -461,7 +461,7 @@ class ConstantVector : public Constant {
|
||||
std::vector<Constant*> >;
|
||||
ConstantVector(const ConstantVector &); // DO NOT IMPLEMENT
|
||||
protected:
|
||||
ConstantVector(VectorType *T, const std::vector<Constant*> &Val);
|
||||
ConstantVector(VectorType *T, ArrayRef<Constant *> Val);
|
||||
public:
|
||||
// ConstantVector accessors
|
||||
static Constant *get(ArrayRef<Constant*> V);
|
||||
|
@ -573,21 +573,16 @@ bool ConstantFP::isExactlyValue(const APFloat &V) const {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
ConstantArray::ConstantArray(ArrayType *T,
|
||||
const std::vector<Constant*> &V)
|
||||
ConstantArray::ConstantArray(ArrayType *T, ArrayRef<Constant *> V)
|
||||
: Constant(T, ConstantArrayVal,
|
||||
OperandTraits<ConstantArray>::op_end(this) - V.size(),
|
||||
V.size()) {
|
||||
assert(V.size() == T->getNumElements() &&
|
||||
"Invalid initializer vector for constant array");
|
||||
Use *OL = OperandList;
|
||||
for (std::vector<Constant*>::const_iterator I = V.begin(), E = V.end();
|
||||
I != E; ++I, ++OL) {
|
||||
Constant *C = *I;
|
||||
assert(C->getType() == T->getElementType() &&
|
||||
for (unsigned i = 0, e = V.size(); i != e; ++i)
|
||||
assert(V[i]->getType() == T->getElementType() &&
|
||||
"Initializer for array element doesn't match array element type!");
|
||||
*OL = C;
|
||||
}
|
||||
std::copy(V.begin(), V.end(), op_begin());
|
||||
}
|
||||
|
||||
Constant *ConstantArray::get(ArrayType *Ty, ArrayRef<Constant*> V) {
|
||||
@ -653,21 +648,16 @@ StructType *ConstantStruct::getTypeForElements(ArrayRef<Constant*> V,
|
||||
}
|
||||
|
||||
|
||||
ConstantStruct::ConstantStruct(StructType *T,
|
||||
const std::vector<Constant*> &V)
|
||||
ConstantStruct::ConstantStruct(StructType *T, ArrayRef<Constant *> V)
|
||||
: Constant(T, ConstantStructVal,
|
||||
OperandTraits<ConstantStruct>::op_end(this) - V.size(),
|
||||
V.size()) {
|
||||
assert((T->isOpaque() || V.size() == T->getNumElements()) &&
|
||||
"Invalid initializer vector for constant structure");
|
||||
Use *OL = OperandList;
|
||||
for (std::vector<Constant*>::const_iterator I = V.begin(), E = V.end();
|
||||
I != E; ++I, ++OL) {
|
||||
Constant *C = *I;
|
||||
assert((T->isOpaque() || C->getType() == T->getElementType(I-V.begin())) &&
|
||||
for (unsigned i = 0, e = V.size(); i != e; ++i)
|
||||
assert((T->isOpaque() || V[i]->getType() == T->getElementType(i)) &&
|
||||
"Initializer for struct element doesn't match struct element type!");
|
||||
*OL = C;
|
||||
}
|
||||
std::copy(V.begin(), V.end(), op_begin());
|
||||
}
|
||||
|
||||
// ConstantStruct accessors.
|
||||
@ -692,19 +682,14 @@ Constant* ConstantStruct::get(StructType *T, ...) {
|
||||
return get(T, Values);
|
||||
}
|
||||
|
||||
ConstantVector::ConstantVector(VectorType *T,
|
||||
const std::vector<Constant*> &V)
|
||||
ConstantVector::ConstantVector(VectorType *T, ArrayRef<Constant *> V)
|
||||
: Constant(T, ConstantVectorVal,
|
||||
OperandTraits<ConstantVector>::op_end(this) - V.size(),
|
||||
V.size()) {
|
||||
Use *OL = OperandList;
|
||||
for (std::vector<Constant*>::const_iterator I = V.begin(), E = V.end();
|
||||
I != E; ++I, ++OL) {
|
||||
Constant *C = *I;
|
||||
assert(C->getType() == T->getElementType() &&
|
||||
for (size_t i = 0, e = V.size(); i != e; i++)
|
||||
assert(V[i]->getType() == T->getElementType() &&
|
||||
"Initializer for vector element doesn't match vector element type!");
|
||||
*OL = C;
|
||||
}
|
||||
std::copy(V.begin(), V.end(), op_begin());
|
||||
}
|
||||
|
||||
// ConstantVector accessors.
|
||||
|
Loading…
x
Reference in New Issue
Block a user