Skip to content

Commit 0a4e129

Browse files
committed
3rd attempt to make Bsucc an array
1 parent 2990bc7 commit 0a4e129

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

compiler/src/dmd/backend/blockopt.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ void block_free(ref BlockOpt bo, block* b)
307307
if (b.Belem)
308308
el_free(b.Belem);
309309
list_free(&b.Bsucc,FPNULL);
310+
b.Bsucca.dtor();
310311
b.Bpred.dtor();
311312
if (OPTIMIZER)
312313
block_optimizer_free(b);

compiler/src/dmd/backend/cc.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ nothrow:
205205
block* Bnext; // pointer to next block in list
206206
list_t Bsucc; // linked list of pointers to successors
207207
// of this block
208+
Barray!(block*) Bsucca; // and the successor array copy of Bsucc
208209
Barray!(block*) Bpred; // and the predecessor array
209210
int Bindex; // into created object stack
210211
int Bendindex; // index at end of block

compiler/src/dmd/backend/x86/cgcod.d

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ void codgenx(ref CGstate cg, Symbol* sfunc)
9898
assert(sfunc == funcsym_p);
9999
assert(cseg == funcsym_p.Sseg);
100100

101+
// Convert Bsucc to Bsucca
102+
for (block* b = bo.startblock; b; b = b.Bnext)
103+
{
104+
foreach (bp; ListRange(b.Bsucc))
105+
b.Bsucca.push(list_block(bp));
106+
assert(list_nitems(b.Bsucc) == b.Bsucca.length);
107+
}
108+
101109
cgreg_init();
102110
CSE.initialize();
103111

compiler/src/dmd/backend/x86/cgreg.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,15 +607,15 @@ void cgreg_spillreg_epilog(block* b,Symbol* s,ref CodeBuilder cdbstore, ref Code
607607
const bi = b.Bdfoidx;
608608
//printf("cgreg_spillreg_epilog(block %d, s = '%s')\n",bi,s.Sident.ptr);
609609
//assert(b.bc == BC.goto_);
610-
if (!cgreg_gotoepilog(b.nthSucc(0), s))
610+
if (!cgreg_gotoepilog(b.Bsucca[0], s))
611611
return;
612612

613613
const live = vec_testbit(bi,s.Slvreg) != 0;
614614

615615
// Look at successors to see if we need to load in/out of register
616-
foreach (bl; ListRange(b.Bsucc))
616+
foreach (bs; b.Bsucca[])
617617
{
618-
const bpi = list_block(bl).Bdfoidx;
618+
const bpi = bs.Bdfoidx;
619619
if (!vec_testbit(bpi,s.Srange))
620620
continue;
621621
if (vec_testbit(bpi,s.Slvreg))

0 commit comments

Comments
 (0)