diff gen/toir.cpp @ 459:9db9099583ca

Implement a rough AddrExp::toConstElem()
author Christian Kamm <kamm incasoftware de>
date Sat, 02 Aug 2008 22:54:36 +0200
parents 30ef3c7bddca
children 3a5d6ff8c70f
line wrap: on
line diff
--- 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<LLConstant>(vd->ir.getIrValue());
+    assert(llc);
+    return llc;
+}
+
 //////////////////////////////////////////////////////////////////////////////////////////
 
 DValue* PtrExp::toElem(IRState* p)