зеркало из https://github.com/microsoft/clang-1.git
Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77012 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
7caa6825f4
Коммит
4a28d5deeb
|
@ -120,4 +120,4 @@ DispatchCast:
|
|||
return CastResult(state,
|
||||
isa<Loc>(val) ? EvalCastL(cast<Loc>(val), castTy)
|
||||
: EvalCastNL(cast<NonLoc>(val), castTy));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
|
|
@ -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 = 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");
|
||||
|
@ -689,7 +689,7 @@ Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E,
|
|||
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 =
|
||||
|
@ -698,7 +698,7 @@ Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E,
|
|||
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);
|
||||
|
@ -725,7 +725,7 @@ Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E,
|
|||
// 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.
|
||||
|
@ -810,7 +810,7 @@ ScalarExprEmitter::VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E) {
|
|||
// 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) {
|
||||
|
@ -989,8 +989,8 @@ Value *ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) {
|
|||
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);
|
||||
|
@ -1058,7 +1058,7 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) {
|
|||
// 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);
|
||||
|
@ -1123,7 +1123,7 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &Ops) {
|
|||
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 =
|
||||
|
@ -1174,12 +1174,12 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &Ops) {
|
|||
// 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");
|
||||
}
|
||||
}
|
||||
|
@ -1351,7 +1351,7 @@ Value *ScalarExprEmitter::VisitBinLOr(const BinaryOperator *E) {
|
|||
|
||||
// 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");
|
||||
|
@ -1591,7 +1591,7 @@ Value *CodeGenFunction::EmitShuffleVector(Value* V1, Value *V2, ...) {
|
|||
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 *);
|
||||
|
@ -1609,7 +1609,7 @@ llvm::Value *CodeGenFunction::EmitVector(llvm::Value * const *Vals,
|
|||
|
||||
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");
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP,
|
|||
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()));
|
||||
|
@ -262,9 +262,9 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP,
|
|||
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()));
|
||||
|
@ -471,7 +471,7 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
|
|||
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));
|
||||
|
||||
|
@ -574,7 +574,7 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
|
|||
|
||||
// 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");
|
||||
|
|
|
@ -210,7 +210,7 @@ CGObjCGNU::CGObjCGNU(CodeGen::CodeGenModule &cgm)
|
|||
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));
|
||||
|
@ -319,7 +319,7 @@ llvm::Constant *CGObjCGNU::GenerateConstantString(const ObjCStringLiteral *SL) {
|
|||
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");
|
||||
|
@ -540,7 +540,7 @@ llvm::Constant *CGObjCGNU::GenerateMethodList(const std::string &ClassName,
|
|||
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);
|
||||
|
||||
|
@ -577,7 +577,7 @@ llvm::Constant *CGObjCGNU::GenerateIvarList(
|
|||
|
||||
|
||||
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,
|
||||
|
@ -618,7 +618,7 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure(
|
|||
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
|
||||
|
@ -627,7 +627,7 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure(
|
|||
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);
|
||||
|
@ -665,7 +665,7 @@ llvm::Constant *CGObjCGNU::GenerateProtocolMethodList(
|
|||
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");
|
||||
}
|
||||
|
@ -693,7 +693,7 @@ llvm::Constant *CGObjCGNU::GenerateProtocolList(
|
|||
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");
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ llvm::Constant *CGObjCGNU::GenerateEmptyProtocol(
|
|||
// 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);
|
||||
|
@ -783,7 +783,7 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) {
|
|||
// 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);
|
||||
|
@ -868,10 +868,10 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -909,7 +909,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
|
|||
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
|
||||
|
@ -986,7 +986,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
|
|||
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.
|
||||
|
@ -1087,7 +1087,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
|
|||
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");
|
||||
|
@ -1100,7 +1100,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
|
|||
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),
|
||||
|
@ -1117,7 +1117,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
|
|||
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),
|
||||
|
@ -1131,10 +1131,10 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
|
|||
(*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());
|
||||
|
@ -1153,14 +1153,14 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
|
|||
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);
|
||||
|
@ -1368,7 +1368,7 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
|
|||
|
||||
// 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));
|
||||
}
|
||||
|
||||
|
@ -1433,7 +1433,7 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
|
|||
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,
|
||||
|
@ -1572,7 +1572,7 @@ llvm::GlobalVariable *CGObjCGNU::ObjCIvarOffsetVariable(
|
|||
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);
|
||||
}
|
||||
|
@ -1615,7 +1615,7 @@ llvm::Value *CGObjCGNU::EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
|
|||
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){
|
||||
|
|
|
@ -1378,8 +1378,8 @@ static llvm::Constant *getConstantGEP(llvm::LLVMContext &VMContext,
|
|||
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);
|
||||
}
|
||||
|
@ -1711,7 +1711,7 @@ CGObjCMac::EmitProtocolExtension(const ObjCProtocolDecl *PD,
|
|||
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(),
|
||||
|
@ -1766,7 +1766,7 @@ CGObjCMac::EmitProtocolList(const std::string &Name,
|
|||
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,
|
||||
|
@ -1813,8 +1813,8 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(const std::string &Name,
|
|||
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);
|
||||
|
@ -1854,7 +1854,7 @@ llvm::Constant *CGObjCMac::EmitMethodDescList(const std::string &Name,
|
|||
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);
|
||||
|
@ -1922,7 +1922,7 @@ void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
|
|||
} 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) {
|
||||
|
@ -2033,9 +2033,9 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) {
|
|||
}
|
||||
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(),
|
||||
|
@ -2085,9 +2085,9 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID,
|
|||
}
|
||||
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(),
|
||||
|
@ -2163,7 +2163,7 @@ CGObjCMac::EmitClassExtension(const ObjCImplementationDecl *ID) {
|
|||
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);
|
||||
|
@ -2216,7 +2216,7 @@ llvm::Constant *CGObjCMac::EmitIvarList(const ObjCImplementationDecl *ID,
|
|||
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));
|
||||
}
|
||||
|
@ -2226,7 +2226,7 @@ llvm::Constant *CGObjCMac::EmitIvarList(const ObjCImplementationDecl *ID,
|
|||
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);
|
||||
|
@ -2286,7 +2286,7 @@ llvm::Constant *CGObjCMac::EmitMethodList(const std::string &Name,
|
|||
|
||||
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);
|
||||
|
@ -2784,7 +2784,7 @@ void CGObjCMac::EmitGCMemmoveCollectable(CodeGen::CodeGenFunction &CGF,
|
|||
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;
|
||||
|
@ -2806,7 +2806,7 @@ llvm::Value *CGObjCMac::EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
|
|||
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);
|
||||
}
|
||||
|
@ -2848,8 +2848,8 @@ void CGObjCMac::EmitImageInfo() {
|
|||
|
||||
// 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);
|
||||
|
||||
|
@ -2882,8 +2882,8 @@ void CGObjCMac::EmitModuleInfo() {
|
|||
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();
|
||||
|
@ -2902,10 +2902,10 @@ llvm::Constant *CGObjCMac::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.
|
||||
|
@ -4106,14 +4106,14 @@ void CGObjCNonFragileABIMac::FinishNonFragileABIModule() {
|
|||
// 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);
|
||||
|
@ -4195,9 +4195,9 @@ llvm::GlobalVariable * CGObjCNonFragileABIMac::BuildClassRoTInitializer(
|
|||
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);
|
||||
|
@ -4591,9 +4591,9 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitMethodList(
|
|||
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);
|
||||
|
@ -4641,7 +4641,7 @@ llvm::Constant * CGObjCNonFragileABIMac::EmitIvarOffsetVar(
|
|||
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));
|
||||
|
@ -4704,13 +4704,13 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitIvarList(
|
|||
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.
|
||||
|
@ -4718,8 +4718,8 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitIvarList(
|
|||
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);
|
||||
|
@ -4838,7 +4838,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol(
|
|||
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);
|
||||
|
@ -4910,7 +4910,7 @@ CGObjCNonFragileABIMac::EmitProtocolList(const std::string &Name,
|
|||
|
||||
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,
|
||||
|
@ -5319,7 +5319,7 @@ void CGObjCNonFragileABIMac::EmitGCMemmoveCollectable(
|
|||
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;
|
||||
|
@ -5482,7 +5482,7 @@ CGObjCNonFragileABIMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
|
|||
|
||||
// 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));
|
||||
}
|
||||
|
||||
|
@ -5552,7 +5552,7 @@ CGObjCNonFragileABIMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
|
|||
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);
|
||||
|
@ -5584,7 +5584,7 @@ CGObjCNonFragileABIMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
|
|||
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);
|
||||
|
@ -5697,7 +5697,7 @@ CGObjCNonFragileABIMac::GetInterfaceEHType(const ObjCInterfaceDecl *ID,
|
|||
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);
|
||||
|
|
|
@ -597,7 +597,7 @@ void CodeGenFunction::EmitCaseStmtRange(const CaseStmt &S) {
|
|||
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;
|
||||
|
@ -618,10 +618,11 @@ void CodeGenFunction::EmitCaseStmtRange(const CaseStmt &S) {
|
|||
|
||||
// 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.
|
||||
|
@ -640,7 +641,7 @@ void CodeGenFunction::EmitCaseStmt(const CaseStmt &S) {
|
|||
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.:
|
||||
|
@ -658,7 +659,7 @@ void CodeGenFunction::EmitCaseStmt(const CaseStmt &S) {
|
|||
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());
|
||||
}
|
||||
|
|
|
@ -420,8 +420,8 @@ void CodeGenFunction::EmitMemSetToZero(llvm::Value *DestPtr, QualType Ty) {
|
|||
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));
|
||||
}
|
||||
|
||||
|
@ -447,7 +447,7 @@ void CodeGenFunction::EmitIndirectSwitches() {
|
|||
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));
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ llvm::Value *CodeGenFunction::EmitVLASize(QualType Ty) {
|
|||
if (ElemTy->isVariableArrayType())
|
||||
ElemSize = EmitVLASize(ElemTy);
|
||||
else {
|
||||
ElemSize = VMContext.getConstantInt(SizeTy,
|
||||
ElemSize = llvm::ConstantInt::get(SizeTy,
|
||||
getContext().getTypeSize(ElemTy) / 8);
|
||||
}
|
||||
|
||||
|
@ -600,13 +600,13 @@ CodeGenFunction::CleanupBlockInfo CodeGenFunction::PopCleanupBlock()
|
|||
|
||||
// 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);
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ CodeGenFunction::CleanupBlockInfo CodeGenFunction::PopCleanupBlock()
|
|||
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.
|
||||
|
|
|
@ -211,7 +211,7 @@ void CodeGenModule::EmitCtorList(const CtorList &Fns, const char *GlobalName) {
|
|||
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));
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ llvm::Constant *CodeGenModule::EmitAnnotateAttr(llvm::GlobalValue *GV,
|
|||
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);
|
||||
}
|
||||
|
@ -1294,8 +1294,8 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) {
|
|||
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.
|
||||
|
@ -1339,7 +1339,7 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) {
|
|||
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);
|
||||
|
|
|
@ -440,7 +440,7 @@ llvm::Value *X86_32ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
|||
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);
|
||||
|
||||
|
@ -1062,11 +1062,11 @@ static llvm::Value *EmitVAArgFromMemory(llvm::Value *VAListAddr,
|
|||
// 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(),
|
||||
|
@ -1085,7 +1085,7 @@ static llvm::Value *EmitVAArgFromMemory(llvm::Value *VAListAddr,
|
|||
// 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");
|
||||
|
@ -1134,7 +1134,7 @@ llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
|||
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");
|
||||
}
|
||||
|
@ -1144,7 +1144,7 @@ llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
|||
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;
|
||||
|
@ -1213,7 +1213,7 @@ llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
|||
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,
|
||||
|
@ -1235,13 +1235,13 @@ llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
|||
// 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);
|
||||
|
@ -1399,7 +1399,7 @@ llvm::Value *ARMABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
|||
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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче