Mercurial > projects > ldc
comparison gen/irstate.h @ 73:b706170e24a9 trunk
[svn r77] Fixed foreach on slice.
Fixed some nested function problems when accessing outer function parameters.
Major changes to handling of structs.
Initial support for unions.
Probably more...
author | lindquist |
---|---|
date | Wed, 31 Oct 2007 03:11:32 +0100 |
parents | 28e99b04a132 |
children | 3587401b6eeb |
comparison
equal
deleted
inserted
replaced
72:d7e764e62462 | 73:b706170e24a9 |
---|---|
2 #define LLVMDC_GEN_IRSTATE_H | 2 #define LLVMDC_GEN_IRSTATE_H |
3 | 3 |
4 #include <stack> | 4 #include <stack> |
5 #include <vector> | 5 #include <vector> |
6 #include <deque> | 6 #include <deque> |
7 #include <map> | |
7 | 8 |
8 #include "root.h" | 9 #include "root.h" |
9 | 10 |
10 // global ir state for current module | 11 // global ir state for current module |
11 struct IRState; | 12 struct IRState; |
12 extern IRState* gIR; | 13 extern IRState* gIR; |
13 extern llvm::TargetData* gTargetData; | 14 extern const llvm::TargetData* gTargetData; |
14 | 15 |
15 struct TypeFunction; | 16 struct TypeFunction; |
16 struct TypeStruct; | 17 struct TypeStruct; |
17 struct ClassDeclaration; | 18 struct ClassDeclaration; |
18 struct FuncDeclaration; | 19 struct FuncDeclaration; |
38 }; | 39 }; |
39 | 40 |
40 // represents a struct or class | 41 // represents a struct or class |
41 struct IRStruct | 42 struct IRStruct |
42 { | 43 { |
43 typedef std::vector<const llvm::Type*> TypeVector; | 44 struct Offset |
44 typedef std::vector<llvm::Constant*> ConstantVector; | 45 { |
45 typedef std::vector<FuncDeclaration*> FuncDeclVec; | 46 VarDeclaration* var; |
47 llvm::Constant* init; | |
48 | |
49 Offset(VarDeclaration* v, llvm::Constant* i) | |
50 : var(v), init(i) {} | |
51 }; | |
52 | |
53 typedef std::vector<FuncDeclaration*> FuncDeclVector; | |
54 typedef std::multimap<unsigned, Offset> OffsetMap; | |
46 | 55 |
47 public: | 56 public: |
48 IRStruct(); | 57 IRStruct(); |
49 IRStruct(Type*); | 58 IRStruct(Type*); |
50 | 59 |
51 Type* type; | 60 Type* type; |
52 TypeVector fields; | |
53 ConstantVector inits; | |
54 llvm::PATypeHolder recty; | 61 llvm::PATypeHolder recty; |
55 FuncDeclVec funcs; | 62 FuncDeclVector funcs; |
56 bool queueFuncs; | 63 bool queueFuncs; |
64 | |
65 OffsetMap offsets; | |
57 }; | 66 }; |
58 | 67 |
59 // represents a finally block | 68 // represents a finally block |
60 struct IRFinally | 69 struct IRFinally |
61 { | 70 { |