summaryrefslogtreecommitdiff
path: root/src/jit/regalloc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jit/regalloc.cpp')
-rw-r--r--src/jit/regalloc.cpp46
1 files changed, 31 insertions, 15 deletions
diff --git a/src/jit/regalloc.cpp b/src/jit/regalloc.cpp
index 8280503795..a9119945d9 100644
--- a/src/jit/regalloc.cpp
+++ b/src/jit/regalloc.cpp
@@ -4835,6 +4835,17 @@ regMaskTP Compiler::rpPredictTreeRegUse(GenTreePtr tree,
}
assert(list == NULL);
+#ifdef LEGACY_BACKEND
+#if CPU_LOAD_STORE_ARCH
+#ifdef FEATURE_READYTORUN_COMPILER
+ if (tree->gtCall.IsR2RRelativeIndir())
+ {
+ tree->gtUsedRegs |= RBM_R2R_INDIRECT_PARAM;
+ }
+#endif // FEATURE_READYTORUN_COMPILER
+#endif // CPU_LOAD_STORE_ARCH
+#endif // LEGACY_BACKEND
+
regMaskTP callAddrMask;
callAddrMask = RBM_NONE;
#if CPU_LOAD_STORE_ARCH
@@ -6256,23 +6267,13 @@ void Compiler::rpPredictRegUse()
mustPredict |= rpLostEnreg;
#ifdef _TARGET_ARM_
-
// See if we previously reserved REG_R10 and try to make it available if we have a small frame now
- //
- if ((rpPasses == 0) && (codeGen->regSet.rsMaskResvd & RBM_OPT_RSVD))
+ if ((rpPasses == 0) && ((codeGen->regSet.rsMaskResvd & RBM_OPT_RSVD) != 0) &&
+ !compRsvdRegCheck(REGALLOC_FRAME_LAYOUT))
{
- if (compRsvdRegCheck(REGALLOC_FRAME_LAYOUT))
- {
- // We must keep reserving R10 in this case
- codeGen->regSet.rsMaskResvd |= RBM_OPT_RSVD;
- }
- else
- {
- // We can release our reservation on R10 and use it to color registers
- //
- codeGen->regSet.rsMaskResvd &= ~RBM_OPT_RSVD;
- allAcceptableRegs |= RBM_OPT_RSVD;
- }
+ // We can release our reservation on R10 and use it to color registers
+ codeGen->regSet.rsMaskResvd &= ~RBM_OPT_RSVD;
+ allAcceptableRegs |= RBM_OPT_RSVD;
}
#endif
@@ -6470,6 +6471,21 @@ void Compiler::rpPredictRegUse()
/* Decide whether we need to set mustPredict */
mustPredict = false;
+#ifdef _TARGET_ARM_
+ // The spill count may be now high enough that we now need to reserve r10. If this is the case, we'll need to
+ // reserve r10, and if it was used, throw out the last prediction and repredict.
+ if (((codeGen->regSet.rsMaskResvd & RBM_OPT_RSVD) == 0) && compRsvdRegCheck(REGALLOC_FRAME_LAYOUT))
+ {
+ codeGen->regSet.rsMaskResvd |= RBM_OPT_RSVD;
+ allAcceptableRegs &= ~RBM_OPT_RSVD;
+ if ((regUsed & RBM_OPT_RSVD) != 0)
+ {
+ mustPredict = true;
+ rpBestRecordedPrediction = nullptr;
+ }
+ }
+#endif
+
if (rpAddedVarIntf)
{
mustPredict = true;