diff options
| author | 2025-09-08 22:05:33 +0200 | |
|---|---|---|
| committer | 2025-09-08 22:05:33 +0200 | |
| commit | e043811980db560fc2507bb53b644e54c80527dc (patch) | |
| tree | 6ea563d81c9d3767f439e361fc2c884cf4f9b64d /optmem.c | |
| parent | 36b5b19bf183cb01525201ccbddd6afa692f21bb (diff) | |
regalloc: start implementing linear scan
Diffstat (limited to 'optmem.c')
| -rw-r--r-- | optmem.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -19,7 +19,7 @@ static const uchar load2ext[] = { #define load2ext(o) (load2ext[(o) - Oloads1]) #define storesz(o) (1 << ((o) - Ostore1)) -/* Implements algorithm in 'Simple and Efficient Construction of Static Single' (Braun et al) */ +/* Implements algorithm in 'Simple and Efficient Construction of Static Single Assignment' (Braun et al) */ struct pendingphi { ushort var, phi; }; struct ssabuilder { @@ -43,6 +43,9 @@ deltrivialphis(struct ssabuilder *sb, struct block *blk, union ref phiref) assert(instrtab[phiref.i].op == Ophi); + if (phiref.i == 4) + efmt(""); + for (int i = 0; i < blk->npred; ++i) { if (args[i].bits == same.bits || args[i].bits == phiref.bits) continue; /* unique value or self-reference */ @@ -79,6 +82,7 @@ Redo: } } } + deluses(phiref.i); return same; } @@ -185,7 +189,6 @@ mem2reg(struct function *fn) } do { - for (int i = 0; i < blk->ins.n; ++i) { struct use *use, *uend; enum irclass k = 0; |