diff options
Diffstat (limited to 'llvm/lib/IR/Core.cpp')
-rw-r--r-- | llvm/lib/IR/Core.cpp | 222 |
1 files changed, 66 insertions, 156 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index 08b7b0e1f956..ea7ee4f97f69 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -61,6 +61,17 @@ void LLVMShutdown() { llvm_shutdown(); } +/*===-- Version query -----------------------------------------------------===*/ + +void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch) { + if (Major) + *Major = LLVM_VERSION_MAJOR; + if (Minor) + *Minor = LLVM_VERSION_MINOR; + if (Patch) + *Patch = LLVM_VERSION_PATCH; +} + /*===-- Error handling ----------------------------------------------------===*/ char *LLVMCreateMessage(const char *Message) { @@ -147,18 +158,6 @@ LLVMAttributeRef LLVMCreateEnumAttribute(LLVMContextRef C, unsigned KindID, uint64_t Val) { auto &Ctx = *unwrap(C); auto AttrKind = (Attribute::AttrKind)KindID; - - if (AttrKind == Attribute::AttrKind::ByVal) { - // After r362128, byval attributes need to have a type attribute. Provide a - // NULL one until a proper API is added for this. - return wrap(Attribute::getWithByValType(Ctx, nullptr)); - } - - if (AttrKind == Attribute::AttrKind::StructRet) { - // Same as byval. - return wrap(Attribute::getWithStructRetType(Ctx, nullptr)); - } - return wrap(Attribute::get(Ctx, AttrKind, Val)); } @@ -541,8 +540,10 @@ LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty) { return LLVMTokenTypeKind; case Type::ScalableVectorTyID: return LLVMScalableVectorTypeKind; - case Type::DXILPointerTyID: - llvm_unreachable("DXIL pointers are unsupported via the C API"); + case Type::TargetExtTyID: + return LLVMTargetExtTypeKind; + case Type::TypedPointerTyID: + llvm_unreachable("Typed pointers are unsupported via the C API"); } llvm_unreachable("Unhandled TypeID."); } @@ -809,7 +810,7 @@ LLVMTypeRef LLVMScalableVectorType(LLVMTypeRef ElementType, } LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy) { - auto *Ty = unwrap<Type>(WrappedTy); + auto *Ty = unwrap(WrappedTy); if (auto *PTy = dyn_cast<PointerType>(Ty)) return wrap(PTy->getNonOpaquePointerElementType()); if (auto *ATy = dyn_cast<ArrayType>(Ty)) @@ -859,6 +860,17 @@ LLVMTypeRef LLVMLabelType(void) { return LLVMLabelTypeInContext(LLVMGetGlobalContext()); } +LLVMTypeRef LLVMTargetExtTypeInContext(LLVMContextRef C, const char *Name, + LLVMTypeRef *TypeParams, + unsigned TypeParamCount, + unsigned *IntParams, + unsigned IntParamCount) { + ArrayRef<Type *> TypeParamArray(unwrap(TypeParams), TypeParamCount); + ArrayRef<unsigned> IntParamArray(IntParams, IntParamCount); + return wrap( + TargetExtType::get(*unwrap(C), Name, TypeParamArray, IntParamArray)); +} + /*===-- Operations on values ----------------------------------------------===*/ /*--.. Operations on all values ............................................--*/ @@ -1142,7 +1154,7 @@ LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals, unsigned Count) { LLVMContext &Context = *unwrap(C); SmallVector<Metadata *, 8> MDs; - for (auto *OV : makeArrayRef(Vals, Count)) { + for (auto *OV : ArrayRef(Vals, Count)) { Value *V = unwrap(OV); Metadata *MD; if (!V) @@ -1193,7 +1205,7 @@ const char *LLVMGetMDString(LLVMValueRef V, unsigned *Length) { } unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V) { - auto *MD = cast<MetadataAsValue>(unwrap(V)); + auto *MD = unwrap<MetadataAsValue>(V); if (isa<ValueAsMetadata>(MD->getMetadata())) return 1; return cast<MDNode>(MD->getMetadata())->getNumOperands(); @@ -1216,7 +1228,7 @@ LLVMNamedMDNodeRef LLVMGetLastNamedMetadata(LLVMModuleRef M) { } LLVMNamedMDNodeRef LLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NMD) { - NamedMDNode *NamedNode = unwrap<NamedMDNode>(NMD); + NamedMDNode *NamedNode = unwrap(NMD); Module::named_metadata_iterator I(NamedNode); if (++I == NamedNode->getParent()->named_metadata_end()) return nullptr; @@ -1224,7 +1236,7 @@ LLVMNamedMDNodeRef LLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NMD) { } LLVMNamedMDNodeRef LLVMGetPreviousNamedMetadata(LLVMNamedMDNodeRef NMD) { - NamedMDNode *NamedNode = unwrap<NamedMDNode>(NMD); + NamedMDNode *NamedNode = unwrap(NMD); Module::named_metadata_iterator I(NamedNode); if (I == NamedNode->getParent()->named_metadata_begin()) return nullptr; @@ -1242,13 +1254,13 @@ LLVMNamedMDNodeRef LLVMGetOrInsertNamedMetadata(LLVMModuleRef M, } const char *LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen) { - NamedMDNode *NamedNode = unwrap<NamedMDNode>(NMD); + NamedMDNode *NamedNode = unwrap(NMD); *NameLen = NamedNode->getName().size(); return NamedNode->getName().data(); } void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest) { - auto *MD = cast<MetadataAsValue>(unwrap(V)); + auto *MD = unwrap<MetadataAsValue>(V); if (auto *MDV = dyn_cast<ValueAsMetadata>(MD->getMetadata())) { *Dest = wrap(MDV->getValue()); return; @@ -1376,9 +1388,8 @@ LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[]) { IntegerType *Ty = unwrap<IntegerType>(IntTy); - return wrap(ConstantInt::get(Ty->getContext(), - APInt(Ty->getBitWidth(), - makeArrayRef(Words, NumWords)))); + return wrap(ConstantInt::get( + Ty->getContext(), APInt(Ty->getBitWidth(), ArrayRef(Words, NumWords)))); } LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[], @@ -1476,7 +1487,7 @@ LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed) { Constant **Elements = unwrap<Constant>(ConstantVals, Count); - return wrap(ConstantStruct::getAnon(*unwrap(C), makeArrayRef(Elements, Count), + return wrap(ConstantStruct::getAnon(*unwrap(C), ArrayRef(Elements, Count), Packed != 0)); } @@ -1490,14 +1501,14 @@ LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef *ConstantVals, unsigned Count) { Constant **Elements = unwrap<Constant>(ConstantVals, Count); - StructType *Ty = cast<StructType>(unwrap(StructTy)); + StructType *Ty = unwrap<StructType>(StructTy); - return wrap(ConstantStruct::get(Ty, makeArrayRef(Elements, Count))); + return wrap(ConstantStruct::get(Ty, ArrayRef(Elements, Count))); } LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) { - return wrap(ConstantVector::get(makeArrayRef( - unwrap<Constant>(ScalarConstantVals, Size), Size))); + return wrap(ConstantVector::get( + ArrayRef(unwrap<Constant>(ScalarConstantVals, Size), Size))); } /*-- Opcode mapping */ @@ -1549,10 +1560,6 @@ LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal) { } -LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getFNeg(unwrap<Constant>(ConstantVal))); -} - LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal) { return wrap(ConstantExpr::getNot(unwrap<Constant>(ConstantVal))); } @@ -1652,15 +1659,6 @@ LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { unwrap<Constant>(RHSConstant))); } -LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal, - LLVMValueRef *ConstantIndices, unsigned NumIndices) { - ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices), - NumIndices); - Constant *Val = unwrap<Constant>(ConstantVal); - Type *Ty = Val->getType()->getScalarType()->getNonOpaquePointerElementType(); - return wrap(ConstantExpr::getGetElementPtr(Ty, Val, IdxList)); -} - LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices) { ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices), @@ -1669,16 +1667,6 @@ LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, return wrap(ConstantExpr::getGetElementPtr(unwrap(Ty), Val, IdxList)); } -LLVMValueRef LLVMConstInBoundsGEP(LLVMValueRef ConstantVal, - LLVMValueRef *ConstantIndices, - unsigned NumIndices) { - ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices), - NumIndices); - Constant *Val = unwrap<Constant>(ConstantVal); - Type *Ty = Val->getType()->getScalarType()->getNonOpaquePointerElementType(); - return wrap(ConstantExpr::getInBoundsGetElementPtr(Ty, Val, IdxList)); -} - LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices) { @@ -2009,7 +1997,7 @@ LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global) { /*--.. Operations on global variables, load and store instructions .........--*/ unsigned LLVMGetAlignment(LLVMValueRef V) { - Value *P = unwrap<Value>(V); + Value *P = unwrap(V); if (GlobalObject *GV = dyn_cast<GlobalObject>(P)) return GV->getAlign() ? GV->getAlign()->value() : 0; if (AllocaInst *AI = dyn_cast<AllocaInst>(P)) @@ -2029,7 +2017,7 @@ unsigned LLVMGetAlignment(LLVMValueRef V) { } void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes) { - Value *P = unwrap<Value>(V); + Value *P = unwrap(V); if (GlobalObject *GV = dyn_cast<GlobalObject>(P)) GV->setAlignment(MaybeAlign(Bytes)); else if (AllocaInst *AI = dyn_cast<AllocaInst>(P)) @@ -2225,15 +2213,6 @@ void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit) { /*--.. Operations on aliases ......................................--*/ -LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee, - const char *Name) { - auto *PTy = cast<PointerType>(unwrap(Ty)); - return wrap(GlobalAlias::create(PTy->getNonOpaquePointerElementType(), - PTy->getAddressSpace(), - GlobalValue::ExternalLinkage, Name, - unwrap<Constant>(Aliasee), unwrap(M))); -} - LLVMValueRef LLVMAddAlias2(LLVMModuleRef M, LLVMTypeRef ValueTy, unsigned AddrSpace, LLVMValueRef Aliasee, const char *Name) { @@ -2688,13 +2667,12 @@ void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, BasicBlock *ToInsert = unwrap(BB); BasicBlock *CurBB = unwrap(Builder)->GetInsertBlock(); assert(CurBB && "current insertion point is invalid!"); - CurBB->getParent()->getBasicBlockList().insertAfter(CurBB->getIterator(), - ToInsert); + CurBB->getParent()->insert(std::next(CurBB->getIterator()), ToInsert); } void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB) { - unwrap<Function>(Fn)->getBasicBlockList().push_back(unwrap(BB)); + unwrap<Function>(Fn)->insert(unwrap<Function>(Fn)->end(), unwrap(BB)); } LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, @@ -2822,7 +2800,7 @@ LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst) { unsigned LLVMGetNumArgOperands(LLVMValueRef Instr) { if (FuncletPadInst *FPI = dyn_cast<FuncletPadInst>(unwrap(Instr))) { - return FPI->getNumArgOperands(); + return FPI->arg_size(); } return unwrap<CallBase>(Instr)->arg_size(); } @@ -3163,26 +3141,13 @@ LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, return wrap(unwrap(B)->CreateIndirectBr(unwrap(Addr), NumDests)); } -LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn, - LLVMValueRef *Args, unsigned NumArgs, - LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, - const char *Name) { - Value *V = unwrap(Fn); - FunctionType *FnT = - cast<FunctionType>(V->getType()->getNonOpaquePointerElementType()); - - return wrap( - unwrap(B)->CreateInvoke(FnT, unwrap(Fn), unwrap(Then), unwrap(Catch), - makeArrayRef(unwrap(Args), NumArgs), Name)); -} - LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name) { - return wrap(unwrap(B)->CreateInvoke( - unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(Then), unwrap(Catch), - makeArrayRef(unwrap(Args), NumArgs), Name)); + return wrap(unwrap(B)->CreateInvoke(unwrap<FunctionType>(Ty), unwrap(Fn), + unwrap(Then), unwrap(Catch), + ArrayRef(unwrap(Args), NumArgs), Name)); } LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, @@ -3193,7 +3158,7 @@ LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, // personality and put it on the parent function. if (PersFn) unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn( - cast<Function>(unwrap(PersFn))); + unwrap<Function>(PersFn)); return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses, Name)); } @@ -3201,8 +3166,7 @@ LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name) { return wrap(unwrap(B)->CreateCatchPad(unwrap(ParentPad), - makeArrayRef(unwrap(Args), NumArgs), - Name)); + ArrayRef(unwrap(Args), NumArgs), Name)); } LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, @@ -3212,9 +3176,8 @@ LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, Type *Ty = Type::getTokenTy(unwrap(B)->getContext()); ParentPad = wrap(Constant::getNullValue(Ty)); } - return wrap(unwrap(B)->CreateCleanupPad(unwrap(ParentPad), - makeArrayRef(unwrap(Args), NumArgs), - Name)); + return wrap(unwrap(B)->CreateCleanupPad( + unwrap(ParentPad), ArrayRef(unwrap(Args), NumArgs), Name)); } LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn) { @@ -3266,8 +3229,7 @@ LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx) { } void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal) { - unwrap<LandingPadInst>(LandingPad)-> - addClause(cast<Constant>(unwrap(ClauseVal))); + unwrap<LandingPadInst>(LandingPad)->addClause(unwrap<Constant>(ClauseVal)); } LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad) { @@ -3536,15 +3498,6 @@ LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal) { CallInst::CreateFree(unwrap(PointerVal), unwrap(B)->GetInsertBlock()))); } -LLVMValueRef LLVMBuildLoad(LLVMBuilderRef B, LLVMValueRef PointerVal, - const char *Name) { - Value *V = unwrap(PointerVal); - PointerType *Ty = cast<PointerType>(V->getType()); - - return wrap( - unwrap(B)->CreateLoad(Ty->getNonOpaquePointerElementType(), V, Name)); -} - LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name) { return wrap(unwrap(B)->CreateLoad(unwrap(Ty), unwrap(PointerVal), Name)); @@ -3643,15 +3596,6 @@ LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, Name)); } -LLVMValueRef LLVMBuildGEP(LLVMBuilderRef B, LLVMValueRef Pointer, - LLVMValueRef *Indices, unsigned NumIndices, - const char *Name) { - ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices); - Value *Val = unwrap(Pointer); - Type *Ty = Val->getType()->getScalarType()->getNonOpaquePointerElementType(); - return wrap(unwrap(B)->CreateGEP(Ty, Val, IdxList, Name)); -} - LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name) { @@ -3659,15 +3603,6 @@ LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, return wrap(unwrap(B)->CreateGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name)); } -LLVMValueRef LLVMBuildInBoundsGEP(LLVMBuilderRef B, LLVMValueRef Pointer, - LLVMValueRef *Indices, unsigned NumIndices, - const char *Name) { - ArrayRef<Value *> IdxList(unwrap(Indices), NumIndices); - Value *Val = unwrap(Pointer); - Type *Ty = Val->getType()->getScalarType()->getNonOpaquePointerElementType(); - return wrap(unwrap(B)->CreateInBoundsGEP(Ty, Val, IdxList, Name)); -} - LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name) { @@ -3676,13 +3611,6 @@ LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, unwrap(B)->CreateInBoundsGEP(unwrap(Ty), unwrap(Pointer), IdxList, Name)); } -LLVMValueRef LLVMBuildStructGEP(LLVMBuilderRef B, LLVMValueRef Pointer, - unsigned Idx, const char *Name) { - Value *Val = unwrap(Pointer); - Type *Ty = Val->getType()->getScalarType()->getNonOpaquePointerElementType(); - return wrap(unwrap(B)->CreateStructGEP(Ty, Val, Idx, Name)); -} - LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name) { @@ -3701,7 +3629,7 @@ LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, } LLVMBool LLVMGetVolatile(LLVMValueRef MemAccessInst) { - Value *P = unwrap<Value>(MemAccessInst); + Value *P = unwrap(MemAccessInst); if (LoadInst *LI = dyn_cast<LoadInst>(P)) return LI->isVolatile(); if (StoreInst *SI = dyn_cast<StoreInst>(P)) @@ -3712,7 +3640,7 @@ LLVMBool LLVMGetVolatile(LLVMValueRef MemAccessInst) { } void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile) { - Value *P = unwrap<Value>(MemAccessInst); + Value *P = unwrap(MemAccessInst); if (LoadInst *LI = dyn_cast<LoadInst>(P)) return LI->setVolatile(isVolatile); if (StoreInst *SI = dyn_cast<StoreInst>(P)) @@ -3731,7 +3659,7 @@ void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak) { } LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst) { - Value *P = unwrap<Value>(MemAccessInst); + Value *P = unwrap(MemAccessInst); AtomicOrdering O; if (LoadInst *LI = dyn_cast<LoadInst>(P)) O = LI->getOrdering(); @@ -3743,7 +3671,7 @@ LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst) { } void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering) { - Value *P = unwrap<Value>(MemAccessInst); + Value *P = unwrap(MemAccessInst); AtomicOrdering O = mapFromLLVMOrdering(Ordering); if (LoadInst *LI = dyn_cast<LoadInst>(P)) @@ -3901,23 +3829,12 @@ LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name) { return wrap(unwrap(B)->CreatePHI(unwrap(Ty), 0, Name)); } -LLVMValueRef LLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, - LLVMValueRef *Args, unsigned NumArgs, - const char *Name) { - Value *V = unwrap(Fn); - FunctionType *FnT = - cast<FunctionType>(V->getType()->getNonOpaquePointerElementType()); - - return wrap(unwrap(B)->CreateCall(FnT, unwrap(Fn), - makeArrayRef(unwrap(Args), NumArgs), Name)); -} - LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name) { FunctionType *FTy = unwrap<FunctionType>(Ty); return wrap(unwrap(B)->CreateCall(FTy, unwrap(Fn), - makeArrayRef(unwrap(Args), NumArgs), Name)); + ArrayRef(unwrap(Args), NumArgs), Name)); } LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, @@ -3979,13 +3896,6 @@ LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, return wrap(unwrap(B)->CreateIsNotNull(unwrap(Val), Name)); } -LLVMValueRef LLVMBuildPtrDiff(LLVMBuilderRef B, LLVMValueRef LHS, - LLVMValueRef RHS, const char *Name) { - Value *L = unwrap(LHS); - Type *ElemTy = L->getType()->getNonOpaquePointerElementType(); - return wrap(unwrap(B)->CreatePtrDiff(ElemTy, L, unwrap(RHS), Name)); -} - LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef B, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name) { @@ -4018,13 +3928,13 @@ LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, } unsigned LLVMGetNumMaskElements(LLVMValueRef SVInst) { - Value *P = unwrap<Value>(SVInst); + Value *P = unwrap(SVInst); ShuffleVectorInst *I = cast<ShuffleVectorInst>(P); return I->getShuffleMask().size(); } int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt) { - Value *P = unwrap<Value>(SVInst); + Value *P = unwrap(SVInst); ShuffleVectorInst *I = cast<ShuffleVectorInst>(P); return I->getMaskValue(Elt); } @@ -4032,7 +3942,7 @@ int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt) { int LLVMGetUndefMaskElem(void) { return UndefMaskElem; } LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst) { - Value *P = unwrap<Value>(AtomicInst); + Value *P = unwrap(AtomicInst); if (AtomicRMWInst *I = dyn_cast<AtomicRMWInst>(P)) return I->getSyncScopeID() == SyncScope::SingleThread; @@ -4041,7 +3951,7 @@ LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst) { } void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue) { - Value *P = unwrap<Value>(AtomicInst); + Value *P = unwrap(AtomicInst); SyncScope::ID SSID = NewValue ? SyncScope::SingleThread : SyncScope::System; if (AtomicRMWInst *I = dyn_cast<AtomicRMWInst>(P)) @@ -4050,26 +3960,26 @@ void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue) { } LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst) { - Value *P = unwrap<Value>(CmpXchgInst); + Value *P = unwrap(CmpXchgInst); return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getSuccessOrdering()); } void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering) { - Value *P = unwrap<Value>(CmpXchgInst); + Value *P = unwrap(CmpXchgInst); AtomicOrdering O = mapFromLLVMOrdering(Ordering); return cast<AtomicCmpXchgInst>(P)->setSuccessOrdering(O); } LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst) { - Value *P = unwrap<Value>(CmpXchgInst); + Value *P = unwrap(CmpXchgInst); return mapToLLVMOrdering(cast<AtomicCmpXchgInst>(P)->getFailureOrdering()); } void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering) { - Value *P = unwrap<Value>(CmpXchgInst); + Value *P = unwrap(CmpXchgInst); AtomicOrdering O = mapFromLLVMOrdering(Ordering); return cast<AtomicCmpXchgInst>(P)->setFailureOrdering(O); |