From 6df4f80c99609162ad3e46bfdce46d0c10696a45 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 12 Jun 2023 18:20:51 +0200 Subject: bugfix --- regalloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'regalloc.c') diff --git a/regalloc.c b/regalloc.c index 85f8ab1..f03c33c 100644 --- a/regalloc.c +++ b/regalloc.c @@ -156,8 +156,8 @@ use(struct rega *ra, struct block *blk, int curi, enum op op, int hint, union re } else { ins->reg = nextreg(ra, ins->cls, *ref, excl) + 1; } - *ref = mkref(RREG, ins->reg-1); } + *ref = mkref(RREG, ins->reg-1); } void @@ -171,6 +171,7 @@ regalloc(struct function *fn) for (int i = 0; i < MAXREGS; ++i) if (in_range(i, mctarg->fpr0, mctarg->fpr0 + mctarg->nfpr - 1)) bsset(floatregs, i); + bszero(globusage, 1); /* a dumb linear register allocator that visits instructions physically backwards * starting at the end of the function, when encountering a use of a new @@ -197,7 +198,7 @@ regalloc(struct function *fn) if (ins->op != Ocall) { if (ins->op == Ocopy) hint0 = ins->reg - 1; if (ins->op == Omove) { - hint1 = ins->l.i; + if (ins->l.t == RREG) hint1 = ins->l.i; /* MOV Rx,Rx is used by isel to indicate a clobber, * so it should be a def point for Rx but not a use point */ if (ins->r.bits != ins->l.bits) -- cgit v1.2.3