Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions compiler/src/dmd/backend/blockopt.d
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,8 @@ void brcombine(ref GlobalOptimizer go, ref BlockOpt bo)
const bc = b.bc;
if (bc == BC.iftrue)
{
block* b2 = b.nthSucc(0);
block* b3 = b.nthSucc(1);
block* b2 = b.Bsuccx(0);
block* b3 = b.Bsuccx(1);

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

const bc2 = b2.bc;
if (bc2 == BC.goto_ &&
b3 == b2.nthSucc(0))
b3 == b2.Bsuccx(0))
{
b.bc = BC.goto_;
if (b2.Belem)
Expand Down Expand Up @@ -570,9 +570,9 @@ void brcombine(ref GlobalOptimizer go, ref BlockOpt bo)
}
else if (bc2 == BC.goto_ &&
b3.bc == BC.goto_ &&
b2.nthSucc(0) == b3.nthSucc(0))
b2.Bsuccx(0) == b3.Bsuccx(0))
{
block* bsucc = b2.nthSucc(0);
block* bsucc = b2.Bsuccx(0);
if (b2.Belem)
{
elem* e;
Expand Down Expand Up @@ -680,13 +680,13 @@ private void bropt(ref GlobalOptimizer go, ref BlockOpt bo)
if (iftrue(n)) /* if elem is true */
{
// select first succ
db = b.nthSucc(1);
db = b.Bsuccx(1);
goto L1;
}
else if (iffalse(n))
{
// select second succ
db = b.nthSucc(0);
db = b.Bsuccx(0);

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

/* Look for both destinations being the same */
else if (b.nthSucc(0) ==
b.nthSucc(1))
else if (b.Bsuccx(0) ==
b.Bsuccx(1))
{
b.bc = BC.goto_;
db = b.nthSucc(0);
db = b.Bsuccx(0);
list_subtract(&(b.Bsucc),db);
db.Bpred.subtract(b);
debug if (debugc) printf("CHANGE: if (e) goto L1; else goto L1;\n");
Expand All @@ -727,7 +727,7 @@ private void bropt(ref GlobalOptimizer go, ref BlockOpt bo)
break;
}
}
block* db = b.nthSucc(i);
block* db = b.Bsuccx(i);

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

static if (NTEXCEPTIONS)
enum additionalAnd = "b.Btry == bt.Btry &&
bt.Btry == bt.nthSucc(0).Btry";
bt.Btry == bt.Bsuccx(0).Btry";
else
enum additionalAnd = "true";

Expand Down Expand Up @@ -814,8 +814,8 @@ private void brrear(ref BlockOpt bo)

if (b.bc == BC.iftrue || b.bc == BC.iffalse)
{
block* bif = b.nthSucc(0);
block* belse = b.nthSucc(1);
block* bif = b.Bsuccx(0);
block* belse = b.Bsuccx(1);

if (bif == b.Bnext)
{
Expand Down
9 changes: 6 additions & 3 deletions compiler/src/dmd/backend/cc.d
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,16 @@ nothrow:

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

@trusted
block* nthSucc(int n) { return cast(block*)list_ptr(list_nth(Bsucc, n)); }

@trusted
void setNthSucc(int n, block* b) { list_nth(Bsucc, n).ptr = b; }
}

@trusted
block* Bsuccx(block* b, int n) { return cast(block*)list_ptr(list_nth(b.Bsucc, n)); }

@trusted
int lengthx(LIST* bl) { return list_nitems((cast(block*)list_ptr(bl)).Bsucc); }

@trusted
inout(block)* list_block(inout list_t lst) { return cast(inout(block)*)list_ptr(lst); }

Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dmd/backend/cgcs.d
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ void comsubs2(block* startblock, ref CGCS cgcs, ref GlobalOptimizer go, ref Bloc
auto blc = bl;
while (bln && bln.Bpred.length == 1 &&
((blc.bc == BC.iftrue &&
blc.nthSucc(1) == bln) ||
(blc.bc == BC.goto_ && blc.nthSucc(0) == bln)
blc.Bsuccx(1) == bln) ||
(blc.bc == BC.goto_ && blc.Bsuccx(0) == bln)
) &&
bln.bc != BC.asm_ // no CSE's extending across ASM blocks
)
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dmd/backend/dwarfeh.d
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static if (0)
DwEhTableEntry* d = deh.push();
d.start = cast(uint)b.Boffset;

block* bf = b.nthSucc(1);
block* bf = b.Bsuccx(1);
if (bf.bc == BC.jcatch)
{
d.lpad = cast(uint)bf.Boffset;
Expand All @@ -138,7 +138,7 @@ static if (0)
d.action = offset + 1;
}
else
d.lpad = cast(uint)bf.nthSucc(0).Boffset;
d.lpad = cast(uint)bf.Bsuccx(0).Boffset;
d.prev = index;
index = i;
bprev = b.Btry;
Expand Down
8 changes: 4 additions & 4 deletions compiler/src/dmd/backend/eh.d
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void except_fillInEHTable(Symbol* s)
}
i = b.Bscope_index + 1;

int nsucc = b.numSucc();
int nsucc = b.numSucc;

if (config.ehmethod == EHmethod.EH_DM)
{
Expand Down Expand Up @@ -216,10 +216,10 @@ void except_fillInEHTable(Symbol* s)
{
assert(nsucc == 2);
dtb.dword(0); // no catch offset
block* bhandler = b.nthSucc(1);
block* bhandler = b.Bsuccx(1);
assert(bhandler.bc == BC._finally);
// To successor of BC._finally block
bhandler = bhandler.nthSucc(0);
bhandler = bhandler.Bsuccx(0);
// finally handler address
if (config.ehmethod == EHmethod.EH_DM)
{
Expand Down Expand Up @@ -341,7 +341,7 @@ void except_fillInEHTable(Symbol* s)

for (int j = 1; j < nsucc; ++j)
{
block* bcatch = b.nthSucc(j);
block* bcatch = b.Bsuccx(j);

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

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/gflow.d
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ private void flowaecp(ref GlobalOptimizer go, ref BlockOpt bo)
bool first = true;
foreach (bp; b.Bpred[])
{
if (bp.bc == BC.iftrue && bp.nthSucc(0) != b)
if (bp.bc == BC.iftrue && bp.Bsuccx(0) != b)
{
if (first)
vec_copy(b.Bin,bp.Bout2);
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/inliner.d
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ bool canInlineFunction(Symbol* sfunc)
switch (b.bc)
{
case BC.goto_:
if (b.Bnext != b.nthSucc(0))
if (b.Bnext != b.Bsuccx(0))
return no(__LINE__);
b = b.Bnext;
continue;
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/x86/cgreg.d
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ void cgreg_spillreg_epilog(block* b,Symbol* s,ref CodeBuilder cdbstore, ref Code
const bi = b.Bdfoidx;
//printf("cgreg_spillreg_epilog(block %d, s = '%s')\n",bi,s.Sident.ptr);
//assert(b.bc == BC.goto_);
if (!cgreg_gotoepilog(b.nthSucc(0), s))
if (!cgreg_gotoepilog(b.Bsuccx(0), s))
return;

const live = vec_testbit(bi,s.Slvreg) != 0;
Expand Down
Loading
Loading