smallvectorize and ArrayRef'ize some stuff.
llvm-svn: 149077
This commit is contained in:
parent
37e3835a94
commit
a474bb265b
|
@ -717,7 +717,7 @@ Constant *ConstantArray::get(ArrayType *Ty, ArrayRef<Constant*> V) {
|
||||||
///
|
///
|
||||||
Constant *ConstantArray::get(LLVMContext &Context, StringRef Str,
|
Constant *ConstantArray::get(LLVMContext &Context, StringRef Str,
|
||||||
bool AddNull) {
|
bool AddNull) {
|
||||||
std::vector<Constant*> ElementVals;
|
SmallVector<Constant*, 8> ElementVals;
|
||||||
ElementVals.reserve(Str.size() + size_t(AddNull));
|
ElementVals.reserve(Str.size() + size_t(AddNull));
|
||||||
for (unsigned i = 0; i < Str.size(); ++i)
|
for (unsigned i = 0; i < Str.size(); ++i)
|
||||||
ElementVals.push_back(ConstantInt::get(Type::getInt8Ty(Context), Str[i]));
|
ElementVals.push_back(ConstantInt::get(Type::getInt8Ty(Context), Str[i]));
|
||||||
|
@ -1957,7 +1957,7 @@ const char *ConstantExpr::getOpcodeName() const {
|
||||||
|
|
||||||
|
|
||||||
GetElementPtrConstantExpr::
|
GetElementPtrConstantExpr::
|
||||||
GetElementPtrConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
|
GetElementPtrConstantExpr(Constant *C, ArrayRef<Constant*> IdxList,
|
||||||
Type *DestTy)
|
Type *DestTy)
|
||||||
: ConstantExpr(DestTy, Instruction::GetElementPtr,
|
: ConstantExpr(DestTy, Instruction::GetElementPtr,
|
||||||
OperandTraits<GetElementPtrConstantExpr>::op_end(this)
|
OperandTraits<GetElementPtrConstantExpr>::op_end(this)
|
||||||
|
@ -2469,7 +2469,7 @@ void ConstantVector::replaceUsesOfWithOnConstant(Value *From, Value *To,
|
||||||
Use *U) {
|
Use *U) {
|
||||||
assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
|
assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
|
||||||
|
|
||||||
std::vector<Constant*> Values;
|
SmallVector<Constant*, 8> Values;
|
||||||
Values.reserve(getNumOperands()); // Build replacement array...
|
Values.reserve(getNumOperands()); // Build replacement array...
|
||||||
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
|
||||||
Constant *Val = getOperand(i);
|
Constant *Val = getOperand(i);
|
||||||
|
|
|
@ -211,11 +211,11 @@ public:
|
||||||
/// used behind the scenes to implement getelementpr constant exprs.
|
/// used behind the scenes to implement getelementpr constant exprs.
|
||||||
class GetElementPtrConstantExpr : public ConstantExpr {
|
class GetElementPtrConstantExpr : public ConstantExpr {
|
||||||
virtual void anchor();
|
virtual void anchor();
|
||||||
GetElementPtrConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
|
GetElementPtrConstantExpr(Constant *C, ArrayRef<Constant*> IdxList,
|
||||||
Type *DestTy);
|
Type *DestTy);
|
||||||
public:
|
public:
|
||||||
static GetElementPtrConstantExpr *Create(Constant *C,
|
static GetElementPtrConstantExpr *Create(Constant *C,
|
||||||
const std::vector<Constant*>&IdxList,
|
ArrayRef<Constant*> IdxList,
|
||||||
Type *DestTy,
|
Type *DestTy,
|
||||||
unsigned Flags) {
|
unsigned Flags) {
|
||||||
GetElementPtrConstantExpr *Result =
|
GetElementPtrConstantExpr *Result =
|
||||||
|
|
Loading…
Reference in New Issue