diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-11-05 17:17:44 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-11-05 17:17:44 +0000 |
commit | ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89 (patch) | |
tree | adc0bc5dc9cb37579ee90d3c0f08c98c0711bebe /lib/VMCore/Core.cpp | |
parent | ee2025263d979561bba11dc526f01d690a2565e7 (diff) | |
download | FreeBSD-src-ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89.zip FreeBSD-src-ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89.tar.gz |
Update LLVM to r86140.
Diffstat (limited to 'lib/VMCore/Core.cpp')
-rw-r--r-- | lib/VMCore/Core.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index 9a49d42..1a34180 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -1699,18 +1699,24 @@ LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name) { LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name) { - const Type* IntPtrT = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); - return wrap(unwrap(B)->Insert(CallInst::CreateMalloc( - unwrap(B)->GetInsertBlock(), IntPtrT, unwrap(Ty), 0, 0, ""), - Twine(Name))); + const Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); + Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty)); + AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy); + Instruction* Malloc = CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), + ITy, unwrap(Ty), AllocSize, + 0, 0, ""); + return wrap(unwrap(B)->Insert(Malloc, Twine(Name))); } LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name) { - const Type* IntPtrT = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); - return wrap(unwrap(B)->Insert(CallInst::CreateMalloc( - unwrap(B)->GetInsertBlock(), IntPtrT, unwrap(Ty), unwrap(Val), 0, ""), - Twine(Name))); + const Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); + Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty)); + AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy); + Instruction* Malloc = CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), + ITy, unwrap(Ty), AllocSize, + unwrap(Val), 0, ""); + return wrap(unwrap(B)->Insert(Malloc, Twine(Name))); } LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, |