Skip to content

Commit 325bc6e

Browse files
committed
REVERT: temporary add #ifdef TARGET_ARM64 for accessing regMaskTP methods
1 parent 06bd9e2 commit 325bc6e

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

src/coreclr/jit/lsra.cpp

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,11 @@ void LinearScan::updateNextFixedRef(RegRecord* regRecord, RefPosition* nextRefPo
302302
SingleTypeRegSet LinearScan::getMatchingConstants(SingleTypeRegSet mask, Interval* currentInterval, RefPosition* refPosition)
303303
{
304304
assert(currentInterval->isConstant && RefTypeIsDef(refPosition->refType));
305+
#ifdef TARGET_ARM64
305306
SingleTypeRegSet candidates = (mask & m_RegistersWithConstants).GetRegSetForType(currentInterval->registerType);
307+
#else
308+
SingleTypeRegSet candidates = (mask & m_RegistersWithConstants);
309+
#endif
306310
SingleTypeRegSet result = RBM_NONE;
307311
while (candidates != RBM_NONE)
308312
{
@@ -495,7 +499,12 @@ SingleTypeRegSet LinearScan::getConstrainedRegMask(RefPosition* refPosition,
495499

496500
if ((refPosition != nullptr) && !refPosition->RegOptional())
497501
{
498-
SingleTypeRegSet busyRegs = (regsBusyUntilKill | regsInUseThisLocation).GetRegSetForType(TYP_VOID); //TODO: Pass the right type
502+
#ifdef TARGET_ARM64
503+
// TODO-lsra: Pass the right type
504+
SingleTypeRegSet busyRegs = (regsBusyUntilKill | regsInUseThisLocation).GetRegSetForType(TYP_VOID);
505+
#else
506+
SingleTypeRegSet busyRegs = (regsBusyUntilKill | regsInUseThisLocation);
507+
#endif
499508
if ((newMask & ~busyRegs) == RBM_NONE)
500509
{
501510
// Constrained mask does not have at least one free register to allocate.
@@ -13481,8 +13490,14 @@ SingleTypeRegSet LinearScan::RegisterSelection::select(Interval*
1348113490
if (currentInterval->isWriteThru)
1348213491
{
1348313492
// We'll only prefer a callee-save register if it's already been used.
13493+
#ifdef TARGET_ARM64
1348413494
SingleTypeRegSet unusedCalleeSaves =
1348513495
calleeSaveCandidates & ~(linearScan->compiler->codeGen->regSet.rsGetModifiedRegsMask()).GetRegSetForType(regType);
13496+
#else
13497+
SingleTypeRegSet unusedCalleeSaves =
13498+
calleeSaveCandidates &
13499+
~(linearScan->compiler->codeGen->regSet.rsGetModifiedRegsMask());
13500+
#endif
1348613501
callerCalleePrefs = calleeSaveCandidates & ~unusedCalleeSaves;
1348713502
preferences &= ~unusedCalleeSaves;
1348813503
}
@@ -13531,7 +13546,11 @@ SingleTypeRegSet LinearScan::RegisterSelection::select(Interval*
1353113546
// TODO-CQ: We assign same registerAssignment to UPPER_RESTORE and the next USE.
1353213547
// When we allocate for USE, we see that the register is busy at current location
1353313548
// and we end up with that candidate is no longer available.
13549+
#ifdef TARGET_ARM64
1353413550
SingleTypeRegSet busyRegs = (linearScan->regsBusyUntilKill | linearScan->regsInUseThisLocation).GetRegSetForType(regType);
13551+
#else
13552+
SingleTypeRegSet busyRegs = (linearScan->regsBusyUntilKill | linearScan->regsInUseThisLocation);
13553+
#endif
1353513554
candidates &= ~busyRegs;
1353613555

1353713556
#ifdef TARGET_ARM
@@ -13553,7 +13572,11 @@ SingleTypeRegSet LinearScan::RegisterSelection::select(Interval*
1355313572
// Also eliminate as busy any register with a conflicting fixed reference at this or
1355413573
// the next location.
1355513574
// Note that this will eliminate the fixedReg, if any, but we'll add it back below.
13575+
#ifdef TARGET_ARM64
1355613576
SingleTypeRegSet checkConflictMask = candidates & linearScan->fixedRegs.GetRegSetForType(regType);
13577+
#else
13578+
SingleTypeRegSet checkConflictMask = candidates & linearScan->fixedRegs;
13579+
#endif
1355713580
while (checkConflictMask != RBM_NONE)
1355813581
{
1355913582
regNumber checkConflictReg = genFirstRegNumFromMask(checkConflictMask);
@@ -13853,7 +13876,11 @@ SingleTypeRegSet LinearScan::RegisterSelection::selectMinimal(
1385313876
// TODO-CQ: We assign same registerAssignment to UPPER_RESTORE and the next USE.
1385413877
// When we allocate for USE, we see that the register is busy at current location
1385513878
// and we end up with that candidate is no longer available.
13879+
#ifdef TARGET_ARM64
1385613880
SingleTypeRegSet busyRegs = (linearScan->regsBusyUntilKill | linearScan->regsInUseThisLocation).GetRegSetForType(regType);
13881+
#else
13882+
SingleTypeRegSet busyRegs = (linearScan->regsBusyUntilKill | linearScan->regsInUseThisLocation);
13883+
#endif // TARGET_ARM64
1385713884
candidates &= ~busyRegs;
1385813885

1385913886
#ifdef TARGET_ARM
@@ -13871,7 +13898,11 @@ SingleTypeRegSet LinearScan::RegisterSelection::selectMinimal(
1387113898
// Also eliminate as busy any register with a conflicting fixed reference at this or
1387213899
// the next location.
1387313900
// Note that this will eliminate the fixedReg, if any, but we'll add it back below.
13901+
#ifdef TARGET_ARM64
1387413902
SingleTypeRegSet checkConflictMask = candidates & linearScan->fixedRegs.GetRegSetForType(regType);
13903+
#else
13904+
SingleTypeRegSet checkConflictMask = candidates & linearScan->fixedRegs;
13905+
#endif
1387513906
while (checkConflictMask != RBM_NONE)
1387613907
{
1387713908
regNumber checkConflictReg = genFirstRegNumFromMask(checkConflictMask);

src/coreclr/jit/lsra.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,11 @@ class LinearScan : public LinearScanInterface
12511251
result &= (m_AvailableRegs >> 1);
12521252
}
12531253
#endif // TARGET_ARM
1254+
#ifdef TARGET_ARM64
12541255
return result.GetRegSetForType(regType);
1256+
#else
1257+
return result;
1258+
#endif
12551259
}
12561260

12571261
#ifdef DEBUG

src/coreclr/jit/lsrabuild.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,11 +708,15 @@ void LinearScan::addKillForRegs(regMaskTP mask, LsraLocation currentLoc)
708708
// modified until codegen, which is too late.
709709
compiler->codeGen->regSet.rsSetRegsModified(mask DEBUGARG(true));
710710

711+
#ifdef TARGET_ARM64
711712
RefPosition* pos = newRefPosition((Interval*)nullptr, currentLoc, RefTypeKill, nullptr, mask.getLow());
712713
*killTail = pos;
713714
killTail = &pos->nextRefPosition;
714715

715716
pos = newRefPosition((Interval*)nullptr, currentLoc, RefTypeKill, nullptr, mask.getHigh());
717+
#else
718+
RefPosition* pos = newRefPosition((Interval*)nullptr, currentLoc, RefTypeKill, nullptr, mask);
719+
#endif
716720

717721
*killTail = pos;
718722
killTail = &pos->nextRefPosition;
@@ -1152,7 +1156,11 @@ bool LinearScan::buildKillPositionsForNode(GenTree* tree, LsraLocation currentLo
11521156
}
11531157
Interval* interval = getIntervalForLocalVar(varIndex);
11541158
const bool isCallKill = ((killMask == RBM_INT_CALLEE_TRASH) || (killMask == RBM_CALLEE_TRASH));
1159+
#ifdef TARGET_ARM64
11551160
SingleTypeRegSet regsKillMask = killMask.GetRegSetForType(interval->registerType);
1161+
#else
1162+
SingleTypeRegSet regsKillMask = killMask;
1163+
#endif
11561164

11571165
if (isCallKill)
11581166
{
@@ -3165,8 +3173,14 @@ void LinearScan::BuildCallDefs(GenTree* tree, int dstCount, regMaskTP dstCandida
31653173
// For all other cases of multi-reg definitions, the registers must be in sequential order.
31663174
regNumber thisReg = tree->AsCall()->GetReturnTypeDesc()->GetABIReturnReg(i, tree->AsCall()->GetUnmanagedCallConv());
31673175

3176+
#ifdef TARGET_ARM64
31683177
assert(dstCandidates.IsRegNumInMask(thisReg));
31693178
dstCandidates.RemoveRegNumFromMask(thisReg);
3179+
#else
3180+
assert((dstCandidates & genRegMask(thisReg)) != RBM_NONE);
3181+
dstCandidates &= ~genRegMask(thisReg);
3182+
#endif // TARGET_ARM64
3183+
31703184

31713185
BuildDef(tree, genRegMask(thisReg), i);
31723186
}
@@ -3368,7 +3382,11 @@ void LinearScan::UpdatePreferencesOfDyingLocal(Interval* interval)
33683382
}
33693383
#endif
33703384

3385+
#ifdef TARGET_ARM64
33713386
SingleTypeRegSet unprefSet = unpref.GetRegSetForType(interval->registerType);
3387+
#else
3388+
SingleTypeRegSet unprefSet = unpref;
3389+
#endif
33723390
interval->registerAversion |= unprefSet;
33733391
SingleTypeRegSet newPreferences = allRegs(interval->registerType) & ~unprefSet;
33743392
interval->updateRegisterPreferences(newPreferences);

0 commit comments

Comments
 (0)