Mercurial > projects > ldc
diff 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 |
line wrap: on
line diff
--- a/gen/dvalue.h Mon Nov 19 06:01:48 2007 +0100 +++ b/gen/dvalue.h Tue Nov 20 00:02:35 2007 +0100 @@ -31,7 +31,7 @@ struct DFuncValue; struct DSliceValue; struct DArrayLenValue; -struct DLValueCast; +struct DLRValue; struct DComplexValue; // base class for d-values @@ -51,8 +51,8 @@ virtual DSliceValue* isSlice() { return NULL; } virtual DFuncValue* isFunc() { return NULL; } virtual DArrayLenValue* isArrayLen() { return NULL; } - virtual DLValueCast* isLValueCast() { return NULL; } - virtual DComplexValue* isComplex() { return NULL; }; + virtual DComplexValue* isComplex() { return NULL; } + virtual DLRValue* isLRValue() { return NULL; } virtual bool inPlace() { return false; } @@ -172,24 +172,28 @@ virtual DFuncValue* isFunc() { return this; } }; -// l-value cast d-value -struct DLValueCast : DValue +// l-value and r-value pair d-value +struct DLRValue : DValue { - Type* type; + Type* ltype; llvm::Value* lval; + Type* rtype; llvm::Value* rval; - DLValueCast(Type* t, llvm::Value* l, llvm::Value* r) { - type = t; + DLRValue(Type* lt, llvm::Value* l, Type* rt, llvm::Value* r) { + ltype = lt; lval = l; + rtype = rt; rval = r; } virtual llvm::Value* getLVal() { assert(lval); return lval; } virtual llvm::Value* getRVal() { assert(rval); return rval; } - virtual Type* getType() { assert(type); return type; } - virtual DLValueCast* isLValueCast() { return this; } + Type* getLType() { return ltype; } + Type* getRType() { return rtype; } + virtual Type* getType() { return getRType(); } + virtual DLRValue* isLRValue() { return this; } }; // complex number immediate d-value (much like slice)