@@ -178,22 +178,16 @@ void lsraAssignRegToTree(GenTree* tree, regNumber reg, unsigned regIdx)
178178//
179179// Returns:
180180// Weight of ref position.
181- weight_t LinearScan::getWeight(RefPosition* refPos DEBUG_ARG(bool forDump) )
181+ weight_t LinearScan::getWeight(RefPosition* refPos)
182182{
183+ // RefTypeKill does not have a valid treeNode field, so we do not expect
184+ // to see getWeight called for it
185+ assert(refPos->refType != RefTypeKill);
186+
183187 weight_t weight;
184188 GenTree* treeNode = refPos->treeNode;
185189
186- #ifdef HAS_MORE_THAN_64_REGISTERS
187- // If refType is `RefTypeKill`, we are using the killRegisterAssignment
188- // and treeNode field is garbage.
189- assert(forDump || refPos->refType != RefTypeKill);
190- #endif
191-
192- if (treeNode != nullptr
193- #ifdef DEBUG
194- && (refPos->refType != RefTypeKill)
195- #endif
196- )
190+ if (treeNode != nullptr)
197191 {
198192 if (isCandidateLocalRef(treeNode))
199193 {
@@ -241,21 +235,6 @@ weight_t LinearScan::getWeight(RefPosition* refPos DEBUG_ARG(bool forDump))
241235 return weight;
242236}
243237
244- #ifdef DEBUG
245- //-------------------------------------------------------------
246- // getWeightForDump: Returns the weight of the RefPosition, for dump
247- //
248- // Arguments:
249- // refPos - ref position
250- //
251- // Returns:
252- // Weight of ref position.
253- weight_t LinearScan::getWeightForDump(RefPosition* refPos)
254- {
255- return getWeight(refPos, true);
256- }
257- #endif
258-
259238// allRegs represents a set of registers that can
260239// be used to allocate the specified type in any point
261240// in time (more of a 'bank' of registers).
@@ -303,11 +282,7 @@ void LinearScan::updateNextFixedRef(RegRecord* regRecord, RefPosition* nextRefPo
303282 RefPosition* kill = nextKill;
304283 while ((kill != nullptr) && (kill->nodeLocation < nextLocation))
305284 {
306- #ifdef HAS_MORE_THAN_64_REGISTERS
307- if (kill->killRegisterAssignment.IsRegNumInMask(regRecord->regNum))
308- #else
309- if ((kill->registerAssignment & genSingleTypeRegMask(regRecord->regNum)) != RBM_NONE)
310- #endif
285+ if (kill->killedRegisters.IsRegNumInMask(regRecord->regNum))
311286 {
312287 nextLocation = kill->nodeLocation;
313288 break;
@@ -4066,7 +4041,7 @@ void LinearScan::processKills(RefPosition* killRefPosition)
40664041{
40674042 RefPosition* nextKill = killRefPosition->nextRefPosition;
40684043
4069- regMaskTP killedRegs = killRefPosition->getKillRegisterAssignment ();
4044+ regMaskTP killedRegs = killRefPosition->getKilledRegisters ();
40704045 while (killedRegs.IsNonEmpty())
40714046 {
40724047 regNumber killedReg = genFirstRegNumFromMaskAndToggle(killedRegs);
@@ -4086,9 +4061,9 @@ void LinearScan::processKills(RefPosition* killRefPosition)
40864061 updateNextFixedRef(regRecord, regNextRefPos, nextKill);
40874062 }
40884063
4089- regsBusyUntilKill &= ~killRefPosition->getKillRegisterAssignment ();
4064+ regsBusyUntilKill &= ~killRefPosition->getKilledRegisters ();
40904065 INDEBUG(dumpLsraAllocationEvent(LSRA_EVENT_KILL_REGS, nullptr, REG_NA, nullptr, NONE,
4091- killRefPosition->getKillRegisterAssignment ()));
4066+ killRefPosition->getKilledRegisters ()));
40924067}
40934068
40944069//------------------------------------------------------------------------
@@ -10420,36 +10395,34 @@ void RefPosition::dump(LinearScan* linearScan)
1042010395
1042110396 printf(" %s ", getRefTypeName(refType));
1042210397
10423- if (this-> IsPhysRegRef())
10398+ if (IsPhysRegRef())
1042410399 {
10425- this-> getReg()->tinyDump();
10400+ getReg()->tinyDump();
1042610401 }
1042710402 else if (getInterval())
1042810403 {
10429- this-> getInterval()->tinyDump();
10404+ getInterval()->tinyDump();
1043010405 }
10431- if ((refType != RefTypeKill) && this-> treeNode)
10406+ if ((refType != RefTypeKill) && treeNode)
1043210407 {
1043310408 printf("%s", treeNode->OpName(treeNode->OperGet()));
10434- if (this-> treeNode->IsMultiRegNode())
10409+ if (treeNode->IsMultiRegNode())
1043510410 {
10436- printf("[%d]", this-> multiRegIdx);
10411+ printf("[%d]", multiRegIdx);
1043710412 }
1043810413 printf(" ");
1043910414 }
10440- printf(FMT_BB " ", this-> bbNum);
10415+ printf(FMT_BB " ", bbNum);
1044110416
1044210417 printf("regmask=");
10443- #ifdef HAS_MORE_THAN_64_REGISTERS
1044410418 if (refType == RefTypeKill)
1044510419 {
10446- linearScan->compiler->dumpRegMask(getKillRegisterAssignment ());
10420+ linearScan->compiler->dumpRegMask(getKilledRegisters ());
1044710421 }
1044810422 else
10449- #endif // HAS_MORE_THAN_64_REGISTERS
1045010423 {
1045110424 var_types type = TYP_UNKNOWN;
10452- if ((refType == RefTypeBB) || (refType == RefTypeKillGCRefs) || (refType == RefTypeKill) )
10425+ if ((refType == RefTypeBB) || (refType == RefTypeKillGCRefs))
1045310426 {
1045410427 // These refTypes do not have intervals
1045510428 type = TYP_INT;
@@ -10463,57 +10436,61 @@ void RefPosition::dump(LinearScan* linearScan)
1046310436
1046410437 printf(" minReg=%d", minRegCandidateCount);
1046510438
10466- if (this-> lastUse)
10439+ if (lastUse)
1046710440 {
1046810441 printf(" last");
1046910442 }
10470- if (this-> reload)
10443+ if (reload)
1047110444 {
1047210445 printf(" reload");
1047310446 }
10474- if (this-> spillAfter)
10447+ if (spillAfter)
1047510448 {
1047610449 printf(" spillAfter");
1047710450 }
10478- if (this-> singleDefSpill)
10451+ if (singleDefSpill)
1047910452 {
1048010453 printf(" singleDefSpill");
1048110454 }
10482- if (this-> writeThru)
10455+ if (writeThru)
1048310456 {
1048410457 printf(" writeThru");
1048510458 }
10486- if (this-> moveReg)
10459+ if (moveReg)
1048710460 {
1048810461 printf(" move");
1048910462 }
10490- if (this-> copyReg)
10463+ if (copyReg)
1049110464 {
1049210465 printf(" copy");
1049310466 }
10494- if (this-> isFixedRegRef)
10467+ if (isFixedRegRef)
1049510468 {
1049610469 printf(" fixed");
1049710470 }
10498- if (this-> isLocalDefUse)
10471+ if (isLocalDefUse)
1049910472 {
1050010473 printf(" local");
1050110474 }
10502- if (this-> delayRegFree)
10475+ if (delayRegFree)
1050310476 {
1050410477 printf(" delay");
1050510478 }
10506- if (this-> outOfOrder)
10479+ if (outOfOrder)
1050710480 {
1050810481 printf(" outOfOrder");
1050910482 }
1051010483
10511- if (this-> RegOptional())
10484+ if (RegOptional())
1051210485 {
1051310486 printf(" regOptional");
1051410487 }
1051510488
10516- printf(" wt=%.2f", linearScan->getWeightForDump(this));
10489+ if (refType != RefTypeKill)
10490+ {
10491+ printf(" wt=%.2f", linearScan->getWeight(this));
10492+ }
10493+
1051710494 printf(">\n");
1051810495}
1051910496
@@ -11116,7 +11093,7 @@ void LinearScan::TupleStyleDump(LsraTupleDumpMode mode)
1111611093 printf("\n Kill: ");
1111711094 killPrinted = true;
1111811095 }
11119- compiler->dumpRegMask(currentRefPosition->getKillRegisterAssignment ());
11096+ compiler->dumpRegMask(currentRefPosition->getKilledRegisters ());
1112011097 printf(" ");
1112111098 break;
1112211099 case RefTypeFixedReg:
@@ -12130,7 +12107,7 @@ void LinearScan::verifyFinalAllocation()
1213012107
1213112108 case RefTypeKill:
1213212109 dumpLsraAllocationEvent(LSRA_EVENT_KILL_REGS, nullptr, REG_NA, currentBlock, NONE,
12133- currentRefPosition.getKillRegisterAssignment ());
12110+ currentRefPosition.getKilledRegisters ());
1213412111 break;
1213512112
1213612113 case RefTypeFixedReg:
0 commit comments