comparison gen/irstate.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 f99a3b393c03
children 3d1b16dabd25
comparison
equal deleted inserted replaced
1144:cdda73cf2f8a 1145:40caa8207b3e
34 struct FuncDeclaration; 34 struct FuncDeclaration;
35 struct Module; 35 struct Module;
36 struct TypeStruct; 36 struct TypeStruct;
37 struct BaseClass; 37 struct BaseClass;
38 struct AnonDeclaration; 38 struct AnonDeclaration;
39 struct EnclosingHandler;
40 39
41 struct IrModule; 40 struct IrModule;
42 41
43 // represents a scope 42 // represents a scope
44 struct IRScope 43 struct IRScope
47 llvm::BasicBlock* end; 46 llvm::BasicBlock* end;
48 IRBuilder<> builder; 47 IRBuilder<> builder;
49 48
50 IRScope(); 49 IRScope();
51 IRScope(llvm::BasicBlock* b, llvm::BasicBlock* e); 50 IRScope(llvm::BasicBlock* b, llvm::BasicBlock* e);
52 };
53
54 // scope statements that can be target of jumps
55 // includes loops, switch, case, labels
56 struct IRTargetScope
57 {
58 // generating statement
59 Statement* s;
60
61 // the try of a TryFinally that encloses the loop
62 EnclosingHandler* enclosinghandler;
63
64 llvm::BasicBlock* breakTarget;
65 llvm::BasicBlock* continueTarget;
66
67 IRTargetScope();
68 IRTargetScope(Statement* s, EnclosingHandler* enclosinghandler, llvm::BasicBlock* continueTarget, llvm::BasicBlock* breakTarget);
69 }; 51 };
70 52
71 struct IRBuilderHelper 53 struct IRBuilderHelper
72 { 54 {
73 IRState* state; 55 IRState* state;
157 llvm::CallSite CreateCallOrInvoke(LLValue* Callee, LLValue* Arg1, const char* Name=""); 139 llvm::CallSite CreateCallOrInvoke(LLValue* Callee, LLValue* Arg1, const char* Name="");
158 llvm::CallSite CreateCallOrInvoke2(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, const char* Name=""); 140 llvm::CallSite CreateCallOrInvoke2(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, const char* Name="");
159 llvm::CallSite CreateCallOrInvoke3(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, const char* Name=""); 141 llvm::CallSite CreateCallOrInvoke3(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, const char* Name="");
160 llvm::CallSite CreateCallOrInvoke4(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, LLValue* Arg4, const char* Name=""); 142 llvm::CallSite CreateCallOrInvoke4(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, LLValue* Arg4, const char* Name="");
161 143
162 // loop blocks
163 typedef std::vector<IRTargetScope> TargetScopeVec;
164 TargetScopeVec targetScopes;
165
166 // this holds the array being indexed or sliced so $ will work 144 // this holds the array being indexed or sliced so $ will work
167 // might be a better way but it works. problem is I only get a 145 // might be a better way but it works. problem is I only get a
168 // VarDeclaration for __dollar, but I can't see how to get the 146 // VarDeclaration for __dollar, but I can't see how to get the
169 // array pointer from this :( 147 // array pointer from this :(
170 std::vector<DValue*> arrays; 148 std::vector<DValue*> arrays;