mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-17 17:29:02 +02:00
Push the context through StructType::get.
Requires LLVM >= 78258. Also remove old #if's.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user