# HG changeset patch # User Benjamin Kramer # Date 1249516059 -7200 # Node ID 755abafbf25d29e165011aeca6979d30d679c8a5 # Parent a591aa6bd6dc9ffb32b1ae90662f35d9ece8a4bd Push the context through StructType::get. Requires LLVM >= 78258. Also remove old #if's. diff -r a591aa6bd6dc -r 755abafbf25d gen/abi-x86-64.cpp --- a/gen/abi-x86-64.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/abi-x86-64.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -36,6 +36,7 @@ #include "declaration.h" #include "aggregate.h" +#include "gen/irstate.h" #include "gen/llvm.h" #include "gen/tollvm.h" #include "gen/logger.h" @@ -281,7 +282,7 @@ default: assert(0 && "Unanticipated argument class for second half"); } - return LLStructType::get(parts); + return LLStructType::get(gIR->context(), parts); } } diff -r a591aa6bd6dc -r 755abafbf25d gen/arrays.cpp --- a/gen/arrays.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/arrays.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -26,12 +26,12 @@ const LLType* elemty = DtoType(arrayTy->nextOf()); if (elemty == LLType::VoidTy) elemty = LLType::Int8Ty; - return LLStructType::get(DtoSize_t(), getPtrToType(elemty), NULL); + return LLStructType::get(gIR->context(), DtoSize_t(), getPtrToType(elemty), NULL); } const LLStructType* DtoArrayType(const LLType* t) { - return LLStructType::get(DtoSize_t(), getPtrToType(t), NULL); + return LLStructType::get(gIR->context(), DtoSize_t(), getPtrToType(t), NULL); } ////////////////////////////////////////////////////////////////////////////////////////// @@ -309,7 +309,7 @@ LLConstant* constarr; if (mismatch) - constarr = LLConstantStruct::get(initvals); + constarr = LLConstantStruct::get(gIR->context(), initvals); else constarr = LLConstantArray::get(LLArrayType::get(llelemty, arrlen), initvals); @@ -394,7 +394,7 @@ LLConstant* DtoConstSlice(LLConstant* dim, LLConstant* ptr) { LLConstant* values[2] = { dim, ptr }; - return LLConstantStruct::get(values, 2); + return LLConstantStruct::get(gIR->context(), values, 2); } ////////////////////////////////////////////////////////////////////////////////////////// diff -r a591aa6bd6dc -r 755abafbf25d gen/complex.cpp --- a/gen/complex.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/complex.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -16,7 +16,7 @@ { Type* t = type->toBasetype(); const LLType* base = DtoComplexBaseType(t); - return llvm::StructType::get(base, base, NULL); + return llvm::StructType::get(gIR->context(), base, base, NULL); } const LLType* DtoComplexBaseType(Type* t) diff -r a591aa6bd6dc -r 755abafbf25d gen/dwarftypes.cpp --- a/gen/dwarftypes.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/dwarftypes.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -23,13 +23,13 @@ std::vectorStructTy_llvm_dbg_anchor_type_fields; StructTy_llvm_dbg_anchor_type_fields.push_back(IntegerType::get(32)); StructTy_llvm_dbg_anchor_type_fields.push_back(IntegerType::get(32)); - StructType* StructTy_llvm_dbg_anchor_type = StructType::get(StructTy_llvm_dbg_anchor_type_fields, /*isPacked=*/false); + StructType* StructTy_llvm_dbg_anchor_type = StructType::get(mod->getContext(), StructTy_llvm_dbg_anchor_type_fields, /*isPacked=*/false); mod->addTypeName("llvm.dbg.anchor.type", StructTy_llvm_dbg_anchor_type); std::vectorStructTy_llvm_dbg_basictype_type_fields; StructTy_llvm_dbg_basictype_type_fields.push_back(IntegerType::get(32)); std::vectorStructTy_1_fields; - StructType* StructTy_1 = StructType::get(StructTy_1_fields, /*isPacked=*/false); + StructType* StructTy_1 = StructType::get(mod->getContext(), StructTy_1_fields, /*isPacked=*/false); PointerType* PointerTy_0 = PointerType::get(StructTy_1,0); @@ -44,7 +44,7 @@ StructTy_llvm_dbg_basictype_type_fields.push_back(IntegerType::get(64)); StructTy_llvm_dbg_basictype_type_fields.push_back(IntegerType::get(32)); StructTy_llvm_dbg_basictype_type_fields.push_back(IntegerType::get(32)); - StructType* StructTy_llvm_dbg_basictype_type = StructType::get(StructTy_llvm_dbg_basictype_type_fields, /*isPacked=*/false); + StructType* StructTy_llvm_dbg_basictype_type = StructType::get(mod->getContext(), StructTy_llvm_dbg_basictype_type_fields, /*isPacked=*/false); mod->addTypeName("llvm.dbg.basictype.type", StructTy_llvm_dbg_basictype_type); std::vectorStructTy_llvm_dbg_compile_unit_type_fields; @@ -54,7 +54,7 @@ StructTy_llvm_dbg_compile_unit_type_fields.push_back(PointerTy_2); StructTy_llvm_dbg_compile_unit_type_fields.push_back(PointerTy_2); StructTy_llvm_dbg_compile_unit_type_fields.push_back(PointerTy_2); - StructType* StructTy_llvm_dbg_compile_unit_type = StructType::get(StructTy_llvm_dbg_compile_unit_type_fields, /*isPacked=*/false); + StructType* StructTy_llvm_dbg_compile_unit_type = StructType::get(mod->getContext(), StructTy_llvm_dbg_compile_unit_type_fields, /*isPacked=*/false); mod->addTypeName("llvm.dbg.compile_unit.type", StructTy_llvm_dbg_compile_unit_type); std::vectorStructTy_llvm_dbg_compositetype_type_fields; @@ -69,7 +69,7 @@ StructTy_llvm_dbg_compositetype_type_fields.push_back(IntegerType::get(32)); StructTy_llvm_dbg_compositetype_type_fields.push_back(PointerTy_0); StructTy_llvm_dbg_compositetype_type_fields.push_back(PointerTy_0); - StructType* StructTy_llvm_dbg_compositetype_type = StructType::get(StructTy_llvm_dbg_compositetype_type_fields, /*isPacked=*/false); + StructType* StructTy_llvm_dbg_compositetype_type = StructType::get(mod->getContext(), StructTy_llvm_dbg_compositetype_type_fields, /*isPacked=*/false); mod->addTypeName("llvm.dbg.compositetype.type", StructTy_llvm_dbg_compositetype_type); std::vectorStructTy_llvm_dbg_derivedtype_type_fields; @@ -83,7 +83,7 @@ StructTy_llvm_dbg_derivedtype_type_fields.push_back(IntegerType::get(64)); StructTy_llvm_dbg_derivedtype_type_fields.push_back(IntegerType::get(32)); StructTy_llvm_dbg_derivedtype_type_fields.push_back(PointerTy_0); - StructType* StructTy_llvm_dbg_derivedtype_type = StructType::get(StructTy_llvm_dbg_derivedtype_type_fields, /*isPacked=*/false); + StructType* StructTy_llvm_dbg_derivedtype_type = StructType::get(mod->getContext(), StructTy_llvm_dbg_derivedtype_type_fields, /*isPacked=*/false); mod->addTypeName("llvm.dbg.derivedtype.type", StructTy_llvm_dbg_derivedtype_type); std::vectorStructTy_llvm_dbg_global_variable_type_fields; @@ -99,7 +99,7 @@ StructTy_llvm_dbg_global_variable_type_fields.push_back(IntegerType::get(1)); StructTy_llvm_dbg_global_variable_type_fields.push_back(IntegerType::get(1)); StructTy_llvm_dbg_global_variable_type_fields.push_back(PointerTy_0); - StructType* StructTy_llvm_dbg_global_variable_type = StructType::get(StructTy_llvm_dbg_global_variable_type_fields, /*isPacked=*/false); + StructType* StructTy_llvm_dbg_global_variable_type = StructType::get(mod->getContext(), StructTy_llvm_dbg_global_variable_type_fields, /*isPacked=*/false); mod->addTypeName("llvm.dbg.global_variable.type", StructTy_llvm_dbg_global_variable_type); std::vectorStructTy_llvm_dbg_subprogram_type_fields; @@ -114,7 +114,7 @@ StructTy_llvm_dbg_subprogram_type_fields.push_back(PointerTy_0); StructTy_llvm_dbg_subprogram_type_fields.push_back(IntegerType::get(1)); StructTy_llvm_dbg_subprogram_type_fields.push_back(IntegerType::get(1)); - StructType* StructTy_llvm_dbg_subprogram_type = StructType::get(StructTy_llvm_dbg_subprogram_type_fields, /*isPacked=*/false); + StructType* StructTy_llvm_dbg_subprogram_type = StructType::get(mod->getContext(), StructTy_llvm_dbg_subprogram_type_fields, /*isPacked=*/false); mod->addTypeName("llvm.dbg.subprogram.type", StructTy_llvm_dbg_subprogram_type); std::vectorStructTy_llvm_dbg_variable_type_fields; @@ -124,7 +124,7 @@ StructTy_llvm_dbg_variable_type_fields.push_back(PointerTy_0); StructTy_llvm_dbg_variable_type_fields.push_back(IntegerType::get(32)); StructTy_llvm_dbg_variable_type_fields.push_back(PointerTy_0); - StructType* StructTy_llvm_dbg_variable_type = StructType::get(StructTy_llvm_dbg_variable_type_fields, /*isPacked=*/false); + StructType* StructTy_llvm_dbg_variable_type = StructType::get(mod->getContext(), StructTy_llvm_dbg_variable_type_fields, /*isPacked=*/false); mod->addTypeName("llvm.dbg.variable.type", StructTy_llvm_dbg_variable_type); std::vectorFuncTy_3_args; diff -r a591aa6bd6dc -r 755abafbf25d gen/main.cpp --- a/gen/main.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/main.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -483,11 +483,7 @@ FeaturesStr = Features.getString(); } -#if LLVM_REV < 77946 - std::auto_ptr target(theTarget->createTargetMachine(mod, FeaturesStr)); -#else std::auto_ptr target(theTarget->createTargetMachine(mod.getTargetTriple(), FeaturesStr)); -#endif assert(target.get() && "Could not allocate target machine!"); gTargetMachine = target.get(); gTargetData = gTargetMachine->getTargetData(); diff -r a591aa6bd6dc -r 755abafbf25d gen/nested.cpp --- a/gen/nested.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/nested.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -447,7 +447,7 @@ } } - const LLStructType* frameType = LLStructType::get(types); + const LLStructType* frameType = LLStructType::get(gIR->context(), types); gIR->module->addTypeName(std::string("nest.") + fd->toChars(), frameType); Logger::cout() << "frameType = " << *frameType << '\n'; diff -r a591aa6bd6dc -r 755abafbf25d gen/rttibuilder.cpp --- a/gen/rttibuilder.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/rttibuilder.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -142,7 +142,7 @@ void RTTIBuilder::finalize(IrGlobal* tid) { // create the inititalizer - LLConstant* tiInit = LLConstantStruct::get(&inits[0], inits.size(), false); + LLConstant* tiInit = LLConstantStruct::get(gIR->context(), &inits[0], inits.size(), false); // refine global type llvm::cast(tid->type.get())->refineAbstractTypeTo(tiInit->getType()); @@ -154,5 +154,5 @@ LLConstant* RTTIBuilder::get_constant() { // just return the inititalizer - return LLConstantStruct::get(&inits[0], inits.size(), false); + return LLConstantStruct::get(gIR->context(), &inits[0], inits.size(), false); } diff -r a591aa6bd6dc -r 755abafbf25d gen/runtime.cpp --- a/gen/runtime.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/runtime.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -124,7 +124,7 @@ static const LLType* rt_array(const LLType* elemty) { - return llvm::StructType::get(DtoSize_t(), rt_ptr(elemty), NULL); + return llvm::StructType::get(gIR->context(), DtoSize_t(), rt_ptr(elemty), NULL); } static const LLType* rt_dg1() @@ -133,7 +133,7 @@ types.push_back(rt_ptr(LLType::Int8Ty)); types.push_back(rt_ptr(LLType::Int8Ty)); const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::Int32Ty, types, false); - return llvm::StructType::get(rt_ptr(LLType::Int8Ty), rt_ptr(fty), NULL); + return llvm::StructType::get(gIR->context(), rt_ptr(LLType::Int8Ty), rt_ptr(fty), NULL); } static const LLType* rt_dg2() @@ -143,7 +143,7 @@ types.push_back(rt_ptr(LLType::Int8Ty)); types.push_back(rt_ptr(LLType::Int8Ty)); const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::Int32Ty, types, false); - return llvm::StructType::get(rt_ptr(LLType::Int8Ty), rt_ptr(fty), NULL); + return llvm::StructType::get(gIR->context(), rt_ptr(LLType::Int8Ty), rt_ptr(fty), NULL); } static void LLVM_D_BuildRuntimeModule() @@ -169,9 +169,9 @@ else realTy = LLType::DoubleTy; - const LLType* cfloatTy = llvm::StructType::get(floatTy, floatTy, NULL); - const LLType* cdoubleTy = llvm::StructType::get(doubleTy, doubleTy, NULL); - const LLType* crealTy = llvm::StructType::get(realTy, realTy, NULL); + const LLType* cfloatTy = llvm::StructType::get(gIR->context(), floatTy, floatTy, NULL); + const LLType* cdoubleTy = llvm::StructType::get(gIR->context(), doubleTy, doubleTy, NULL); + const LLType* crealTy = llvm::StructType::get(gIR->context(), realTy, realTy, NULL); Logger::println("building aggr types"); const LLType* voidPtrTy = rt_ptr(byteTy); diff -r a591aa6bd6dc -r 755abafbf25d gen/statements.cpp --- a/gen/statements.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/statements.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -825,7 +825,7 @@ std::vector types; types.push_back(DtoSize_t()); types.push_back(elemPtrTy); - const llvm::StructType* sTy = llvm::StructType::get(types); + const llvm::StructType* sTy = llvm::StructType::get(gIR->context(), types); std::vector sinits; sinits.push_back(DtoConstSize_t(inits.size())); sinits.push_back(arrPtr); diff -r a591aa6bd6dc -r 755abafbf25d gen/structs.cpp --- a/gen/structs.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/structs.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -362,7 +362,7 @@ } types.push_back(fty); } - LLType* Ty = LLStructType::get(types); + LLType* Ty = LLStructType::get(gIR->context(), types); cache.insert(std::make_pair(dty, Ty)); return Ty; } diff -r a591aa6bd6dc -r 755abafbf25d gen/tocall.cpp --- a/gen/tocall.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/tocall.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -160,11 +160,11 @@ gah.push_back(DtoSize_t()); gah_sz += PTRSIZE; } - vtypes.back() = LLStructType::get(gah, true); + vtypes.back() = LLStructType::get(gIR->context(), gah, true); } } } - const LLStructType* vtype = LLStructType::get(vtypes); + const LLStructType* vtype = LLStructType::get(gIR->context(), vtypes); if (Logger::enabled()) Logger::cout() << "d-variadic argument struct type:\n" << *vtype << '\n'; @@ -207,7 +207,7 @@ pinits.push_back(DtoConstSize_t(vtype->getNumElements())); pinits.push_back(llvm::ConstantExpr::getBitCast(typeinfomem, getPtrToType(typeinfotype))); const LLType* tiarrty = DtoType(Type::typeinfo->type->arrayOf()); - tiinits = LLConstantStruct::get(pinits); + tiinits = LLConstantStruct::get(gIR->context(), pinits); LLValue* typeinfoarrayparam = new llvm::GlobalVariable(*gIR->module, tiarrty, true, llvm::GlobalValue::InternalLinkage, tiinits, "._arguments.array"); diff -r a591aa6bd6dc -r 755abafbf25d gen/todebug.cpp --- a/gen/todebug.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/todebug.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -20,7 +20,7 @@ using namespace llvm::dwarf; #define DBG_NULL ( LLConstant::getNullValue(DBG_TYPE) ) -#define DBG_TYPE ( getPtrToType(llvm::StructType::get(NULL,NULL)) ) +#define DBG_TYPE ( getPtrToType(llvm::StructType::get(gIR->context(),NULL,NULL)) ) #define DBG_CAST(X) ( llvm::ConstantExpr::getBitCast(X, DBG_TYPE) ) #define DBG_TAG(X) ( llvm::ConstantExpr::getAdd( DtoConstUint( X ), DtoConstUint( llvm::LLVMDebugVersion ) ) ) diff -r a591aa6bd6dc -r 755abafbf25d gen/toir.cpp --- a/gen/toir.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/toir.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -2517,7 +2517,7 @@ constvals[i] = llvm::cast(values[i]); // return constant struct - return LLConstantStruct::get(constvals, sd->ir.irStruct->packed); + return LLConstantStruct::get(gIR->context(), constvals, sd->ir.irStruct->packed); } ////////////////////////////////////////////////////////////////////////////////////////// diff -r a591aa6bd6dc -r 755abafbf25d gen/tollvm.cpp --- a/gen/tollvm.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/tollvm.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -817,11 +817,11 @@ vtbltypes.push_back(DtoSize_t()); const LLType* byteptrptrty = getPtrToType(getPtrToType(LLType::Int8Ty)); vtbltypes.push_back(byteptrptrty); - types.push_back(LLStructType::get(vtbltypes)); + types.push_back(LLStructType::get(gIR->context(), vtbltypes)); // int offset types.push_back(LLType::Int32Ty); // create type - gIR->interfaceInfoType = LLStructType::get(types); + gIR->interfaceInfoType = LLStructType::get(gIR->context(), types); return gIR->interfaceInfoType; } @@ -838,20 +838,20 @@ { // CRITICAL_SECTION.sizeof == 68 std::vector types(17, LLType::Int32Ty); - return LLStructType::get(types); + return LLStructType::get(gIR->context(), types); } // FreeBSD else if (global.params.os == OSFreeBSD) { // Just a pointer - return LLStructType::get(DtoSize_t(), NULL); + return LLStructType::get(gIR->context(), DtoSize_t(), NULL); } // pthread_fastlock std::vector types2; types2.push_back(DtoSize_t()); types2.push_back(LLType::Int32Ty); - const LLStructType* fastlock = LLStructType::get(types2); + const LLStructType* fastlock = LLStructType::get(gIR->context(), types2); // pthread_mutex std::vector types1; @@ -860,7 +860,7 @@ types1.push_back(getVoidPtrType()); types1.push_back(LLType::Int32Ty); types1.push_back(fastlock); - const LLStructType* pmutex = LLStructType::get(types1); + const LLStructType* pmutex = LLStructType::get(gIR->context(), types1); // D_CRITICAL_SECTION LLOpaqueType* opaque = LLOpaqueType::get(); @@ -869,7 +869,7 @@ types.push_back(pmutex); // resolve type - pmutex = LLStructType::get(types); + pmutex = LLStructType::get(gIR->context(), types); LLPATypeHolder pa(pmutex); opaque->refineAbstractTypeTo(pa.get()); pmutex = isaStruct(pa.get()); @@ -895,7 +895,7 @@ types.push_back(DtoType(Module::moduleinfo->type)); // resolve type - const LLStructType* st = LLStructType::get(types); + const LLStructType* st = LLStructType::get(gIR->context(), types); LLPATypeHolder pa(st); opaque->refineAbstractTypeTo(pa.get()); st = isaStruct(pa.get()); @@ -917,7 +917,7 @@ LLValue* DtoAggrPair(LLValue* V1, LLValue* V2, const char* name) { - const LLType* t = LLStructType::get(V1->getType(), V2->getType(), NULL); + const LLType* t = LLStructType::get(gIR->context(), V1->getType(), V2->getType(), NULL); return DtoAggrPair(t, V1, V2, name); } diff -r a591aa6bd6dc -r 755abafbf25d gen/toobj.cpp --- a/gen/toobj.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/toobj.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -405,7 +405,7 @@ // the following code generates functions and needs to output // debug info. these macros are useful for that -#define DBG_TYPE ( getPtrToType(llvm::StructType::get(NULL,NULL)) ) +#define DBG_TYPE ( getPtrToType(llvm::StructType::get(gIR->context(),NULL,NULL)) ) #define DBG_CAST(X) ( llvm::ConstantExpr::getBitCast(X, DBG_TYPE) ) // build module ctor @@ -811,7 +811,7 @@ std::vector magictypes; magictypes.push_back(LLType::Int32Ty); magictypes.push_back(getPtrToType(magicfty)); - const LLStructType* magicsty = LLStructType::get(magictypes); + const LLStructType* magicsty = LLStructType::get(gIR->context(), magictypes); // make the constant element std::vector magicconstants; diff -r a591aa6bd6dc -r 755abafbf25d gen/typinf.cpp --- a/gen/typinf.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/gen/typinf.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -16,7 +16,6 @@ #include #include "gen/llvm.h" -#include "gen/llvm-version.h" #include "mars.h" #include "module.h" @@ -318,11 +317,7 @@ mdVals[TD_Confirm] = llvm::cast(irg->value); mdVals[TD_Type] = llvm::UndefValue::get(DtoType(tid->tinfo)); // Construct the metadata -#if LLVM_REV < 77733 - llvm::MetadataBase* metadata = gIR->context().getMDNode(mdVals, TD_NumFields); -#else llvm::MetadataBase* metadata = llvm::MDNode::get(gIR->context(), mdVals, TD_NumFields); -#endif // Insert it into the module llvm::NamedMDNode::Create(metaname, &metadata, 1, gIR->module); } diff -r a591aa6bd6dc -r 755abafbf25d ir/irclass.cpp --- a/ir/irclass.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/ir/irclass.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -5,7 +5,6 @@ #include "declaration.h" #include "mtype.h" -#include "gen/llvm-version.h" #include "gen/irstate.h" #include "gen/logger.h" #include "gen/tollvm.h" @@ -87,11 +86,7 @@ mdVals[CD_Finalize] = LLConstantInt::get(LLType::Int1Ty, hasDestructor); mdVals[CD_CustomDelete] = LLConstantInt::get(LLType::Int1Ty, hasCustomDelete); // Construct the metadata -#if LLVM_REV < 77733 - llvm::MetadataBase* metadata = gIR->context().getMDNode(mdVals, CD_NumFields); -#else llvm::MetadataBase* metadata = llvm::MDNode::get(gIR->context(), mdVals, CD_NumFields); -#endif // Insert it into the module std::string metaname = CD_PREFIX + initname; llvm::NamedMDNode::Create(metaname, &metadata, 1, gIR->module); @@ -177,7 +172,7 @@ } // build the constant struct - constVtbl = LLConstantStruct::get(constants, false); + constVtbl = LLConstantStruct::get(gIR->context(), constants, false); #if 0 IF_LOG Logger::cout() << "constVtbl type: " << *constVtbl->getType() << std::endl; @@ -321,7 +316,7 @@ addBaseClassInits(constants, cd, offset, field_index); // build the constant - llvm::Constant* definit = LLConstantStruct::get(constants, false); + llvm::Constant* definit = LLConstantStruct::get(gIR->context(), constants, false); return definit; } @@ -389,7 +384,7 @@ } // build the vtbl constant - llvm::Constant* vtbl_constant = LLConstantStruct::get(constants, false); + llvm::Constant* vtbl_constant = LLConstantStruct::get(gIR->context(), constants, false); // create the global variable to hold it llvm::GlobalValue::LinkageTypes _linkage = DtoExternalLinkage(aggrdecl); @@ -488,7 +483,7 @@ // create Interface struct LLConstant* inits[3] = { ci, vtb, off }; - LLConstant* entry = LLConstantStruct::get(inits, 3); + LLConstant* entry = LLConstantStruct::get(gIR->context(), inits, 3); constants.push_back(entry); } diff -r a591aa6bd6dc -r 755abafbf25d ir/irstruct.cpp --- a/ir/irstruct.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/ir/irstruct.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -195,7 +195,7 @@ } // build constant struct - llvm::Constant* definit = LLConstantStruct::get(constants, packed); + llvm::Constant* definit = LLConstantStruct::get(gIR->context(), constants, packed); #if 0 IF_LOG Logger::cout() << "final default initializer: " << *definit << std::endl; #endif @@ -384,7 +384,7 @@ // build constant assert(!constants.empty()); - llvm::Constant* c = LLConstantStruct::get(&constants[0], constants.size(), packed); + llvm::Constant* c = LLConstantStruct::get(gIR->context(), &constants[0], constants.size(), packed); IF_LOG Logger::cout() << "final struct initializer: " << *c << std::endl; return c; } diff -r a591aa6bd6dc -r 755abafbf25d ir/irtype.cpp --- a/ir/irtype.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/ir/irtype.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -92,17 +92,17 @@ case Tcomplex32: t2 = llvm::Type::FloatTy; - return llvm::StructType::get(t2, t2, NULL); + return llvm::StructType::get(gIR->context(), t2, t2, NULL); case Tcomplex64: t2 = llvm::Type::DoubleTy; - return llvm::StructType::get(t2, t2, NULL); + return llvm::StructType::get(gIR->context(), t2, t2, NULL); case Tcomplex80: t2 = (global.params.cpu == ARCHx86 || global.params.cpu == ARCHx86_64) ? llvm::Type::X86_FP80Ty : llvm::Type::DoubleTy; - return llvm::StructType::get(t2, t2, NULL); + return llvm::StructType::get(gIR->context(), t2, t2, NULL); case Tbool: return llvm::Type::Int1Ty; @@ -204,7 +204,7 @@ elemType = llvm::PointerType::get(elemType, 0); // create struct type - const llvm::Type* at = llvm::StructType::get(DtoSize_t(), elemType, NULL); + const llvm::Type* at = llvm::StructType::get(gIR->context(), DtoSize_t(), elemType, NULL); // name dynamic array types Type::sir->getState()->module->addTypeName(t->toChars(), at); diff -r a591aa6bd6dc -r 755abafbf25d ir/irtypeclass.cpp --- a/ir/irtypeclass.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/ir/irtypeclass.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -258,7 +258,7 @@ fatal(); // build the llvm type - const llvm::Type* st = llvm::StructType::get(defaultTypes, false); + const llvm::Type* st = llvm::StructType::get(gIR->context(), defaultTypes, false); // refine type llvm::cast(pa.get())->refineAbstractTypeTo(st); @@ -324,7 +324,7 @@ } // build the vtbl llvm type - return llvm::StructType::get(types, false); + return llvm::StructType::get(gIR->context(), types, false); } ////////////////////////////////////////////////////////////////////////////// diff -r a591aa6bd6dc -r 755abafbf25d ir/irtypefunction.cpp --- a/ir/irtypefunction.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/ir/irtypefunction.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -39,7 +39,7 @@ const LLType* i8ptr = getVoidPtrType(); const LLType* func = DtoFunctionType(dtype->nextOf(), NULL, Type::tvoid->pointerTo()); const LLType* funcptr = getPtrToType(func); - const LLStructType* dgtype = LLStructType::get(i8ptr, funcptr, NULL); + const LLStructType* dgtype = LLStructType::get(gIR->context(), i8ptr, funcptr, NULL); gIR->module->addTypeName(dtype->toChars(), dgtype); llvm::cast(pa.get())->refineAbstractTypeTo(dgtype); diff -r a591aa6bd6dc -r 755abafbf25d ir/irtypestruct.cpp --- a/ir/irtypestruct.cpp Thu Aug 06 17:04:36 2009 +0200 +++ b/ir/irtypestruct.cpp Thu Aug 06 01:47:39 2009 +0200 @@ -219,7 +219,7 @@ } // build the llvm type - const llvm::Type* st = llvm::StructType::get(defaultTypes, packed); + const llvm::Type* st = llvm::StructType::get(gIR->context(), defaultTypes, packed); // refine type llvm::cast(pa.get())->refineAbstractTypeTo(st);