return CastResult(state,
isa<Loc>(val) ? EvalCastL(cast<Loc>(val), castTy)
: EvalCastNL(cast<NonLoc>(val), castTy));
-}
\ No newline at end of file
+}
llvm::LLVMContext &VMContext = CGM.getLLVMContext();
// reserved
- C = VMContext.getConstantInt(UnsignedLongTy, 0);
+ C = llvm::ConstantInt::get(UnsignedLongTy, 0);
Elts.push_back(C);
// Size
// FIXME: What is the right way to say this doesn't fit? We should give
// a user diagnostic in that case. Better fix would be to change the
// API to size_t.
- C = VMContext.getConstantInt(UnsignedLongTy, Size);
+ C = llvm::ConstantInt::get(UnsignedLongTy, Size);
Elts.push_back(C);
if (BlockHasCopyDispose) {
// __flags
const llvm::IntegerType *IntTy = cast<llvm::IntegerType>(
CGM.getTypes().ConvertType(CGM.getContext().IntTy));
- C = VMContext.getConstantInt(IntTy, flags);
+ C = llvm::ConstantInt::get(IntTy, flags);
Elts[1] = C;
// __reserved
- C = VMContext.getConstantInt(IntTy, 0);
+ C = llvm::ConstantInt::get(IntTy, 0);
Elts[2] = C;
if (subBlockDeclRefDecls.size() == 0) {
// Optimize to being a global block.
Elts[0] = CGM.getNSConcreteGlobalBlock();
- Elts[1] = VMContext.getConstantInt(IntTy, flags|BLOCK_IS_GLOBAL);
+ Elts[1] = llvm::ConstantInt::get(IntTy, flags|BLOCK_IS_GLOBAL);
C = VMContext.getConstantStruct(Elts);
llvm::Value *BlockLiteral = LoadBlockStruct();
Loc = Builder.CreateGEP(BlockLiteral,
- VMContext.getConstantInt(llvm::Type::Int64Ty,
+ llvm::ConstantInt::get(llvm::Type::Int64Ty,
offset),
"block.literal");
Ty = VMContext.getPointerType(Ty, 0);
llvm::Value *BlockLiteral = LoadBlockStruct();
llvm::Value *V = Builder.CreateGEP(BlockLiteral,
- VMContext.getConstantInt(llvm::Type::Int64Ty,
+ llvm::ConstantInt::get(llvm::Type::Int64Ty,
offset),
"block.literal");
if (E->isByRef()) {
uint64_t BlockLiteralSize =
TheTargetData.getTypeStoreSizeInBits(getGenericBlockLiteralType()) / 8;
DescriptorFields[1] =
- VMContext.getConstantInt(UnsignedLongTy,BlockLiteralSize);
+ llvm::ConstantInt::get(UnsignedLongTy,BlockLiteralSize);
llvm::Constant *DescriptorStruct =
VMContext.getConstantStruct(&DescriptorFields[0], 2);
// Flags
LiteralFields[1] =
- VMContext.getConstantInt(IntTy, BLOCK_IS_GLOBAL | BLOCK_HAS_DESCRIPTOR);
+ llvm::ConstantInt::get(IntTy, BLOCK_IS_GLOBAL | BLOCK_HAS_DESCRIPTOR);
// Reserved
LiteralFields[2] = getModule().getContext().getNullValue(IntTy);
llvm::Value *Dstv = Builder.CreateStructGEP(DstObj, index);
Dstv = Builder.CreateBitCast(Dstv, PtrToInt8Ty);
- llvm::Value *N = VMContext.getConstantInt(llvm::Type::Int32Ty, flag);
+ llvm::Value *N = llvm::ConstantInt::get(llvm::Type::Int32Ty, flag);
llvm::Value *F = getBlockObjectAssign();
Builder.CreateCall3(F, Dstv, Srcv, N);
}
flag |= BLOCK_BYREF_CALLER;
- llvm::Value *N = VMContext.getConstantInt(llvm::Type::Int32Ty, flag);
+ llvm::Value *N = llvm::ConstantInt::get(llvm::Type::Int32Ty, flag);
llvm::Value *F = getBlockObjectAssign();
Builder.CreateCall3(F, DstObj, SrcObj, N);
llvm::Value *F = getBlockObjectDispose();
llvm::Value *N;
V = Builder.CreateBitCast(V, PtrToInt8Ty);
- N = VMContext.getConstantInt(llvm::Type::Int32Ty, flag);
+ N = llvm::ConstantInt::get(llvm::Type::Int32Ty, flag);
Builder.CreateCall2(F, V, N);
}
Expr::EvalResult Result;
if (E->Evaluate(Result, CGM.getContext())) {
if (Result.Val.isInt())
- return RValue::get(VMContext.getConstantInt(Result.Val.getInt()));
+ return RValue::get(llvm::ConstantInt::get(VMContext,
+ Result.Val.getInt()));
else if (Result.Val.isFloat())
return RValue::get(VMContext.getConstantFP(Result.Val.getFloat()));
}
const llvm::Type *ResultType = ConvertType(E->getType());
Value *Tmp = Builder.CreateAdd(Builder.CreateCall(F, ArgValue, "tmp"),
- VMContext.getConstantInt(ArgType, 1), "tmp");
+ llvm::ConstantInt::get(ArgType, 1), "tmp");
Value *Zero = VMContext.getNullValue(ArgType);
Value *IsZero = Builder.CreateICmpEQ(ArgValue, Zero, "iszero");
Value *Result = Builder.CreateSelect(IsZero, Zero, Tmp, "ffs");
const llvm::Type *ResultType = ConvertType(E->getType());
Value *Tmp = Builder.CreateCall(F, ArgValue, "tmp");
- Value *Result = Builder.CreateAnd(Tmp, VMContext.getConstantInt(ArgType, 1),
+ Value *Result = Builder.CreateAnd(Tmp, llvm::ConstantInt::get(ArgType, 1),
"tmp");
if (Result->getType() != ResultType)
Result = Builder.CreateIntCast(Result, ResultType, "cast");
// bool UseSubObject = TypeArg.getZExtValue() & 1;
bool UseMinimum = TypeArg.getZExtValue() & 2;
return RValue::get(
- VMContext.getConstantInt(ResType, UseMinimum ? 0 : -1LL));
+ llvm::ConstantInt::get(ResType, UseMinimum ? 0 : -1LL));
}
case Builtin::BI__builtin_prefetch: {
Value *Locality, *RW, *Address = EmitScalarExpr(E->getArg(0));
// FIXME: Technically these constants should of type 'int', yes?
RW = (E->getNumArgs() > 1) ? EmitScalarExpr(E->getArg(1)) :
- VMContext.getConstantInt(llvm::Type::Int32Ty, 0);
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, 0);
Locality = (E->getNumArgs() > 2) ? EmitScalarExpr(E->getArg(2)) :
- VMContext.getConstantInt(llvm::Type::Int32Ty, 3);
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, 3);
Value *F = CGM.getIntrinsic(Intrinsic::prefetch, 0, 0);
return RValue::get(Builder.CreateCall3(F, Address, RW, Locality));
}
case Builtin::BI__builtin_bzero: {
Value *Address = EmitScalarExpr(E->getArg(0));
Builder.CreateCall4(CGM.getMemSetFn(), Address,
- VMContext.getConstantInt(llvm::Type::Int8Ty, 0),
+ llvm::ConstantInt::get(llvm::Type::Int8Ty, 0),
EmitScalarExpr(E->getArg(1)),
- VMContext.getConstantInt(llvm::Type::Int32Ty, 1));
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, 1));
return RValue::get(Address);
}
case Builtin::BI__builtin_memcpy: {
Builder.CreateCall4(CGM.getMemCpyFn(), Address,
EmitScalarExpr(E->getArg(1)),
EmitScalarExpr(E->getArg(2)),
- VMContext.getConstantInt(llvm::Type::Int32Ty, 1));
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, 1));
return RValue::get(Address);
}
case Builtin::BI__builtin_memmove: {
Builder.CreateCall4(CGM.getMemMoveFn(), Address,
EmitScalarExpr(E->getArg(1)),
EmitScalarExpr(E->getArg(2)),
- VMContext.getConstantInt(llvm::Type::Int32Ty, 1));
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, 1));
return RValue::get(Address);
}
case Builtin::BI__builtin_memset: {
Builder.CreateTrunc(EmitScalarExpr(E->getArg(1)),
llvm::Type::Int8Ty),
EmitScalarExpr(E->getArg(2)),
- VMContext.getConstantInt(llvm::Type::Int32Ty, 1));
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, 1));
return RValue::get(Address);
}
case Builtin::BI__builtin_return_address: {
case Builtin::BI__sync_synchronize: {
Value *C[5];
- C[0] = C[1] = C[2] = C[3] = VMContext.getConstantInt(llvm::Type::Int1Ty, 1);
- C[4] = VMContext.getConstantInt(llvm::Type::Int1Ty, 0);
+ C[0] = C[1] = C[2] = C[3] = llvm::ConstantInt::get(llvm::Type::Int1Ty, 1);
+ C[4] = llvm::ConstantInt::get(llvm::Type::Int1Ty, 0);
Builder.CreateCall(CGM.getIntrinsic(Intrinsic::memory_barrier), C, C + 5);
return RValue::get(0);
}
case X86::BI__builtin_ia32_psrlwi128: {
Ops[1] = Builder.CreateZExt(Ops[1], llvm::Type::Int64Ty, "zext");
const llvm::Type *Ty = VMContext.getVectorType(llvm::Type::Int64Ty, 2);
- llvm::Value *Zero = VMContext.getConstantInt(llvm::Type::Int32Ty, 0);
+ llvm::Value *Zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0);
Ops[1] = Builder.CreateInsertElement(VMContext.getUndef(Ty),
Ops[1], Zero, "insert");
Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType(), "bitcast");
}
case X86::BI__builtin_ia32_ldmxcsr: {
llvm::Type *PtrTy = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
- Value *One = VMContext.getConstantInt(llvm::Type::Int32Ty, 1);
+ Value *One = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1);
Value *Tmp = Builder.CreateAlloca(llvm::Type::Int32Ty, One, "tmp");
Builder.CreateStore(Ops[0], Tmp);
return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_sse_ldmxcsr),
}
case X86::BI__builtin_ia32_stmxcsr: {
llvm::Type *PtrTy = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
- Value *One = VMContext.getConstantInt(llvm::Type::Int32Ty, 1);
+ Value *One = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1);
Value *Tmp = Builder.CreateAlloca(llvm::Type::Int32Ty, One, "tmp");
One = Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_sse_stmxcsr),
Builder.CreateBitCast(Tmp, PtrTy));
// extract (0, 1)
unsigned Index = BuiltinID == X86::BI__builtin_ia32_storelps ? 0 : 1;
- llvm::Value *Idx = VMContext.getConstantInt(llvm::Type::Int32Ty, Index);
+ llvm::Value *Idx = llvm::ConstantInt::get(llvm::Type::Int32Ty, Index);
Ops[1] = Builder.CreateExtractElement(Ops[1], Idx, "extract");
// cast pointer to i64 & store
EmitAggExpr(Init, GV, D.getType().isVolatileQualified());
}
- Builder.CreateStore(VMContext.getConstantInt(llvm::Type::Int8Ty, 1),
+ Builder.CreateStore(llvm::ConstantInt::get(llvm::Type::Int8Ty, 1),
Builder.CreateBitCast(GuardV, PtrTy));
EmitBlock(EndBlock);
// The allocation size is the first argument.
QualType SizeTy = getContext().getSizeType();
llvm::Value *AllocSize =
- VMContext.getConstantInt(ConvertType(SizeTy),
+ llvm::ConstantInt::get(ConvertType(SizeTy),
getContext().getTypeSize(AllocType) / 8);
NewArgs.push_back(std::make_pair(RValue::get(AllocSize), SizeTy));
int isa = 0;
if (flag&BLOCK_FIELD_IS_WEAK)
isa = 1;
- V = VMContext.getConstantInt(llvm::Type::Int32Ty, isa);
+ V = llvm::ConstantInt::get(llvm::Type::Int32Ty, isa);
V = Builder.CreateIntToPtr(V, PtrToInt8Ty, "isa");
Builder.CreateStore(V, isa_field);
V = Builder.CreateBitCast(DeclPtr, PtrToInt8Ty, "forwarding");
Builder.CreateStore(V, forwarding_field);
- V = VMContext.getConstantInt(llvm::Type::Int32Ty, flags);
+ V = llvm::ConstantInt::get(llvm::Type::Int32Ty, flags);
Builder.CreateStore(V, flags_field);
const llvm::Type *V1;
V1 = cast<llvm::PointerType>(DeclPtr->getType())->getElementType();
- V = VMContext.getConstantInt(llvm::Type::Int32Ty,
+ V = llvm::ConstantInt::get(llvm::Type::Int32Ty,
(CGM.getTargetData().getTypeStoreSizeInBits(V1)
/ 8));
Builder.CreateStore(V, size_field);
// Shift to proper location.
if (StartBit)
- Val = Builder.CreateLShr(Val, VMContext.getConstantInt(EltTy, StartBit),
+ Val = Builder.CreateLShr(Val, llvm::ConstantInt::get(EltTy, StartBit),
"bf.lo");
// Mask off unused bits.
- llvm::Constant *LowMask =
- VMContext.getConstantInt(llvm::APInt::getLowBitsSet(EltTySize, LowBits));
+ llvm::Constant *LowMask = llvm::ConstantInt::get(VMContext,
+ llvm::APInt::getLowBitsSet(EltTySize, LowBits));
Val = Builder.CreateAnd(Val, LowMask, "bf.lo.cleared");
// Fetch the high bits if necessary.
if (LowBits < BitfieldSize) {
unsigned HighBits = BitfieldSize - LowBits;
llvm::Value *HighPtr =
- Builder.CreateGEP(Ptr, VMContext.getConstantInt(llvm::Type::Int32Ty, 1),
+ Builder.CreateGEP(Ptr, llvm::ConstantInt::get(llvm::Type::Int32Ty, 1),
"bf.ptr.hi");
llvm::Value *HighVal = Builder.CreateLoad(HighPtr,
LV.isVolatileQualified(),
"tmp");
// Mask off unused bits.
- llvm::Constant *HighMask =
- VMContext.getConstantInt(llvm::APInt::getLowBitsSet(EltTySize, HighBits));
+ llvm::Constant *HighMask = llvm::ConstantInt::get(VMContext,
+ llvm::APInt::getLowBitsSet(EltTySize, HighBits));
HighVal = Builder.CreateAnd(HighVal, HighMask, "bf.lo.cleared");
// Shift to proper location and or in to bitfield value.
HighVal = Builder.CreateShl(HighVal,
- VMContext.getConstantInt(EltTy, LowBits));
+ llvm::ConstantInt::get(EltTy, LowBits));
Val = Builder.CreateOr(Val, HighVal, "bf.val");
}
// Sign extend if necessary.
if (LV.isBitfieldSigned()) {
- llvm::Value *ExtraBits = VMContext.getConstantInt(EltTy,
+ llvm::Value *ExtraBits = llvm::ConstantInt::get(EltTy,
EltTySize - BitfieldSize);
Val = Builder.CreateAShr(Builder.CreateShl(Val, ExtraBits),
ExtraBits, "bf.val.sext");
const VectorType *ExprVT = ExprType->getAsVectorType();
if (!ExprVT) {
unsigned InIdx = getAccessedFieldNo(0, Elts);
- llvm::Value *Elt = VMContext.getConstantInt(llvm::Type::Int32Ty, InIdx);
+ llvm::Value *Elt = llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx);
return RValue::get(Builder.CreateExtractElement(Vec, Elt, "tmp"));
}
llvm::SmallVector<llvm::Constant*, 4> Mask;
for (unsigned i = 0; i != NumResultElts; ++i) {
unsigned InIdx = getAccessedFieldNo(i, Elts);
- Mask.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty, InIdx));
+ Mask.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx));
}
llvm::Value *MaskV = VMContext.getConstantVector(&Mask[0], Mask.size());
// exactly the size of the bit-field.
llvm::Value *SrcVal = Src.getScalarVal();
llvm::Value *NewVal = Builder.CreateIntCast(SrcVal, EltTy, false, "tmp");
- llvm::Constant *Mask =
- VMContext.getConstantInt(llvm::APInt::getLowBitsSet(EltTySize, BitfieldSize));
+ llvm::Constant *Mask = llvm::ConstantInt::get(VMContext,
+ llvm::APInt::getLowBitsSet(EltTySize, BitfieldSize));
NewVal = Builder.CreateAnd(NewVal, Mask, "bf.value");
// Return the new value of the bit-field, if requested.
// Sign extend if necessary.
if (Dst.isBitfieldSigned()) {
unsigned SrcTySize = CGM.getTargetData().getTypeSizeInBits(SrcTy);
- llvm::Value *ExtraBits = VMContext.getConstantInt(SrcTy,
+ llvm::Value *ExtraBits = llvm::ConstantInt::get(SrcTy,
SrcTySize - BitfieldSize);
SrcTrunc = Builder.CreateAShr(Builder.CreateShl(SrcTrunc, ExtraBits),
ExtraBits, "bf.reload.sext");
// Compute the mask for zero-ing the low part of this bitfield.
llvm::Constant *InvMask =
- VMContext.getConstantInt(~llvm::APInt::getBitsSet(EltTySize, StartBit,
- StartBit + LowBits));
+ llvm::ConstantInt::get(VMContext,
+ ~llvm::APInt::getBitsSet(EltTySize, StartBit, StartBit + LowBits));
// Compute the new low part as
// LowVal = (LowVal & InvMask) | (NewVal << StartBit),
// with the shift of NewVal implicitly stripping the high bits.
llvm::Value *NewLowVal =
- Builder.CreateShl(NewVal, VMContext.getConstantInt(EltTy, StartBit),
+ Builder.CreateShl(NewVal, llvm::ConstantInt::get(EltTy, StartBit),
"bf.value.lo");
LowVal = Builder.CreateAnd(LowVal, InvMask, "bf.prev.lo.cleared");
LowVal = Builder.CreateOr(LowVal, NewLowVal, "bf.new.lo");
if (LowBits < BitfieldSize) {
unsigned HighBits = BitfieldSize - LowBits;
llvm::Value *HighPtr =
- Builder.CreateGEP(Ptr, VMContext.getConstantInt(llvm::Type::Int32Ty, 1),
+ Builder.CreateGEP(Ptr, llvm::ConstantInt::get(llvm::Type::Int32Ty, 1),
"bf.ptr.hi");
llvm::Value *HighVal = Builder.CreateLoad(HighPtr,
Dst.isVolatileQualified(),
// Compute the mask for zero-ing the high part of this bitfield.
llvm::Constant *InvMask =
- VMContext.getConstantInt(~llvm::APInt::getLowBitsSet(EltTySize,
+ llvm::ConstantInt::get(VMContext, ~llvm::APInt::getLowBitsSet(EltTySize,
HighBits));
// Compute the new high part as
// where the high bits of NewVal have already been cleared and the
// shift stripping the low bits.
llvm::Value *NewHighVal =
- Builder.CreateLShr(NewVal, VMContext.getConstantInt(EltTy, LowBits),
+ Builder.CreateLShr(NewVal, llvm::ConstantInt::get(EltTy, LowBits),
"bf.value.high");
HighVal = Builder.CreateAnd(HighVal, InvMask, "bf.prev.hi.cleared");
HighVal = Builder.CreateOr(HighVal, NewHighVal, "bf.new.hi");
llvm::SmallVector<llvm::Constant*, 4> Mask(NumDstElts);
for (unsigned i = 0; i != NumSrcElts; ++i) {
unsigned InIdx = getAccessedFieldNo(i, Elts);
- Mask[InIdx] = VMContext.getConstantInt(llvm::Type::Int32Ty, i);
+ Mask[InIdx] = llvm::ConstantInt::get(llvm::Type::Int32Ty, i);
}
llvm::Value *MaskV = VMContext.getConstantVector(&Mask[0], Mask.size());
llvm::SmallVector<llvm::Constant*, 4> ExtMask;
unsigned i;
for (i = 0; i != NumSrcElts; ++i)
- ExtMask.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty, i));
+ ExtMask.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, i));
for (; i != NumDstElts; ++i)
ExtMask.push_back(VMContext.getUndef(llvm::Type::Int32Ty));
llvm::Value *ExtMaskV = VMContext.getConstantVector(&ExtMask[0],
// build identity
llvm::SmallVector<llvm::Constant*, 4> Mask;
for (unsigned i = 0; i != NumDstElts; ++i) {
- Mask.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty, i));
+ Mask.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, i));
}
// modify when what gets shuffled in
for (unsigned i = 0; i != NumSrcElts; ++i) {
unsigned Idx = getAccessedFieldNo(i, Elts);
- Mask[Idx] = VMContext.getConstantInt(llvm::Type::Int32Ty, i+NumDstElts);
+ Mask[Idx] = llvm::ConstantInt::get(llvm::Type::Int32Ty, i+NumDstElts);
}
llvm::Value *MaskV = VMContext.getConstantVector(&Mask[0], Mask.size());
Vec = Builder.CreateShuffleVector(Vec, ExtSrcVal, MaskV, "tmp");
} else {
// If the Src is a scalar (not a vector) it must be updating one element.
unsigned InIdx = getAccessedFieldNo(0, Elts);
- llvm::Value *Elt = VMContext.getConstantInt(llvm::Type::Int32Ty, InIdx);
+ llvm::Value *Elt = llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx);
Vec = Builder.CreateInsertElement(Vec, SrcVal, Elt, "tmp");
}
uint64_t BaseTypeSize = getContext().getTypeSize(BaseType) / 8;
Idx = Builder.CreateUDiv(Idx,
- VMContext.getConstantInt(Idx->getType(),
+ llvm::ConstantInt::get(Idx->getType(),
BaseTypeSize));
Address = Builder.CreateGEP(Base, Idx, "arrayidx");
} else if (const ObjCInterfaceType *OIT =
dyn_cast<ObjCInterfaceType>(E->getType())) {
llvm::Value *InterfaceSize =
- VMContext.getConstantInt(Idx->getType(),
+ llvm::ConstantInt::get(Idx->getType(),
getContext().getTypeSize(OIT) / 8);
Idx = Builder.CreateMul(Idx, InterfaceSize);
llvm::SmallVector<llvm::Constant *, 4> CElts;
for (unsigned i = 0, e = Elts.size(); i != e; ++i)
- CElts.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty, Elts[i]));
+ CElts.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, Elts[i]));
return VMContext.getConstantVector(&CElts[0], CElts.size());
}
for (unsigned i = 0, e = Indices.size(); i != e; ++i) {
if (isa<llvm::ConstantAggregateZero>(BaseElts))
- CElts.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty, 0));
+ CElts.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, 0));
else
CElts.push_back(BaseElts->getOperand(Indices[i]));
}
"tmp");
llvm::Value *Idx =
- VMContext.getConstantInt(llvm::Type::Int32Ty, Info.FieldNo);
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, Info.FieldNo);
llvm::Value *V = Builder.CreateGEP(BaseValue, Idx, "tmp");
return LValue::MakeBitfield(V, Info.Start, Info.Size,
Builder.CreateCall4(CGM.getMemCpyFn(),
DestPtr, SrcPtr,
// TypeInfo.first describes size in bits.
- VMContext.getConstantInt(IntPtr, TypeInfo.first/8),
- VMContext.getConstantInt(llvm::Type::Int32Ty,
+ llvm::ConstantInt::get(IntPtr, TypeInfo.first/8),
+ llvm::ConstantInt::get(llvm::Type::Int32Ty,
TypeInfo.second/8));
}
llvm::Value *NextVal;
if (isa<llvm::IntegerType>(InVal.first->getType())) {
uint64_t AmountVal = isInc ? 1 : -1;
- NextVal = VMContext.getConstantInt(InVal.first->getType(), AmountVal, true);
+ NextVal = llvm::ConstantInt::get(InVal.first->getType(), AmountVal, true);
// Add the inc/dec to the real part.
NextVal = Builder.CreateAdd(InVal.first, NextVal, isInc ? "inc" : "dec");
unsigned byte = V.getLoBits(curBits).getZExtValue() << (FieldOffset & 7);
do {
llvm::Constant* byteC =
- VMContext.getConstantInt(llvm::Type::Int8Ty, byte);
+ llvm::ConstantInt::get(llvm::Type::Int8Ty, byte);
Elts[i] = VMContext.getConstantExprOr(Elts[i], byteC);
++i;
V = V.lshr(curBits);
case Expr::AddrLabelExprClass: {
assert(CGF && "Invalid address of label expression outside function.");
unsigned id = CGF->GetIDForAddrOfLabel(cast<AddrLabelExpr>(E)->getLabel());
- llvm::Constant *C = VMContext.getConstantInt(llvm::Type::Int32Ty, id);
+ llvm::Constant *C = llvm::ConstantInt::get(llvm::Type::Int32Ty, id);
return VMContext.getConstantExprIntToPtr(C, ConvertType(E->getType()));
}
case Expr::CallExprClass: {
case APValue::LValue: {
const llvm::Type *DestTy = getTypes().ConvertTypeForMem(DestType);
llvm::Constant *Offset =
- VMContext.getConstantInt(llvm::Type::Int64Ty,
+ llvm::ConstantInt::get(llvm::Type::Int64Ty,
Result.Val.getLValueOffset());
llvm::Constant *C;
}
}
case APValue::Int: {
- llvm::Constant *C = VMContext.getConstantInt(Result.Val.getInt());
+ llvm::Constant *C = llvm::ConstantInt::get(VMContext,
+ Result.Val.getInt());
if (C->getType() == llvm::Type::Int1Ty) {
const llvm::Type *BoolTy = getTypes().ConvertTypeForMem(E->getType());
case APValue::ComplexInt: {
llvm::Constant *Complex[2];
- Complex[0] = VMContext.getConstantInt(Result.Val.getComplexIntReal());
- Complex[1] = VMContext.getConstantInt(Result.Val.getComplexIntImag());
+ Complex[0] = llvm::ConstantInt::get(VMContext,
+ Result.Val.getComplexIntReal());
+ Complex[1] = llvm::ConstantInt::get(VMContext,
+ Result.Val.getComplexIntImag());
return VMContext.getConstantStruct(Complex, 2);
}
for (unsigned i = 0; i != NumElts; ++i) {
APValue &Elt = Result.Val.getVectorElt(i);
if (Elt.isInt())
- Inits.push_back(VMContext.getConstantInt(Elt.getInt()));
+ Inits.push_back(llvm::ConstantInt::get(VMContext, Elt.getInt()));
else
Inits.push_back(VMContext.getConstantFP(Elt.getFloat()));
}
// Leaves.
Value *VisitIntegerLiteral(const IntegerLiteral *E) {
- return VMContext.getConstantInt(E->getValue());
+ return llvm::ConstantInt::get(VMContext, E->getValue());
}
Value *VisitFloatingLiteral(const FloatingLiteral *E) {
return VMContext.getConstantFP(E->getValue());
}
Value *VisitCharacterLiteral(const CharacterLiteral *E) {
- return VMContext.getConstantInt(ConvertType(E->getType()), E->getValue());
+ return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());
}
Value *VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *E) {
- return VMContext.getConstantInt(ConvertType(E->getType()), E->getValue());
+ return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());
}
Value *VisitCXXZeroInitValueExpr(const CXXZeroInitValueExpr *E) {
return VMContext.getNullValue(ConvertType(E->getType()));
return VMContext.getNullValue(ConvertType(E->getType()));
}
Value *VisitTypesCompatibleExpr(const TypesCompatibleExpr *E) {
- return VMContext.getConstantInt(ConvertType(E->getType()),
+ return llvm::ConstantInt::get(ConvertType(E->getType()),
CGF.getContext().typesAreCompatible(
E->getArgType1(), E->getArgType2()));
}
Value *VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E);
Value *VisitAddrLabelExpr(const AddrLabelExpr *E) {
llvm::Value *V =
- VMContext.getConstantInt(llvm::Type::Int32Ty,
+ llvm::ConstantInt::get(llvm::Type::Int32Ty,
CGF.GetIDForAddrOfLabel(E->getLabel()));
return Builder.CreateIntToPtr(V, ConvertType(E->getType()));
// l-values.
Value *VisitDeclRefExpr(DeclRefExpr *E) {
if (const EnumConstantDecl *EC = dyn_cast<EnumConstantDecl>(E->getDecl()))
- return VMContext.getConstantInt(EC->getInitVal());
+ return llvm::ConstantInt::get(VMContext, EC->getInitVal());
return EmitLoadOfLValue(E);
}
Value *VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
unsigned i;
for (i = 0; i < NumInitElements; ++i) {
Value *NewV = Visit(E->getInit(i));
- Value *Idx = VMContext.getConstantInt(llvm::Type::Int32Ty, i);
+ Value *Idx = llvm::ConstantInt::get(llvm::Type::Int32Ty, i);
V = Builder.CreateInsertElement(V, NewV, Idx);
}
// Emit remaining default initializers
for (/* Do not initialize i*/; i < NumVectorElements; ++i) {
- Value *Idx = VMContext.getConstantInt(llvm::Type::Int32Ty, i);
+ Value *Idx = llvm::ConstantInt::get(llvm::Type::Int32Ty, i);
llvm::Value *NewV = VMContext.getNullValue(ElementType);
V = Builder.CreateInsertElement(V, NewV, Idx);
}
// Insert the element in element zero of an undef vector
llvm::Value *UnV = VMContext.getUndef(DstTy);
- llvm::Value *Idx = VMContext.getConstantInt(llvm::Type::Int32Ty, 0);
+ llvm::Value *Idx = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0);
UnV = Builder.CreateInsertElement(UnV, Elt, Idx, "tmp");
// Splat the element across to all elements
llvm::SmallVector<llvm::Constant*, 16> Args;
unsigned NumElements = cast<llvm::VectorType>(DstTy)->getNumElements();
for (unsigned i = 0; i < NumElements; i++)
- Args.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty, 0));
+ Args.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, 0));
llvm::Constant *Mask = VMContext.getConstantVector(&Args[0], NumElements);
llvm::Value *Yay = Builder.CreateShuffleVector(UnV, UnV, Mask, "splat");
if (const llvm::PointerType *PT =
dyn_cast<llvm::PointerType>(InVal->getType())) {
llvm::Constant *Inc =
- VMContext.getConstantInt(llvm::Type::Int32Ty, AmountVal);
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, AmountVal);
if (!isa<llvm::FunctionType>(PT->getElementType())) {
QualType PTEE = ValTy->getPointeeType();
if (const ObjCInterfaceType *OIT =
int size = CGF.getContext().getTypeSize(OIT) / 8;
if (!isInc)
size = -size;
- Inc = VMContext.getConstantInt(Inc->getType(), size);
+ Inc = llvm::ConstantInt::get(Inc->getType(), size);
const llvm::Type *i8Ty =
VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
InVal = Builder.CreateBitCast(InVal, i8Ty);
// Decrement does not have this property.
NextVal = VMContext.getTrue();
} else if (isa<llvm::IntegerType>(InVal->getType())) {
- NextVal = VMContext.getConstantInt(InVal->getType(), AmountVal);
+ NextVal = llvm::ConstantInt::get(InVal->getType(), AmountVal);
NextVal = Builder.CreateAdd(InVal, NextVal, isInc ? "inc" : "dec");
} else {
// Add the inc/dec to the real part.
// constant folding logic so we don't have to duplicate it here.
Expr::EvalResult Result;
E->Evaluate(Result, CGF.getContext());
- return VMContext.getConstantInt(Result.Val.getInt());
+ return llvm::ConstantInt::get(VMContext, Result.Val.getInt());
}
Value *ScalarExprEmitter::VisitUnaryReal(const UnaryOperator *E) {
llvm::Value *handlerResult = Builder.CreateCall4(handlerFunction,
Builder.CreateSExt(Ops.LHS, llvm::Type::Int64Ty),
Builder.CreateSExt(Ops.RHS, llvm::Type::Int64Ty),
- VMContext.getConstantInt(llvm::Type::Int8Ty, OpID),
- VMContext.getConstantInt(llvm::Type::Int8Ty,
+ llvm::ConstantInt::get(llvm::Type::Int8Ty, OpID),
+ llvm::ConstantInt::get(llvm::Type::Int8Ty,
cast<llvm::IntegerType>(opTy)->getBitWidth()));
handlerResult = Builder.CreateTrunc(handlerResult, opTy);
// type.
if (const ObjCInterfaceType *OIT = dyn_cast<ObjCInterfaceType>(ElementType)) {
llvm::Value *InterfaceSize =
- VMContext.getConstantInt(Idx->getType(),
+ llvm::ConstantInt::get(Idx->getType(),
CGF.getContext().getTypeSize(OIT) / 8);
Idx = Builder.CreateMul(Idx, InterfaceSize);
const llvm::Type *i8Ty = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
if (const ObjCInterfaceType *OIT =
dyn_cast<ObjCInterfaceType>(LHSElementType)) {
llvm::Value *InterfaceSize =
- VMContext.getConstantInt(Idx->getType(),
+ llvm::ConstantInt::get(Idx->getType(),
CGF.getContext().getTypeSize(OIT) / 8);
Idx = Builder.CreateMul(Idx, InterfaceSize);
const llvm::Type *i8Ty =
// better code. See PR2247.
if (llvm::isPowerOf2_64(ElementSize)) {
Value *ShAmt =
- VMContext.getConstantInt(ResultType, llvm::Log2_64(ElementSize));
+ llvm::ConstantInt::get(ResultType, llvm::Log2_64(ElementSize));
return Builder.CreateAShr(BytesBetween, ShAmt, "sub.ptr.shr");
}
// Otherwise, do a full sdiv.
- Value *BytesPerElt = VMContext.getConstantInt(ResultType, ElementSize);
+ Value *BytesPerElt = llvm::ConstantInt::get(ResultType, ElementSize);
return Builder.CreateSDiv(BytesBetween, BytesPerElt, "sub.ptr.div");
}
}
// 1 || RHS: If it is safe, just elide the RHS, and return 1.
if (!CGF.ContainsLabel(E->getRHS()))
- return VMContext.getConstantInt(CGF.LLVMIntTy, 1);
+ return llvm::ConstantInt::get(CGF.LLVMIntTy, 1);
}
llvm::BasicBlock *ContBlock = CGF.createBasicBlock("lor.end");
int n = va_arg(va, int);
assert(n >= 0 && n < (int)NumElements * 2 &&
"Vector shuffle index out of bounds!");
- Args.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty, n));
+ Args.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, n));
}
const char *Name = va_arg(va, const char *);
for (unsigned i = 0, e = NumVals; i != e; ++i) {
llvm::Value *Val = isSplat ? Vals[0] : Vals[i];
- llvm::Value *Idx = VMContext.getConstantInt(llvm::Type::Int32Ty, i);
+ llvm::Value *Idx = llvm::ConstantInt::get(llvm::Type::Int32Ty, i);
Vec = Builder.CreateInsertElement(Vec, Val, Idx, "tmp");
}
Builder.CreateBitCast(LoadObjCSelf(), Types.ConvertType(IdTy));
llvm::Value *Offset = EmitIvarOffset(IMP->getClassInterface(), Ivar);
llvm::Value *True =
- VMContext.getConstantInt(Types.ConvertType(getContext().BoolTy), 1);
+ llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 1);
CallArgList Args;
Args.push_back(std::make_pair(RValue::get(SelfAsId), IdTy));
Args.push_back(std::make_pair(RValue::get(CmdVal), Cmd->getType()));
Builder.CreateBitCast(Builder.CreateLoad(Arg, "arg"),
Types.ConvertType(IdTy));
llvm::Value *True =
- VMContext.getConstantInt(Types.ConvertType(getContext().BoolTy), 1);
+ llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 1);
llvm::Value *False =
- VMContext.getConstantInt(Types.ConvertType(getContext().BoolTy), 0);
+ llvm::ConstantInt::get(Types.ConvertType(getContext().BoolTy), 0);
CallArgList Args;
Args.push_back(std::make_pair(RValue::get(SelfAsId), IdTy));
Args.push_back(std::make_pair(RValue::get(CmdVal), Cmd->getType()));
getContext().getPointerType(ItemsTy)));
const llvm::Type *UnsignedLongLTy = ConvertType(getContext().UnsignedLongTy);
- llvm::Constant *Count = VMContext.getConstantInt(UnsignedLongLTy, NumItems);
+ llvm::Constant *Count = llvm::ConstantInt::get(UnsignedLongLTy, NumItems);
Args.push_back(std::make_pair(RValue::get(Count),
getContext().UnsignedLongTy));
// Increment the counter.
Counter = Builder.CreateAdd(Counter,
- VMContext.getConstantInt(UnsignedLongLTy, 1));
+ llvm::ConstantInt::get(UnsignedLongLTy, 1));
Builder.CreateStore(Counter, CounterPtr);
llvm::BasicBlock *LoopEnd = createBasicBlock("loopend");
LongTy = cast<llvm::IntegerType>(
CGM.getTypes().ConvertType(CGM.getContext().LongTy));
- Zeros[0] = VMContext.getConstantInt(LongTy, 0);
+ Zeros[0] = llvm::ConstantInt::get(LongTy, 0);
Zeros[1] = Zeros[0];
NULLPtr = VMContext.getConstantPointerNull(
VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty));
std::vector<llvm::Constant*> Ivars;
Ivars.push_back(NULLPtr);
Ivars.push_back(MakeConstantString(Str));
- Ivars.push_back(VMContext.getConstantInt(IntTy, Str.size()));
+ Ivars.push_back(llvm::ConstantInt::get(IntTy, Str.size()));
llvm::Constant *ObjCStr = MakeGlobal(
VMContext.getStructType(PtrToInt8Ty, PtrToInt8Ty, IntTy, NULL),
Ivars, ".objc_str");
Methods.clear();
Methods.push_back(VMContext.getConstantPointerNull(
VMContext.getPointerTypeUnqual(ObjCMethodListTy)));
- Methods.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty,
+ Methods.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty,
MethodTypes.size()));
Methods.push_back(MethodArray);
Elements.clear();
- Elements.push_back(VMContext.getConstantInt(IntTy, (int)IvarNames.size()));
+ Elements.push_back(llvm::ConstantInt::get(IntTy, (int)IvarNames.size()));
Elements.push_back(VMContext.getConstantArray(ObjCIvarArrayTy, Ivars));
// Structure containing array and array count
llvm::StructType *ObjCIvarListTy = VMContext.getStructType(IntTy,
PtrTy, // protocols
PtrTy, // gc_object_type
NULL);
- llvm::Constant *Zero = VMContext.getConstantInt(LongTy, 0);
+ llvm::Constant *Zero = llvm::ConstantInt::get(LongTy, 0);
llvm::Constant *NullP =
VMContext.getConstantPointerNull(PtrTy);
// Fill in the structure
Elements.push_back(SuperClass);
Elements.push_back(MakeConstantString(Name, ".class_name"));
Elements.push_back(Zero);
- Elements.push_back(VMContext.getConstantInt(LongTy, info));
+ Elements.push_back(llvm::ConstantInt::get(LongTy, info));
Elements.push_back(InstanceSize);
Elements.push_back(IVars);
Elements.push_back(Methods);
llvm::StructType *ObjCMethodDescListTy = VMContext.getStructType(
IntTy, ObjCMethodArrayTy, NULL);
Methods.clear();
- Methods.push_back(VMContext.getConstantInt(IntTy, MethodNames.size()));
+ Methods.push_back(llvm::ConstantInt::get(IntTy, MethodNames.size()));
Methods.push_back(Array);
return MakeGlobal(ObjCMethodDescListTy, Methods, ".objc_method_list");
}
Elements);
Elements.clear();
Elements.push_back(NULLPtr);
- Elements.push_back(VMContext.getConstantInt(LongTy, Protocols.size()));
+ Elements.push_back(llvm::ConstantInt::get(LongTy, Protocols.size()));
Elements.push_back(ProtocolArray);
return MakeGlobal(ProtocolListTy, Elements, ".objc_protocol_list");
}
// The isa pointer must be set to a magic number so the runtime knows it's
// the correct layout.
Elements.push_back(VMContext.getConstantExprIntToPtr(
- VMContext.getConstantInt(llvm::Type::Int32Ty, ProtocolVersion), IdTy));
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, ProtocolVersion), IdTy));
Elements.push_back(MakeConstantString(ProtocolName, ".objc_protocol_name"));
Elements.push_back(ProtocolList);
Elements.push_back(InstanceMethodList);
// The isa pointer must be set to a magic number so the runtime knows it's
// the correct layout.
Elements.push_back(VMContext.getConstantExprIntToPtr(
- VMContext.getConstantInt(llvm::Type::Int32Ty, ProtocolVersion), IdTy));
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, ProtocolVersion), IdTy));
Elements.push_back(MakeConstantString(ProtocolName, ".objc_protocol_name"));
Elements.push_back(ProtocolList);
Elements.push_back(InstanceMethodList);
std::string classSymbolName = "__objc_class_name_" + ClassName;
if (llvm::GlobalVariable *symbol =
TheModule.getGlobalVariable(classSymbolName)) {
- symbol->setInitializer(VMContext.getConstantInt(LongTy, 0));
+ symbol->setInitializer(llvm::ConstantInt::get(LongTy, 0));
} else {
new llvm::GlobalVariable(TheModule, LongTy, false,
- llvm::GlobalValue::ExternalLinkage, VMContext.getConstantInt(LongTy, 0),
+ llvm::GlobalValue::ExternalLinkage, llvm::ConstantInt::get(LongTy, 0),
classSymbolName);
}
Offset = ComputeIvarBaseOffset(CGM, ClassDecl, *iter);
}
IvarOffsets.push_back(
- VMContext.getConstantInt(llvm::Type::Int32Ty, Offset));
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, Offset));
}
// Collect information about instance methods
llvm::Constant *ClassStruct =
GenerateClassStructure(MetaClassStruct, SuperClass, 0x1L,
ClassName.c_str(), 0,
- VMContext.getConstantInt(LongTy, instanceSize), IvarList,
+ llvm::ConstantInt::get(LongTy, instanceSize), IvarList,
MethodList, GenerateProtocolList(Protocols));
// Resolve the class aliases, if they exist.
Selectors.push_back(VMContext.getConstantStruct(SelStructTy, Elements));
Elements.clear();
// Number of static selectors
- Elements.push_back(VMContext.getConstantInt(LongTy, Selectors.size() ));
+ Elements.push_back(llvm::ConstantInt::get(LongTy, Selectors.size() ));
llvm::Constant *SelectorList = MakeGlobal(
VMContext.getArrayType(SelStructTy, Selectors.size()), Selectors,
".objc_selector_list");
iter=TypedSelectors.begin(), iterEnd =TypedSelectors.end();
iter != iterEnd; ++iter) {
llvm::Constant *Idxs[] = {Zeros[0],
- VMContext.getConstantInt(llvm::Type::Int32Ty, index++), Zeros[0]};
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, index++), Zeros[0]};
llvm::Constant *SelPtr = new llvm::GlobalVariable(TheModule, SelStructPtrTy,
true, llvm::GlobalValue::InternalLinkage,
VMContext.getConstantExprGetElementPtr(SelectorList, Idxs, 2),
iter=UntypedSelectors.begin(), iterEnd = UntypedSelectors.end();
iter != iterEnd; iter++) {
llvm::Constant *Idxs[] = {Zeros[0],
- VMContext.getConstantInt(llvm::Type::Int32Ty, index++), Zeros[0]};
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, index++), Zeros[0]};
llvm::Constant *SelPtr = new llvm::GlobalVariable(TheModule, SelStructPtrTy,
true, llvm::GlobalValue::InternalLinkage,
VMContext.getConstantExprGetElementPtr(SelectorList, Idxs, 2),
(*iter).second->setAliasee(SelPtr);
}
// Number of classes defined.
- Elements.push_back(VMContext.getConstantInt(llvm::Type::Int16Ty,
+ Elements.push_back(llvm::ConstantInt::get(llvm::Type::Int16Ty,
Classes.size()));
// Number of categories defined
- Elements.push_back(VMContext.getConstantInt(llvm::Type::Int16Ty,
+ Elements.push_back(llvm::ConstantInt::get(llvm::Type::Int16Ty,
Categories.size()));
// Create an array of classes, then categories, then static object instances
Classes.insert(Classes.end(), Categories.begin(), Categories.end());
Elements.clear();
// Runtime version used for compatibility checking.
if (CGM.getContext().getLangOptions().ObjCNonFragileABI) {
- Elements.push_back(VMContext.getConstantInt(LongTy,
+ Elements.push_back(llvm::ConstantInt::get(LongTy,
NonFragileRuntimeVersion));
} else {
- Elements.push_back(VMContext.getConstantInt(LongTy, RuntimeVersion));
+ Elements.push_back(llvm::ConstantInt::get(LongTy, RuntimeVersion));
}
// sizeof(ModuleTy)
llvm::TargetData td = llvm::TargetData::TargetData(&TheModule);
- Elements.push_back(VMContext.getConstantInt(LongTy,
+ Elements.push_back(llvm::ConstantInt::get(LongTy,
td.getTypeSizeInBits(ModuleTy)/8));
//FIXME: Should be the path to the file where this module was declared
Elements.push_back(NULLPtr);
// We use a cleanup unless there was already a catch all.
if (!HasCatchAll) {
- ESelArgs.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty, 0));
+ ESelArgs.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, 0));
Handlers.push_back(std::make_pair((const ParmVarDecl*) 0, (const Stmt*) 0));
}
ESelArgs.clear();
ESelArgs.push_back(Exc);
ESelArgs.push_back(Personality);
- ESelArgs.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty, 0));
+ ESelArgs.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, 0));
CGF.Builder.CreateCall(llvm_eh_selector, ESelArgs.begin(), ESelArgs.end(),
"selector");
CGF.Builder.CreateCall(llvm_eh_typeid_for,
if (!IvarOffsetGV) {
uint64_t Offset = ComputeIvarBaseOffset(CGM, ID, Ivar);
llvm::ConstantInt *OffsetGuess =
- VMContext.getConstantInt(LongTy, Offset, "ivar");
+ llvm::ConstantInt::get(LongTy, Offset, "ivar");
IvarOffsetGV = new llvm::GlobalVariable(TheModule, LongTy, false,
llvm::GlobalValue::CommonLinkage, OffsetGuess, Name);
}
false, "ivar");
}
uint64_t Offset = ComputeIvarBaseOffset(CGF.CGM, Interface, Ivar);
- return VMContext.getConstantInt(LongTy, Offset, "ivar");
+ return llvm::ConstantInt::get(LongTy, Offset, "ivar");
}
CodeGen::CGObjCRuntime *CodeGen::CreateGNUObjCRuntime(CodeGen::CodeGenModule &CGM){
unsigned idx0,
unsigned idx1) {
llvm::Value *Idxs[] = {
- VMContext.getConstantInt(llvm::Type::Int32Ty, idx0),
- VMContext.getConstantInt(llvm::Type::Int32Ty, idx1)
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, idx0),
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, idx1)
};
return VMContext.getConstantExprGetElementPtr(C, Idxs, 2);
}
uint64_t Size =
CGM.getTargetData().getTypeAllocSize(ObjCTypes.ProtocolExtensionTy);
std::vector<llvm::Constant*> Values(4);
- Values[0] = VMContext.getConstantInt(ObjCTypes.IntTy, Size);
+ Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
Values[1] =
EmitMethodDescList("\01L_OBJC_PROTOCOL_INSTANCE_METHODS_OPT_"
+ PD->getNameAsString(),
std::vector<llvm::Constant*> Values(3);
// This field is only used by the runtime.
Values[0] = VMContext.getNullValue(ObjCTypes.ProtocolListPtrTy);
- Values[1] = VMContext.getConstantInt(ObjCTypes.LongTy,
+ Values[1] = llvm::ConstantInt::get(ObjCTypes.LongTy,
ProtocolRefs.size() - 1);
Values[2] =
VMContext.getConstantArray(VMContext.getArrayType(ObjCTypes.ProtocolPtrTy,
unsigned PropertySize =
CGM.getTargetData().getTypeAllocSize(ObjCTypes.PropertyTy);
std::vector<llvm::Constant*> Values(3);
- Values[0] = VMContext.getConstantInt(ObjCTypes.IntTy, PropertySize);
- Values[1] = VMContext.getConstantInt(ObjCTypes.IntTy, Properties.size());
+ Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, PropertySize);
+ Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Properties.size());
llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.PropertyTy,
Properties.size());
Values[2] = VMContext.getConstantArray(AT, Properties);
return VMContext.getNullValue(ObjCTypes.MethodDescriptionListPtrTy);
std::vector<llvm::Constant*> Values(2);
- Values[0] = VMContext.getConstantInt(ObjCTypes.IntTy, Methods.size());
+ Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size());
llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.MethodDescriptionTy,
Methods.size());
Values[1] = VMContext.getConstantArray(AT, Methods);
} else {
Values[4] = VMContext.getNullValue(ObjCTypes.ProtocolListPtrTy);
}
- Values[5] = VMContext.getConstantInt(ObjCTypes.IntTy, Size);
+ Values[5] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
// If there is no category @interface then there can be no properties.
if (Category) {
}
Values[ 2] = GetClassName(ID->getIdentifier());
// Version is always 0.
- Values[ 3] = VMContext.getConstantInt(ObjCTypes.LongTy, 0);
- Values[ 4] = VMContext.getConstantInt(ObjCTypes.LongTy, Flags);
- Values[ 5] = VMContext.getConstantInt(ObjCTypes.LongTy, Size);
+ Values[ 3] = llvm::ConstantInt::get(ObjCTypes.LongTy, 0);
+ Values[ 4] = llvm::ConstantInt::get(ObjCTypes.LongTy, Flags);
+ Values[ 5] = llvm::ConstantInt::get(ObjCTypes.LongTy, Size);
Values[ 6] = EmitIvarList(ID, false);
Values[ 7] =
EmitMethodList("\01L_OBJC_INSTANCE_METHODS_" + ID->getNameAsString(),
}
Values[ 2] = GetClassName(ID->getIdentifier());
// Version is always 0.
- Values[ 3] = VMContext.getConstantInt(ObjCTypes.LongTy, 0);
- Values[ 4] = VMContext.getConstantInt(ObjCTypes.LongTy, Flags);
- Values[ 5] = VMContext.getConstantInt(ObjCTypes.LongTy, Size);
+ Values[ 3] = llvm::ConstantInt::get(ObjCTypes.LongTy, 0);
+ Values[ 4] = llvm::ConstantInt::get(ObjCTypes.LongTy, Flags);
+ Values[ 5] = llvm::ConstantInt::get(ObjCTypes.LongTy, Size);
Values[ 6] = EmitIvarList(ID, true);
Values[ 7] =
EmitMethodList("\01L_OBJC_CLASS_METHODS_" + ID->getNameAsString(),
CGM.getTargetData().getTypeAllocSize(ObjCTypes.ClassExtensionTy);
std::vector<llvm::Constant*> Values(3);
- Values[0] = VMContext.getConstantInt(ObjCTypes.IntTy, Size);
+ Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
Values[1] = BuildIvarLayout(ID, false);
Values[2] = EmitPropertyList("\01l_OBJC_$_PROP_LIST_" + ID->getNameAsString(),
ID, ID->getClassInterface(), ObjCTypes);
continue;
Ivar[0] = GetMethodVarName(IVD->getIdentifier());
Ivar[1] = GetMethodVarType(IVD);
- Ivar[2] = VMContext.getConstantInt(ObjCTypes.IntTy,
+ Ivar[2] = llvm::ConstantInt::get(ObjCTypes.IntTy,
ComputeIvarBaseOffset(CGM, OID, IVD));
Ivars.push_back(VMContext.getConstantStruct(ObjCTypes.IvarTy, Ivar));
}
return VMContext.getNullValue(ObjCTypes.IvarListPtrTy);
std::vector<llvm::Constant*> Values(2);
- Values[0] = VMContext.getConstantInt(ObjCTypes.IntTy, Ivars.size());
+ Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size());
llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.IvarTy,
Ivars.size());
Values[1] = VMContext.getConstantArray(AT, Ivars);
std::vector<llvm::Constant*> Values(3);
Values[0] = VMContext.getNullValue(ObjCTypes.Int8PtrTy);
- Values[1] = VMContext.getConstantInt(ObjCTypes.IntTy, Methods.size());
+ Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size());
llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.MethodTy,
Methods.size());
Values[2] = VMContext.getConstantArray(AT, Methods);
unsigned long size) {
SrcPtr = CGF.Builder.CreateBitCast(SrcPtr, ObjCTypes.Int8PtrTy);
DestPtr = CGF.Builder.CreateBitCast(DestPtr, ObjCTypes.Int8PtrTy);
- llvm::Value *N = VMContext.getConstantInt(ObjCTypes.LongTy, size);
+ llvm::Value *N = llvm::ConstantInt::get(ObjCTypes.LongTy, size);
CGF.Builder.CreateCall3(ObjCTypes.GcMemmoveCollectableFn(),
DestPtr, SrcPtr, N);
return;
const ObjCInterfaceDecl *Interface,
const ObjCIvarDecl *Ivar) {
uint64_t Offset = ComputeIvarBaseOffset(CGM, Interface, Ivar);
- return VMContext.getConstantInt(
+ return llvm::ConstantInt::get(
CGM.getTypes().ConvertType(CGM.getContext().LongTy),
Offset);
}
// Emitted as int[2];
llvm::Constant *values[2] = {
- VMContext.getConstantInt(llvm::Type::Int32Ty, version),
- VMContext.getConstantInt(llvm::Type::Int32Ty, flags)
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, version),
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, flags)
};
llvm::ArrayType *AT = VMContext.getArrayType(llvm::Type::Int32Ty, 2);
uint64_t Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.ModuleTy);
std::vector<llvm::Constant*> Values(4);
- Values[0] = VMContext.getConstantInt(ObjCTypes.LongTy, ModuleVersion);
- Values[1] = VMContext.getConstantInt(ObjCTypes.LongTy, Size);
+ Values[0] = llvm::ConstantInt::get(ObjCTypes.LongTy, ModuleVersion);
+ Values[1] = llvm::ConstantInt::get(ObjCTypes.LongTy, Size);
// This used to be the filename, now it is unused. <rdr://4327263>
Values[2] = GetClassName(&CGM.getContext().Idents.get(""));
Values[3] = EmitModuleSymbols();
return VMContext.getNullValue(ObjCTypes.SymtabPtrTy);
std::vector<llvm::Constant*> Values(5);
- Values[0] = VMContext.getConstantInt(ObjCTypes.LongTy, 0);
+ Values[0] = llvm::ConstantInt::get(ObjCTypes.LongTy, 0);
Values[1] = VMContext.getNullValue(ObjCTypes.SelectorPtrTy);
- Values[2] = VMContext.getConstantInt(ObjCTypes.ShortTy, NumClasses);
- Values[3] = VMContext.getConstantInt(ObjCTypes.ShortTy, NumCategories);
+ Values[2] = llvm::ConstantInt::get(ObjCTypes.ShortTy, NumClasses);
+ Values[3] = llvm::ConstantInt::get(ObjCTypes.ShortTy, NumCategories);
// The runtime expects exactly the list of defined classes followed
// by the list of defined categories, in a single array.
// static int L_OBJC_IMAGE_INFO[2] = { 0, flags };
// FIXME. flags can be 0 | 1 | 2 | 6. For now just use 0
std::vector<llvm::Constant*> Values(2);
- Values[0] = VMContext.getConstantInt(ObjCTypes.IntTy, 0);
+ Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, 0);
unsigned int flags = 0;
// FIXME: Fix and continue?
if (CGM.getLangOptions().getGCMode() != LangOptions::NonGC)
flags |= eImageInfo_GarbageCollected;
if (CGM.getLangOptions().getGCMode() == LangOptions::GCOnly)
flags |= eImageInfo_GCOnly;
- Values[1] = VMContext.getConstantInt(ObjCTypes.IntTy, flags);
+ Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, flags);
llvm::Constant* Init = VMContext.getConstantArray(
VMContext.getArrayType(ObjCTypes.IntTy, 2),
Values);
const ObjCImplementationDecl *ID) {
std::string ClassName = ID->getNameAsString();
std::vector<llvm::Constant*> Values(10); // 11 for 64bit targets!
- Values[ 0] = VMContext.getConstantInt(ObjCTypes.IntTy, flags);
- Values[ 1] = VMContext.getConstantInt(ObjCTypes.IntTy, InstanceStart);
- Values[ 2] = VMContext.getConstantInt(ObjCTypes.IntTy, InstanceSize);
+ Values[ 0] = llvm::ConstantInt::get(ObjCTypes.IntTy, flags);
+ Values[ 1] = llvm::ConstantInt::get(ObjCTypes.IntTy, InstanceStart);
+ Values[ 2] = llvm::ConstantInt::get(ObjCTypes.IntTy, InstanceSize);
// FIXME. For 64bit targets add 0 here.
Values[ 3] = (flags & CLS_META) ? GetIvarLayoutName(0, ObjCTypes)
: BuildIvarLayout(ID, true);
std::vector<llvm::Constant*> Values(3);
// sizeof(struct _objc_method)
unsigned Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.MethodTy);
- Values[0] = VMContext.getConstantInt(ObjCTypes.IntTy, Size);
+ Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
// method_count
- Values[1] = VMContext.getConstantInt(ObjCTypes.IntTy, Methods.size());
+ Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size());
llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.MethodTy,
Methods.size());
Values[2] = VMContext.getConstantArray(AT, Methods);
const ObjCIvarDecl *Ivar,
unsigned long int Offset) {
llvm::GlobalVariable *IvarOffsetGV = ObjCIvarOffsetVariable(ID, Ivar);
- IvarOffsetGV->setInitializer(VMContext.getConstantInt(ObjCTypes.LongTy,
+ IvarOffsetGV->setInitializer(llvm::ConstantInt::get(ObjCTypes.LongTy,
Offset));
IvarOffsetGV->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(ObjCTypes.LongTy));
unsigned Align = CGM.getContext().getPreferredTypeAlign(
IVD->getType().getTypePtr()) >> 3;
Align = llvm::Log2_32(Align);
- Ivar[3] = VMContext.getConstantInt(ObjCTypes.IntTy, Align);
+ Ivar[3] = llvm::ConstantInt::get(ObjCTypes.IntTy, Align);
// NOTE. Size of a bitfield does not match gcc's, because of the
// way bitfields are treated special in each. But I am told that
// 'size' for bitfield ivars is ignored by the runtime so it does
// not matter. If it matters, there is enough info to get the
// bitfield right!
- Ivar[4] = VMContext.getConstantInt(ObjCTypes.IntTy, Size);
+ Ivar[4] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
Ivars.push_back(VMContext.getConstantStruct(ObjCTypes.IvarnfABITy, Ivar));
}
// Return null for empty list.
return VMContext.getNullValue(ObjCTypes.IvarListnfABIPtrTy);
std::vector<llvm::Constant*> Values(3);
unsigned Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.IvarnfABITy);
- Values[0] = VMContext.getConstantInt(ObjCTypes.IntTy, Size);
- Values[1] = VMContext.getConstantInt(ObjCTypes.IntTy, Ivars.size());
+ Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
+ Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size());
llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.IvarnfABITy,
Ivars.size());
Values[2] = VMContext.getConstantArray(AT, Ivars);
0, PD, ObjCTypes);
uint32_t Size =
CGM.getTargetData().getTypeAllocSize(ObjCTypes.ProtocolnfABITy);
- Values[8] = VMContext.getConstantInt(ObjCTypes.IntTy, Size);
+ Values[8] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
Values[9] = VMContext.getNullValue(ObjCTypes.IntTy);
llvm::Constant *Init = VMContext.getConstantStruct(ObjCTypes.ProtocolnfABITy,
Values);
std::vector<llvm::Constant*> Values(2);
Values[0] =
- VMContext.getConstantInt(ObjCTypes.LongTy, ProtocolRefs.size() - 1);
+ llvm::ConstantInt::get(ObjCTypes.LongTy, ProtocolRefs.size() - 1);
Values[1] =
VMContext.getConstantArray(
VMContext.getArrayType(ObjCTypes.ProtocolnfABIPtrTy,
unsigned long size) {
SrcPtr = CGF.Builder.CreateBitCast(SrcPtr, ObjCTypes.Int8PtrTy);
DestPtr = CGF.Builder.CreateBitCast(DestPtr, ObjCTypes.Int8PtrTy);
- llvm::Value *N = VMContext.getConstantInt(ObjCTypes.LongTy, size);
+ llvm::Value *N = llvm::ConstantInt::get(ObjCTypes.LongTy, size);
CGF.Builder.CreateCall3(ObjCTypes.GcMemmoveCollectableFn(),
DestPtr, SrcPtr, N);
return;
// We use a cleanup unless there was already a catch all.
if (!HasCatchAll) {
- SelectorArgs.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty, 0));
+ SelectorArgs.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, 0));
Handlers.push_back(std::make_pair((const ParmVarDecl*) 0, (const Stmt*) 0));
}
llvm::SmallVector<llvm::Value*, 8> Args;
Args.push_back(Exc);
Args.push_back(ObjCTypes.getEHPersonalityPtr());
- Args.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty,
+ Args.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty,
0));
CGF.Builder.CreateCall(llvm_eh_selector_i64, Args.begin(), Args.end());
CGF.Builder.CreateStore(Exc, RethrowPtr);
Args.clear();
Args.push_back(Exc);
Args.push_back(ObjCTypes.getEHPersonalityPtr());
- Args.push_back(VMContext.getConstantInt(llvm::Type::Int32Ty,
+ Args.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty,
0));
CGF.Builder.CreateCall(llvm_eh_selector_i64, Args.begin(), Args.end());
CGF.Builder.CreateStore(Exc, RethrowPtr);
llvm::GlobalValue::ExternalLinkage,
0, VTableName);
- llvm::Value *VTableIdx = VMContext.getConstantInt(llvm::Type::Int32Ty, 2);
+ llvm::Value *VTableIdx = llvm::ConstantInt::get(llvm::Type::Int32Ty, 2);
std::vector<llvm::Constant*> Values(3);
Values[0] = VMContext.getConstantExprGetElementPtr(VTableGV, &VTableIdx, 1);
if (Range.ult(llvm::APInt(Range.getBitWidth(), 64))) {
// Range is small enough to add multiple switch instruction cases.
for (unsigned i = 0, e = Range.getZExtValue() + 1; i != e; ++i) {
- SwitchInsn->addCase(VMContext.getConstantInt(LHS), CaseDest);
+ SwitchInsn->addCase(llvm::ConstantInt::get(VMContext, LHS), CaseDest);
LHS++;
}
return;
// Emit range check.
llvm::Value *Diff =
- Builder.CreateSub(SwitchInsn->getCondition(), VMContext.getConstantInt(LHS),
- "tmp");
+ Builder.CreateSub(SwitchInsn->getCondition(),
+ llvm::ConstantInt::get(VMContext, LHS), "tmp");
llvm::Value *Cond =
- Builder.CreateICmpULE(Diff, VMContext.getConstantInt(Range), "tmp");
+ Builder.CreateICmpULE(Diff,
+ llvm::ConstantInt::get(VMContext, Range), "tmp");
Builder.CreateCondBr(Cond, CaseDest, FalseDest);
// Restore the appropriate insertion point.
EmitBlock(createBasicBlock("sw.bb"));
llvm::BasicBlock *CaseDest = Builder.GetInsertBlock();
llvm::APSInt CaseVal = S.getLHS()->EvaluateAsInt(getContext());
- SwitchInsn->addCase(VMContext.getConstantInt(CaseVal), CaseDest);
+ SwitchInsn->addCase(llvm::ConstantInt::get(VMContext, CaseVal), CaseDest);
// Recursively emitting the statement is acceptable, but is not wonderful for
// code where we have many case statements nested together, i.e.:
while (NextCase && NextCase->getRHS() == 0) {
CurCase = NextCase;
CaseVal = CurCase->getLHS()->EvaluateAsInt(getContext());
- SwitchInsn->addCase(VMContext.getConstantInt(CaseVal), CaseDest);
+ SwitchInsn->addCase(llvm::ConstantInt::get(VMContext, CaseVal), CaseDest);
NextCase = dyn_cast<CaseStmt>(CurCase->getSubStmt());
}
Builder.CreateCall4(CGM.getMemSetFn(), DestPtr,
getLLVMContext().getNullValue(llvm::Type::Int8Ty),
// TypeInfo.first describes size in bits.
- VMContext.getConstantInt(IntPtr, TypeInfo.first/8),
- VMContext.getConstantInt(llvm::Type::Int32Ty,
+ llvm::ConstantInt::get(IntPtr, TypeInfo.first/8),
+ llvm::ConstantInt::get(llvm::Type::Int32Ty,
TypeInfo.second/8));
}
I->setSuccessor(0, Default);
for (std::map<const LabelStmt*,unsigned>::iterator LI = LabelIDs.begin(),
LE = LabelIDs.end(); LI != LE; ++LI) {
- I->addCase(VMContext.getConstantInt(llvm::Type::Int32Ty,
+ I->addCase(llvm::ConstantInt::get(llvm::Type::Int32Ty,
LI->second),
getBasicBlockForLabel(LI->first));
}
if (ElemTy->isVariableArrayType())
ElemSize = EmitVLASize(ElemTy);
else {
- ElemSize = VMContext.getConstantInt(SizeTy,
+ ElemSize = llvm::ConstantInt::get(SizeTy,
getContext().getTypeSize(ElemTy) / 8);
}
// Check if we already have a destination for this block.
if (Dest == SI->getDefaultDest())
- ID = VMContext.getConstantInt(llvm::Type::Int32Ty, 0);
+ ID = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0);
else {
ID = SI->findCaseDest(Dest);
if (!ID) {
// No code found, get a new unique one by using the number of
// switch successors.
- ID = VMContext.getConstantInt(llvm::Type::Int32Ty,
+ ID = llvm::ConstantInt::get(llvm::Type::Int32Ty,
SI->getNumSuccessors());
SI->addCase(ID, Dest);
}
llvm::BasicBlock *CleanupPad = createBasicBlock("cleanup.pad", CurFn);
// Create a unique case ID.
- llvm::ConstantInt *ID = VMContext.getConstantInt(llvm::Type::Int32Ty,
+ llvm::ConstantInt *ID = llvm::ConstantInt::get(llvm::Type::Int32Ty,
SI->getNumSuccessors());
// Store the jump destination before the branch instruction.
for (CtorList::const_iterator I = Fns.begin(), E = Fns.end(); I != E; ++I) {
std::vector<llvm::Constant*> S;
S.push_back(
- VMContext.getConstantInt(llvm::Type::Int32Ty, I->second, false));
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, I->second, false));
S.push_back(VMContext.getConstantExprBitCast(I->first, CtorPFTy));
Ctors.push_back(VMContext.getConstantStruct(CtorStructTy, S));
}
VMContext.getConstantExprBitCast(GV, SBP),
VMContext.getConstantExprBitCast(annoGV, SBP),
VMContext.getConstantExprBitCast(unitGV, SBP),
- VMContext.getConstantInt(llvm::Type::Int32Ty, LineNo)
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, LineNo)
};
return VMContext.getConstantStruct(Fields, 4, false);
}
NextField = *Field++;
const llvm::Type *Ty = getTypes().ConvertType(getContext().UnsignedIntTy);
appendFieldAndPadding(*this, Fields, CurField, NextField,
- isUTF16 ? VMContext.getConstantInt(Ty, 0x07d0)
- : VMContext.getConstantInt(Ty, 0x07C8),
+ isUTF16 ? llvm::ConstantInt::get(Ty, 0x07d0)
+ : llvm::ConstantInt::get(Ty, 0x07C8),
CFRD, STy);
// String pointer.
NextField = 0;
Ty = getTypes().ConvertType(getContext().LongTy);
appendFieldAndPadding(*this, Fields, CurField, NextField,
- VMContext.getConstantInt(Ty, StringLength), CFRD, STy);
+ llvm::ConstantInt::get(Ty, StringLength), CFRD, STy);
// The struct.
C = VMContext.getConstantStruct(STy, Fields);
llvm::RoundUpToAlignment(CGF.getContext().getTypeSize(Ty) / 8, 4);
llvm::Value *NextAddr =
Builder.CreateGEP(Addr,
- VMContext.getConstantInt(llvm::Type::Int32Ty, Offset),
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, Offset),
"ap.next");
Builder.CreateStore(NextAddr, VAListAddrAsBPP);
// shouldn't ever matter in practice.
// overflow_arg_area = (overflow_arg_area + 15) & ~15;
- llvm::Value *Offset = VMContext.getConstantInt(llvm::Type::Int32Ty, 15);
+ llvm::Value *Offset = llvm::ConstantInt::get(llvm::Type::Int32Ty, 15);
overflow_arg_area = CGF.Builder.CreateGEP(overflow_arg_area, Offset);
llvm::Value *AsInt = CGF.Builder.CreatePtrToInt(overflow_arg_area,
llvm::Type::Int64Ty);
- llvm::Value *Mask = VMContext.getConstantInt(llvm::Type::Int64Ty, ~15LL);
+ llvm::Value *Mask = llvm::ConstantInt::get(llvm::Type::Int64Ty, ~15LL);
overflow_arg_area =
CGF.Builder.CreateIntToPtr(CGF.Builder.CreateAnd(AsInt, Mask),
overflow_arg_area->getType(),
// an 8 byte boundary.
uint64_t SizeInBytes = (CGF.getContext().getTypeSize(Ty) + 7) / 8;
- llvm::Value *Offset = VMContext.getConstantInt(llvm::Type::Int32Ty,
+ llvm::Value *Offset = llvm::ConstantInt::get(llvm::Type::Int32Ty,
(SizeInBytes + 7) & ~7);
overflow_arg_area = CGF.Builder.CreateGEP(overflow_arg_area, Offset,
"overflow_arg_area.next");
gp_offset = CGF.Builder.CreateLoad(gp_offset_p, "gp_offset");
InRegs =
CGF.Builder.CreateICmpULE(gp_offset,
- VMContext.getConstantInt(llvm::Type::Int32Ty,
+ llvm::ConstantInt::get(llvm::Type::Int32Ty,
48 - neededInt * 8),
"fits_in_gp");
}
fp_offset = CGF.Builder.CreateLoad(fp_offset_p, "fp_offset");
llvm::Value *FitsInFP =
CGF.Builder.CreateICmpULE(fp_offset,
- VMContext.getConstantInt(llvm::Type::Int32Ty,
+ llvm::ConstantInt::get(llvm::Type::Int32Ty,
176 - neededSSE * 16),
"fits_in_fp");
InRegs = InRegs ? CGF.Builder.CreateAnd(InRegs, FitsInFP) : FitsInFP;
llvm::Value *RegAddrLo = CGF.Builder.CreateGEP(RegAddr, fp_offset);
llvm::Value *RegAddrHi =
CGF.Builder.CreateGEP(RegAddrLo,
- VMContext.getConstantInt(llvm::Type::Int32Ty, 16));
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, 16));
const llvm::Type *DblPtrTy =
VMContext.getPointerTypeUnqual(llvm::Type::DoubleTy);
const llvm::StructType *ST = VMContext.getStructType(llvm::Type::DoubleTy,
// l->gp_offset = l->gp_offset + num_gp * 8
// l->fp_offset = l->fp_offset + num_fp * 16.
if (neededInt) {
- llvm::Value *Offset = VMContext.getConstantInt(llvm::Type::Int32Ty,
+ llvm::Value *Offset = llvm::ConstantInt::get(llvm::Type::Int32Ty,
neededInt * 8);
CGF.Builder.CreateStore(CGF.Builder.CreateAdd(gp_offset, Offset),
gp_offset_p);
}
if (neededSSE) {
- llvm::Value *Offset = VMContext.getConstantInt(llvm::Type::Int32Ty,
+ llvm::Value *Offset = llvm::ConstantInt::get(llvm::Type::Int32Ty,
neededSSE * 16);
CGF.Builder.CreateStore(CGF.Builder.CreateAdd(fp_offset, Offset),
fp_offset_p);
llvm::RoundUpToAlignment(CGF.getContext().getTypeSize(Ty) / 8, 4);
llvm::Value *NextAddr =
Builder.CreateGEP(Addr,
- VMContext.getConstantInt(llvm::Type::Int32Ty, Offset),
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, Offset),
"ap.next");
Builder.CreateStore(NextAddr, VAListAddrAsBPP);