Mercurial > projects > ldc
view gen/dvalue.cpp @ 486:a34078905d01
Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Reimplemented support for nested functions/class using a new approach.
Added error on taking address of intrinsic.
Fixed problems with the ->syntaxCopy of TypeFunction delegate exp.
Removed DtoDType and replaced all uses with ->toBasetype() instead.
Removed unused inplace stuff.
Fixed a bunch of issues in the runtime unittests, not complete yet.
Added mini tests.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Sun, 10 Aug 2008 08:37:38 +0200 |
parents | 45a67b6f1310 |
children | fbb1a366cfbc |
line wrap: on
line source
#include "gen/llvm.h" #include "gen/tollvm.h" #include "gen/irstate.h" #include "gen/logger.h" #include "gen/dvalue.h" #include "declaration.h" ///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// DVarValue::DVarValue(Type* t, VarDeclaration* vd, LLValue* llvmValue, bool lvalue) { var = vd; val = llvmValue; rval = 0; lval = lvalue; type = t; } DVarValue::DVarValue(Type* t, LLValue* lv, LLValue* rv) { var = 0; val = lv; rval = rv; lval = true; type = t; } DVarValue::DVarValue(Type* t, LLValue* llvmValue, bool lvalue) { var = 0; val = llvmValue; rval = 0; lval = lvalue; type = t; } LLValue* DVarValue::getLVal() { assert(val && lval); return val; } LLValue* DVarValue::getRVal() { assert(rval || val); if (DtoIsPassedByRef(type)) { if (rval) return rval; return val; } else { if (rval) return rval; //Logger::cout() << "val: " << *val << '\n'; if (!isField() && DtoCanLoad(val)) { return DtoLoad(val); } return val; } } ///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// DFuncValue::DFuncValue(FuncDeclaration* fd, LLValue* v, LLValue* vt) { func = fd; type = func->type; val = v; vthis = vt; } LLValue* DFuncValue::getRVal() { assert(val); return val; } ///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// LLValue* DConstValue::getRVal() { assert(c); return c; } ///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////