summaryrefslogtreecommitdiff
path: root/src/jit/lsra.h
diff options
context:
space:
mode:
authorsivarv <sivarv@microsoft.com>2016-07-06 11:29:36 -0700
committersivarv <sivarv@microsoft.com>2016-07-07 11:54:44 -0700
commitcc23275388ec304aeca054b9a255c87a502c2bcd (patch)
treebc7771f4dd160153480444edb8b3e39caa6fd51d /src/jit/lsra.h
parente18245844cc8400400fc05c01ecf311cb9bdf019 (diff)
downloadcoreclr-cc23275388ec304aeca054b9a255c87a502c2bcd.tar.gz
coreclr-cc23275388ec304aeca054b9a255c87a502c2bcd.tar.bz2
coreclr-cc23275388ec304aeca054b9a255c87a502c2bcd.zip
Code review feedback.
Diffstat (limited to 'src/jit/lsra.h')
-rw-r--r--src/jit/lsra.h52
1 files changed, 30 insertions, 22 deletions
diff --git a/src/jit/lsra.h b/src/jit/lsra.h
index dc6d689d2e..11af9be3aa 100644
--- a/src/jit/lsra.h
+++ b/src/jit/lsra.h
@@ -538,8 +538,8 @@ private:
LsraSpill getLsraSpill() { return (LsraSpill) (lsraStressMask & LSRA_SPILL_MASK); }
bool spillAlways() { return getLsraSpill() == LSRA_SPILL_ALWAYS; }
- // This controls whether RefPositions that require a register optionally should
- // be allocated a reg at all.
+ // This controls whether RefPositions that lower/codegen indicated as reg optional be
+ // allocated a reg at all.
enum LsraRegOptionalControl { LSRA_REG_OPTIONAL_DEFAULT = 0,
LSRA_REG_OPTIONAL_NO_ALLOC = 0x1000,
LSRA_REG_OPTIONAL_MASK = 0x1000 };
@@ -768,7 +768,7 @@ private:
regNumber tryAllocateFreeReg(Interval *current, RefPosition *refPosition);
RegRecord* findBestPhysicalReg(RegisterType regType, LsraLocation endLocation,
regMaskTP candidates, regMaskTP preferences);
- regNumber allocateBusyReg(Interval* current, RefPosition* refPosition, bool allocationOptional);
+ regNumber allocateBusyReg(Interval* current, RefPosition* refPosition, bool allocateIfProfitable);
regNumber assignCopyReg(RefPosition * refPosition);
void checkAndAssignInterval(RegRecord * regRec, Interval * interval);
@@ -1355,15 +1355,39 @@ public:
RefType refType;
+ // Returns true if it is a reference on a gentree node.
bool IsActualRef()
{
return (refType == RefTypeDef ||
- refType == RefTypeUse
+ refType == RefTypeUse);
+ }
+
+ bool RequiresRegister()
+ {
+ return (IsActualRef()
#if FEATURE_PARTIAL_SIMD_CALLEE_SAVE
- || refType == RefTypeUpperVectorSaveDef
+ || refType == RefTypeUpperVectorSaveDef
|| refType == RefTypeUpperVectorSaveUse
#endif // FEATURE_PARTIAL_SIMD_CALLEE_SAVE
- );
+ ) && !AllocateIfProfitable();
+ }
+
+ // Returns true whether this ref position is to be allocated
+ // a reg only if it is profitable. Currently these are the
+ // ref positions that lower/codegen has indicated as reg
+ // optional and is considered a contained memory operand if
+ // no reg is allocated.
+ bool AllocateIfProfitable()
+ {
+ // TODO-CQ: Right now if a ref position is marked as
+ // copyreg or movereg, then it is not treated as
+ // 'allocate if profitable'. This is an implementation
+ // limitation that needs to be addressed.
+ return (refType == RefTypeUse) &&
+ !copyReg &&
+ !moveReg &&
+ (treeNode != nullptr) &&
+ treeNode->IsRegOptional();
}
// Used by RefTypeDef/Use positions of a multi-reg call node.
@@ -1381,22 +1405,6 @@ public:
unsigned getMultiRegIdx() { return multiRegIdx; }
- // Returns true if codegen has indicated that the tree node
- // referred to by RefPosition can be treated as a contained
- // memory operand if no register was allocated.
- bool IsRegOptional()
- {
- // TODO-CQ: Right now if a ref position is marked as
- // copyreg or movereg, then it is always allocated a
- // register, though it is marked as reg optional.
- // This is an implementation limitation that needs to
- // be addressed.
- return (refType == RefTypeUse) &&
- !copyReg &&
- !moveReg &&
- (treeNode != nullptr) &&
- treeNode->IsRegOptional();
- }
// Last Use - this may be true for multiple RefPositions in the same Interval
bool lastUse : 1;