diff options
| author | Roland Paterson-Jones <[email protected]> | 2024-10-23 09:15:30 +0200 |
|---|---|---|
| committer | Quentin Carbonneaux <[email protected]> | 2025-03-14 09:47:05 +0100 |
| commit | 0ce9966c235d92553842c33587bb3ded1d3dbaba (patch) | |
| tree | 0a1b2152c3e7bbc1937d7d2f419d0cbf39acbbd9 /rv64/abi.c | |
| parent | 434cf5fdc4ba027f0ac04cd198658860b6fc034a (diff) | |
Re-use (vgrow) b->ins vector in backend xxx_abi() fn's.
Removes last re-allocation of b->ins.
Diffstat (limited to 'rv64/abi.c')
| -rw-r--r-- | rv64/abi.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -587,9 +587,9 @@ void rv64_abi(Fn *fn) { Blk *b; - Ins *i, *i0, *ip; + Ins *i, *i0; Insl *il; - int n; + int n0, n1, ioff; Params p; for (b=fn->start; b; b=b->link) @@ -600,12 +600,13 @@ rv64_abi(Fn *fn) if (!ispar(i->op)) break; p = selpar(fn, b->ins, i); - n = b->nins - (i - b->ins) + (&insb[NIns] - curi); - i0 = vnew(n, sizeof(Ins), PFn); - ip = icpy(ip = i0, curi, &insb[NIns] - curi); - ip = icpy(ip, i, &b->ins[b->nins] - i); - b->nins = n; - b->ins = i0; + n0 = &insb[NIns] - curi; + ioff = i - b->ins; + n1 = b->nins - ioff; + vgrow(&b->ins, n0+n1); + icpy(b->ins+n0, b->ins+ioff, n1); + icpy(b->ins, curi, n0); + b->nins = n0+n1; /* lower calls, returns, and vararg instructions */ il = 0; |
