From 756a2cb2a1d3446956bdc566873fdc9795cbbd34 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 10 Jul 2009 21:30:02 +0200 Subject: [PATCH] Adjust LDC to work with the LLVMContext LLVM changes. This means we now require a fairly new LLVM revision. I use 75234. --- gen/arrays.cpp | 2 +- gen/complex.cpp | 4 ++-- gen/declarations.cpp | 2 +- gen/irstate.cpp | 10 +++++++++- gen/irstate.h | 2 ++ gen/passes/SimplifyDRuntimeCalls.cpp | 2 +- gen/rttibuilder.cpp | 4 ++-- gen/runtime.cpp | 2 +- gen/statements.cpp | 4 ++-- gen/tocall.cpp | 6 +++--- gen/todebug.cpp | 6 +++--- gen/toir.cpp | 6 +++--- gen/tollvm.cpp | 4 ++-- gen/toobj.cpp | 16 ++++++++-------- gen/typinf.cpp | 8 ++++---- ir/irclass.cpp | 15 ++++++++------- ir/irmodule.cpp | 2 +- ir/irstruct.cpp | 2 +- 18 files changed, 54 insertions(+), 43 deletions(-) diff --git a/gen/arrays.cpp b/gen/arrays.cpp index eab6cc05..3061242a 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -322,7 +322,7 @@ LLConstant* DtoConstArrayInitializer(ArrayInitializer* arrinit) // for dynamic array we need to make a global with the data, so we have a pointer for the dynamic array // Important: don't make the gvar constant, since this const initializer might // be used as an initializer for a static T[] - where modifying contents is allowed. - LLGlobalVariable* gvar = new LLGlobalVariable(constarr->getType(), false, LLGlobalValue::InternalLinkage, constarr, ".constarray", gIR->module); + LLGlobalVariable* gvar = new LLGlobalVariable(*gIR->module, constarr->getType(), false, LLGlobalValue::InternalLinkage, constarr, ".constarray"); LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; LLConstant* gep = llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2); diff --git a/gen/complex.cpp b/gen/complex.cpp index b25de6b6..a1daa4e6 100644 --- a/gen/complex.cpp +++ b/gen/complex.cpp @@ -396,8 +396,8 @@ LLValue* DtoComplexEquals(Loc& loc, TOK op, DValue* lhs, DValue* rhs) cmpop = llvm::FCmpInst::FCMP_UNE; // (l.re==r.re && l.im==r.im) or (l.re!=r.re || l.im!=r.im) - LLValue* b1 = new llvm::FCmpInst(cmpop, lhs_re, rhs_re, "tmp", gIR->scopebb()); - LLValue* b2 = new llvm::FCmpInst(cmpop, lhs_im, rhs_im, "tmp", gIR->scopebb()); + LLValue* b1 = gIR->ir->CreateFCmp(cmpop, lhs_re, rhs_re, "tmp"); + LLValue* b2 = gIR->ir->CreateFCmp(cmpop, lhs_im, rhs_im, "tmp"); if (op == TOKequal) return gIR->ir->CreateAnd(b1,b2,"tmp"); diff --git a/gen/declarations.cpp b/gen/declarations.cpp index 5227fbb8..942fde08 100644 --- a/gen/declarations.cpp +++ b/gen/declarations.cpp @@ -133,7 +133,7 @@ void VarDeclaration::codegen(Ir* p) llvm::GlobalValue::LinkageTypes _linkage = DtoLinkage(this); std::string _name(mangle()); - llvm::GlobalVariable* gvar = new llvm::GlobalVariable(_type,_isconst,_linkage,NULL,_name,gIR->module); + llvm::GlobalVariable* gvar = new llvm::GlobalVariable(*gIR->module,_type,_isconst,_linkage,NULL,_name); this->ir.irGlobal->value = gvar; // set the alignment diff --git a/gen/irstate.cpp b/gen/irstate.cpp index 0d1f0836..ac8f19ed 100644 --- a/gen/irstate.cpp +++ b/gen/irstate.cpp @@ -22,15 +22,23 @@ TargetABI* gABI = 0; ////////////////////////////////////////////////////////////////////////////////////////// IRScope::IRScope() + : builder(llvm::getGlobalContext()) { begin = end = NULL; } IRScope::IRScope(llvm::BasicBlock* b, llvm::BasicBlock* e) + : builder(b) { begin = b; end = e; - builder.SetInsertPoint(b); +} + +const IRScope& IRScope::operator=(const IRScope& rhs) +{ + begin = rhs.begin; + end = rhs.end; + builder.SetInsertPoint(begin); } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/gen/irstate.h b/gen/irstate.h index d56f3fc9..0d528bc3 100644 --- a/gen/irstate.h +++ b/gen/irstate.h @@ -48,6 +48,8 @@ struct IRScope IRScope(); IRScope(llvm::BasicBlock* b, llvm::BasicBlock* e); + + const IRScope& operator=(const IRScope& rhs); }; struct IRBuilderHelper diff --git a/gen/passes/SimplifyDRuntimeCalls.cpp b/gen/passes/SimplifyDRuntimeCalls.cpp index f2ad9fb5..86538ddf 100644 --- a/gen/passes/SimplifyDRuntimeCalls.cpp +++ b/gen/passes/SimplifyDRuntimeCalls.cpp @@ -355,7 +355,7 @@ bool SimplifyDRuntimeCalls::runOnFunction(Function &F) { } bool SimplifyDRuntimeCalls::runOnce(Function &F, const TargetData& TD, AliasAnalysis& AA) { - IRBuilder<> Builder; + IRBuilder<> Builder(llvm::getGlobalContext()); bool Changed = false; for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { diff --git a/gen/rttibuilder.cpp b/gen/rttibuilder.cpp index 7aa6fe3f..f3f7dfe5 100644 --- a/gen/rttibuilder.cpp +++ b/gen/rttibuilder.cpp @@ -79,7 +79,7 @@ void RTTIBuilder::push_void_array(llvm::Constant* CI, Type* valtype, Dsymbol* ma initname.append(".rtti.voidarr.data"); LLGlobalVariable* G = new llvm::GlobalVariable( - CI->getType(), true, TYPEINFO_LINKAGE_TYPE, CI, initname, gIR->module); + *gIR->module, CI->getType(), true, TYPEINFO_LINKAGE_TYPE, CI, initname); G->setAlignment(valtype->alignsize()); push_void_array(getTypePaddedSize(CI->getType()), G); @@ -98,7 +98,7 @@ void RTTIBuilder::push_array(llvm::Constant * CI, uint64_t dim, Type* valtype, D initname.append(".data"); LLGlobalVariable* G = new llvm::GlobalVariable( - CI->getType(), true, TYPEINFO_LINKAGE_TYPE, CI, initname, gIR->module); + *gIR->module, CI->getType(), true, TYPEINFO_LINKAGE_TYPE, CI, initname); G->setAlignment(valtype->alignsize()); push_array(dim, DtoBitCast(G, DtoType(valtype->pointerTo()))); diff --git a/gen/runtime.cpp b/gen/runtime.cpp index e5fe2079..6dd8994d 100644 --- a/gen/runtime.cpp +++ b/gen/runtime.cpp @@ -116,7 +116,7 @@ llvm::GlobalVariable* LLVM_D_GetRuntimeGlobal(llvm::Module* target, const char* } const llvm::PointerType* t = g->getType(); - return new llvm::GlobalVariable(t->getElementType(),g->isConstant(),g->getLinkage(),NULL,g->getName(),target); + return new llvm::GlobalVariable(*target, t->getElementType(),g->isConstant(),g->getLinkage(),NULL,g->getName()); } ////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/gen/statements.cpp b/gen/statements.cpp index abff984a..f314c8db 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -818,7 +818,7 @@ void SwitchStatement::toIR(IRState* p) const LLType* elemTy = DtoType(condition->type); const llvm::ArrayType* arrTy = llvm::ArrayType::get(elemTy, inits.size()); LLConstant* arrInit = llvm::ConstantArray::get(arrTy, inits); - llvm::GlobalVariable* arr = new llvm::GlobalVariable(arrTy, true, llvm::GlobalValue::InternalLinkage, arrInit, ".string_switch_table_data", gIR->module); + llvm::GlobalVariable* arr = new llvm::GlobalVariable(*gIR->module, arrTy, true, llvm::GlobalValue::InternalLinkage, arrInit, ".string_switch_table_data"); const LLType* elemPtrTy = getPtrToType(elemTy); LLConstant* arrPtr = llvm::ConstantExpr::getBitCast(arr, elemPtrTy); @@ -1380,7 +1380,7 @@ void WithStatement::toIR(IRState* p) static LLConstant* generate_unique_critical_section() { const LLType* Mty = DtoMutexType(); - return new llvm::GlobalVariable(Mty, false, llvm::GlobalValue::InternalLinkage, LLConstant::getNullValue(Mty), ".uniqueCS", gIR->module); + return new llvm::GlobalVariable(*gIR->module, Mty, false, llvm::GlobalValue::InternalLinkage, LLConstant::getNullValue(Mty), ".uniqueCS"); } void SynchronizedStatement::toIR(IRState* p) diff --git a/gen/tocall.cpp b/gen/tocall.cpp index 73e11a2e..9a74fa42 100644 --- a/gen/tocall.cpp +++ b/gen/tocall.cpp @@ -187,7 +187,7 @@ void DtoBuildDVarArgList(std::vector& args, std::vectorgetNumElements()); llvm::GlobalVariable* typeinfomem = - new llvm::GlobalVariable(typeinfoarraytype, true, llvm::GlobalValue::InternalLinkage, NULL, "._arguments.storage", gIR->module); + new llvm::GlobalVariable(*gIR->module, typeinfoarraytype, true, llvm::GlobalValue::InternalLinkage, NULL, "._arguments.storage"); if (Logger::enabled()) Logger::cout() << "_arguments storage: " << *typeinfomem << '\n'; @@ -208,8 +208,8 @@ void DtoBuildDVarArgList(std::vector& args, std::vectortype->arrayOf()); tiinits = llvm::ConstantStruct::get(pinits); - LLValue* typeinfoarrayparam = new llvm::GlobalVariable(tiarrty, - true, llvm::GlobalValue::InternalLinkage, tiinits, "._arguments.array", gIR->module); + LLValue* typeinfoarrayparam = new llvm::GlobalVariable(*gIR->module, tiarrty, + true, llvm::GlobalValue::InternalLinkage, tiinits, "._arguments.array"); llvm::AttributeWithIndex Attr; // specify arguments diff --git a/gen/todebug.cpp b/gen/todebug.cpp index 7eff09d8..325e46d4 100644 --- a/gen/todebug.cpp +++ b/gen/todebug.cpp @@ -38,7 +38,7 @@ static LLGlobalVariable* emitDwarfGlobalDecl(const LLStructType* type, const cha LLGlobalValue::LinkageTypes linkage = linkonce ? DEBUGINFO_LINKONCE_LINKAGE_TYPE : LLGlobalValue::InternalLinkage; - LLGlobalVariable* gv = new LLGlobalVariable(type, true, linkage, NULL, name, gIR->module); + LLGlobalVariable* gv = new LLGlobalVariable(*gIR->module, type, true, linkage, NULL, name); gv->setSection("llvm.metadata"); return gv; } @@ -256,7 +256,7 @@ static llvm::DICompositeType dwarfCompositeType(Type* type, llvm::DICompileUnit elems[1] = DBG_CAST(ptr); LLConstant* ca = LLConstantArray::get(at, elems); - members = new LLGlobalVariable(ca->getType(), true, LLGlobalValue::InternalLinkage, ca, ".array", gIR->module); + members = new LLGlobalVariable(*gIR->module, ca->getType(), true, LLGlobalValue::InternalLinkage, ca, ".array"); members->setSection("llvm.metadata"); name = DtoConstStringPtr(t->toChars(), "llvm.metadata"); @@ -330,7 +330,7 @@ static llvm::DICompositeType dwarfCompositeType(Type* type, llvm::DICompileUnit const LLArrayType* at = LLArrayType::get(DBG_TYPE, elems.size()); LLConstant* ca = LLConstantArray::get(at, elems); - members = new LLGlobalVariable(ca->getType(), true, LLGlobalValue::InternalLinkage, ca, ".array", gIR->module); + members = new LLGlobalVariable(*gIR->module, ca->getType(), true, LLGlobalValue::InternalLinkage, ca, ".array"); members->setSection("llvm.metadata"); } diff --git a/gen/toir.cpp b/gen/toir.cpp index 2b028eba..1c9ca70b 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -430,7 +430,7 @@ DValue* StringExp::toElem(IRState* p) llvm::GlobalValue::LinkageTypes _linkage = llvm::GlobalValue::InternalLinkage; if (Logger::enabled()) Logger::cout() << "type: " << *at << "\ninit: " << *_init << '\n'; - llvm::GlobalVariable* gvar = new llvm::GlobalVariable(at,true,_linkage,_init,".str",gIR->module); + llvm::GlobalVariable* gvar = new llvm::GlobalVariable(*gIR->module,at,true,_linkage,_init,".str"); llvm::ConstantInt* zero = llvm::ConstantInt::get(LLType::Int32Ty, 0, false); LLConstant* idxs[2] = { zero, zero }; @@ -506,7 +506,7 @@ LLConstant* StringExp::toConstElem(IRState* p) } llvm::GlobalValue::LinkageTypes _linkage = llvm::GlobalValue::InternalLinkage; - llvm::GlobalVariable* gvar = new llvm::GlobalVariable(_init->getType(),true,_linkage,_init,".str",gIR->module); + llvm::GlobalVariable* gvar = new llvm::GlobalVariable(*gIR->module,_init->getType(),true,_linkage,_init,".str"); llvm::ConstantInt* zero = llvm::ConstantInt::get(LLType::Int32Ty, 0, false); LLConstant* idxs[2] = { zero, zero }; @@ -2385,7 +2385,7 @@ LLConstant* ArrayLiteralExp::toConstElem(IRState* p) // for dynamic arrays we need to put the initializer in a global, and build a constant dynamic array reference with the .ptr field pointing into this global // Important: don't make the global constant, since this const initializer might // be used as an initializer for a static T[] - where modifying contents is allowed. - LLConstant* globalstore = new LLGlobalVariable(arrtype, false, LLGlobalValue::InternalLinkage, initval, ".dynarrayStorage", p->module); + LLConstant* globalstore = new LLGlobalVariable(*gIR->module, arrtype, false, LLGlobalValue::InternalLinkage, initval, ".dynarrayStorage"); LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; LLConstant* globalstorePtr = llvm::ConstantExpr::getGetElementPtr(globalstore, idxs, 2); diff --git a/gen/tollvm.cpp b/gen/tollvm.cpp index f71a7aa0..7c155477 100644 --- a/gen/tollvm.cpp +++ b/gen/tollvm.cpp @@ -585,7 +585,7 @@ LLConstant* DtoConstString(const char* str) std::string s(str?str:""); LLConstant* init = llvm::ConstantArray::get(s, true); llvm::GlobalVariable* gvar = new llvm::GlobalVariable( - init->getType(), true,llvm::GlobalValue::InternalLinkage, init, ".str", gIR->module); + *gIR->module, init->getType(), true,llvm::GlobalValue::InternalLinkage, init, ".str"); LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; return DtoConstSlice( DtoConstSize_t(s.length()), @@ -597,7 +597,7 @@ LLConstant* DtoConstStringPtr(const char* str, const char* section) std::string s(str); LLConstant* init = llvm::ConstantArray::get(s, true); llvm::GlobalVariable* gvar = new llvm::GlobalVariable( - init->getType(), true,llvm::GlobalValue::InternalLinkage, init, ".str", gIR->module); + *gIR->module, init->getType(), true,llvm::GlobalValue::InternalLinkage, init, ".str"); if (section) gvar->setSection(section); LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; return llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2); diff --git a/gen/toobj.cpp b/gen/toobj.cpp index a7f2286c..1e7b12fd 100644 --- a/gen/toobj.cpp +++ b/gen/toobj.cpp @@ -172,7 +172,7 @@ llvm::Module* Module::genLLVMModule(Ir* sir) { const LLArrayType* usedTy = LLArrayType::get(getVoidPtrType(), ir.usedArray.size()); LLConstant* usedInit = LLConstantArray::get(usedTy, ir.usedArray); - LLGlobalVariable* usedArray = new LLGlobalVariable(usedTy, true, LLGlobalValue::AppendingLinkage, usedInit, "llvm.used", ir.module); + LLGlobalVariable* usedArray = new LLGlobalVariable(*ir.module, usedTy, true, LLGlobalValue::AppendingLinkage, usedInit, "llvm.used"); usedArray->setSection("llvm.metadata"); } @@ -578,12 +578,12 @@ static LLFunction* build_module_reference_and_ctor(LLConstant* moduleinfo) std::string thismrefname = "_D"; thismrefname += gIR->dmodule->mangle(); thismrefname += "11__moduleRefZ"; - LLGlobalVariable* thismref = new LLGlobalVariable(modulerefTy, false, LLGlobalValue::InternalLinkage, thismrefinit, thismrefname, gIR->module); + LLGlobalVariable* thismref = new LLGlobalVariable(*gIR->module, modulerefTy, false, LLGlobalValue::InternalLinkage, thismrefinit, thismrefname); // make sure _Dmodule_ref is declared LLGlobalVariable* mref = gIR->module->getNamedGlobal("_Dmodule_ref"); if (!mref) - mref = new LLGlobalVariable(getPtrToType(modulerefTy), false, LLGlobalValue::ExternalLinkage, NULL, "_Dmodule_ref", gIR->module); + mref = new LLGlobalVariable(*gIR->module, getPtrToType(modulerefTy), false, LLGlobalValue::ExternalLinkage, NULL, "_Dmodule_ref"); // make the function insert this moduleinfo as the beginning of the _Dmodule_ref linked list llvm::BasicBlock* bb = llvm::BasicBlock::Create("moduleinfoCtorEntry", ctor); @@ -680,7 +680,7 @@ void Module::genmoduleinfo() m_name.append(m->mangle()); m_name.append("8__ModuleZ"); llvm::GlobalVariable* m_gvar = gIR->module->getGlobalVariable(m_name); - if (!m_gvar) m_gvar = new llvm::GlobalVariable(moduleinfoTy, false, llvm::GlobalValue::ExternalLinkage, NULL, m_name, gIR->module); + if (!m_gvar) m_gvar = new llvm::GlobalVariable(*gIR->module, moduleinfoTy, false, llvm::GlobalValue::ExternalLinkage, NULL, m_name); importInits.push_back(m_gvar); } // has import array? @@ -692,7 +692,7 @@ void Module::genmoduleinfo() m_name.append(mangle()); m_name.append("9__importsZ"); llvm::GlobalVariable* m_gvar = gIR->module->getGlobalVariable(m_name); - if (!m_gvar) m_gvar = new llvm::GlobalVariable(importArrTy, true, llvm::GlobalValue::InternalLinkage, c, m_name, gIR->module); + if (!m_gvar) m_gvar = new llvm::GlobalVariable(*gIR->module, importArrTy, true, llvm::GlobalValue::InternalLinkage, c, m_name); c = llvm::ConstantExpr::getBitCast(m_gvar, getPtrToType(importArrTy->getElementType())); c = DtoConstSlice(DtoConstSize_t(importInits.size()), c); } @@ -743,7 +743,7 @@ void Module::genmoduleinfo() m_name.append(mangle()); 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); + llvm::GlobalVariable* m_gvar = new llvm::GlobalVariable(*gIR->module, classArrTy, true, llvm::GlobalValue::InternalLinkage, c, m_name); c = DtoGEPi(m_gvar, 0, 0); c = DtoConstSlice(DtoConstSize_t(classInits.size()), c); } @@ -811,7 +811,7 @@ void Module::genmoduleinfo() // it makes no sense that the our own module info already exists! assert(!gIR->module->getGlobalVariable(MIname)); - llvm::GlobalVariable* gvar = new llvm::GlobalVariable(constMI->getType(), false, llvm::GlobalValue::ExternalLinkage, constMI, MIname, gIR->module); + llvm::GlobalVariable* gvar = new llvm::GlobalVariable(*gIR->module, constMI->getType(), false, llvm::GlobalValue::ExternalLinkage, constMI, MIname); // build the modulereference and ctor for registering it LLFunction* mictor = build_module_reference_and_ctor(gvar); @@ -834,5 +834,5 @@ void Module::genmoduleinfo() std::vector appendInits(1, magicinit); LLConstant* appendInit = llvm::ConstantArray::get(appendArrTy, appendInits); std::string appendName("llvm.global_ctors"); - llvm::GlobalVariable* appendVar = new llvm::GlobalVariable(appendArrTy, true, llvm::GlobalValue::AppendingLinkage, appendInit, appendName, gIR->module); + llvm::GlobalVariable* appendVar = new llvm::GlobalVariable(*gIR->module, appendArrTy, true, llvm::GlobalValue::AppendingLinkage, appendInit, appendName); } diff --git a/gen/typinf.cpp b/gen/typinf.cpp index d5b14854..80a7ef26 100644 --- a/gen/typinf.cpp +++ b/gen/typinf.cpp @@ -298,8 +298,8 @@ void DtoResolveTypeInfo(TypeInfoDeclaration* tid) irg->value = gIR->module->getGlobalVariable(mangle); if (!irg->value) - irg->value = new llvm::GlobalVariable(irg->type.get(), true, - TYPEINFO_LINKAGE_TYPE, NULL, mangle, gIR->module); + irg->value = new llvm::GlobalVariable(*gIR->module, irg->type.get(), true, + TYPEINFO_LINKAGE_TYPE, NULL, mangle); tid->ir.irGlobal = irg; @@ -318,8 +318,8 @@ void DtoResolveTypeInfo(TypeInfoDeclaration* tid) // Construct the metadata llvm::MDNode* metadata = llvm::MDNode::get(mdVals, TD_NumFields); // Insert it into the module - new llvm::GlobalVariable(metadata->getType(), true, - METADATA_LINKAGE_TYPE, metadata, metaname, gIR->module); + new llvm::GlobalVariable(*gIR->module, metadata->getType(), true, + METADATA_LINKAGE_TYPE, metadata, metaname); } #endif diff --git a/ir/irclass.cpp b/ir/irclass.cpp index 6ea0a062..ca174b2b 100644 --- a/ir/irclass.cpp +++ b/ir/irclass.cpp @@ -40,7 +40,7 @@ LLGlobalVariable * IrStruct::getVtblSymbol() const LLType* vtblTy = type->irtype->isClass()->getVtbl(); vtbl = new llvm::GlobalVariable( - vtblTy, true, _linkage, NULL, initname, gIR->module); + *gIR->module, vtblTy, true, _linkage, NULL, initname); return vtbl; } @@ -69,7 +69,7 @@ LLGlobalVariable * IrStruct::getClassInfoSymbol() // classinfos cannot be constants since they're used a locks for synchronized classInfo = new llvm::GlobalVariable( - tc->getPA().get(), false, _linkage, NULL, initname, gIR->module); + *gIR->module, tc->getPA().get(), false, _linkage, NULL, initname); #ifdef USE_METADATA // Generate some metadata on this ClassInfo if it's for a class. @@ -89,8 +89,8 @@ LLGlobalVariable * IrStruct::getClassInfoSymbol() // Construct the metadata llvm::MDNode* metadata = llvm::MDNode::get(mdVals, CD_NumFields); // Insert it into the module - new llvm::GlobalVariable(metadata->getType(), true, - METADATA_LINKAGE_TYPE, metadata, CD_PREFIX + initname, gIR->module); + new llvm::GlobalVariable(*gIR->module, metadata->getType(), true, + METADATA_LINKAGE_TYPE, metadata, CD_PREFIX + initname); } #endif @@ -122,7 +122,8 @@ LLGlobalVariable * IrStruct::getInterfaceArraySymbol() name.append("16__interfaceInfosZ"); llvm::GlobalValue::LinkageTypes _linkage = DtoExternalLinkage(aggrdecl); - classInterfacesArray = new llvm::GlobalVariable(array_type, true, _linkage, NULL, name, classInfo); + classInterfacesArray = new llvm::GlobalVariable(*gIR->module, + array_type, true, _linkage, NULL, name); return classInterfacesArray; } @@ -396,12 +397,12 @@ llvm::GlobalVariable * IrStruct::getInterfaceVtbl(BaseClass * b, bool new_instan mangle.append("6__vtblZ"); llvm::GlobalVariable* GV = new llvm::GlobalVariable( + *gIR->module, vtbl_constant->getType(), true, _linkage, vtbl_constant, - mangle, - gIR->module + mangle ); // insert into the vtbl map diff --git a/ir/irmodule.cpp b/ir/irmodule.cpp index 55fd0984..64bcd254 100644 --- a/ir/irmodule.cpp +++ b/ir/irmodule.cpp @@ -9,7 +9,7 @@ IrModule::IrModule(Module* module, const char* srcfilename) LLConstant* slice = DtoConstString(srcfilename); fileName = new llvm::GlobalVariable( - slice->getType(), true, LLGlobalValue::InternalLinkage, slice, ".modulefilename", gIR->module); + *gIR->module, slice->getType(), true, LLGlobalValue::InternalLinkage, slice, ".modulefilename"); } IrModule::~IrModule() diff --git a/ir/irstruct.cpp b/ir/irstruct.cpp index f0dfab86..1ad44aad 100644 --- a/ir/irstruct.cpp +++ b/ir/irstruct.cpp @@ -58,7 +58,7 @@ LLGlobalVariable * IrStruct::getInitSymbol() llvm::GlobalValue::LinkageTypes _linkage = DtoExternalLinkage(aggrdecl); init = new llvm::GlobalVariable( - init_pa.get(), true, _linkage, NULL, initname, gIR->module); + *gIR->module, init_pa.get(), true, _linkage, NULL, initname); // set alignment init->setAlignment(type->alignsize());