From 088c3c1ce51de82ef317592bae766ad20f82208d Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 2 Nov 2025 19:26:20 +0100 Subject: regalloc: misc --- ir/regalloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ir/regalloc.c') diff --git a/ir/regalloc.c b/ir/regalloc.c index 03d9413..fae1a61 100644 --- a/ir/regalloc.c +++ b/ir/regalloc.c @@ -982,18 +982,18 @@ devirt(struct rega *ra, struct block *blk) int tr; if (r->t == RTMP) { alloc = (it = &ra->intervals.temps[r->i]) && it->nrange ? &it->alloc : NULL; - if (alloc->t == ASTACK && ins->op == Omove) { + if (alloc && alloc->t == ASTACK && ins->op == Omove) { /* move [reg], [stk] -> [reg] = load [stk] */ assert(r == &ins->r && ins->l.t == RREG); ins->reg = ins->l.i+1; ins->op = cls2load[ins->cls]; ins->r = NOREF; addstkslotref(temp, alloc->a*8); - } else if (alloc->t == ASTACK && ins->op == Ocopy && r == &ins->l && ins->reg) { + } else if (alloc && alloc->t == ASTACK && ins->op == Ocopy && r == &ins->l && ins->reg) { /* [reg] = copy [stk] -> [reg] = load [stk] */ ins->op = cls2load[ins->cls]; addstkslotref(temp, alloc->a*8); - } else if (alloc->t == ASTACK) { + } else if (alloc && alloc->t == ASTACK) { /* ref was spilled, gen load to scratch register and use it */ struct instr ld = {.cls = insrescls(instrtab[r->i])}; int reg = kisint(ld.cls) ? mctarg->gprscratch : mctarg->fprscratch; -- cgit v1.2.3