diff options
| author | 2023-06-12 18:20:51 +0200 | |
|---|---|---|
| committer | 2023-06-12 18:49:44 +0200 | |
| commit | 6df4f80c99609162ad3e46bfdce46d0c10696a45 (patch) | |
| tree | 9e0457332b1df00b97a2d1d9aed5e52a19d963e5 | |
| parent | 1b56e5832e54a0fe8876bf12013b8164f0c05a92 (diff) | |
bugfix
| -rw-r--r-- | mem.c | 2 | ||||
| -rw-r--r-- | regalloc.c | 5 |
2 files changed, 4 insertions, 3 deletions
@@ -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; } @@ -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) |