comparison ir/irtype.h @ 1228:79758fd2f48a

Added Doxygen file. Completely seperated type and symbol generation. Should fix a lot of bugs, but is not yet 100% complete.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Wed, 15 Apr 2009 20:06:25 +0200
parents 3251ce06c820
children 46f6365a50d7
comparison
equal deleted inserted replaced
1215:08f87d8cd101 1228:79758fd2f48a
7 7
8 // forward declarations 8 // forward declarations
9 9
10 struct Type; 10 struct Type;
11 11
12 class IrTypeAggr;
12 class IrTypeArray; 13 class IrTypeArray;
13 class IrTypeBasic; 14 class IrTypeBasic;
15 class IrTypeClass;
14 class IrTypePointer; 16 class IrTypePointer;
15 class IrTypeSArray; 17 class IrTypeSArray;
18 class IrTypeStruct;
16 19
17 ////////////////////////////////////////////////////////////////////////////// 20 //////////////////////////////////////////////////////////////////////////////
18 21
19 /// Base class for IrTypeS. 22 /// Base class for IrTypeS.
20 class IrType 23 class IrType
22 public: 25 public:
23 /// 26 ///
24 IrType(Type* dt, const llvm::Type* lt); 27 IrType(Type* dt, const llvm::Type* lt);
25 28
26 /// 29 ///
27 Type* getD() { return dtype; } 30 virtual IrTypeAggr* isAggr() { return NULL; }
28
29 ///
30 const llvm::Type* get() { return pa.get(); }
31
32 /// 31 ///
33 virtual IrTypeArray* isArray() { return NULL; } 32 virtual IrTypeArray* isArray() { return NULL; }
34 /// 33 ///
35 virtual IrTypeBasic* isBasic() { return NULL; } 34 virtual IrTypeBasic* isBasic() { return NULL; }
36 /// 35 ///
36 virtual IrTypeClass* isClass() { return NULL; }
37 ///
37 virtual IrTypePointer* isPointer() { return NULL; } 38 virtual IrTypePointer* isPointer() { return NULL; }
38 /// 39 ///
39 virtual IrTypeSArray* isSArray() { return NULL; } 40 virtual IrTypeSArray* isSArray() { return NULL; }
41 ///
42 virtual IrTypeStruct* isStruct() { return NULL; }
43
44 ///
45 Type* getD() { return dtype; }
46 ///
47 virtual const llvm::Type* get() { return pa.get(); }
48 ///
49 llvm::PATypeHolder& getPA() { return pa; }
50
51 ///
52 virtual const llvm::Type* buildType() = 0;
40 53
41 protected: 54 protected:
42 /// 55 ///
43 Type* dtype; 56 Type* dtype;
44 57
56 IrTypeBasic(Type* dt); 69 IrTypeBasic(Type* dt);
57 70
58 /// 71 ///
59 IrTypeBasic* isBasic() { return this; } 72 IrTypeBasic* isBasic() { return this; }
60 73
74 ///
75 const llvm::Type* buildType();
76
61 protected: 77 protected:
62 /// 78 ///
63 const llvm::Type* basic2llvm(Type* t); 79 const llvm::Type* basic2llvm(Type* t);
64 }; 80 };
65 81
73 IrTypePointer(Type* dt); 89 IrTypePointer(Type* dt);
74 90
75 /// 91 ///
76 IrTypePointer* isPointer() { return this; } 92 IrTypePointer* isPointer() { return this; }
77 93
94 ///
95 const llvm::Type* buildType();
96
78 protected: 97 protected:
79 /// 98 ///
80 const llvm::Type* pointer2llvm(Type* t); 99 const llvm::Type* pointer2llvm(Type* t);
81 }; 100 };
82 101
89 /// 108 ///
90 IrTypeSArray(Type* dt); 109 IrTypeSArray(Type* dt);
91 110
92 /// 111 ///
93 IrTypeSArray* isSArray() { return this; } 112 IrTypeSArray* isSArray() { return this; }
113
114 ///
115 const llvm::Type* buildType();
94 116
95 protected: 117 protected:
96 /// 118 ///
97 const llvm::Type* sarray2llvm(Type* t); 119 const llvm::Type* sarray2llvm(Type* t);
98 120
110 IrTypeArray(Type* dt); 132 IrTypeArray(Type* dt);
111 133
112 /// 134 ///
113 IrTypeArray* isArray() { return this; } 135 IrTypeArray* isArray() { return this; }
114 136
137 ///
138 const llvm::Type* buildType();
139
115 protected: 140 protected:
116 /// 141 ///
117 const llvm::Type* array2llvm(Type* t); 142 const llvm::Type* array2llvm(Type* t);
118 }; 143 };
119 144