changeset 460:3a5d6ff8c70f

Automated merge with http://hg.dsource.org/projects/llvmdc
author Christian Kamm <kamm incasoftware de>
date Sat, 02 Aug 2008 22:54:46 +0200
parents 121624c14053 (current diff) 9db9099583ca (diff)
children 2b28fd92bab8 e381e082d5cb
files gen/toir.cpp
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/expression.h	Sat Aug 02 22:35:24 2008 +0200
+++ b/dmd/expression.h	Sat Aug 02 22:54:46 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
--- a/gen/toir.cpp	Sat Aug 02 22:35:24 2008 +0200
+++ b/gen/toir.cpp	Sat Aug 02 22:54:46 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<LLConstant>(vd->ir.getIrValue());
+    assert(llc);
+    return llc;
+}
+
 //////////////////////////////////////////////////////////////////////////////////////////
 
 DValue* PtrExp::toElem(IRState* p)