Skip to content

Commit

Permalink
move dfoidx to CGstate
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored and dlang-bot committed May 13, 2024
1 parent 4559aee commit ac008f9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
14 changes: 6 additions & 8 deletions compiler/src/dmd/backend/cgcod.d
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ regm_t msavereg; // Mask of registers that we would like to save.
regm_t mfuncreg; // Mask of registers preserved by a function

regm_t allregs; // ALLREGS optionally including mBP

int dfoidx; /* which block we are in */
}

/*********************************
Expand Down Expand Up @@ -252,11 +250,11 @@ void codgen(Symbol *sfunc)
cgreg_reset();
foreach (i, b; dfo[])
{
dfoidx = cast(int)i;
cgstate.dfoidx = cast(int)i;
regcon.used = msavereg | regcon.cse.mval; // registers already in use
blcodgen(b); // gen code in depth-first order
//printf("b.Bregcon.used = %s\n", regm_str(b.Bregcon.used));
cgreg_used(dfoidx, b.Bregcon.used); // gather register used information
cgreg_used(cgstate.dfoidx, b.Bregcon.used); // gather register used information
}
}
else
Expand Down Expand Up @@ -1368,14 +1366,14 @@ private void blcodgen(block *bl)
sflsave[i] = s.Sfl;
if (regParamInPreg(s) &&
regcon.params & s.Spregm() &&
vec_testbit(dfoidx,s.Srange))
vec_testbit(cgstate.dfoidx,s.Srange))
{
// regcon.used |= s.Spregm();
}

if (s.Sfl == FLreg)
{
if (vec_testbit(dfoidx,s.Srange))
if (vec_testbit(cgstate.dfoidx,s.Srange))
{
regcon.mvar |= s.Sregm;
if (s.Sclass == SC.fastpar || s.Sclass == SC.shadowreg)
Expand All @@ -1384,11 +1382,11 @@ private void blcodgen(block *bl)
}
else if (s.Sflags & SFLspill)
{
if (vec_testbit(dfoidx,s.Srange))
if (vec_testbit(cgstate.dfoidx,s.Srange))
{
anyspill = cast(int)(i + 1);
cgreg_spillreg_prolog(bl,s,cdbstore,cdbload);
if (vec_testbit(dfoidx,s.Slvreg))
if (vec_testbit(cgstate.dfoidx,s.Slvreg))
{
s.Sfl = FLreg;
regcon.mvar |= s.Sregm;
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/cod1.d
Original file line number Diff line number Diff line change
Expand Up @@ -3990,7 +3990,7 @@ static if (0)
if (config.flags4 & CFG4optimized)
{ // If symbol is live in this basic block and
// isn't already in a register
if (s.Srange && vec_testbit(dfoidx, s.Srange) &&
if (s.Srange && vec_testbit(cgstate.dfoidx, s.Srange) &&
s.Sfl != FLreg)
{ // Then symbol must be allocated on stack
needframe = true;
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/cod3.d
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ void outblkexitcode(ref CodeBuilder cdb, block *bl, ref int anyspill, const(char
{ Symbol *s = globsym[i];

if (s.Sflags & SFLspill &&
vec_testbit(dfoidx,s.Srange))
vec_testbit(cgstate.dfoidx,s.Srange))
{
s.Sfl = sflsave[i]; // undo block register assignments
cgreg_spillreg_epilog(bl,s,cdbstore,cdbload);
Expand Down
2 changes: 2 additions & 0 deletions compiler/src/dmd/backend/code.d
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ struct CGstate
targ_size_t funcoffset; // offset of start of function
targ_size_t retoffset; // offset from start of func to ret code
targ_size_t retsize; // size of function return code

int dfoidx; // which block we are in
}

public import dmd.backend.nteh;
Expand Down

0 comments on commit ac008f9

Please sign in to comment.