aboutsummaryrefslogtreecommitdiffhomepage
path: root/ir/ir.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-31 11:13:15 +0100
committerlemon <lsof@mailbox.org>2025-12-31 11:13:15 +0100
commit97c6d5c44f30b29b52d1dc431ab9f2df4bb47fd2 (patch)
tree564615d402793491d545d612df31dd80451120ab /ir/ir.c
parent3a46902b3ede49116522992793d3ececef53c5a8 (diff)
backend: separate instrs for integer/float store
Diffstat (limited to 'ir/ir.c')
-rw-r--r--ir/ir.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ir/ir.c b/ir/ir.c
index 29d52d4..cc16919 100644
--- a/ir/ir.c
+++ b/ir/ir.c
@@ -6,6 +6,9 @@ uchar cls2siz[] = { [KI32] = 4, [KI64] = 8, [KF32] = 4, [KF64] = 8 };
uchar cls2load[] = {
[KI32] = Oloads32, [KI64] = Oloadi64,
[KF32] = Oloadf32, [KF64] = Oloadf64, [KPTR] = -1
+}, cls2store[] = {
+ [KI32] = Ostorei32, [KI64] = Ostorei64,
+ [KF32] = Ostoref32, [KF64] = Ostoref64, [KPTR] = -1
};
const uchar siz2intcls[] = { [1] = KI32, [2] = KI32, [4] = KI32, [8] = KI64 };
@@ -71,6 +74,7 @@ irinit(struct function *fn)
type2cls[TYARRAY] = KPTR;
cls2siz[KPTR] = targ_primsizes[TYPTR];
cls2load[KPTR] = targ_64bit ? Oloadi64 : Oloads32;
+ cls2store[KPTR] = targ_64bit ? Ostorei64 : Ostorei32;
}
fn->entry = fn->curblk = allocz(fn->arena, sizeof(struct block), 0);
fn->nblk = 1;
@@ -513,6 +517,7 @@ replcuses(union ref from, union ref to)
} else if (instrtab[use->u].op == Ophi) {
u = phitab.p[instrtab[use->u].l.i];
n = use->blk->npred;
+ if (use->blk->phi.n == 0) continue; /* shouldn't happen */
} else {
u = &instrtab[use->u].l;
n = 2;