diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-10-06 13:15:52 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-10-06 13:17:20 -0400 |
commit | ce72ad0ecdb43f6572c1febe8993d817f572f269 (patch) | |
tree | 11dac3426fd0a7a8f03576d9bed0d6f07ce95533 /lisc/isel.c | |
parent | a83174f44741088906718cc656675099e9193ad5 (diff) | |
download | roux-ce72ad0ecdb43f6572c1febe8993d817f572f269.tar.gz |
factor ins array edition in icpy
Diffstat (limited to 'lisc/isel.c')
-rw-r--r-- | lisc/isel.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lisc/isel.c b/lisc/isel.c index 126baf7..17fc01e 100644 --- a/lisc/isel.c +++ b/lisc/isel.c @@ -622,7 +622,7 @@ void isel(Fn *fn) { Blk *b, **sb; - Ins *i, *i0; + Ins *i, *i0, *ip; Phi *p; uint a; int n, al, s; @@ -637,14 +637,13 @@ isel(Fn *fn) if (i->op != OPar && i->op != OParc) break; selpar(fn, b->ins, i); - i0 = i; - n = b->nins - (i-b->ins); - b->nins = n + (curi-insb); - i = alloc(b->nins * sizeof i[0]); - memcpy(i, insb, (curi-insb) * sizeof i[0]); - memcpy(&i[curi-insb], i0, n * sizeof i[0]); + n = b->nins - (i - b->ins) + (curi - insb); + i0 = alloc(n * sizeof(Ins)); + ip = icpy(ip = i0, insb, curi - insb); + ip = icpy(ip, i, &b->ins[b->nins] - i); + b->nins = n; free(b->ins); - b->ins = i; + b->ins = i0; /* lower function calls */ for (b=fn->start; b; b=b->link) { |