Mercurial > projects > ldc
diff gen/toir.cpp @ 599:4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Mon, 15 Sep 2008 02:04:26 +0200 |
parents | e096a1502428 |
children | 311f16f26297 |
line wrap: on
line diff
--- a/gen/toir.cpp Sun Sep 14 22:49:19 2008 +0200 +++ b/gen/toir.cpp Mon Sep 15 02:04:26 2008 +0200 @@ -2380,6 +2380,17 @@ ////////////////////////////////////////////////////////////////////////////////////////// +DValue* GEPExp::toElem(IRState* p) +{ + // this should be good enough for now! + DValue* val = e1->toElem(p); + assert(val->isLVal()); + LLValue* v = DtoGEPi(val->getLVal(), 0, index); + return new DVarValue(type, DtoBitCast(v, getPtrToType(DtoType(type)))); +} + +////////////////////////////////////////////////////////////////////////////////////////// + #define STUB(x) DValue *x::toElem(IRState * p) {error("Exp type "#x" not implemented: %s", toChars()); fatal(); return 0; } STUB(Expression); STUB(DotTypeExp);