diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-05-21 23:14:36 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-05-21 23:14:36 +0000 |
commit | 0cf51561eddd659a7b427f40144e22363fd95a57 (patch) | |
tree | a66609b096578e6bd62f2c9cc5e6e292bcdcb8bc /lib | |
parent | d22920aae81ec318404f7c5235c634954d966cf6 (diff) | |
download | llvm-0cf51561eddd659a7b427f40144e22363fd95a57.tar.gz llvm-0cf51561eddd659a7b427f40144e22363fd95a57.tar.bz2 llvm-0cf51561eddd659a7b427f40144e22363fd95a57.tar.xz |
Add CreateLifetimeStart and CreateLifetimeEnd to the IRBuilder, with plans to
use these soon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131812 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VMCore/IRBuilder.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/VMCore/IRBuilder.cpp b/lib/VMCore/IRBuilder.cpp index 21491557d4..f2d469a2d8 100644 --- a/lib/VMCore/IRBuilder.cpp +++ b/lib/VMCore/IRBuilder.cpp @@ -60,7 +60,6 @@ static CallInst *createCallHelper(Value *Callee, Value *const* Ops, return CI; } - CallInst *IRBuilderBase:: CreateMemSet(Value *Ptr, Value *Val, Value *Size, unsigned Align, bool isVolatile, MDNode *TBAATag) { @@ -118,3 +117,33 @@ CreateMemMove(Value *Dst, Value *Src, Value *Size, unsigned Align, return CI; } + +CallInst *IRBuilderBase::CreateLifetimeStart(Value *Ptr, ConstantInt *Size) { + assert(isa<PointerType>(Ptr->getType()) && + "lifetime.start only applies to pointers."); + Ptr = getCastedInt8PtrValue(Ptr); + if (!Size) + Size = getInt64(-1); + else + assert(Size->getType() == getInt64Ty() && + "lifetime.start requires the size to be an i64"); + Value *Ops[] = { Size, Ptr }; + Module *M = BB->getParent()->getParent(); + Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::lifetime_start); + return createCallHelper(TheFn, Ops, 2, this); +} + +CallInst *IRBuilderBase::CreateLifetimeEnd(Value *Ptr, ConstantInt *Size) { + assert(isa<PointerType>(Ptr->getType()) && + "lifetime.end only applies to pointers."); + Ptr = getCastedInt8PtrValue(Ptr); + if (!Size) + Size = getInt64(-1); + else + assert(Size->getType() == getInt64Ty() && + "lifetime.end requires the size to be an i64"); + Value *Ops[] = { Size, Ptr }; + Module *M = BB->getParent()->getParent(); + Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::lifetime_end); + return createCallHelper(TheFn, Ops, 2, this); +} |