diff options
author | Arnaud A. de Grandmaison <arnaud.degrandmaison@arm.com> | 2014-07-18 13:36:33 +0000 |
---|---|---|
committer | Arnaud A. de Grandmaison <arnaud.degrandmaison@arm.com> | 2014-07-18 13:36:33 +0000 |
commit | 1be89f4977724896289e6d706690ada275e9f451 (patch) | |
tree | a73ba745d323d0a58e41f059a8c39a49cea620d5 /clang/lib/CodeGen/CodeGenFunction.h | |
parent | f8bfe21fad8f4c1ca41e583ef6fd7aae5b17e95e (diff) | |
download | llvm-1be89f4977724896289e6d706690ada275e9f451.zip llvm-1be89f4977724896289e6d706690ada275e9f451.tar.gz llvm-1be89f4977724896289e6d706690ada275e9f451.tar.bz2 |
Emit lifetime.start / lifetime.end markers for unnamed temporary objects.
This will give more information to the optimizers so that they can reuse stack slots.
llvm-svn: 213379
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 3692b02..285ef63 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -990,6 +990,23 @@ private: void EmitOpenCLKernelMetadata(const FunctionDecl *FD, llvm::Function *Fn); + /// Should we use the LLVM lifetime intrinsics for a local variable of the + /// given size in bytes ? + bool shouldUseLifetimeMarkers(unsigned Size) const; + + /// A cleanup to call @llvm.lifetime.end. + class CallLifetimeEnd : public EHScopeStack::Cleanup { + llvm::Value *Addr; + llvm::Value *Size; + public: + CallLifetimeEnd(llvm::Value *addr, llvm::Value *size) + : Addr(addr), Size(size) {} + + void Emit(CodeGenFunction &CGF, Flags flags) override { + CGF.EmitLifetimeEnd(Size, Addr); + } + }; + public: CodeGenFunction(CodeGenModule &cgm, bool suppressNewContext=false); ~CodeGenFunction(); @@ -1673,6 +1690,9 @@ public: void EmitCXXTemporary(const CXXTemporary *Temporary, QualType TempType, llvm::Value *Ptr); + void EmitLifetimeStart(llvm::Value *Size, llvm::Value *Addr); + void EmitLifetimeEnd(llvm::Value *Size, llvm::Value *Addr); + llvm::Value *EmitCXXNewExpr(const CXXNewExpr *E); void EmitCXXDeleteExpr(const CXXDeleteExpr *E); |