Skip to content

Commit fa89d73

Browse files
committed
replace nthSucc with Bsuccx
1 parent 15422fa commit fa89d73

10 files changed

Lines changed: 66 additions & 66 deletions

File tree

compiler/src/dmd/backend/blockopt.d

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,8 @@ void brcombine(ref GlobalOptimizer go, ref BlockOpt bo)
519519
const bc = b.bc;
520520
if (bc == BC.iftrue)
521521
{
522-
block* b2 = b.nthSucc(0);
523-
block* b3 = b.nthSucc(1);
522+
block* b2 = b.Bsuccx(0);
523+
block* b3 = b.Bsuccx(1);
524524

525525
if (b2.Bpred.length > 1) // if more than one predecessor
526526
continue;
@@ -533,7 +533,7 @@ void brcombine(ref GlobalOptimizer go, ref BlockOpt bo)
533533

534534
const bc2 = b2.bc;
535535
if (bc2 == BC.goto_ &&
536-
b3 == b2.nthSucc(0))
536+
b3 == b2.Bsuccx(0))
537537
{
538538
b.bc = BC.goto_;
539539
if (b2.Belem)
@@ -570,9 +570,9 @@ void brcombine(ref GlobalOptimizer go, ref BlockOpt bo)
570570
}
571571
else if (bc2 == BC.goto_ &&
572572
b3.bc == BC.goto_ &&
573-
b2.nthSucc(0) == b3.nthSucc(0))
573+
b2.Bsuccx(0) == b3.Bsuccx(0))
574574
{
575-
block* bsucc = b2.nthSucc(0);
575+
block* bsucc = b2.Bsuccx(0);
576576
if (b2.Belem)
577577
{
578578
elem* e;
@@ -680,13 +680,13 @@ private void bropt(ref GlobalOptimizer go, ref BlockOpt bo)
680680
if (iftrue(n)) /* if elem is true */
681681
{
682682
// select first succ
683-
db = b.nthSucc(1);
683+
db = b.Bsuccx(1);
684684
goto L1;
685685
}
686686
else if (iffalse(n))
687687
{
688688
// select second succ
689-
db = b.nthSucc(0);
689+
db = b.Bsuccx(0);
690690

691691
L1:
692692
list_subtract(&(b.Bsucc),db);
@@ -699,11 +699,11 @@ private void bropt(ref GlobalOptimizer go, ref BlockOpt bo)
699699
}
700700

701701
/* Look for both destinations being the same */
702-
else if (b.nthSucc(0) ==
703-
b.nthSucc(1))
702+
else if (b.Bsuccx(0) ==
703+
b.Bsuccx(1))
704704
{
705705
b.bc = BC.goto_;
706-
db = b.nthSucc(0);
706+
db = b.Bsuccx(0);
707707
list_subtract(&(b.Bsucc),db);
708708
db.Bpred.subtract(b);
709709
debug if (debugc) printf("CHANGE: if (e) goto L1; else goto L1;\n");
@@ -727,7 +727,7 @@ private void bropt(ref GlobalOptimizer go, ref BlockOpt bo)
727727
break;
728728
}
729729
}
730-
block* db = b.nthSucc(i);
730+
block* db = b.Bsuccx(i);
731731

732732
/* delete predecessors of successors (!) */
733733
foreach (bl; ListRange(b.Bsucc))
@@ -776,7 +776,7 @@ private void brrear(ref BlockOpt bo)
776776

777777
static if (NTEXCEPTIONS)
778778
enum additionalAnd = "b.Btry == bt.Btry &&
779-
bt.Btry == bt.nthSucc(0).Btry";
779+
bt.Btry == bt.Bsuccx(0).Btry";
780780
else
781781
enum additionalAnd = "true";
782782

@@ -814,8 +814,8 @@ private void brrear(ref BlockOpt bo)
814814

815815
if (b.bc == BC.iftrue || b.bc == BC.iffalse)
816816
{
817-
block* bif = b.nthSucc(0);
818-
block* belse = b.nthSucc(1);
817+
block* bif = b.Bsuccx(0);
818+
block* belse = b.Bsuccx(1);
819819

820820
if (bif == b.Bnext)
821821
{

compiler/src/dmd/backend/cc.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,13 @@ nothrow:
325325

326326
int numSucc() { return list_nitems(this.Bsucc); }
327327

328-
@trusted
329-
block* nthSucc(int n) { return cast(block*)list_ptr(list_nth(Bsucc, n)); }
330-
331328
@trusted
332329
void setNthSucc(int n, block* b) { list_nth(Bsucc, n).ptr = b; }
333330
}
334331

332+
@trusted
333+
block* Bsuccx(block* b, int n) { return cast(block*)list_ptr(list_nth(b.Bsucc, n)); }
334+
335335
@trusted
336336
inout(block)* list_block(inout list_t lst) { return cast(inout(block)*)list_ptr(lst); }
337337

compiler/src/dmd/backend/cgcs.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ void comsubs2(block* startblock, ref CGCS cgcs, ref GlobalOptimizer go, ref Bloc
9999
auto blc = bl;
100100
while (bln && bln.Bpred.length == 1 &&
101101
((blc.bc == BC.iftrue &&
102-
blc.nthSucc(1) == bln) ||
103-
(blc.bc == BC.goto_ && blc.nthSucc(0) == bln)
102+
blc.Bsuccx(1) == bln) ||
103+
(blc.bc == BC.goto_ && blc.Bsuccx(0) == bln)
104104
) &&
105105
bln.bc != BC.asm_ // no CSE's extending across ASM blocks
106106
)

compiler/src/dmd/backend/dwarfeh.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static if (0)
119119
DwEhTableEntry* d = deh.push();
120120
d.start = cast(uint)b.Boffset;
121121

122-
block* bf = b.nthSucc(1);
122+
block* bf = b.Bsuccx(1);
123123
if (bf.bc == BC.jcatch)
124124
{
125125
d.lpad = cast(uint)bf.Boffset;
@@ -138,7 +138,7 @@ static if (0)
138138
d.action = offset + 1;
139139
}
140140
else
141-
d.lpad = cast(uint)bf.nthSucc(0).Boffset;
141+
d.lpad = cast(uint)bf.Bsuccx(0).Boffset;
142142
d.prev = index;
143143
index = i;
144144
bprev = b.Btry;

compiler/src/dmd/backend/eh.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ void except_fillInEHTable(Symbol* s)
216216
{
217217
assert(nsucc == 2);
218218
dtb.dword(0); // no catch offset
219-
block* bhandler = b.nthSucc(1);
219+
block* bhandler = b.Bsuccx(1);
220220
assert(bhandler.bc == BC._finally);
221221
// To successor of BC._finally block
222-
bhandler = bhandler.nthSucc(0);
222+
bhandler = bhandler.Bsuccx(0);
223223
// finally handler address
224224
if (config.ehmethod == EHmethod.EH_DM)
225225
{
@@ -341,7 +341,7 @@ void except_fillInEHTable(Symbol* s)
341341

342342
for (int j = 1; j < nsucc; ++j)
343343
{
344-
block* bcatch = b.nthSucc(j);
344+
block* bcatch = b.Bsuccx(j);
345345

346346
dtb.xoff(bcatch.Bcatchtype,0,TYnptr);
347347

compiler/src/dmd/backend/gflow.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ private void flowaecp(ref GlobalOptimizer go, ref BlockOpt bo)
570570
bool first = true;
571571
foreach (bp; b.Bpred[])
572572
{
573-
if (bp.bc == BC.iftrue && bp.nthSucc(0) != b)
573+
if (bp.bc == BC.iftrue && bp.Bsuccx(0) != b)
574574
{
575575
if (first)
576576
vec_copy(b.Bin,bp.Bout2);

compiler/src/dmd/backend/inliner.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ bool canInlineFunction(Symbol* sfunc)
112112
switch (b.bc)
113113
{
114114
case BC.goto_:
115-
if (b.Bnext != b.nthSucc(0))
115+
if (b.Bnext != b.Bsuccx(0))
116116
return no(__LINE__);
117117
b = b.Bnext;
118118
continue;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ 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.Bsuccx(0), s))
611611
return;
612612

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

0 commit comments

Comments
 (0)