Mercurial > projects > ldc
annotate ir/irstruct.h @ 210:1d6cfdbc97f0 trunk
[svn r226] Fixed: deleting interface.
Removed: unused util function for calling class destructors.
author | lindquist |
---|---|
date | Wed, 14 May 2008 02:00:23 +0200 |
parents | ba47ac346ddd |
children | a95056b3c996 |
rev | line source |
---|---|
136
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
1 #ifndef LLVMDC_IR_IRSTRUCT_H |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
2 #define LLVMDC_IR_IRSTRUCT_H |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
3 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
4 #include "ir/ir.h" |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
5 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
6 #include <vector> |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
7 #include <map> |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
8 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
9 struct IrInterface : IrBase |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
10 { |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
11 BaseClass* base; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
12 ClassDeclaration* decl; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
13 |
193
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
14 #if OPAQUE_VTBLS |
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
15 const llvm::ArrayType* vtblTy; |
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
16 llvm::ConstantArray* vtblInit; |
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
17 #else |
136
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
18 const llvm::StructType* vtblTy; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
19 llvm::ConstantStruct* vtblInit; |
193
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
20 #endif |
136
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
21 llvm::GlobalVariable* vtbl; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
22 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
23 const llvm::StructType* infoTy; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
24 llvm::ConstantStruct* infoInit; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
25 llvm::Constant* info; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
26 |
137 | 27 int index; |
28 | |
193
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
29 #if OPAQUE_VTBLS |
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
30 IrInterface(BaseClass* b, const llvm::ArrayType* vt); |
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
31 #else |
136
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
32 IrInterface(BaseClass* b, const llvm::StructType* vt); |
193
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
33 #endif |
136
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
34 ~IrInterface(); |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
35 }; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
36 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
37 ////////////////////////////////////////////////////////////////////////////// |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
38 ////////////////////////////////////////////////////////////////////////////// |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
39 ////////////////////////////////////////////////////////////////////////////// |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
40 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
41 // represents a struct or class |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
42 struct IrStruct : IrBase |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
43 { |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
44 struct Offset |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
45 { |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
46 VarDeclaration* var; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
47 const llvm::Type* type; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
48 llvm::Constant* init; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
49 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
50 Offset(VarDeclaration* v, const llvm::Type* ty) |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
51 : var(v), type(ty), init(NULL) {} |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
52 }; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
53 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
54 typedef std::multimap<unsigned, Offset> OffsetMap; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
55 typedef std::vector<VarDeclaration*> VarDeclVector; |
142
a123dca8349b
[svn r146] fixed some potential problems with mismatch in order of interfaces in class data layout
lindquist
parents:
140
diff
changeset
|
56 typedef std::map<ClassDeclaration*, IrInterface*> InterfaceMap; |
a123dca8349b
[svn r146] fixed some potential problems with mismatch in order of interfaces in class data layout
lindquist
parents:
140
diff
changeset
|
57 typedef InterfaceMap::iterator InterfaceMapIter; |
a123dca8349b
[svn r146] fixed some potential problems with mismatch in order of interfaces in class data layout
lindquist
parents:
140
diff
changeset
|
58 typedef std::vector<IrInterface*> InterfaceVector; |
a123dca8349b
[svn r146] fixed some potential problems with mismatch in order of interfaces in class data layout
lindquist
parents:
140
diff
changeset
|
59 typedef InterfaceVector::iterator InterfaceVectorIter; |
136
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
60 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
61 public: |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
62 IrStruct(Type*); |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
63 virtual ~IrStruct(); |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
64 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
65 Type* type; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
66 llvm::PATypeHolder recty; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
67 OffsetMap offsets; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
68 VarDeclVector defaultFields; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
69 |
142
a123dca8349b
[svn r146] fixed some potential problems with mismatch in order of interfaces in class data layout
lindquist
parents:
140
diff
changeset
|
70 InterfaceMap interfaceMap; |
a123dca8349b
[svn r146] fixed some potential problems with mismatch in order of interfaces in class data layout
lindquist
parents:
140
diff
changeset
|
71 InterfaceVector interfaceVec; |
136
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
72 const llvm::ArrayType* interfaceInfosTy; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
73 llvm::GlobalVariable* interfaceInfos; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
74 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
75 bool defined; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
76 bool constinited; |
137 | 77 |
78 llvm::GlobalVariable* vtbl; | |
193
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
79 #if OPAQUE_VTBLS |
199 | 80 llvm::Constant* constVtbl; |
193
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
81 #else |
137 | 82 llvm::ConstantStruct* constVtbl; |
193
aca17e55b7a5
[svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents:
142
diff
changeset
|
83 #endif |
137 | 84 llvm::GlobalVariable* init; |
85 llvm::Constant* constInit; | |
86 llvm::GlobalVariable* classInfo; | |
87 llvm::Constant* constClassInfo; | |
88 bool hasUnions; | |
89 DUnion* dunion; | |
90 bool classDeclared; | |
91 bool classDefined; | |
136
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
92 }; |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
93 |
0e28624814e8
[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents:
diff
changeset
|
94 #endif |