Push the context through StructType::get.

Requires LLVM >= 78258. Also remove old #if's.
This commit is contained in:
Benjamin Kramer 2009-08-06 01:47:39 +02:00
parent de0d74dc68
commit 977fa551ee
22 changed files with 57 additions and 70 deletions

View file

@ -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 @@ namespace {
default:
assert(0 && "Unanticipated argument class for second half");
}
return LLStructType::get(parts);
return LLStructType::get(gIR->context(), parts);
}
}

View file

@ -26,12 +26,12 @@ const LLStructType* DtoArrayType(Type* arrayTy)
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* DtoConstArrayInitializer(ArrayInitializer* arrinit)
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 @@ void DtoStaticArrayCopy(LLValue* dst, LLValue* src)
LLConstant* DtoConstSlice(LLConstant* dim, LLConstant* ptr)
{
LLConstant* values[2] = { dim, ptr };
return LLConstantStruct::get(values, 2);
return LLConstantStruct::get(gIR->context(), values, 2);
}
//////////////////////////////////////////////////////////////////////////////////////////

View file

@ -16,7 +16,7 @@ const llvm::StructType* DtoComplexType(Type* type)
{
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)

View file

@ -23,13 +23,13 @@ void RegisterDwarfSymbols(llvm::Module* mod) {
std::vector<const Type*>StructTy_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::vector<const Type*>StructTy_llvm_dbg_basictype_type_fields;
StructTy_llvm_dbg_basictype_type_fields.push_back(IntegerType::get(32));
std::vector<const Type*>StructTy_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 @@ void RegisterDwarfSymbols(llvm::Module* mod) {
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::vector<const Type*>StructTy_llvm_dbg_compile_unit_type_fields;
@ -54,7 +54,7 @@ void RegisterDwarfSymbols(llvm::Module* mod) {
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::vector<const Type*>StructTy_llvm_dbg_compositetype_type_fields;
@ -69,7 +69,7 @@ void RegisterDwarfSymbols(llvm::Module* mod) {
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::vector<const Type*>StructTy_llvm_dbg_derivedtype_type_fields;
@ -83,7 +83,7 @@ void RegisterDwarfSymbols(llvm::Module* mod) {
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::vector<const Type*>StructTy_llvm_dbg_global_variable_type_fields;
@ -99,7 +99,7 @@ void RegisterDwarfSymbols(llvm::Module* mod) {
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::vector<const Type*>StructTy_llvm_dbg_subprogram_type_fields;
@ -114,7 +114,7 @@ void RegisterDwarfSymbols(llvm::Module* mod) {
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::vector<const Type*>StructTy_llvm_dbg_variable_type_fields;
@ -124,7 +124,7 @@ void RegisterDwarfSymbols(llvm::Module* mod) {
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::vector<const Type*>FuncTy_3_args;

View file

@ -483,11 +483,7 @@ LDC_TARGETS
FeaturesStr = Features.getString();
}
#if LLVM_REV < 77946
std::auto_ptr<llvm::TargetMachine> target(theTarget->createTargetMachine(mod, FeaturesStr));
#else
std::auto_ptr<llvm::TargetMachine> target(theTarget->createTargetMachine(mod.getTargetTriple(), FeaturesStr));
#endif
assert(target.get() && "Could not allocate target machine!");
gTargetMachine = target.get();
gTargetData = gTargetMachine->getTargetData();

View file

@ -447,7 +447,7 @@ void DtoCreateNestedContext(FuncDeclaration* fd) {
}
}
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';

View file

@ -142,7 +142,7 @@ void RTTIBuilder::push_funcptr(FuncDeclaration* fd, Type* castto)
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<llvm::OpaqueType>(tid->type.get())->refineAbstractTypeTo(tiInit->getType());
@ -154,5 +154,5 @@ void RTTIBuilder::finalize(IrGlobal* tid)
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);
}

View file

@ -124,7 +124,7 @@ static const LLType* rt_ptr(const LLType* t)
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 @@ static const LLType* rt_dg1()
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 @@ static const LLType* rt_dg2()
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 @@ static void LLVM_D_BuildRuntimeModule()
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);

View file

@ -825,7 +825,7 @@ void SwitchStatement::toIR(IRState* p)
std::vector<const LLType*> 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<LLConstant*> sinits;
sinits.push_back(DtoConstSize_t(inits.size()));
sinits.push_back(arrPtr);

View file

@ -362,7 +362,7 @@ LLType* DtoUnpaddedStructType(Type* dty) {
}
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;
}

View file

@ -160,11 +160,11 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args, std::vector<llvm::Attribut
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 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args, std::vector<llvm::Attribut
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");

View file

@ -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 ) ) )

View file

@ -2517,7 +2517,7 @@ LLConstant* StructLiteralExp::toConstElem(IRState* p)
constvals[i] = llvm::cast<LLConstant>(values[i]);
// return constant struct
return LLConstantStruct::get(constvals, sd->ir.irStruct->packed);
return LLConstantStruct::get(gIR->context(), constvals, sd->ir.irStruct->packed);
}
//////////////////////////////////////////////////////////////////////////////////////////

View file

@ -817,11 +817,11 @@ const LLStructType* DtoInterfaceInfoType()
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 @@ const LLStructType* DtoMutexType()
{
// CRITICAL_SECTION.sizeof == 68
std::vector<const LLType*> 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<const LLType*> 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<const LLType*> types1;
@ -860,7 +860,7 @@ const LLStructType* DtoMutexType()
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 @@ const LLStructType* DtoMutexType()
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 @@ const LLStructType* DtoModuleReferenceType()
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(const LLType* type, LLValue* V1, LLValue* V2, const char* n
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);
}

View file

@ -405,7 +405,7 @@ void assemble(const llvm::sys::Path& asmpath, const llvm::sys::Path& objpath)
// 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 @@ void Module::genmoduleinfo()
std::vector<const LLType*> 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<LLConstant*> magicconstants;

View file

@ -16,7 +16,6 @@
#include <cassert>
#include "gen/llvm.h"
#include "gen/llvm-version.h"
#include "mars.h"
#include "module.h"
@ -318,11 +317,7 @@ void DtoResolveTypeInfo(TypeInfoDeclaration* tid)
mdVals[TD_Confirm] = llvm::cast<MDNodeField>(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);
}

View file

@ -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 @@ LLGlobalVariable * IrStruct::getClassInfoSymbol()
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 @@ LLConstant * IrStruct::getVtblInit()
}
// 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 @@ LLConstant * IrStruct::createClassDefaultInitializer()
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 @@ llvm::GlobalVariable * IrStruct::getInterfaceVtbl(BaseClass * b, bool new_instan
}
// 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 @@ LLConstant * IrStruct::getClassInfoInterfaces()
// 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);
}

View file

@ -195,7 +195,7 @@ LLConstant * IrStruct::createStructDefaultInitializer()
}
// 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 @@ LLConstant * IrStruct::createStructInitializer(StructInitializer * si)
// 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;
}

View file

@ -92,17 +92,17 @@ const llvm::Type * IrTypeBasic::basic2llvm(Type* t)
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 @@ const llvm::Type * IrTypeArray::array2llvm(Type * t)
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);

View file

@ -258,7 +258,7 @@ const llvm::Type* IrTypeClass::buildType()
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<llvm::OpaqueType>(pa.get())->refineAbstractTypeTo(st);
@ -324,7 +324,7 @@ const llvm::Type* IrTypeClass::buildVtblType(Type* first, Array* vtbl_array)
}
// build the vtbl llvm type
return llvm::StructType::get(types, false);
return llvm::StructType::get(gIR->context(), types, false);
}
//////////////////////////////////////////////////////////////////////////////

View file

@ -39,7 +39,7 @@ const llvm::Type * IrTypeDelegate::buildType()
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<llvm::OpaqueType>(pa.get())->refineAbstractTypeTo(dgtype);

View file

@ -219,7 +219,7 @@ const llvm::Type* IrTypeStruct::buildType()
}
// 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<llvm::OpaqueType>(pa.get())->refineAbstractTypeTo(st);