diff ir/irfunction.h @ 1145:40caa8207b3e

Moved IRTargetScopeS from IRState into IrFunction, fixes #240 .
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Thu, 26 Mar 2009 18:46:21 +0100
parents dc608dc33081
children 8699c450a1a0
line wrap: on
line diff
--- a/ir/irfunction.h	Wed Mar 25 13:46:49 2009 +0100
+++ b/ir/irfunction.h	Thu Mar 26 18:46:21 2009 +0100
@@ -9,6 +9,26 @@
 #include <stack>
 #include <map>
 
+struct Statement;
+struct EnclosingHandler;
+
+// 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;
+    
+    llvm::BasicBlock* breakTarget;
+    llvm::BasicBlock* continueTarget;
+
+    IRTargetScope();
+    IRTargetScope(Statement* s, EnclosingHandler* enclosinghandler, llvm::BasicBlock* continueTarget, llvm::BasicBlock* breakTarget);
+};
+
 // represents a function
 struct IrFunction : IrBase
 {
@@ -48,6 +68,11 @@
     // landing pads for try statements
     IRLandingPad landingPad;
 
+    // loop blocks
+    typedef std::vector<IRTargetScope> TargetScopeVec;
+    TargetScopeVec targetScopes;
+
+    // constructor
     IrFunction(FuncDeclaration* fd);
 
     // annotations