Adapt to removed _d_array[set]ctor druntime hooks (replaced by templated lowerings)

This commit is contained in:
Martin Kinkelin 2022-09-15 19:00:21 +02:00
parent 0a98ccd153
commit 6998886e89
2 changed files with 11 additions and 13 deletions

View file

@ -270,10 +270,10 @@ void DtoArrayAssign(const Loc &loc, DValue *lhs, DValue *rhs, EXP op,
knownInBounds); knownInBounds);
} }
} else if (isConstructing) { } else if (isConstructing) {
LLFunction *fn = getRuntimeFunction(loc, gIR->module, "_d_arrayctor"); error(
gIR->CreateCallOrInvoke(fn, DtoTypeInfoOf(loc, elemType), loc,
DtoSlice(rhsPtr, rhsLength, getI8Type()), "ICE: array construction should have been lowered to `_d_arrayctor`");
DtoSlice(lhsPtr, lhsLength, getI8Type())); fatal();
} else { // assigning } else { // assigning
LLValue *tmpSwap = DtoAlloca(elemType, "arrayAssign.tmpSwap"); LLValue *tmpSwap = DtoAlloca(elemType, "arrayAssign.tmpSwap");
LLFunction *fn = getRuntimeFunction( LLFunction *fn = getRuntimeFunction(
@ -306,10 +306,13 @@ void DtoArrayAssign(const Loc &loc, DValue *lhs, DValue *rhs, EXP op,
: gIR->ir->CreateExactUDiv(lhsSize, DtoConstSize_t(rhsSize)); : gIR->ir->CreateExactUDiv(lhsSize, DtoConstSize_t(rhsSize));
} }
DtoArrayInit(loc, actualPtr, actualLength, rhs); DtoArrayInit(loc, actualPtr, actualLength, rhs);
} else if (isConstructing) {
error(loc, "ICE: array construction should have been lowered to "
"`_d_arraysetctor`");
fatal();
} else { } else {
LLFunction *fn = getRuntimeFunction(loc, gIR->module, LLFunction *fn =
isConstructing ? "_d_arraysetctor" getRuntimeFunction(loc, gIR->module, "_d_arraysetassign");
: "_d_arraysetassign");
gIR->CreateCallOrInvoke( gIR->CreateCallOrInvoke(
fn, lhsPtr, DtoBitCast(makeLValue(loc, rhs), getVoidPtrType()), fn, lhsPtr, DtoBitCast(makeLValue(loc, rhs), getVoidPtrType()),
gIR->ir->CreateTruncOrBitCast(lhsLength, gIR->ir->CreateTruncOrBitCast(lhsLength,

View file

@ -696,13 +696,8 @@ static void buildRuntimeModule() {
createFwdDecl(LINK::c, voidArrayTy, {"_d_arrayassign_l", "_d_arrayassign_r"}, createFwdDecl(LINK::c, voidArrayTy, {"_d_arrayassign_l", "_d_arrayassign_r"},
{typeInfoTy, voidArrayTy, voidArrayTy, voidPtrTy}); {typeInfoTy, voidArrayTy, voidArrayTy, voidPtrTy});
// void[] _d_arrayctor(TypeInfo ti, void[] from, void[] to)
createFwdDecl(LINK::c, voidArrayTy, {"_d_arrayctor"},
{typeInfoTy, voidArrayTy, voidArrayTy});
// void* _d_arraysetassign(void* p, void* value, int count, TypeInfo ti) // void* _d_arraysetassign(void* p, void* value, int count, TypeInfo ti)
// void* _d_arraysetctor(void* p, void* value, int count, TypeInfo ti) createFwdDecl(LINK::c, voidPtrTy, {"_d_arraysetassign"},
createFwdDecl(LINK::c, voidPtrTy, {"_d_arraysetassign", "_d_arraysetctor"},
{voidPtrTy, voidPtrTy, intTy, typeInfoTy}); {voidPtrTy, voidPtrTy, intTy, typeInfoTy});
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////