diff options
| author | 2023-06-21 12:32:32 +0200 | |
|---|---|---|
| committer | 2023-06-21 12:32:32 +0200 | |
| commit | 995fd23ecd5de710a6f587d29af2874b1fb4756d (patch) | |
| tree | c8c8d95d51a25abbfc3ea08f984b8a1720cacc4b /regalloc.c | |
| parent | 2e4d5123544b86ec13e166dc94da43c850a588f2 (diff) | |
explicitly store predecessors in each block
Diffstat (limited to 'regalloc.c')
| -rw-r--r-- | regalloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -368,16 +368,16 @@ regalloc(struct function *fn) } } for (int i = blk->phi.n - 1; i >= 0; --i) { - struct phi *phi; + union ref *phi; ins = &instrtab[blk->phi.p[i]]; assert(ins->op == Ophi); - phi = &phitab.p[ins->l.i]; + phi = phitab.p[ins->l.i]; if (ins->reg) { /* introduce necessary moves in each pred, * XXX this doesn't work for backwards branches */ - for (int i = 0; i < phi->n; ++i) { - struct instr mov = mkinstr(Omove, insrescls(*ins), mkref(RREG, ins->reg-1), phi->ref[i]); - insertinstr(phi->blk[i], phi->blk[i]->ins.n, mov); + for (int i = 0; i < blk->npred; ++i) { + struct instr mov = mkinstr(Omove, insrescls(*ins), mkref(RREG, ins->reg-1), phi[i]); + insertinstr(blkpred(blk, i), blkpred(blk, i)->ins.n, mov); } } def(&ra, ins, NULL, 0); |