comparison gen/dvalue.h @ 107:3efbcc81ba45 trunk

[svn r111] Fixed most problems with complex number support and added typeinfo for them. Added typeinfo ti_C. Did some changes to the way expressions that have both lvalue and rvalue LLVM values are handled.
author lindquist
date Tue, 20 Nov 2007 00:02:35 +0100
parents 4d1e9eb001e0
children 336ec4f4bbb3
comparison
equal deleted inserted replaced
106:5b5194b25f33 107:3efbcc81ba45
29 struct DFieldValue; 29 struct DFieldValue;
30 struct DThisValue; 30 struct DThisValue;
31 struct DFuncValue; 31 struct DFuncValue;
32 struct DSliceValue; 32 struct DSliceValue;
33 struct DArrayLenValue; 33 struct DArrayLenValue;
34 struct DLValueCast; 34 struct DLRValue;
35 struct DComplexValue; 35 struct DComplexValue;
36 36
37 // base class for d-values 37 // base class for d-values
38 struct DValue : Object 38 struct DValue : Object
39 { 39 {
49 virtual DFieldValue* isField() { return NULL; } 49 virtual DFieldValue* isField() { return NULL; }
50 virtual DThisValue* isThis() { return NULL; } 50 virtual DThisValue* isThis() { return NULL; }
51 virtual DSliceValue* isSlice() { return NULL; } 51 virtual DSliceValue* isSlice() { return NULL; }
52 virtual DFuncValue* isFunc() { return NULL; } 52 virtual DFuncValue* isFunc() { return NULL; }
53 virtual DArrayLenValue* isArrayLen() { return NULL; } 53 virtual DArrayLenValue* isArrayLen() { return NULL; }
54 virtual DLValueCast* isLValueCast() { return NULL; } 54 virtual DComplexValue* isComplex() { return NULL; }
55 virtual DComplexValue* isComplex() { return NULL; }; 55 virtual DLRValue* isLRValue() { return NULL; }
56 56
57 virtual bool inPlace() { return false; } 57 virtual bool inPlace() { return false; }
58 58
59 protected: 59 protected:
60 DValue() {} 60 DValue() {}
170 170
171 virtual Type* getType() { assert(type); return type; } 171 virtual Type* getType() { assert(type); return type; }
172 virtual DFuncValue* isFunc() { return this; } 172 virtual DFuncValue* isFunc() { return this; }
173 }; 173 };
174 174
175 // l-value cast d-value 175 // l-value and r-value pair d-value
176 struct DLValueCast : DValue 176 struct DLRValue : DValue
177 { 177 {
178 Type* type; 178 Type* ltype;
179 llvm::Value* lval; 179 llvm::Value* lval;
180 Type* rtype;
180 llvm::Value* rval; 181 llvm::Value* rval;
181 182
182 DLValueCast(Type* t, llvm::Value* l, llvm::Value* r) { 183 DLRValue(Type* lt, llvm::Value* l, Type* rt, llvm::Value* r) {
183 type = t; 184 ltype = lt;
184 lval = l; 185 lval = l;
186 rtype = rt;
185 rval = r; 187 rval = r;
186 } 188 }
187 189
188 virtual llvm::Value* getLVal() { assert(lval); return lval; } 190 virtual llvm::Value* getLVal() { assert(lval); return lval; }
189 virtual llvm::Value* getRVal() { assert(rval); return rval; } 191 virtual llvm::Value* getRVal() { assert(rval); return rval; }
190 192
191 virtual Type* getType() { assert(type); return type; } 193 Type* getLType() { return ltype; }
192 virtual DLValueCast* isLValueCast() { return this; } 194 Type* getRType() { return rtype; }
195 virtual Type* getType() { return getRType(); }
196 virtual DLRValue* isLRValue() { return this; }
193 }; 197 };
194 198
195 // complex number immediate d-value (much like slice) 199 // complex number immediate d-value (much like slice)
196 struct DComplexValue : DValue 200 struct DComplexValue : DValue
197 { 201 {