Mercurial > projects > ldc
view gen/dvalue.cpp @ 704:43165a082535
Fixed issue with accessing a WithStatement context from inside a nested function. see mini/with2.d
Renamed some LLVM uses of ::create statics to ::Create , lower case ones will be deprecated soon.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 14 Oct 2008 13:21:14 +0200 |
parents | 03a5e609eef3 |
children | 30b42a283c8e |
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 "gen/llvmhelpers.h" #include "declaration.h" ///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// DVarValue::DVarValue(Type* t, VarDeclaration* vd, LLValue* llvmValue) { var = vd; val = llvmValue; type = t; } DVarValue::DVarValue(Type* t, LLValue* llvmValue) { var = 0; val = llvmValue; type = t; } LLValue* DVarValue::getLVal() { assert(val); return val; } LLValue* DVarValue::getRVal() { assert(val); Type* bt = type->toBasetype(); if (DtoIsPassedByRef(bt)) return val; return DtoLoad(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; } ///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// Type*& DLRValue::getLType() { if (DLRValue* lr = lvalue->isLRValue()) { return lr->getLType(); } else { return lvalue->getType(); } }