Mercurial > projects > ldc
comparison gen/dvalue.h @ 334:20446d22f832 trunk
[svn r355] Get rid of IRState::exps and topexp.
author | ChristianK |
---|---|
date | Sat, 12 Jul 2008 15:43:13 +0200 |
parents | 7816aafeea3c |
children | 17b844102023 |
comparison
equal
deleted
inserted
replaced
333:f7190d9eb70c | 334:20446d22f832 |
---|---|
40 virtual Type* getType() = 0; | 40 virtual Type* getType() = 0; |
41 | 41 |
42 virtual LLValue* getLVal() { assert(0); return 0; } | 42 virtual LLValue* getLVal() { assert(0); return 0; } |
43 virtual LLValue* getRVal() { assert(0); return 0; } | 43 virtual LLValue* getRVal() { assert(0); return 0; } |
44 | 44 |
45 virtual bool isLVal() { return false; } | |
46 | |
45 virtual DImValue* isIm() { return NULL; } | 47 virtual DImValue* isIm() { return NULL; } |
46 virtual DConstValue* isConst() { return NULL; } | 48 virtual DConstValue* isConst() { return NULL; } |
47 virtual DNullValue* isNull() { return NULL; } | 49 virtual DNullValue* isNull() { return NULL; } |
48 virtual DVarValue* isVar() { return NULL; } | 50 virtual DVarValue* isVar() { return NULL; } |
49 virtual DFieldValue* isField() { return NULL; } | 51 virtual DFieldValue* isField() { return NULL; } |
111 | 113 |
112 DVarValue(VarDeclaration* vd, LLValue* llvmValue, bool lvalue); | 114 DVarValue(VarDeclaration* vd, LLValue* llvmValue, bool lvalue); |
113 DVarValue(Type* vd, LLValue* lv, LLValue* rv); | 115 DVarValue(Type* vd, LLValue* lv, LLValue* rv); |
114 DVarValue(Type* t, LLValue* llvmValue, bool lvalue); | 116 DVarValue(Type* t, LLValue* llvmValue, bool lvalue); |
115 | 117 |
118 virtual bool isLVal() { return val && lval; } | |
116 virtual LLValue* getLVal(); | 119 virtual LLValue* getLVal(); |
117 virtual LLValue* getRVal(); | 120 virtual LLValue* getRVal(); |
118 | 121 |
119 virtual Type* getType() { assert(type); return type; } | 122 virtual Type* getType() { assert(type); return type; } |
120 virtual DVarValue* isVar() { return this; } | 123 virtual DVarValue* isVar() { return this; } |
130 // this d-value | 133 // this d-value |
131 struct DThisValue : DVarValue | 134 struct DThisValue : DVarValue |
132 { | 135 { |
133 DThisValue(VarDeclaration* vd, LLValue* llvmValue) : DVarValue(vd, llvmValue, true) {} | 136 DThisValue(VarDeclaration* vd, LLValue* llvmValue) : DVarValue(vd, llvmValue, true) {} |
134 virtual DThisValue* isThis() { return this; } | 137 virtual DThisValue* isThis() { return this; } |
135 }; | |
136 | |
137 // array length d-value | |
138 struct DArrayLenValue : DVarValue | |
139 { | |
140 DArrayLenValue(Type* t, LLValue* llvmValue) : DVarValue(t, llvmValue, true) {} | |
141 virtual DArrayLenValue* isArrayLen() { return this; } | |
142 }; | 138 }; |
143 | 139 |
144 // slice d-value | 140 // slice d-value |
145 struct DSliceValue : DValue | 141 struct DSliceValue : DValue |
146 { | 142 { |
163 LLValue* vthis; | 159 LLValue* vthis; |
164 unsigned cc; | 160 unsigned cc; |
165 | 161 |
166 DFuncValue(FuncDeclaration* fd, LLValue* v, LLValue* vt = 0); | 162 DFuncValue(FuncDeclaration* fd, LLValue* v, LLValue* vt = 0); |
167 | 163 |
168 virtual LLValue* getLVal(); | |
169 virtual LLValue* getRVal(); | 164 virtual LLValue* getRVal(); |
170 | 165 |
171 virtual Type* getType() { assert(type); return type; } | 166 virtual Type* getType() { assert(type); return type; } |
172 virtual DFuncValue* isFunc() { return this; } | 167 virtual DFuncValue* isFunc() { return this; } |
173 }; | 168 }; |
185 lval = l; | 180 lval = l; |
186 rtype = rt; | 181 rtype = rt; |
187 rval = r; | 182 rval = r; |
188 } | 183 } |
189 | 184 |
185 virtual bool isLVal() { return lval; } | |
190 virtual LLValue* getLVal() { assert(lval); return lval; } | 186 virtual LLValue* getLVal() { assert(lval); return lval; } |
191 virtual LLValue* getRVal() { assert(rval); return rval; } | 187 virtual LLValue* getRVal() { assert(rval); return rval; } |
192 | 188 |
193 Type* getLType() { return ltype; } | 189 Type* getLType() { return ltype; } |
194 Type* getRType() { return rtype; } | 190 Type* getRType() { return rtype; } |
195 virtual Type* getType() { return getRType(); } | 191 virtual Type* getType() { return getRType(); } |
196 virtual DLRValue* isLRValue() { return this; } | 192 virtual DLRValue* isLRValue() { return this; } |
193 }; | |
194 | |
195 // array length d-value | |
196 struct DArrayLenValue : DLRValue | |
197 { | |
198 DArrayLenValue(Type* lt, LLValue* l, Type* rt, LLValue* r) : DLRValue(lt, l, rt, r) {} | |
199 virtual DArrayLenValue* isArrayLen() { return this; } | |
197 }; | 200 }; |
198 | 201 |
199 // complex number immediate d-value (much like slice) | 202 // complex number immediate d-value (much like slice) |
200 struct DComplexValue : DValue | 203 struct DComplexValue : DValue |
201 { | 204 { |