bool isDominatedByFirstBB = false;
- BLOCKSET_ITER_INIT(this, iter, varDsc->lvRefBlks, blkNum);
- while (iter.NextElem(&blkNum))
+ BlockSetOps::Iter iter(this, varDsc->lvRefBlks);
+ unsigned bbNum = 0;
+ while (iter.NextElem(&bbNum))
{
- /* Find the block 'blkNum' */
+ /* Find the block 'bbNum' */
BasicBlock* block = fgFirstBB;
- while (block && (block->bbNum != blkNum))
+ while (block && (block->bbNum != bbNum))
{
block = block->bbNext;
}
- noway_assert(block && (block->bbNum == blkNum));
+ noway_assert(block && (block->bbNum == bbNum));
bool importantUseInBlock = (varDsc->lvIsParam) && (block->getBBWeight(this) > paramAvgWtdRefDiv2);
bool isPreHeaderBlock = ((block->bbFlags & BBF_LOOP_PREHEADER) != 0);
#ifdef DEBUG
if (verbose)
{
- printf(" Referenced in BB%02u, bbWeight is %s", blkNum, refCntWtd2str(block->getBBWeight(this)));
+ printf(" Referenced in BB%02u, bbWeight is %s", bbNum, refCntWtd2str(block->getBBWeight(this)));
if (isDominatedByFirstBB)
{
#endif
/* We have already calculated paramImportantUseDom above. */
-
- BLOCKSET_ITER_INIT(this, iter, paramImportantUseDom, blkNum);
- while (iter.NextElem(&blkNum))
+ BlockSetOps::Iter iter(this, paramImportantUseDom);
+ unsigned bbNum = 0;
+ while (iter.NextElem(&bbNum))
{
- /* Advance block to point to 'blkNum' */
+ /* Advance block to point to 'bbNum' */
/* This assumes that the iterator returns block number is increasing lexical order. */
- while (block && (block->bbNum != blkNum))
+ while (block && (block->bbNum != bbNum))
{
block = block->bbNext;
}
- noway_assert(block && (block->bbNum == blkNum));
+ noway_assert(block && (block->bbNum == bbNum));
#ifdef DEBUG
if (verbose)
typedef BitVecOps::ValArgType BitVec_ValArg_T;
typedef BitVecOps::RetValType BitVec_ValRet_T;
-// Initialize "_varName" to "_initVal." Copies contents, not references; if "_varName" is uninitialized, allocates a
-// set for it (using "_traits" for any necessary allocation), and copies the contents of "_initVal" into it.
-#define BITVEC_INIT(_traits, _varName, _initVal) _varName(BitVecOps::MakeCopy(_traits, _initVal))
-
-// Initializes "_varName" to "_initVal", without copying: if "_initVal" is an indirect representation, copies its
-// pointer into "_varName".
-#define BITVEC_INIT_NOCOPY(_varName, _initVal) _varName(_initVal)
-
-// The iterator pattern.
-
-// Use this to initialize an iterator "_iterName" to iterate over a BitVec "_bitVec".
-// "_bitNum" will be an unsigned variable to which we assign the elements of "_bitVec".
-#define BITVEC_ITER_INIT(_traits, _iterName, _bitVec, _bitNum) \
- unsigned _bitNum = 0; \
- BitVecOps::Iter _iterName(_traits, _bitVec)
-
#endif // _BITVEC_INCLUDED_
typedef BlockSetOps::ValArgType BlockSet_ValArg_T;
typedef BlockSetOps::RetValType BlockSet_ValRet_T;
-// The iterator pattern.
-
-// Use this to initialize an iterator "_iterName" to iterate over a BlockSet "_blockSet".
-// "_blockNum" will be an unsigned variable to which we assign the elements of "_blockSet".
-#define BLOCKSET_ITER_INIT(_comp, _iterName, _blockSet, _blockNum) \
- unsigned _blockNum = 0; \
- BlockSetOps::Iter _iterName(_comp, _blockSet)
-
#endif // _BLOCKSET_INCLUDED_
// Handle the dying vars first, then the newly live vars.
// This is because, in the RyuJIT backend case, they may occupy registers that
// will be occupied by another var that is newly live.
- VARSET_ITER_INIT(this, deadIter, deadSet, deadVarIndex);
+ VarSetOps::Iter deadIter(this, deadSet);
+ unsigned deadVarIndex = 0;
while (deadIter.NextElem(&deadVarIndex))
{
unsigned varNum = lvaTrackedToVarNum[deadVarIndex];
#endif // !LEGACY_BACKEND
}
- VARSET_ITER_INIT(this, bornIter, bornSet, bornVarIndex);
+ VarSetOps::Iter bornIter(this, bornSet);
+ unsigned bornVarIndex = 0;
while (bornIter.NextElem(&bornVarIndex))
{
unsigned varNum = lvaTrackedToVarNum[bornVarIndex];
regMaskTP liveMask = 0;
- VARSET_ITER_INIT(compiler, iter, liveSet, varIndex);
+ VarSetOps::Iter iter(compiler, liveSet);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
/* iterate through the dead variables */
- VARSET_ITER_INIT(compiler, iter, deadSet, varIndex);
+ VarSetOps::Iter iter(compiler, deadSet);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
varNum = compiler->lvaTrackedToVarNum[varIndex];
VARSET_TP regVarLiveNow(VarSetOps::Intersection(compiler, compiler->raRegVarsMask, rsLiveNow));
- VARSET_ITER_INIT(compiler, iter, regVarLiveNow, varIndex);
+ VarSetOps::Iter iter(compiler, regVarLiveNow);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
// Find the variable in compiler->lvaTable
// We should never enregister variables in any of the specialUseMask registers
noway_assert((specialUseMask & regSet.rsMaskVars) == 0);
- VARSET_ITER_INIT(compiler, iter, liveSet, varIndex);
+ VarSetOps::Iter iter(compiler, liveSet);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
varNum = compiler->lvaTrackedToVarNum[varIndex];
{
unsigned regCount = 0;
- VARSET_ITER_INIT(compiler, iter, compiler->compCurLife, varNum);
+ VarSetOps::Iter iter(compiler, compiler->compCurLife);
+ unsigned varNum = 0;
while (iter.NextElem(&varNum))
{
unsigned lclNum = compiler->lvaTrackedToVarNum[varNum];
VARSET_TP removedGCVars(VarSetOps::MakeEmpty(compiler));
VARSET_TP addedGCVars(VarSetOps::MakeEmpty(compiler));
#endif
- VARSET_ITER_INIT(compiler, iter, block->bbLiveIn, varIndex);
+ VarSetOps::Iter iter(compiler, block->bbLiveIn);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[varIndex];
VARSET_TP extraLiveVars(VarSetOps::Diff(compiler, block->bbLiveOut, compiler->compCurLife));
VarSetOps::UnionD(compiler, extraLiveVars, VarSetOps::Diff(compiler, compiler->compCurLife, block->bbLiveOut));
- VARSET_ITER_INIT(compiler, extraLiveVarIter, extraLiveVars, extraLiveVarIndex);
+ VarSetOps::Iter extraLiveVarIter(compiler, extraLiveVars);
+ unsigned extraLiveVarIndex = 0;
while (extraLiveVarIter.NextElem(&extraLiveVarIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[extraLiveVarIndex];
pVarNumSet = (BYTE*)_alloca(varNumSetBytes);
memset(pVarNumSet, 0, varNumSetBytes); // empty the set
- VARSET_ITER_INIT(comp, iter, vars, varIndex);
+ VarSetOps::Iter iter(comp, vars);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
unsigned varNum = comp->lvaTrackedToVarNum[varIndex];
void fgTableDispBasicBlock(BasicBlock* block, int ibcColWidth = 0);
void fgDispBasicBlocks(BasicBlock* firstBlock, BasicBlock* lastBlock, bool dumpTrees);
void fgDispBasicBlocks(bool dumpTrees = false);
- void fgDumpStmtTree(GenTreePtr stmt, unsigned blkNum);
+ void fgDumpStmtTree(GenTreePtr stmt, unsigned bbNum);
void fgDumpBlock(BasicBlock* block);
void fgDumpTrees(BasicBlock* firstBlock, BasicBlock* lastBlock);
if (verbose)
{
printf("Enter blocks: ");
- BLOCKSET_ITER_INIT(this, iter, fgEnterBlks, bbNum);
+ BlockSetOps::Iter iter(this, fgEnterBlks);
+ unsigned bbNum = 0;
while (iter.NextElem(&bbNum))
{
printf("BB%02u ", bbNum);
if (verbose)
{
printf("\nDominator computation start blocks (those blocks with no incoming edges):\n");
- BLOCKSET_ITER_INIT(this, iter, startNodes, bbNum);
+ BlockSetOps::Iter iter(this, startNodes);
+ unsigned bbNum = 0;
while (iter.NextElem(&bbNum))
{
printf("BB%02u ", bbNum);
// reachability information stored in the blocks. To avoid that, we just use a local BitVec.
BitVecTraits blockVecTraits(fgBBNumMax + 1, this);
- BitVec BITVEC_INIT_NOCOPY(uniqueSuccBlocks, BitVecOps::MakeEmpty(&blockVecTraits));
+ BitVec uniqueSuccBlocks(BitVecOps::MakeEmpty(&blockVecTraits));
BasicBlock** jumpTable = switchBlk->bbJumpSwt->bbsDstTab;
unsigned jumpCount = switchBlk->bbJumpSwt->bbsCount;
for (unsigned i = 0; i < jumpCount; i++)
for (BasicBlock* block = fgFirstBB; block != nullptr; block = block->bbNext)
{
printf("BB%02u : ", block->bbNum);
- BLOCKSET_ITER_INIT(this, iter, block->bbReach, bbNum);
+ BlockSetOps::Iter iter(this, block->bbReach);
+ unsigned bbNum = 0;
while (iter.NextElem(&bbNum))
{
printf("BB%02u ", bbNum);
/*****************************************************************************/
// Increment the stmtNum and dump the tree using gtDispTree
//
-void Compiler::fgDumpStmtTree(GenTreePtr stmt, unsigned blkNum)
+void Compiler::fgDumpStmtTree(GenTreePtr stmt, unsigned bbNum)
{
compCurStmtNum++; // Increment the current stmtNum
- printf("\n***** BB%02u, stmt %d\n", blkNum, compCurStmtNum);
+ printf("\n***** BB%02u, stmt %d\n", bbNum, compCurStmtNum);
if (fgOrder == FGOrderLinear || opts.compDbgInfo)
{
// Create a set with all the successors. Don't use BlockSet, so we don't need to worry
// about the BlockSet epoch.
BitVecTraits bitVecTraits(fgBBNumMax + 1, this);
- BitVec BITVEC_INIT_NOCOPY(succBlocks, BitVecOps::MakeEmpty(&bitVecTraits));
+ BitVec succBlocks(BitVecOps::MakeEmpty(&bitVecTraits));
BasicBlock** jumpTable = block->bbJumpSwt->bbsDstTab;
unsigned jumpCount = block->bbJumpSwt->bbsCount;
for (unsigned i = 0; i < jumpCount; i++)
/* Add statements initializing the vars, if there are any to initialize */
unsigned blockWeight = block->getBBWeight(this);
- VARSET_ITER_INIT(this, iter, initVars, varIndex);
+ VarSetOps::Iter iter(this, initVars);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
/* Create initialization tree */
VarSetOps::Assign(this, fgMarkIntfUnionVS, varSet1);
VarSetOps::UnionD(this, fgMarkIntfUnionVS, varSet2);
- VARSET_ITER_INIT(this, iter, fgMarkIntfUnionVS, refIndex);
+ VarSetOps::Iter iter(this, fgMarkIntfUnionVS);
+ unsigned refIndex = 0;
while (iter.NextElem(&refIndex))
{
// if varSet1 has this bit set then it interferes with varSet2
bool addedIntf = false; // This is set to true if we add any new interferences
- VARSET_ITER_INIT(this, iter, varSet, refIndex);
+ VarSetOps::Iter iter(this, varSet);
+ unsigned refIndex = 0;
while (iter.NextElem(&refIndex))
{
// Calculate the set of new interference to add
VarSetOps::AssignNoCopy(compiler, currentLiveVars,
VarSetOps::Intersection(compiler, registerCandidateVars, bb->bbLiveIn));
- VARSET_ITER_INIT(compiler, iter, currentLiveVars, varIndex);
+ VarSetOps::Iter iter(compiler, currentLiveVars);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[varIndex];
block as either volatile for non-GC ref types or as
'explicitly initialized' (volatile and must-init) for GC-ref types */
- VARSET_ITER_INIT(compiler, iter, exceptVars, varIndex);
+ VarSetOps::Iter iter(compiler, exceptVars);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[varIndex];
VARSET_TP liveInNotComputedLive(VarSetOps::Diff(compiler, block->bbLiveIn, computedLive));
- unsigned liveInNotComputedLiveIndex = 0;
VarSetOps::Iter liveInNotComputedLiveIter(compiler, liveInNotComputedLive);
+ unsigned liveInNotComputedLiveIndex = 0;
while (liveInNotComputedLiveIter.NextElem(&liveInNotComputedLiveIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[liveInNotComputedLiveIndex];
VarSetOps::DiffD(compiler, computedLive, block->bbLiveIn);
const VARSET_TP& computedLiveNotLiveIn(computedLive); // reuse the buffer.
- unsigned computedLiveNotLiveInIndex = 0;
VarSetOps::Iter computedLiveNotLiveInIter(compiler, computedLiveNotLiveIn);
+ unsigned computedLiveNotLiveInIndex = 0;
while (computedLiveNotLiveInIter.NextElem(&computedLiveNotLiveInIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[computedLiveNotLiveInIndex];
// if (!blockSequence[curBBSeqNum]->isRunRarely())
if (enregisterLocalVars)
{
-
- VARSET_ITER_INIT(compiler, iter, currentLiveVars, varIndex);
+ VarSetOps::Iter iter(compiler, currentLiveVars);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[varIndex];
{
VarSetOps::AssignNoCopy(compiler, liveLargeVectors,
VarSetOps::Intersection(compiler, currentLiveVars, largeVectorVars));
- VARSET_ITER_INIT(compiler, iter, liveLargeVectors, varIndex);
+ VarSetOps::Iter iter(compiler, liveLargeVectors);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
Interval* varInterval = getIntervalForLocalVar(varIndex);
assert(enregisterLocalVars);
if (!VarSetOps::IsEmpty(compiler, liveLargeVectors))
{
- VARSET_ITER_INIT(compiler, iter, liveLargeVectors, varIndex);
+ VarSetOps::Iter iter(compiler, liveLargeVectors);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
Interval* varInterval = getIntervalForLocalVar(varIndex);
// insert defs for this, then a block boundary
- VARSET_ITER_INIT(compiler, iter, currentLiveVars, varIndex);
+ VarSetOps::Iter iter(compiler, currentLiveVars);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[varIndex];
assert(!predBlockIsAllocated);
JITDUMP("Creating dummy definitions\n");
- VARSET_ITER_INIT(compiler, iter, newLiveIn, varIndex);
+ VarSetOps::Iter iter(compiler, newLiveIn);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[varIndex];
if (!VarSetOps::IsEmpty(compiler, expUseSet))
{
JITDUMP("Exposed uses:");
- VARSET_ITER_INIT(compiler, iter, expUseSet, varIndex);
+ VarSetOps::Iter iter(compiler, expUseSet);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[varIndex];
// Clear the "last use" flag on any vars that are live-out from this block.
{
- VARSET_ITER_INIT(compiler, iter, block->bbLiveOut, varIndex);
+ VarSetOps::Iter iter(compiler, block->bbLiveOut);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[varIndex];
// inactive registers available for the rotation.
regMaskTP inactiveRegs = RBM_NONE;
#endif // DEBUG
- regMaskTP liveRegs = RBM_NONE;
- VARSET_ITER_INIT(compiler, iter, currentLiveVars, varIndex);
+ regMaskTP liveRegs = RBM_NONE;
+ VarSetOps::Iter iter(compiler, currentLiveVars);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
unsigned varNum = compiler->lvaTrackedToVarNum[varIndex];
VarSetOps::Assign(compiler, currentLiveVars, registerCandidateVars);
}
#endif // DEBUG
- regMaskTP liveRegs = RBM_NONE;
- VARSET_ITER_INIT(compiler, iter, currentLiveVars, varIndex);
+ regMaskTP liveRegs = RBM_NONE;
+ VarSetOps::Iter iter(compiler, currentLiveVars);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
Interval* interval = getIntervalForLocalVar(varIndex);
INDEBUG(freeRegs = stressLimitRegs(nullptr, freeRegs));
// We are only interested in the variables that are live-in to the "to" block.
- VARSET_ITER_INIT(compiler, iter, toBlock->bbLiveIn, varIndex);
+ VarSetOps::Iter iter(compiler, toBlock->bbLiveIn);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex) && freeRegs != RBM_NONE)
{
regNumber fromReg = getVarReg(fromVarToRegMap, varIndex);
// available to copy into.
// Note that for this purpose we use the full live-out set, because we must ensure that
// even the registers that remain the same across the edge are preserved correctly.
- regMaskTP liveOutRegs = RBM_NONE;
- VARSET_ITER_INIT(compiler, iter1, block->bbLiveOut, varIndex1);
- while (iter1.NextElem(&varIndex1))
+ regMaskTP liveOutRegs = RBM_NONE;
+ VarSetOps::Iter liveOutIter(compiler, block->bbLiveOut);
+ unsigned liveOutVarIndex = 0;
+ while (liveOutIter.NextElem(&liveOutVarIndex))
{
- regNumber fromReg = getVarReg(outVarToRegMap, varIndex1);
+ regNumber fromReg = getVarReg(outVarToRegMap, liveOutVarIndex);
if (fromReg != REG_STK)
{
liveOutRegs |= genRegMask(fromReg);
// write to any registers that are read by those in the diffResolutionSet:
// sameResolutionSet
- VARSET_ITER_INIT(compiler, iter, outResolutionSet, varIndex);
- while (iter.NextElem(&varIndex))
+ VarSetOps::Iter outResolutionSetIter(compiler, outResolutionSet);
+ unsigned outResolutionSetVarIndex = 0;
+ while (outResolutionSetIter.NextElem(&outResolutionSetVarIndex))
{
- regNumber fromReg = getVarReg(outVarToRegMap, varIndex);
+ regNumber fromReg = getVarReg(outVarToRegMap, outResolutionSetVarIndex);
bool isMatch = true;
bool isSame = false;
bool maybeSingleTarget = false;
for (unsigned succIndex = 0; succIndex < succCount; succIndex++)
{
BasicBlock* succBlock = block->GetSucc(succIndex, compiler);
- if (!VarSetOps::IsMember(compiler, succBlock->bbLiveIn, varIndex))
+ if (!VarSetOps::IsMember(compiler, succBlock->bbLiveIn, outResolutionSetVarIndex))
{
maybeSameLivePaths = true;
continue;
liveOnlyAtSplitEdge = ((succBlock->bbPreds->flNext == nullptr) && (succBlock != compiler->fgFirstBB));
}
- regNumber toReg = getVarReg(getInVarToRegMap(succBlock->bbNum), varIndex);
+ regNumber toReg = getVarReg(getInVarToRegMap(succBlock->bbNum), outResolutionSetVarIndex);
if (sameToReg == REG_NA)
{
sameToReg = toReg;
if (sameToReg == REG_NA)
{
- VarSetOps::AddElemD(compiler, diffResolutionSet, varIndex);
+ VarSetOps::AddElemD(compiler, diffResolutionSet, outResolutionSetVarIndex);
if (fromReg != REG_STK)
{
diffReadRegs |= genRegMask(fromReg);
}
else if (sameToReg != fromReg)
{
- VarSetOps::AddElemD(compiler, sameResolutionSet, varIndex);
- setVarReg(sameVarToRegMap, varIndex, sameToReg);
+ VarSetOps::AddElemD(compiler, sameResolutionSet, outResolutionSetVarIndex);
+ setVarReg(sameVarToRegMap, outResolutionSetVarIndex, sameToReg);
if (sameToReg != REG_STK)
{
sameWriteRegs |= genRegMask(sameToReg);
bool needsResolution = false;
VarToRegMap succInVarToRegMap = getInVarToRegMap(succBlock->bbNum);
VARSET_TP edgeResolutionSet(VarSetOps::Intersection(compiler, diffResolutionSet, succBlock->bbLiveIn));
- VARSET_ITER_INIT(compiler, iter, edgeResolutionSet, varIndex);
+ VarSetOps::Iter iter(compiler, edgeResolutionSet);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
regNumber fromReg = getVarReg(outVarToRegMap, varIndex);
VarToRegMap toVarToRegMap = getInVarToRegMap(block->bbNum);
for (flowList* pred = block->bbPreds; pred != nullptr; pred = pred->flNext)
{
- BasicBlock* predBlock = pred->flBlock;
- VarToRegMap fromVarToRegMap = getOutVarToRegMap(predBlock->bbNum);
- VARSET_ITER_INIT(compiler, iter, block->bbLiveIn, varIndex);
+ BasicBlock* predBlock = pred->flBlock;
+ VarToRegMap fromVarToRegMap = getOutVarToRegMap(predBlock->bbNum);
+ VarSetOps::Iter iter(compiler, block->bbLiveIn);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
regNumber fromReg = getVarReg(fromVarToRegMap, varIndex);
// TODO-Throughput: We should be looping over the liveIn and liveOut registers, since
// that will scale better than the live variables
- VARSET_ITER_INIT(compiler, iter, liveSet, varIndex);
+ VarSetOps::Iter iter(compiler, liveSet);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
regNumber fromReg = getVarReg(fromVarToRegMap, varIndex);
// Validate the locations at the end of the previous block.
if (enregisterLocalVars)
{
- VarToRegMap outVarToRegMap = outVarToRegMaps[currentBlock->bbNum];
- VARSET_ITER_INIT(compiler, iter, currentBlock->bbLiveOut, varIndex);
+ VarToRegMap outVarToRegMap = outVarToRegMaps[currentBlock->bbNum];
+ VarSetOps::Iter iter(compiler, currentBlock->bbLiveOut);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
if (localVarIntervals[varIndex] == nullptr)
{
if (enregisterLocalVars)
{
- VarToRegMap inVarToRegMap = inVarToRegMaps[currentBlock->bbNum];
- VARSET_ITER_INIT(compiler, iter, currentBlock->bbLiveIn, varIndex);
+ VarToRegMap inVarToRegMap = inVarToRegMaps[currentBlock->bbNum];
+ VarSetOps::Iter iter(compiler, currentBlock->bbLiveIn);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
if (localVarIntervals[varIndex] == nullptr)
}
// Set the incoming register assignments
- VarToRegMap inVarToRegMap = getInVarToRegMap(currentBlock->bbNum);
- VARSET_ITER_INIT(compiler, iter, currentBlock->bbLiveIn, varIndex);
+ VarToRegMap inVarToRegMap = getInVarToRegMap(currentBlock->bbNum);
+ VarSetOps::Iter iter(compiler, currentBlock->bbLiveIn);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
if (localVarIntervals[varIndex] == nullptr)
// Verify the outgoing register assignments
{
- VarToRegMap outVarToRegMap = getOutVarToRegMap(currentBlock->bbNum);
- VARSET_ITER_INIT(compiler, iter, currentBlock->bbLiveOut, varIndex);
+ VarToRegMap outVarToRegMap = getOutVarToRegMap(currentBlock->bbNum);
+ VarSetOps::Iter iter(compiler, currentBlock->bbLiveOut);
+ unsigned varIndex = 0;
while (iter.NextElem(&varIndex))
{
if (localVarIntervals[varIndex] == nullptr)
#ifdef DEBUG
if (verbose)
{
- VARSET_ITER_INIT(this, newIntfIter, newIntf, varNum);
+ VarSetOps::Iter newIntfIter(this, newIntf);
+ unsigned varNum = 0;
while (newIntfIter.NextElem(&varNum))
{
unsigned lclNum = lvaTrackedToVarNum[varNum];
// While we still have any lastUse or inPlaceUse bits
VARSET_TP useUnion(VarSetOps::Union(this, lastUse, inPlaceUse));
- VARSET_TP varAsSet(VarSetOps::MakeEmpty(this));
- VARSET_ITER_INIT(this, iter, useUnion, varNum);
+ VARSET_TP varAsSet(VarSetOps::MakeEmpty(this));
+ VarSetOps::Iter iter(this, useUnion);
+ unsigned varNum = 0;
while (iter.NextElem(&varNum))
{
// We'll need this for one of the calls...
// psc is abbeviation for possibleSameColor
VARSET_TP pscVarSet(VarSetOps::Diff(this, unprocessedVars, lvaVarIntf[varIndex]));
- VARSET_ITER_INIT(this, pscIndexIter, pscVarSet, pscIndex);
+ VarSetOps::Iter pscIndexIter(this, pscVarSet);
+ unsigned pscIndex = 0;
while (pscIndexIter.NextElem(&pscIndex))
{
LclVarDsc* pscVar = lvaTable + lvaTrackedToVarNum[pscIndex];
#ifdef _TARGET_ARM_
if (isDouble)
{
- regNumber secondHalf = REG_NEXT(regNum);
- VARSET_ITER_INIT(this, iter, lvaVarIntf[varIndex], intfIndex);
+ regNumber secondHalf = REG_NEXT(regNum);
+ VarSetOps::Iter iter(this, lvaVarIntf[varIndex]);
+ unsigned intfIndex = 0;
while (iter.NextElem(&intfIndex))
{
VarSetOps::AddElemD(this, raLclRegIntf[secondHalf], intfIndex);
// Check that vars which are live on entry have an open scope
- VARSET_ITER_INIT(compiler, iter, block->bbLiveIn, i);
- while (iter.NextElem(&i))
+ VarSetOps::Iter iter(compiler, block->bbLiveIn);
+ unsigned varIndex = 0;
+ while (iter.NextElem(&varIndex))
{
- unsigned varNum = compiler->lvaTrackedToVarNum[i];
+ unsigned varNum = compiler->lvaTrackedToVarNum[varIndex];
// lvRefCnt may go down to 0 after liveness-analysis.
// So we need to check if this tracked variable is actually used.
if (!compiler->lvaTable[varNum].lvIsInReg() && !compiler->lvaTable[varNum].lvOnFrame)
VARSET_TP killed(VarSetOps::Diff(compiler, siLastLife, compiler->compCurLife));
assert(VarSetOps::IsSubset(compiler, killed, compiler->lvaTrackedVars));
- VARSET_ITER_INIT(compiler, iter, killed, i);
- while (iter.NextElem(&i))
+ VarSetOps::Iter iter(compiler, killed);
+ unsigned varIndex = 0;
+ while (iter.NextElem(&varIndex))
{
#ifdef DEBUG
- unsigned lclNum = compiler->lvaTrackedToVarNum[i];
+ unsigned lclNum = compiler->lvaTrackedToVarNum[varIndex];
LclVarDsc* lclVar = &compiler->lvaTable[lclNum];
assert(lclVar->lvTracked);
#endif
- siScope* scope = siLatestTrackedScopes[i];
- siEndTrackedScope(i);
+ siScope* scope = siLatestTrackedScopes[varIndex];
+ siEndTrackedScope(varIndex);
}
VarSetOps::Assign(compiler, siLastLife, compiler->compCurLife);
Compiler* comp = m_pCompiler;
BitVecTraits traits(comp->fgBBNumMax + 1, comp);
- BitVec BITVEC_INIT_NOCOPY(visited, BitVecOps::MakeEmpty(&traits));
+ BitVec visited(BitVecOps::MakeEmpty(&traits));
// Display basic blocks.
DBEXEC(VERBOSE, comp->fgDispBasicBlocks());
// Add entry point to processed as its IDom is NULL.
BitVecTraits traits(m_pCompiler->fgBBNumMax + 1, m_pCompiler);
- BitVec BITVEC_INIT_NOCOPY(processed, BitVecOps::MakeEmpty(&traits));
+ BitVec processed(BitVecOps::MakeEmpty(&traits));
BitVecOps::AddElemD(&traits, processed, m_pCompiler->fgFirstBB->bbNum);
assert(postOrder[count - 1] == m_pCompiler->fgFirstBB);
}
// For each local var number "lclNum" that "block" assigns to...
- VARSET_ITER_INIT(m_pCompiler, defVars, block->bbVarDef, varIndex);
+ VarSetOps::Iter defVars(m_pCompiler, block->bbVarDef);
+ unsigned varIndex = 0;
while (defVars.NextElem(&varIndex))
{
unsigned lclNum = m_pCompiler->lvaTrackedToVarNum[varIndex];
typedef AllVarSetOps::ValArgType ALLVARSET_VALARG_TP;
typedef AllVarSetOps::RetValType ALLVARSET_VALRET_TP;
-// The iterator pattern.
-
-// Use this to initialize an iterator "iterName" to iterate over a VARSET_TP "vs".
-// "varIndex" will be an unsigned variable to which we assign the elements of "vs".
-#define VARSET_ITER_INIT(comp, iterName, vs, varIndex) \
- unsigned varIndex = 0; \
- VarSetOps::Iter iterName(comp, vs)
-
#endif // _VARSET_INCLUDED_