aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2023-06-12 18:20:51 +0200
committerlemon <lsof@mailbox.org>2023-06-12 18:49:44 +0200
commit6df4f80c99609162ad3e46bfdce46d0c10696a45 (patch)
tree9e0457332b1df00b97a2d1d9aed5e52a19d963e5
parent1b56e5832e54a0fe8876bf12013b8164f0c05a92 (diff)
bugfix
-rw-r--r--mem.c2
-rw-r--r--regalloc.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/mem.c b/mem.c
index ea35e41..43029ac 100644
--- a/mem.c
+++ b/mem.c
@@ -176,7 +176,7 @@ imap_rehash(struct imapbase *m, void **v, uint vsiz)
j &= N2 - 1;
if (!bstest(newbs, j)) {
bsset(newbs, j);
- m->k[j] = k;
+ newk[j] = k;
memcpy((char *)newv + j*vsiz, (char *)*v + i*vsiz, vsiz);
break;
}
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)