comparison ir/irtypeclass.h @ 1230:e67c85d6e680

Completed interface implementation. Hopefully that's it for now..
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Thu, 16 Apr 2009 13:18:56 +0200
parents 79758fd2f48a
children 465a77c904d4
comparison
equal deleted inserted replaced
1229:fafe7c8d6734 1230:e67c85d6e680
15 15
16 /// 16 ///
17 const llvm::Type* buildType(); 17 const llvm::Type* buildType();
18 18
19 /// 19 ///
20 const llvm::Type* get();
21
22 /// Returns the vtable type for this class.
20 const llvm::Type* getVtbl() { return vtbl_pa.get(); } 23 const llvm::Type* getVtbl() { return vtbl_pa.get(); }
21
22 ///
23 const llvm::Type* get();
24 24
25 /// Get index to interface implementation. 25 /// Get index to interface implementation.
26 /// Returns the index of a specific interface implementation in this 26 /// Returns the index of a specific interface implementation in this
27 /// class or ~0 if not found. 27 /// class or ~0 if not found.
28 size_t getInterfaceIndex(ClassDeclaration* inter); 28 size_t getInterfaceIndex(ClassDeclaration* inter);
29 29
30 /// Returns the total number of pointers in the vtable. 30 /// Returns the total number of pointers in the vtable.
31 unsigned getVtblSize() { return vtbl_size; } 31 unsigned getVtblSize() { return vtbl_size; }
32 32
33 /// Returns the number of interface implementations (vtables) in this
34 /// class.
35 unsigned getNumInterfaceVtbls() { return num_interface_vtbls; }
36
33 protected: 37 protected:
34 /// 38 ///
35 ClassDeclaration* cd; 39 ClassDeclaration* cd;
36 /// 40 ///
37 TypeClass* tc; 41 TypeClass* tc;
38 42
39 /// 43 /// Type holder for the vtable type.
40 llvm::PATypeHolder vtbl_pa; 44 llvm::PATypeHolder vtbl_pa;
41 45
42 /// Number of pointers in vtable. 46 /// Number of pointers in vtable.
43 unsigned vtbl_size; 47 unsigned vtbl_size;
44 48
49 /// Number of interface implementations (vtables) in this class.
50 unsigned num_interface_vtbls;
51
45 /// std::map type mapping ClassDeclaration* to size_t. 52 /// std::map type mapping ClassDeclaration* to size_t.
46 typedef std::map<ClassDeclaration*, size_t> ClassIndexMap; 53 typedef std::map<ClassDeclaration*, size_t> ClassIndexMap;
47 54
48 /// Map for mapping the index of a specific interface implementation 55 /// Map for mapping the index of a specific interface implementation
49 /// in this class to it's ClassDeclaration*. 56 /// in this class to its ClassDeclaration.
50 ClassIndexMap interfaceMap; 57 ClassIndexMap interfaceMap;
51 58
52 ////////////////////////////////////////////////////////////////////////// 59 //////////////////////////////////////////////////////////////////////////
53 60
54 /// 61 /// Builds a vtable type given the type of the first entry and an array
62 /// of all entries.
55 const llvm::Type* buildVtblType(Type* first, Array* vtbl_array); 63 const llvm::Type* buildVtblType(Type* first, Array* vtbl_array);
56 64
57 /// 65 ///
58 void addBaseClassData( 66 void addBaseClassData(
59 std::vector<const llvm::Type*>& defaultTypes, 67 std::vector<const llvm::Type*>& defaultTypes,