From 2504941793b549323f9d29c62507cf21d865fade Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 16 Feb 2010 22:04:33 +0000 Subject: IRgen optimization: cache the value of 'this' and 'vtt' instead of repeatedly reloading from an alloca. We still need to create the alloca for debug info purposes (although we currently create it in all cases because of some abstraction boundaries that're hard to break down). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96403 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/CodeGenFunction.h') diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index a4db556d39..a694b894df 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -382,11 +382,13 @@ private: /// CXXThisDecl - When generating code for a C++ member function, /// this will hold the implicit 'this' declaration. ImplicitParamDecl *CXXThisDecl; + llvm::Value *CXXThisValue; /// CXXVTTDecl - When generating code for a base object constructor or /// base object destructor with virtual bases, this will hold the implicit /// VTT parameter. ImplicitParamDecl *CXXVTTDecl; + llvm::Value *CXXVTTValue; /// CXXLiveTemporaryInfo - Holds information about a live C++ temporary. struct CXXLiveTemporaryInfo { @@ -745,11 +747,17 @@ public: /// LoadCXXThis - Load the value of 'this'. This function is only valid while /// generating code for an C++ member function. - llvm::Value *LoadCXXThis(); + llvm::Value *LoadCXXThis() { + assert(CXXThisValue && "no 'this' value for this function"); + return CXXThisValue; + } /// LoadCXXVTT - Load the VTT parameter to base constructors/destructors have /// virtual bases. - llvm::Value *LoadCXXVTT(); + llvm::Value *LoadCXXVTT() { + assert(CXXVTTValue && "no VTT value for this function"); + return CXXVTTValue; + } /// GetAddressOfBaseOfCompleteClass - Convert the given pointer to a /// complete class down to one of its virtual bases. -- cgit v1.2.3-18-g5258