annotate ir/irstruct.h @ 715:30b42a283c8e

Removed TypeOpaque from DMD. Changed runtime functions taking opaque[] to void[]. Implemented proper type painting, to avoid "resizing" array casts in runtime calls that previously took opaque[]. Implemented dynamic arrays as first class types, this implements proper ABI for these types on x86. Added dwarf region end after call to assert function, fixes some problems with llvm not allowing this to be missing. Reverted change to WithStatement from rev [704] it breaks MiniD, mini/with2.d needs to be fixed some other way... Fixed tango bug 1339 in runtime, problem with _adReverseChar on invalid UTF-8. Disabled .bc generation in the compiler runtime part, genobj.d triggers some llvm bug when using debug info. the .o seems to work fine.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 22 Oct 2008 14:55:33 +0200
parents eef8ac26c66c
children 041c1596d217
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
664
eef8ac26c66c Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents: 435
diff changeset
1 #ifndef LDC_IR_IRSTRUCT_H
eef8ac26c66c Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents: 435
diff changeset
2 #define LDC_IR_IRSTRUCT_H
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
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
307
7ade5e035beb [svn r328] Fixed an issue with interfaces where the vtable type of a interface implemented could be invalid. Fixes several tango modules like, FileStream, ServerSocket
lindquist
parents: 252
diff changeset
14 llvm::PATypeHolder* vtblTy;
7ade5e035beb [svn r328] Fixed an issue with interfaces where the vtable type of a interface implemented could be invalid. Fixes several tango modules like, FileStream, ServerSocket
lindquist
parents: 252
diff changeset
15 LLConstant* vtblInit;
252
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
16 LLGlobalVariable* vtbl;
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
17
252
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
18 const LLStructType* infoTy;
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
19 LLConstantStruct* infoInit;
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
20 LLConstant* info;
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
137
ce7b81fb957f [svn r141] fixed more problems with classinfo
lindquist
parents: 136
diff changeset
22 int index;
ce7b81fb957f [svn r141] fixed more problems with classinfo
lindquist
parents: 136
diff changeset
23
307
7ade5e035beb [svn r328] Fixed an issue with interfaces where the vtable type of a interface implemented could be invalid. Fixes several tango modules like, FileStream, ServerSocket
lindquist
parents: 252
diff changeset
24 IrInterface(BaseClass* b);
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
25 ~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
26 };
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
27
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
28 //////////////////////////////////////////////////////////////////////////////
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
29 //////////////////////////////////////////////////////////////////////////////
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
30 //////////////////////////////////////////////////////////////////////////////
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
31
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 // 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
33 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
34 {
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 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
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 VarDeclaration* var;
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 199
diff changeset
38 const LLType* type;
252
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
39 LLConstant* init;
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
40
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 199
diff changeset
41 Offset(VarDeclaration* v, const LLType* ty)
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
42 : 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
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
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 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
46 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
47 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
48 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
49 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
50 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
51
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 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
53 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
54 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
55
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
56 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
57 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
58 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
59 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
60
142
a123dca8349b [svn r146] fixed some potential problems with mismatch in order of interfaces in class data layout
lindquist
parents: 140
diff changeset
61 InterfaceMap interfaceMap;
a123dca8349b [svn r146] fixed some potential problems with mismatch in order of interfaces in class data layout
lindquist
parents: 140
diff changeset
62 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
63 const llvm::ArrayType* interfaceInfosTy;
252
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
64 LLGlobalVariable* interfaceInfos;
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
65
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 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
67 bool constinited;
137
ce7b81fb957f [svn r141] fixed more problems with classinfo
lindquist
parents: 136
diff changeset
68
252
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
69 LLGlobalVariable* vtbl;
193
aca17e55b7a5 [svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents: 142
diff changeset
70 #if OPAQUE_VTBLS
252
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
71 LLConstant* constVtbl;
193
aca17e55b7a5 [svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents: 142
diff changeset
72 #else
252
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
73 LLConstantStruct* constVtbl;
193
aca17e55b7a5 [svn r209] Fixed: exotic array to pointer casts were broken.
lindquist
parents: 142
diff changeset
74 #endif
252
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
75 LLGlobalVariable* init;
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
76 LLConstant* constInit;
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
77 LLGlobalVariable* classInfo;
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
78 LLConstant* constClassInfo;
137
ce7b81fb957f [svn r141] fixed more problems with classinfo
lindquist
parents: 136
diff changeset
79 bool hasUnions;
ce7b81fb957f [svn r141] fixed more problems with classinfo
lindquist
parents: 136
diff changeset
80 DUnion* dunion;
ce7b81fb957f [svn r141] fixed more problems with classinfo
lindquist
parents: 136
diff changeset
81 bool classDeclared;
ce7b81fb957f [svn r141] fixed more problems with classinfo
lindquist
parents: 136
diff changeset
82 bool classDefined;
252
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
83
435
74101be2a553 Added type param to DVarValue as DMD sometimes overrides the type of the VarDeclaration.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 307
diff changeset
84 bool packed; // true for: align(1) struct S { ... }
74101be2a553 Added type param to DVarValue as DMD sometimes overrides the type of the VarDeclaration.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 307
diff changeset
85
252
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 244
diff changeset
86 LLGlobalVariable* dwarfComposite;
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
87 };
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
88
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
89 #endif