commit 8c8b088b5f33ac89504b4df37e526e69334dc220
parent f9eff2c2abe9d87037320f7310e16f1d902a472e
Author: Drew DeVault <sir@cmpwn.com>
Date: Fri, 17 Jun 2022 13:13:25 +0200
gen: use memmove for slice copy
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gen.c b/src/gen.c
@@ -831,14 +831,14 @@ gen_expr_assign_slice(struct gen_context *ctx, const struct expression *expr)
gen_fixed_abort(ctx, expr->loc, ABORT_OOB);
push(&ctx->current->body, &lvalid);
- struct qbe_value rtmemcpy = mkrtfunc(ctx, "rt.memcpy");
+ struct qbe_value rtmemmove = mkrtfunc(ctx, "rt.memmove");
struct qbe_value optr = mkqtmp(ctx, ctx->arch.ptr, ".%d");
struct qbe_value vptr = mkqtmp(ctx, ctx->arch.ptr, ".%d");
pushi(ctx->current, &optr, Q_LOADL, &qobj, NULL);
pushi(ctx->current, &vptr, Q_LOADL, &qval, NULL);
tmp = constl(expr->assign.object->result->array.members->size);
pushi(ctx->current, &olen, Q_MUL, &olen, &tmp, NULL);
- pushi(ctx->current, NULL, Q_CALL, &rtmemcpy, &optr, &vptr, &olen, NULL);
+ pushi(ctx->current, NULL, Q_CALL, &rtmemmove, &optr, &vptr, &olen, NULL);
return gv_void;
}