Mercurial > projects > ldc
comparison gen/dvalue.h @ 359:926f65e39246 trunk
[svn r380] Improve complex number support.
author | ChristianK |
---|---|
date | Mon, 14 Jul 2008 17:22:43 +0200 |
parents | 6057fdf797d8 |
children | 932229a851a4 |
comparison
equal
deleted
inserted
replaced
358:051f5b550d9c | 359:926f65e39246 |
---|---|
167 }; | 167 }; |
168 | 168 |
169 // l-value and r-value pair d-value | 169 // l-value and r-value pair d-value |
170 struct DLRValue : DValue | 170 struct DLRValue : DValue |
171 { | 171 { |
172 Type* ltype; | 172 DValue* lvalue; |
173 LLValue* lval; | 173 DValue* rvalue; |
174 Type* rtype; | 174 |
175 LLValue* rval; | 175 DLRValue(DValue* lval, DValue* rval) { |
176 | 176 lvalue = lval; |
177 DLRValue(Type* lt, LLValue* l, Type* rt, LLValue* r) { | 177 rvalue = rval; |
178 ltype = lt; | |
179 lval = l; | |
180 rtype = rt; | |
181 rval = r; | |
182 } | 178 } |
183 | 179 |
184 virtual bool isLVal() { return lval; } | 180 virtual bool isLVal() { return true; } |
185 virtual LLValue* getLVal() { assert(lval); return lval; } | 181 virtual LLValue* getLVal() { return lvalue->isLVal() ? lvalue->getLVal() : lvalue->getRVal(); } |
186 virtual LLValue* getRVal() { assert(rval); return rval; } | 182 virtual LLValue* getRVal() { return rvalue->getRVal(); } |
187 | 183 |
188 Type* getLType() { return ltype; } | 184 Type* getLType() { return lvalue->getType(); } |
189 Type* getRType() { return rtype; } | 185 Type* getRType() { return rvalue->getType(); } |
190 virtual Type* getType() { return getRType(); } | 186 virtual Type* getType() { return getRType(); } |
191 virtual DLRValue* isLRValue() { return this; } | 187 virtual DLRValue* isLRValue() { return this; } |
192 }; | 188 }; |
193 | 189 |
194 // complex number immediate d-value (much like slice) | 190 // complex number immediate d-value (much like slice) |