Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
1137:45d73f0a9b43 | 1141:f99a3b393c03 |
---|---|
49 | 49 |
50 IRScope(); | 50 IRScope(); |
51 IRScope(llvm::BasicBlock* b, llvm::BasicBlock* e); | 51 IRScope(llvm::BasicBlock* b, llvm::BasicBlock* e); |
52 }; | 52 }; |
53 | 53 |
54 // scope for loops | 54 // scope statements that can be target of jumps |
55 struct IRLoopScope : IRScope | 55 // includes loops, switch, case, labels |
56 struct IRTargetScope | |
56 { | 57 { |
57 // generating statement | 58 // generating statement |
58 Statement* s; | 59 Statement* s; |
60 | |
59 // the try of a TryFinally that encloses the loop | 61 // the try of a TryFinally that encloses the loop |
60 EnclosingHandler* enclosinghandler; | 62 EnclosingHandler* enclosinghandler; |
61 // if it is a switch, we are a possible target for break | 63 |
62 // but not for continue | 64 llvm::BasicBlock* breakTarget; |
63 bool isSwitch; | 65 llvm::BasicBlock* continueTarget; |
64 | 66 |
65 IRLoopScope(); | 67 IRTargetScope(); |
66 IRLoopScope(Statement* s, EnclosingHandler* enclosinghandler, llvm::BasicBlock* b, llvm::BasicBlock* e, bool isSwitch = false); | 68 IRTargetScope(Statement* s, EnclosingHandler* enclosinghandler, llvm::BasicBlock* continueTarget, llvm::BasicBlock* breakTarget); |
67 }; | 69 }; |
68 | 70 |
69 struct IRBuilderHelper | 71 struct IRBuilderHelper |
70 { | 72 { |
71 IRState* state; | 73 IRState* state; |
156 llvm::CallSite CreateCallOrInvoke2(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, const char* Name=""); | 158 llvm::CallSite CreateCallOrInvoke2(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, const char* Name=""); |
157 llvm::CallSite CreateCallOrInvoke3(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, const char* Name=""); | 159 llvm::CallSite CreateCallOrInvoke3(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, const char* Name=""); |
158 llvm::CallSite CreateCallOrInvoke4(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, LLValue* Arg4, const char* Name=""); | 160 llvm::CallSite CreateCallOrInvoke4(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, LLValue* Arg4, const char* Name=""); |
159 | 161 |
160 // loop blocks | 162 // loop blocks |
161 typedef std::vector<IRLoopScope> LoopScopeVec; | 163 typedef std::vector<IRTargetScope> TargetScopeVec; |
162 LoopScopeVec loopbbs; | 164 TargetScopeVec targetScopes; |
163 | 165 |
164 // this holds the array being indexed or sliced so $ will work | 166 // this holds the array being indexed or sliced so $ will work |
165 // might be a better way but it works. problem is I only get a | 167 // might be a better way but it works. problem is I only get a |
166 // VarDeclaration for __dollar, but I can't see how to get the | 168 // VarDeclaration for __dollar, but I can't see how to get the |
167 // array pointer from this :( | 169 // array pointer from this :( |