# HG changeset patch # User Christian Kamm # Date 1217710476 -7200 # Node ID 9db9099583cafd0be107829b55b9875f351548d6 # Parent b975f29b7256487229f849ec67d51ab78df29f6d Implement a rough AddrExp::toConstElem() diff -r b975f29b7256 -r 9db9099583ca dmd/expression.h --- a/dmd/expression.h Sat Aug 02 21:20:31 2008 +0200 +++ b/dmd/expression.h Sat Aug 02 22:54:36 2008 +0200 @@ -865,6 +865,8 @@ MATCH implicitConvTo(Type *t); Expression *castTo(Scope *sc, Type *t); Expression *optimize(int result); + // LLVMDC + virtual llvm::Constant *toConstElem(IRState *irs); }; struct PtrExp : UnaExp diff -r b975f29b7256 -r 9db9099583ca gen/toir.cpp --- a/gen/toir.cpp Sat Aug 02 21:20:31 2008 +0200 +++ b/gen/toir.cpp Sat Aug 02 22:54:36 2008 +0200 @@ -847,6 +847,17 @@ return new DFieldValue(type, v->getLVal(), false); } +LLConstant* AddrExp::toConstElem(IRState* p) +{ + assert(e1->op == TOKvar); + VarExp* vexp = (VarExp*)e1; + VarDeclaration* vd = vexp->var->isVarDeclaration(); + assert(vd); + LLConstant* llc = llvm::dyn_cast(vd->ir.getIrValue()); + assert(llc); + return llc; +} + ////////////////////////////////////////////////////////////////////////////////////////// DValue* PtrExp::toElem(IRState* p)