diff options
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 19 | ||||
-rw-r--r-- | lib/VMCore/Constants.cpp | 10 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 17 |
3 files changed, 23 insertions, 23 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 5411549..c1fcc5f 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -192,7 +192,7 @@ Constant *llvm::ConstantFoldCastInstruction(LLVMContext &Context, return UndefValue::get(DestTy); } // No compile-time operations on this type yet. - if (V->getType() == Type::getPPC_FP128Ty(Context) || DestTy == Type::getPPC_FP128Ty(Context)) + if (V->getType()->isPPC_FP128Ty() || DestTy->isPPC_FP128Ty()) return 0; // If the cast operand is a constant expression, there's a few things we can @@ -241,10 +241,10 @@ Constant *llvm::ConstantFoldCastInstruction(LLVMContext &Context, if (ConstantFP *FPC = dyn_cast<ConstantFP>(V)) { bool ignored; APFloat Val = FPC->getValueAPF(); - Val.convert(DestTy == Type::getFloatTy(Context) ? APFloat::IEEEsingle : - DestTy == Type::getDoubleTy(Context) ? APFloat::IEEEdouble : - DestTy == Type::getX86_FP80Ty(Context) ? APFloat::x87DoubleExtended : - DestTy == Type::getFP128Ty(Context) ? APFloat::IEEEquad : + Val.convert(DestTy->isFloatTy() ? APFloat::IEEEsingle : + DestTy->isDoubleTy() ? APFloat::IEEEdouble : + DestTy->isX86_FP80Ty() ? APFloat::x87DoubleExtended : + DestTy->isFP128Ty() ? APFloat::IEEEquad : APFloat::Bogus, APFloat::rmNearestTiesToEven, &ignored); return ConstantFP::get(Context, Val); @@ -584,7 +584,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(LLVMContext &Context, unsigned Opcode, Constant *C1, Constant *C2) { // No compile-time operations on this type yet. - if (C1->getType() == Type::getPPC_FP128Ty(Context)) + if (C1->getType()->isPPC_FP128Ty()) return 0; // Handle UndefValue up front. @@ -1110,7 +1110,7 @@ static FCmpInst::Predicate evaluateFCmpRelation(LLVMContext &Context, "Cannot compare values of different types!"); // No compile-time operations on this type yet. - if (V1->getType() == Type::getPPC_FP128Ty(Context)) + if (V1->getType()->isPPC_FP128Ty()) return FCmpInst::BAD_FCMP_PREDICATE; // Handle degenerate case quickly @@ -1403,7 +1403,7 @@ Constant *llvm::ConstantFoldCompareInstruction(LLVMContext &Context, return UndefValue::get(ResultTy); // No compile-time operations on this type yet. - if (C1->getType() == Type::getPPC_FP128Ty(Context)) + if (C1->getType()->isPPC_FP128Ty()) return 0; // icmp eq/ne(null,GV) -> false/true @@ -1837,7 +1837,8 @@ Constant *llvm::ConstantFoldGetElementPtr(LLVMContext &Context, // This happens with pointers to member functions in C++. if (CE->getOpcode() == Instruction::IntToPtr && NumIdx == 1 && isa<ConstantInt>(CE->getOperand(0)) && isa<ConstantInt>(Idxs[0]) && - cast<PointerType>(CE->getType())->getElementType() == Type::getInt8Ty(Context)) { + cast<PointerType>(CE->getType())->getElementType() == + Type::getInt8Ty(Context)) { Constant *Base = CE->getOperand(0); Constant *Offset = Idxs[0]; diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index ba1731d..529c455 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -327,16 +327,16 @@ ConstantInt* ConstantInt::get(const IntegerType* Ty, const StringRef& Str, //===----------------------------------------------------------------------===// static const fltSemantics *TypeToFloatSemantics(const Type *Ty) { - if (Ty == Type::getFloatTy(Ty->getContext())) + if (Ty->isFloatTy()) return &APFloat::IEEEsingle; - if (Ty == Type::getDoubleTy(Ty->getContext())) + if (Ty->isDoubleTy()) return &APFloat::IEEEdouble; - if (Ty == Type::getX86_FP80Ty(Ty->getContext())) + if (Ty->isX86_FP80Ty()) return &APFloat::x87DoubleExtended; - else if (Ty == Type::getFP128Ty(Ty->getContext())) + else if (Ty->isFP128Ty()) return &APFloat::IEEEquad; - assert(Ty == Type::getPPC_FP128Ty(Ty->getContext()) && "Unknown FP format"); + assert(Ty->isPPC_FP128Ty() && "Unknown FP format"); return &APFloat::PPCDoubleDouble; } diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 4f7c847..257b249 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -600,12 +600,11 @@ void Verifier::visitFunction(Function &F) { "# formal arguments must match # of arguments for function type!", &F, FT); Assert1(F.getReturnType()->isFirstClassType() || - F.getReturnType()->getTypeID() == Type::VoidTyID || + F.getReturnType()->isVoidTy() || isa<StructType>(F.getReturnType()), "Functions cannot return aggregate values!", &F); - Assert1(!F.hasStructRetAttr() || - F.getReturnType()->getTypeID() == Type::VoidTyID, + Assert1(!F.hasStructRetAttr() || F.getReturnType()->isVoidTy(), "Invalid struct return type!", &F); const AttrListPtr &Attrs = F.getAttributes(); @@ -643,7 +642,7 @@ void Verifier::visitFunction(Function &F) { Assert1(I->getType()->isFirstClassType(), "Function arguments must have first-class types!", I); if (!isLLVMdotName) - Assert2(I->getType() != Type::getMetadataTy(F.getContext()), + Assert2(!I->getType()->isMetadataTy(), "Function takes metadata but isn't an intrinsic", I, &F); } @@ -738,7 +737,7 @@ void Verifier::visitTerminatorInst(TerminatorInst &I) { void Verifier::visitReturnInst(ReturnInst &RI) { Function *F = RI.getParent()->getParent(); unsigned N = RI.getNumOperands(); - if (F->getReturnType()->getTypeID() == Type::VoidTyID) + if (F->getReturnType()->isVoidTy()) Assert2(N == 0, "Found return instr that returns non-void in Function of void " "return type!", &RI, F->getReturnType()); @@ -1103,7 +1102,7 @@ void Verifier::VerifyCallSite(CallSite CS) { CS.getCalledFunction()->getName().substr(0, 5) != "llvm.") { for (FunctionType::param_iterator PI = FTy->param_begin(), PE = FTy->param_end(); PI != PE; ++PI) - Assert1(PI->get() != Type::getMetadataTy(I->getContext()), + Assert1(!PI->get()->isMetadataTy(), "Function has metadata parameter but isn't an intrinsic", I); } @@ -1329,18 +1328,18 @@ void Verifier::visitInstruction(Instruction &I) { Assert1(BB->getTerminator() == &I, "Terminator not at end of block!", &I); // Check that void typed values don't have names - Assert1(I.getType() != Type::getVoidTy(I.getContext()) || !I.hasName(), + Assert1(!I.getType()->isVoidTy() || !I.hasName(), "Instruction has a name, but provides a void value!", &I); // Check that the return value of the instruction is either void or a legal // value type. - Assert1(I.getType()->getTypeID() == Type::VoidTyID || + Assert1(I.getType()->isVoidTy() || I.getType()->isFirstClassType(), "Instruction returns a non-scalar type!", &I); // Check that the instruction doesn't produce metadata. Calls are already // checked against the callee type. - Assert1(I.getType()->getTypeID() != Type::MetadataTyID || + Assert1(!I.getType()->isMetadataTy() || isa<CallInst>(I) || isa<InvokeInst>(I), "Invalid use of metadata!", &I); |