[LLVMdev] Cleanup of constant sequence type construction
Daniel Dunbar
daniel at zuster.org
Wed Aug 13 16:08:05 PDT 2008
The methods for constructing constant sequencish types (struct, array, vector) aren't
consistent and we are missing a few useful convenience methods. I would like to change
the interfaces to each support four construction methods:
(a) With and without a type.
(b) With a vector or an array + size.
Here:
--
ConstantStruct {
static Constant *get(const StructType *T,
Constant*const* Vals, unsigned NumVals,
bool Packed = false);
static Constant *get(const StructType *T, const std::vector<Constant*> &V);
static Constant *get(Constant*const* Vals, unsigned NumVals,
bool Packed = false);
static Constant *get(const std::vector<Constant*> &V, bool Packed = false);
}
ConstantAray {
static Constant *get(const ArrayType *T,
Constant*const* Vals, unsigned NumVals);
static Constant *get(const ArrayType *T, const std::vector<Constant*> &);
static Constant *get(Constant*const* Vals, unsigned NumVals);
static Constant *get(const std::vector<Constant*> &);
}
ConstantVector {
static Constant *get(const VectorType *T,
Constant*const* Vals, unsigned NumVals);
static Constant *get(const VectorType *T, const std::vector<Constant*> &);
static Constant *get(Constant*const* Vals, unsigned NumVals);
static Constant *get(const std::vector<Constant*> &V);
}
--
While I am at it it would make sense to make the array + size methods more
efficient (not construct a vector).
Any problems?
- Daniel
More information about the llvm-dev
mailing list