comparison ir/irstruct.h @ 136:0e28624814e8 trunk

[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
author lindquist
date Thu, 17 Jan 2008 03:15:12 +0100
parents
children ce7b81fb957f
comparison
equal deleted inserted replaced
135:176bd52b3cf5 136:0e28624814e8
1 #ifndef LLVMDC_IR_IRSTRUCT_H
2 #define LLVMDC_IR_IRSTRUCT_H
3
4 #include "ir/ir.h"
5
6 #include <vector>
7 #include <map>
8
9 struct IrInterface : IrBase
10 {
11 BaseClass* base;
12 ClassDeclaration* decl;
13
14 const llvm::StructType* vtblTy;
15 llvm::ConstantStruct* vtblInit;
16 llvm::GlobalVariable* vtbl;
17
18 const llvm::StructType* infoTy;
19 llvm::ConstantStruct* infoInit;
20 llvm::Constant* info;
21
22 IrInterface(BaseClass* b, const llvm::StructType* vt);
23 ~IrInterface();
24 };
25
26 //////////////////////////////////////////////////////////////////////////////
27 //////////////////////////////////////////////////////////////////////////////
28 //////////////////////////////////////////////////////////////////////////////
29
30 // represents a struct or class
31 struct IrStruct : IrBase
32 {
33 struct Offset
34 {
35 VarDeclaration* var;
36 const llvm::Type* type;
37 llvm::Constant* init;
38
39 Offset(VarDeclaration* v, const llvm::Type* ty)
40 : var(v), type(ty), init(NULL) {}
41 };
42
43 typedef std::multimap<unsigned, Offset> OffsetMap;
44 typedef std::vector<VarDeclaration*> VarDeclVector;
45 typedef std::map<ClassDeclaration*, IrInterface*> InterfaceMap;
46 typedef InterfaceMap::iterator InterfaceIter;
47
48 public:
49 IrStruct(Type*);
50 virtual ~IrStruct();
51
52 Type* type;
53 llvm::PATypeHolder recty;
54 OffsetMap offsets;
55 VarDeclVector defaultFields;
56
57 InterfaceMap interfaces;
58 const llvm::ArrayType* interfaceInfosTy;
59 llvm::GlobalVariable* interfaceInfos;
60
61 bool defined;
62 bool constinited;
63 };
64
65 #endif