diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-24 23:12:02 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-24 23:12:02 +0000 |
commit | eed707b1e6097aac2bb6b3d47271f6300ace7f2e (patch) | |
tree | c7390f63d90fc0c0ac483a90275863f41b69c085 /lib/CodeGen | |
parent | e8530a3d8c940fb7710be7e25098b5c3b2c2de19 (diff) | |
download | external_llvm-eed707b1e6097aac2bb6b3d47271f6300ace7f2e.tar.gz external_llvm-eed707b1e6097aac2bb6b3d47271f6300ace7f2e.tar.bz2 external_llvm-eed707b1e6097aac2bb6b3d47271f6300ace7f2e.zip |
Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/IntrinsicLowering.cpp | 62 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/FastISel.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/ShadowStackGC.cpp | 18 |
6 files changed, 44 insertions, 44 deletions
diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp index 34cbf2f9b2..113eea0777 100644 --- a/lib/CodeGen/IntrinsicLowering.cpp +++ b/lib/CodeGen/IntrinsicLowering.cpp @@ -159,27 +159,27 @@ static Value *LowerBSWAP(LLVMContext &Context, Value *V, Instruction *IP) { switch(BitSize) { default: llvm_unreachable("Unhandled type size of value to byteswap!"); case 16: { - Value *Tmp1 = Builder.CreateShl(V, Context.getConstantInt(V->getType(), 8), + Value *Tmp1 = Builder.CreateShl(V, ConstantInt::get(V->getType(), 8), "bswap.2"); - Value *Tmp2 = Builder.CreateLShr(V, Context.getConstantInt(V->getType(), 8), + Value *Tmp2 = Builder.CreateLShr(V, ConstantInt::get(V->getType(), 8), "bswap.1"); V = Builder.CreateOr(Tmp1, Tmp2, "bswap.i16"); break; } case 32: { - Value *Tmp4 = Builder.CreateShl(V, Context.getConstantInt(V->getType(), 24), + Value *Tmp4 = Builder.CreateShl(V, ConstantInt::get(V->getType(), 24), "bswap.4"); - Value *Tmp3 = Builder.CreateShl(V, Context.getConstantInt(V->getType(), 8), + Value *Tmp3 = Builder.CreateShl(V, ConstantInt::get(V->getType(), 8), "bswap.3"); - Value *Tmp2 = Builder.CreateLShr(V, Context.getConstantInt(V->getType(), 8), + Value *Tmp2 = Builder.CreateLShr(V, ConstantInt::get(V->getType(), 8), "bswap.2"); - Value *Tmp1 = Builder.CreateLShr(V,Context.getConstantInt(V->getType(), 24), + Value *Tmp1 = Builder.CreateLShr(V,ConstantInt::get(V->getType(), 24), "bswap.1"); Tmp3 = Builder.CreateAnd(Tmp3, - Context.getConstantInt(Type::Int32Ty, 0xFF0000), + ConstantInt::get(Type::Int32Ty, 0xFF0000), "bswap.and3"); Tmp2 = Builder.CreateAnd(Tmp2, - Context.getConstantInt(Type::Int32Ty, 0xFF00), + ConstantInt::get(Type::Int32Ty, 0xFF00), "bswap.and2"); Tmp4 = Builder.CreateOr(Tmp4, Tmp3, "bswap.or1"); Tmp2 = Builder.CreateOr(Tmp2, Tmp1, "bswap.or2"); @@ -187,44 +187,44 @@ static Value *LowerBSWAP(LLVMContext &Context, Value *V, Instruction *IP) { break; } case 64: { - Value *Tmp8 = Builder.CreateShl(V, Context.getConstantInt(V->getType(), 56), + Value *Tmp8 = Builder.CreateShl(V, ConstantInt::get(V->getType(), 56), "bswap.8"); - Value *Tmp7 = Builder.CreateShl(V, Context.getConstantInt(V->getType(), 40), + Value *Tmp7 = Builder.CreateShl(V, ConstantInt::get(V->getType(), 40), "bswap.7"); - Value *Tmp6 = Builder.CreateShl(V, Context.getConstantInt(V->getType(), 24), + Value *Tmp6 = Builder.CreateShl(V, ConstantInt::get(V->getType(), 24), "bswap.6"); - Value *Tmp5 = Builder.CreateShl(V, Context.getConstantInt(V->getType(), 8), + Value *Tmp5 = Builder.CreateShl(V, ConstantInt::get(V->getType(), 8), "bswap.5"); - Value* Tmp4 = Builder.CreateLShr(V, Context.getConstantInt(V->getType(), 8), + Value* Tmp4 = Builder.CreateLShr(V, ConstantInt::get(V->getType(), 8), "bswap.4"); Value* Tmp3 = Builder.CreateLShr(V, - Context.getConstantInt(V->getType(), 24), + ConstantInt::get(V->getType(), 24), "bswap.3"); Value* Tmp2 = Builder.CreateLShr(V, - Context.getConstantInt(V->getType(), 40), + ConstantInt::get(V->getType(), 40), "bswap.2"); Value* Tmp1 = Builder.CreateLShr(V, - Context.getConstantInt(V->getType(), 56), + ConstantInt::get(V->getType(), 56), "bswap.1"); Tmp7 = Builder.CreateAnd(Tmp7, - Context.getConstantInt(Type::Int64Ty, + ConstantInt::get(Type::Int64Ty, 0xFF000000000000ULL), "bswap.and7"); Tmp6 = Builder.CreateAnd(Tmp6, - Context.getConstantInt(Type::Int64Ty, + ConstantInt::get(Type::Int64Ty, 0xFF0000000000ULL), "bswap.and6"); Tmp5 = Builder.CreateAnd(Tmp5, - Context.getConstantInt(Type::Int64Ty, 0xFF00000000ULL), + ConstantInt::get(Type::Int64Ty, 0xFF00000000ULL), "bswap.and5"); Tmp4 = Builder.CreateAnd(Tmp4, - Context.getConstantInt(Type::Int64Ty, 0xFF000000ULL), + ConstantInt::get(Type::Int64Ty, 0xFF000000ULL), "bswap.and4"); Tmp3 = Builder.CreateAnd(Tmp3, - Context.getConstantInt(Type::Int64Ty, 0xFF0000ULL), + ConstantInt::get(Type::Int64Ty, 0xFF0000ULL), "bswap.and3"); Tmp2 = Builder.CreateAnd(Tmp2, - Context.getConstantInt(Type::Int64Ty, 0xFF00ULL), + ConstantInt::get(Type::Int64Ty, 0xFF00ULL), "bswap.and2"); Tmp8 = Builder.CreateOr(Tmp8, Tmp7, "bswap.or1"); Tmp6 = Builder.CreateOr(Tmp6, Tmp5, "bswap.or2"); @@ -254,23 +254,23 @@ static Value *LowerCTPOP(LLVMContext &Context, Value *V, Instruction *IP) { unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); unsigned WordSize = (BitSize + 63) / 64; - Value *Count = Context.getConstantInt(V->getType(), 0); + Value *Count = ConstantInt::get(V->getType(), 0); for (unsigned n = 0; n < WordSize; ++n) { Value *PartValue = V; for (unsigned i = 1, ct = 0; i < (BitSize>64 ? 64 : BitSize); i <<= 1, ++ct) { - Value *MaskCst = Context.getConstantInt(V->getType(), MaskValues[ct]); + Value *MaskCst = ConstantInt::get(V->getType(), MaskValues[ct]); Value *LHS = Builder.CreateAnd(PartValue, MaskCst, "cppop.and1"); Value *VShift = Builder.CreateLShr(PartValue, - Context.getConstantInt(V->getType(), i), + ConstantInt::get(V->getType(), i), "ctpop.sh"); Value *RHS = Builder.CreateAnd(VShift, MaskCst, "cppop.and2"); PartValue = Builder.CreateAdd(LHS, RHS, "ctpop.step"); } Count = Builder.CreateAdd(PartValue, Count, "ctpop.part"); if (BitSize > 64) { - V = Builder.CreateLShr(V, Context.getConstantInt(V->getType(), 64), + V = Builder.CreateLShr(V, ConstantInt::get(V->getType(), 64), "ctpop.part.sh"); BitSize -= 64; } @@ -287,7 +287,7 @@ static Value *LowerCTLZ(LLVMContext &Context, Value *V, Instruction *IP) { unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); for (unsigned i = 1; i < BitSize; i <<= 1) { - Value *ShVal = Context.getConstantInt(V->getType(), i); + Value *ShVal = ConstantInt::get(V->getType(), i); ShVal = Builder.CreateLShr(V, ShVal, "ctlz.sh"); V = Builder.CreateOr(V, ShVal, "ctlz.step"); } @@ -378,7 +378,7 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { Value *Src = CI->getOperand(1); Value *NotSrc = Builder.CreateNot(Src); NotSrc->setName(Src->getName() + ".not"); - Value *SrcM1 = Context.getConstantInt(Src->getType(), 1); + Value *SrcM1 = ConstantInt::get(Src->getType(), 1); SrcM1 = Builder.CreateSub(Src, SrcM1); Src = LowerCTPOP(Context, Builder.CreateAnd(NotSrc, SrcM1), CI); CI->replaceAllUsesWith(Src); @@ -414,7 +414,7 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { case Intrinsic::readcyclecounter: { cerr << "WARNING: this target does not support the llvm.readcyclecoun" << "ter intrinsic. It is being lowered to a constant 0\n"; - CI->replaceAllUsesWith(Context.getConstantInt(Type::Int64Ty, 0)); + CI->replaceAllUsesWith(ConstantInt::get(Type::Int64Ty, 0)); break; } @@ -434,7 +434,7 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { case Intrinsic::eh_typeid_for_i32: case Intrinsic::eh_typeid_for_i64: // Return something different to eh_selector. - CI->replaceAllUsesWith(Context.getConstantInt(CI->getType(), 1)); + CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 1)); break; case Intrinsic::var_annotation: @@ -506,7 +506,7 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { case Intrinsic::flt_rounds: // Lower to "round to the nearest" if (CI->getType() != Type::VoidTy) - CI->replaceAllUsesWith(Context.getConstantInt(CI->getType(), 1)); + CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 1)); break; } diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index 547a7bf281..01493bbba7 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -109,7 +109,7 @@ unsigned FastISel::getRegForValue(Value *V) { APInt IntVal(IntBitWidth, 2, x); unsigned IntegerReg = - getRegForValue(V->getContext().getConstantInt(IntVal)); + getRegForValue(ConstantInt::get(V->getContext(), IntVal)); if (IntegerReg != 0) Reg = FastEmit_r(IntVT.getSimpleVT(), VT, ISD::SINT_TO_FP, IntegerReg); } diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 787f7ed8f9..4f4c255b08 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -2038,7 +2038,7 @@ SDValue SelectionDAGLegalize::ExpandLegalINT_TO_FP(bool isSigned, case MVT::i64: FF = 0x5F800000ULL; break; // 2^64 (as a float) } if (TLI.isLittleEndian()) FF <<= 32; - Constant *FudgeFactor = DAG.getContext()->getConstantInt(Type::Int64Ty, FF); + Constant *FudgeFactor = ConstantInt::get(Type::Int64Ty, FF); SDValue CPIdx = DAG.getConstantPool(FudgeFactor, TLI.getPointerTy()); unsigned Alignment = cast<ConstantPoolSDNode>(CPIdx)->getAlignment(); diff --git a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index 1447ee339a..dd66f7bb85 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -2306,7 +2306,7 @@ SDValue DAGTypeLegalizer::ExpandIntOp_UINT_TO_FP(SDNode *N) { // Build a 64 bit pair (0, FF) in the constant pool, with FF in the lo bits. SDValue FudgePtr = DAG.getConstantPool( - DAG.getContext()->getConstantInt(FF.zext(64)), + ConstantInt::get(*DAG.getContext(), FF.zext(64)), TLI.getPointerTy()); // Get a pointer to FF if the sign bit was set, or to 0 otherwise. diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index c2595bced3..5a46288e58 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -874,7 +874,7 @@ SDValue SelectionDAG::getConstant(uint64_t Val, MVT VT, bool isT) { } SDValue SelectionDAG::getConstant(const APInt &Val, MVT VT, bool isT) { - return getConstant(*Context->getConstantInt(Val), VT, isT); + return getConstant(*ConstantInt::get(*Context, Val), VT, isT); } SDValue SelectionDAG::getConstant(const ConstantInt &Val, MVT VT, bool isT) { diff --git a/lib/CodeGen/ShadowStackGC.cpp b/lib/CodeGen/ShadowStackGC.cpp index fe843f7250..e3281d2492 100644 --- a/lib/CodeGen/ShadowStackGC.cpp +++ b/lib/CodeGen/ShadowStackGC.cpp @@ -203,8 +203,8 @@ Constant *ShadowStackGC::GetFrameMap(Function &F) { } Constant *BaseElts[] = { - Context.getConstantInt(Type::Int32Ty, Roots.size(), false), - Context.getConstantInt(Type::Int32Ty, NumMeta, false), + ConstantInt::get(Type::Int32Ty, Roots.size(), false), + ConstantInt::get(Type::Int32Ty, NumMeta, false), }; Constant *DescriptorElts[] = { @@ -236,8 +236,8 @@ Constant *ShadowStackGC::GetFrameMap(Function &F) { GlobalVariable::InternalLinkage, FrameMap, "__gc_" + F.getName()); - Constant *GEPIndices[2] = { Context.getConstantInt(Type::Int32Ty, 0), - Context.getConstantInt(Type::Int32Ty, 0) }; + Constant *GEPIndices[2] = { ConstantInt::get(Type::Int32Ty, 0), + ConstantInt::get(Type::Int32Ty, 0) }; return Context.getConstantExprGetElementPtr(GV, GEPIndices, 2); } @@ -342,9 +342,9 @@ void ShadowStackGC::CollectRoots(Function &F) { GetElementPtrInst * ShadowStackGC::CreateGEP(LLVMContext &Context, IRBuilder<> &B, Value *BasePtr, int Idx, int Idx2, const char *Name) { - Value *Indices[] = { Context.getConstantInt(Type::Int32Ty, 0), - Context.getConstantInt(Type::Int32Ty, Idx), - Context.getConstantInt(Type::Int32Ty, Idx2) }; + Value *Indices[] = { ConstantInt::get(Type::Int32Ty, 0), + ConstantInt::get(Type::Int32Ty, Idx), + ConstantInt::get(Type::Int32Ty, Idx2) }; Value* Val = B.CreateGEP(BasePtr, Indices, Indices + 3, Name); assert(isa<GetElementPtrInst>(Val) && "Unexpected folded constant"); @@ -355,8 +355,8 @@ ShadowStackGC::CreateGEP(LLVMContext &Context, IRBuilder<> &B, Value *BasePtr, GetElementPtrInst * ShadowStackGC::CreateGEP(LLVMContext &Context, IRBuilder<> &B, Value *BasePtr, int Idx, const char *Name) { - Value *Indices[] = { Context.getConstantInt(Type::Int32Ty, 0), - Context.getConstantInt(Type::Int32Ty, Idx) }; + Value *Indices[] = { ConstantInt::get(Type::Int32Ty, 0), + ConstantInt::get(Type::Int32Ty, Idx) }; Value *Val = B.CreateGEP(BasePtr, Indices, Indices + 2, Name); assert(isa<GetElementPtrInst>(Val) && "Unexpected folded constant"); |