changeset 1450:83bdf7bed9c5

Fix a type mismatch in ModuleInfo generation.
author Frits van Bommel <fvbommel wxs.nl>
date Mon, 01 Jun 2009 23:17:47 +0200
parents 301a916eceef
children 297d1e2f6441
files gen/tollvm.cpp gen/tollvm.h gen/toobj.cpp
diffstat 3 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gen/tollvm.cpp	Mon Jun 01 01:28:18 2009 +0200
+++ b/gen/tollvm.cpp	Mon Jun 01 23:17:47 2009 +0200
@@ -403,6 +403,14 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
+LLConstant* DtoGEPi(LLConstant* ptr, unsigned i0, unsigned i1)
+{
+    LLValue* v[2] = { DtoConstUint(i0), DtoConstUint(i1) };
+    return llvm::ConstantExpr::getGetElementPtr(ptr, v, 2);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
 void DtoMemSetZero(LLValue* dst, LLValue* nbytes)
 {
     dst = DtoBitCast(dst,getVoidPtrType());
--- a/gen/tollvm.h	Mon Jun 01 01:28:18 2009 +0200
+++ b/gen/tollvm.h	Mon Jun 01 23:17:47 2009 +0200
@@ -48,6 +48,7 @@
 
 LLValue* DtoGEPi1(LLValue* ptr, unsigned i0, const char* var=NULL, llvm::BasicBlock* bb=NULL);
 LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* var=NULL, llvm::BasicBlock* bb=NULL);
+LLConstant* DtoGEPi(LLConstant* ptr, unsigned i0, unsigned i1);
 
 // to constant helpers
 LLConstantInt* DtoConstSize_t(uint64_t);
--- a/gen/toobj.cpp	Mon Jun 01 01:28:18 2009 +0200
+++ b/gen/toobj.cpp	Mon Jun 01 23:17:47 2009 +0200
@@ -715,11 +715,11 @@
         m_name.append("9__classesZ");
         assert(gIR->module->getGlobalVariable(m_name) == NULL);
         llvm::GlobalVariable* m_gvar = new llvm::GlobalVariable(classArrTy, true, llvm::GlobalValue::InternalLinkage, c, m_name, gIR->module);
-        c = DtoBitCast(m_gvar, getPtrToType(classinfoTy));
+        c = DtoGEPi(m_gvar, 0, 0);
         c = DtoConstSlice(DtoConstSize_t(classInits.size()), c);
     }
     else
-        c = DtoConstSlice( DtoConstSize_t(0), getNullValue(getPtrToType(classinfoTy)) );
+        c = DtoConstSlice( DtoConstSize_t(0), getNullValue(getPtrToType(getPtrToType(classinfoTy))) );
     b.push(c);
 
     // flags (4 means MIstandalone)