Mercurial > projects > ldc
diff gen/dvalue.h @ 104:4d1e9eb001e0 trunk
[svn r108] Now basic suppport for complex types. =,+,-,*,/ are supported.
author | lindquist |
---|---|
date | Mon, 19 Nov 2007 02:58:58 +0100 |
parents | 058d3925950e |
children | 3efbcc81ba45 |
line wrap: on
line diff
--- a/gen/dvalue.h Sun Nov 18 08:25:07 2007 +0100 +++ b/gen/dvalue.h Mon Nov 19 02:58:58 2007 +0100 @@ -32,6 +32,7 @@ struct DSliceValue; struct DArrayLenValue; struct DLValueCast; +struct DComplexValue; // base class for d-values struct DValue : Object @@ -51,6 +52,7 @@ virtual DFuncValue* isFunc() { return NULL; } virtual DArrayLenValue* isArrayLen() { return NULL; } virtual DLValueCast* isLValueCast() { return NULL; } + virtual DComplexValue* isComplex() { return NULL; }; virtual bool inPlace() { return false; } @@ -190,4 +192,21 @@ virtual DLValueCast* isLValueCast() { return this; } }; +// complex number immediate d-value (much like slice) +struct DComplexValue : DValue +{ + Type* type; + llvm::Value* re; + llvm::Value* im; + + DComplexValue(Type* t, llvm::Value* r, llvm::Value* i) { + type = t; + re = r; + im = i; + } + + virtual Type* getType() { assert(type); return type; } + virtual DComplexValue* isComplex() { return this; } +}; + #endif // LLVMDC_GEN_DVALUE_H