diff gen/irstate.h @ 1141:f99a3b393c03

Reorganize EnclosingHandlers to require less changes to the frontend and allow us to implement the synchronized storage class for functions.
author Christian Kamm <kamm incasoftware de>
date Tue, 24 Mar 2009 21:18:18 +0100
parents 8c73ff5f69e0
children 40caa8207b3e
line wrap: on
line diff
--- a/gen/irstate.h	Tue Mar 24 14:34:16 2009 +0100
+++ b/gen/irstate.h	Tue Mar 24 21:18:18 2009 +0100
@@ -51,19 +51,21 @@
     IRScope(llvm::BasicBlock* b, llvm::BasicBlock* e);
 };
 
-// scope for loops
-struct IRLoopScope : IRScope
+// scope statements that can be target of jumps
+// includes loops, switch, case, labels
+struct IRTargetScope
 {
     // generating statement
     Statement* s;
+    
     // the try of a TryFinally that encloses the loop
     EnclosingHandler* enclosinghandler;
-    // if it is a switch, we are a possible target for break
-    // but not for continue
-    bool isSwitch;
+    
+    llvm::BasicBlock* breakTarget;
+    llvm::BasicBlock* continueTarget;
 
-    IRLoopScope();
-    IRLoopScope(Statement* s, EnclosingHandler* enclosinghandler, llvm::BasicBlock* b, llvm::BasicBlock* e, bool isSwitch = false);
+    IRTargetScope();
+    IRTargetScope(Statement* s, EnclosingHandler* enclosinghandler, llvm::BasicBlock* continueTarget, llvm::BasicBlock* breakTarget);
 };
 
 struct IRBuilderHelper
@@ -158,8 +160,8 @@
     llvm::CallSite CreateCallOrInvoke4(LLValue* Callee, LLValue* Arg1, LLValue* Arg2,  LLValue* Arg3, LLValue* Arg4, const char* Name="");
 
     // loop blocks
-    typedef std::vector<IRLoopScope> LoopScopeVec;
-    LoopScopeVec loopbbs;
+    typedef std::vector<IRTargetScope> TargetScopeVec;
+    TargetScopeVec targetScopes;
 
     // this holds the array being indexed or sliced so $ will work
     // might be a better way but it works. problem is I only get a