[cfe-commits] r64098 - in /cfe/trunk/lib/CodeGen: CGObjCMac.cpp CodeGenFunction.h

Anders Carlsson andersca at mac.com
Sun Feb 8 14:25:30 PST 2009


Author: andersca
Date: Sun Feb  8 16:25:30 2009
New Revision: 64098

URL: http://llvm.org/viewvc/llvm-project?rev=64098&view=rev
Log:
Add a simplified EmitJumpThroughFinally and use it in CGObjC in preparation of making it use the cleanup stack.

Modified:
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=64098&r1=64097&r2=64098&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Sun Feb  8 16:25:30 2009
@@ -1904,7 +1904,7 @@
   CGF.EmitBlock(TryBlock);
   CGF.EmitStmt(isTry ? cast<ObjCAtTryStmt>(S).getTryBody() 
                      : cast<ObjCAtSynchronizedStmt>(S).getSynchBody());
-  CGF.EmitJumpThroughFinally(&EHEntry, FinallyEnd);
+  CGF.EmitJumpThroughFinally(FinallyEnd);
   
   // Emit the "exception in @try" block.
   CGF.EmitBlock(TryHandler);
@@ -1919,7 +1919,7 @@
   {
     CGF.Builder.CreateStore(Caught, RethrowPtr);
     CGF.Builder.CreateStore(llvm::ConstantInt::getFalse(), CallTryExitPtr);
-    CGF.EmitJumpThroughFinally(&EHEntry, FinallyRethrow, false);    
+    CGF.EmitJumpThroughFinally(FinallyRethrow);
   }
   else if (const ObjCAtCatchStmt* CatchStmt = 
            cast<ObjCAtTryStmt>(S).getCatchStmts()) 
@@ -1973,7 +1973,7 @@
         }
         
         CGF.EmitStmt(CatchStmt->getCatchBody());
-        CGF.EmitJumpThroughFinally(&EHEntry, FinallyEnd);
+        CGF.EmitJumpThroughFinally(FinallyEnd);
         break;
       }
       
@@ -2004,7 +2004,7 @@
       CGF.Builder.CreateStore(Tmp, CGF.GetAddrOfLocalVar(VD));
       
       CGF.EmitStmt(CatchStmt->getCatchBody());
-      CGF.EmitJumpThroughFinally(&EHEntry, FinallyEnd);
+      CGF.EmitJumpThroughFinally(FinallyEnd);
       
       CGF.EmitBlock(NextCatchBlock);
     }
@@ -2013,7 +2013,7 @@
       // None of the handlers caught the exception, so store it to be
       // rethrown at the end of the @finally block.
       CGF.Builder.CreateStore(Caught, RethrowPtr);
-      CGF.EmitJumpThroughFinally(&EHEntry, FinallyRethrow);
+      CGF.EmitJumpThroughFinally(FinallyRethrow);
     }
     
     // Emit the exception handler for the @catch blocks.
@@ -2022,11 +2022,11 @@
                                                    ExceptionData), 
                             RethrowPtr);
     CGF.Builder.CreateStore(llvm::ConstantInt::getFalse(), CallTryExitPtr);
-    CGF.EmitJumpThroughFinally(&EHEntry, FinallyRethrow, false);
+    CGF.EmitJumpThroughFinally(FinallyRethrow);
   } else {
     CGF.Builder.CreateStore(Caught, RethrowPtr);
     CGF.Builder.CreateStore(llvm::ConstantInt::getFalse(), CallTryExitPtr);
-    CGF.EmitJumpThroughFinally(&EHEntry, FinallyRethrow, false);    
+    CGF.EmitJumpThroughFinally(FinallyRethrow);
   }
   
   // Pop the exception-handling stack entry. It is important to do
@@ -2090,9 +2090,12 @@
   CGF.Builder.ClearInsertionPoint();
 }
 
+void CodeGenFunction::EmitJumpThroughFinally(llvm::BasicBlock *Dest) {
+  EmitJumpThroughFinally(ObjCEHStack.back(), Dest);
+}
+
 void CodeGenFunction::EmitJumpThroughFinally(ObjCEHEntry *E,
-                                             llvm::BasicBlock *Dst,
-                                             bool ExecuteTryExit) {
+                                             llvm::BasicBlock *Dst) {
   if (!HaveInsertPoint())
     return;
   

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=64098&r1=64097&r2=64098&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sun Feb  8 16:25:30 2009
@@ -125,8 +125,9 @@
   ///
   /// \param ExecuteTryExit - When true, the try_exit runtime function
   /// should be called prior to executing the finally code.
-  void EmitJumpThroughFinally(ObjCEHEntry *Entry, llvm::BasicBlock *Dest,
-                              bool ExecuteTryExit=true);
+  void EmitJumpThroughFinally(ObjCEHEntry *Entry, llvm::BasicBlock *Dest);
+  
+  void EmitJumpThroughFinally(llvm::BasicBlock *Dest);
   
   /// PushCleanupBlock - Push a new cleanup entry on the stack and set the
   /// passed in block as the cleanup block.





More information about the cfe-commits mailing list