aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-24 23:12:58 +0000
committerOwen Anderson <resistor@mac.com>2009-07-24 23:12:58 +0000
commit4a28d5deeba33722aa009eab488591fb9055cc7e (patch)
tree2036bd7275eb1a0b5139d8a9578d5f4abfec0668
parent7caa6825f42a0f7e97d6fc06233133c42b218e46 (diff)
Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77012 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/SValuator.cpp2
-rw-r--r--lib/CodeGen/CGBlocks.cpp24
-rw-r--r--lib/CodeGen/CGBuiltin.cpp35
-rw-r--r--lib/CodeGen/CGCXX.cpp4
-rw-r--r--lib/CodeGen/CGDecl.cpp6
-rw-r--r--lib/CodeGen/CGExpr.cpp58
-rw-r--r--lib/CodeGen/CGExprAgg.cpp4
-rw-r--r--lib/CodeGen/CGExprComplex.cpp2
-rw-r--r--lib/CodeGen/CGExprConstant.cpp17
-rw-r--r--lib/CodeGen/CGExprScalar.cpp46
-rw-r--r--lib/CodeGen/CGObjC.cpp10
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp52
-rw-r--r--lib/CodeGen/CGObjCMac.cpp92
-rw-r--r--lib/CodeGen/CGStmt.cpp13
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp14
-rw-r--r--lib/CodeGen/CodeGenModule.cpp10
-rw-r--r--lib/CodeGen/TargetABIInfo.cpp20
17 files changed, 207 insertions, 202 deletions
diff --git a/lib/Analysis/SValuator.cpp b/lib/Analysis/SValuator.cpp
index b06b94f321..787c926f6b 100644
--- a/lib/Analysis/SValuator.cpp
+++ b/lib/Analysis/SValuator.cpp
@@ -120,4 +120,4 @@ DispatchCast:
return CastResult(state,
isa<Loc>(val) ? EvalCastL(cast<Loc>(val), castTy)
: EvalCastNL(cast<NonLoc>(val), castTy));
-} \ No newline at end of file
+}
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index 73200fe2ca..0bcacd1e48 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -32,14 +32,14 @@ BuildDescriptorBlockDecl(bool BlockHasCopyDispose, uint64_t Size,
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) {
@@ -148,11 +148,11 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) {
// __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) {
@@ -161,7 +161,7 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) {
// 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);
@@ -267,7 +267,7 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) {
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);
@@ -455,7 +455,7 @@ llvm::Value *CodeGenFunction::GetAddrOfBlockDecl(const BlockDeclRefExpr *E) {
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()) {
@@ -510,7 +510,7 @@ BlockModule::GetAddrOfGlobalBlock(const BlockExpr *BE, const char * n) {
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);
@@ -542,7 +542,7 @@ BlockModule::GetAddrOfGlobalBlock(const BlockExpr *BE, const char * n) {
// 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);
@@ -777,7 +777,7 @@ GenerateCopyHelperFunction(bool BlockHasCopyDispose, const llvm::StructType *T,
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);
}
@@ -928,7 +928,7 @@ GeneratebyrefCopyHelperFunction(const llvm::Type *T, int flag) {
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);
@@ -1054,7 +1054,7 @@ void BlockFunction::BuildBlockRelease(llvm::Value *V, int flag) {
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);
}
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index 638d83ecb0..7209446ed1 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -63,7 +63,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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()));
}
@@ -150,7 +151,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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");
@@ -169,7 +170,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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");
@@ -207,15 +208,15 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
// 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));
}
@@ -280,9 +281,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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: {
@@ -290,7 +291,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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: {
@@ -298,7 +299,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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: {
@@ -307,7 +308,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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: {
@@ -513,8 +514,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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);
}
@@ -637,7 +638,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
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");
@@ -744,7 +745,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
}
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),
@@ -752,7 +753,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
}
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));
@@ -777,7 +778,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
// 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
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 2349171ae7..724364f5e2 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -70,7 +70,7 @@ CodeGenFunction::GenerateStaticCXXBlockVarDeclInit(const VarDecl &D,
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);
@@ -203,7 +203,7 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) {
// 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));
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 47727f2d36..aec7fadcdb 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -405,19 +405,19 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
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);
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 9b5b68d3f6..48f69e4ca4 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -329,38 +329,38 @@ RValue CodeGenFunction::EmitLoadOfBitfieldLValue(LValue LV,
// 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");
@@ -397,7 +397,7 @@ RValue CodeGenFunction::EmitLoadOfExtVectorElementLValue(LValue LV,
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"));
}
@@ -407,7 +407,7 @@ RValue CodeGenFunction::EmitLoadOfExtVectorElementLValue(LValue LV,
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());
@@ -501,8 +501,8 @@ void CodeGenFunction::EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst,
// 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.
@@ -515,7 +515,7 @@ void CodeGenFunction::EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst,
// 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");
@@ -533,14 +533,14 @@ void CodeGenFunction::EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst,
// 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");
@@ -552,7 +552,7 @@ void CodeGenFunction::EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst,
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(),
@@ -560,7 +560,7 @@ void CodeGenFunction::EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst,
// 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
@@ -568,7 +568,7 @@ void CodeGenFunction::EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst,
// 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");
@@ -612,7 +612,7 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src,
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());
@@ -628,7 +628,7 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src,
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],
@@ -640,12 +640,12 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src,
// 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");
@@ -657,7 +657,7 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src,
} 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");
}
@@ -891,13 +891,13 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) {
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);
@@ -930,7 +930,7 @@ llvm::Constant *GenerateConstantVector(llvm::LLVMContext &VMContext,
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());
}
@@ -968,7 +968,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) {
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]));
}
@@ -1040,7 +1040,7 @@ LValue CodeGenFunction::EmitLValueForBitfield(llvm::Value* BaseValue,
"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,
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index 32e5afce51..5e81bf2651 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -570,7 +570,7 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr,
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));
}
diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp
index b5597ad7b0..a89ef9e80e 100644
--- a/lib/CodeGen/CGExprComplex.cpp
+++ b/lib/CodeGen/CGExprComplex.cpp
@@ -376,7 +376,7 @@ ComplexPairTy ComplexExprEmitter::VisitPrePostIncDec(const UnaryOperator *E,
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");
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 34b67c80b4..07570c1034 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -315,7 +315,7 @@ public:
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);
@@ -591,7 +591,7 @@ public:
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: {
@@ -643,7 +643,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
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;
@@ -681,7 +681,8 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
}
}
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());
@@ -692,8 +693,10 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
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);
}
@@ -714,7 +717,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
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()));
}
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 4d31f99e3a..b80b64ccce 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -109,16 +109,16 @@ public:
// 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()));
@@ -127,14 +127,14 @@ public:
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()));
@@ -143,7 +143,7 @@ public:
// 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) {
@@ -206,13 +206,13 @@ public:
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);
}
@@ -467,14 +467,14 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType,
// 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 =