Mercurial > projects > ldc
comparison gen/irstate.h @ 145:8f704cb9969b trunk
[svn r150] fixes #16 and #17, implements GotoCaseStatement
author | ChristianK |
---|---|
date | Sat, 08 Mar 2008 15:22:07 +0100 |
parents | 0e28624814e8 |
children | 86d3bb8ca33e |
comparison
equal
deleted
inserted
replaced
144:a27941d00351 | 145:8f704cb9969b |
---|---|
21 struct ClassDeclaration; | 21 struct ClassDeclaration; |
22 struct FuncDeclaration; | 22 struct FuncDeclaration; |
23 struct Module; | 23 struct Module; |
24 struct TypeStruct; | 24 struct TypeStruct; |
25 struct BaseClass; | 25 struct BaseClass; |
26 struct TryFinallyStatement; | |
26 | 27 |
27 // represents a scope | 28 // represents a scope |
28 struct IRScope | 29 struct IRScope |
29 { | 30 { |
30 llvm::BasicBlock* begin; | 31 llvm::BasicBlock* begin; |
31 llvm::BasicBlock* end; | 32 llvm::BasicBlock* end; |
32 LLVMBuilder builder; | 33 LLVMBuilder builder; |
33 | 34 |
34 IRScope(); | 35 IRScope(); |
35 IRScope(llvm::BasicBlock* b, llvm::BasicBlock* e); | 36 IRScope(llvm::BasicBlock* b, llvm::BasicBlock* e); |
37 }; | |
38 | |
39 // scope for loops | |
40 struct IRLoopScope : IRScope | |
41 { | |
42 // generating statement | |
43 Statement* s; | |
44 // the try of a TryFinally that encloses the loop | |
45 TryFinallyStatement* enclosingtry; | |
46 | |
47 IRLoopScope(); | |
48 IRLoopScope(Statement* s, TryFinallyStatement* enclosingtry, llvm::BasicBlock* b, llvm::BasicBlock* e); | |
36 }; | 49 }; |
37 | 50 |
38 struct IRBuilderHelper | 51 struct IRBuilderHelper |
39 { | 52 { |
40 IRState* state; | 53 IRState* state; |
93 llvm::BasicBlock* scopeend(); | 106 llvm::BasicBlock* scopeend(); |
94 bool scopereturned(); | 107 bool scopereturned(); |
95 | 108 |
96 // loop blocks | 109 // loop blocks |
97 typedef std::vector<IRScope> BBVec; | 110 typedef std::vector<IRScope> BBVec; |
98 BBVec loopbbs; | 111 typedef std::vector<IRLoopScope> LoopScopeVec; |
112 LoopScopeVec loopbbs; | |
99 | 113 |
100 // this holds the array being indexed or sliced so $ will work | 114 // this holds the array being indexed or sliced so $ will work |
101 // might be a better way but it works. problem is I only get a | 115 // might be a better way but it works. problem is I only get a |
102 // VarDeclaration for __dollar, but I can't see how to get the | 116 // VarDeclaration for __dollar, but I can't see how to get the |
103 // array pointer from this :( | 117 // array pointer from this :( |