diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 22dd807d1b..3426ef99e7 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -91,15 +91,6 @@ LLValue *DtoNew(const Loc &loc, Type *newtype) { return DtoBitCast(mem, DtoPtrToType(newtype), ".gc_mem"); } -LLValue *DtoNewStruct(const Loc &loc, TypeStruct *newtype) { - llvm::Function *fn = getRuntimeFunction( - loc, gIR->module, - newtype->isZeroInit(newtype->sym->loc) ? "_d_newitemT" : "_d_newitemiT"); - LLConstant *ti = DtoTypeInfoOf(loc, newtype); - LLValue *mem = gIR->CreateCallOrInvoke(fn, ti, ".gc_struct"); - return DtoBitCast(mem, DtoPtrToType(newtype), ".gc_struct"); -} - void DtoDeleteMemory(const Loc &loc, DValue *ptr) { llvm::Function *fn = getRuntimeFunction(loc, gIR->module, "_d_delmemory"); LLValue *lval = (ptr->isLVal() ? DtoLVal(ptr) : makeLValue(loc, ptr)); diff --git a/gen/llvmhelpers.h b/gen/llvmhelpers.h index 7dbacbefda..6720309942 100644 --- a/gen/llvmhelpers.h +++ b/gen/llvmhelpers.h @@ -30,7 +30,6 @@ llvm::LLVMContext& getGlobalContext(); // dynamic memory helpers LLValue *DtoNew(const Loc &loc, Type *newtype); -LLValue *DtoNewStruct(const Loc &loc, TypeStruct *newtype); void DtoDeleteMemory(const Loc &loc, DValue *ptr); void DtoDeleteStruct(const Loc &loc, DValue *ptr); void DtoDeleteClass(const Loc &loc, DValue *inst); diff --git a/gen/runtime.cpp b/gen/runtime.cpp index 706acac292..4fc39fdff2 100644 --- a/gen/runtime.cpp +++ b/gen/runtime.cpp @@ -89,8 +89,7 @@ static void checkForImplicitGCCall(const Loc &loc, const char *name) { "_d_newarrayU", "_d_newclass", "_d_allocclass", - "_d_newitemT", - "_d_newitemiT", + // TODO: _d_newitemT instantiations }; if (binary_search(&GCNAMES[0], @@ -618,11 +617,6 @@ static void buildRuntimeModule() { createFwdDecl(LINK::c, throwableTy, {"_d_newThrowable"}, {classInfoTy}, {STCconst}); - // void* _d_newitemT (TypeInfo ti) - // void* _d_newitemiT(TypeInfo ti) - createFwdDecl(LINK::c, voidPtrTy, {"_d_newitemT", "_d_newitemiT"}, - {typeInfoTy}, {0}); - // void _d_delarray_t(void[]* p, const TypeInfo_Struct ti) createFwdDecl(LINK::c, voidTy, {"_d_delarray_t"}, {voidArrayPtrTy, structTypeInfoTy}, {0, STCconst}); diff --git a/gen/toir.cpp b/gen/toir.cpp index 6ea93a6982..1fa7a7f5bd 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -1549,8 +1549,9 @@ public: TypeStruct *ts = static_cast(ntype); - // allocate - LLValue *mem = DtoNewStruct(e->loc, ts); + // allocate (via _d_newitemT template lowering) + assert(e->lowering); + LLValue *mem = DtoRVal(e->lowering); if (!e->member && e->arguments) { IF_LOG Logger::println("Constructing using literal");