for (unsigned i = 0; i != NumElts; ++i)
Result.push_back(Context.getConstantExprBitCast(CV->getOperand(i),
DstEltTy));
- return Context.getConstantVector(Result);
+ return ConstantVector::get(Result);
}
/// This function determines which opcode to use to fold two constant cast
// can only be handled by Analysis/ConstantFolding.cpp).
if (isa<ConstantInt>(V) || isa<ConstantFP>(V))
return Context.getConstantExprBitCast(
- Context.getConstantVector(&V, 1), DestPTy);
+ ConstantVector::get(&V, 1), DestPTy);
}
// Finally, implement bitcast folding now. The code below doesn't handle
for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i)
res.push_back(Context.getConstantExprCast(opc,
CV->getOperand(i), DstEltTy));
- return Context.getConstantVector(DestVecTy, res);
+ return ConstantVector::get(DestVecTy, res);
}
// We actually have to do a cast now. Perform the cast according to the
(idxVal == i) ? Elt : Context.getUndef(Elt->getType());
Ops.push_back(const_cast<Constant*>(Op));
}
- return Context.getConstantVector(Ops);
+ return ConstantVector::get(Ops);
}
if (isa<ConstantAggregateZero>(Val)) {
// Insertion of scalar constant into vector aggregate zero
(idxVal == i) ? Elt : Context.getNullValue(Elt->getType());
Ops.push_back(const_cast<Constant*>(Op));
}
- return Context.getConstantVector(Ops);
+ return ConstantVector::get(Ops);
}
if (const ConstantVector *CVal = dyn_cast<ConstantVector>(Val)) {
// Insertion of scalar constant into vector constant
(idxVal == i) ? Elt : cast<Constant>(CVal->getOperand(i));
Ops.push_back(const_cast<Constant*>(Op));
}
- return Context.getConstantVector(Ops);
+ return ConstantVector::get(Ops);
}
return 0;
Result.push_back(InElt);
}
- return Context.getConstantVector(&Result[0], Result.size());
+ return ConstantVector::get(&Result[0], Result.size());
}
Constant *llvm::ConstantFoldExtractValueInstruction(LLVMContext &Context,
Ops[i] = const_cast<Constant*>(Op);
}
if (isa<StructType>(AggTy))
- return Context.getConstantStruct(Ops);
+ return ConstantStruct::get(Ops);
else
- return Context.getConstantArray(cast<ArrayType>(AggTy), Ops);
+ return ConstantArray::get(cast<ArrayType>(AggTy), Ops);
}
if (isa<ConstantAggregateZero>(Agg)) {
// Insertion of constant into aggregate zero
Ops[i] = const_cast<Constant*>(Op);
}
if (isa<StructType>(AggTy))
- return Context.getConstantStruct(Ops);
+ return ConstantStruct::get(Ops);
else
- return Context.getConstantArray(cast<ArrayType>(AggTy), Ops);
+ return ConstantArray::get(cast<ArrayType>(AggTy), Ops);
}
if (isa<ConstantStruct>(Agg) || isa<ConstantArray>(Agg)) {
// Insertion of constant into aggregate constant
}
Constant *C;
if (isa<StructType>(Agg->getType()))
- C = Context.getConstantStruct(Ops);
+ C = ConstantStruct::get(Ops);
else
- C = Context.getConstantArray(cast<ArrayType>(Agg->getType()), Ops);
+ C = ConstantArray::get(cast<ArrayType>(Agg->getType()), Ops);
return C;
}
Res.push_back(Context.getConstantExprAdd(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::FAdd:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprFAdd(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::Sub:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprSub(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::FSub:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprFSub(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::Mul:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprMul(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::FMul:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprFMul(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::UDiv:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprUDiv(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::SDiv:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprSDiv(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::FDiv:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprFDiv(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::URem:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprURem(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::SRem:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprSRem(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::FRem:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprFRem(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::And:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprAnd(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::Or:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprOr(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::Xor:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprXor(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::LShr:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprLShr(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::AShr:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprAShr(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
case Instruction::Shl:
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy);
Res.push_back(Context.getConstantExprShl(const_cast<Constant*>(C1),
const_cast<Constant*>(C2)));
}
- return Context.getConstantVector(Res);
+ return ConstantVector::get(Res);
}
}
}
ResElts.push_back(
Context.getConstantExprCompare(pred, C1Elts[i], C2Elts[i]));
}
- return Context.getConstantVector(&ResElts[0], ResElts.size());
+ return ConstantVector::get(&ResElts[0], ResElts.size());
}
if (C1->getType()->isFloatingPoint()) {