From d84dbd6075b45cc43b5201c78b4de61aec808eec Mon Sep 17 00:00:00 2001 From: Hyung-Kyu Choi Date: Wed, 21 Jun 2017 11:21:45 +0900 Subject: [PATCH] Introduce LinearScan::isAssignedToInterval() Signed-off-by: Hyung-Kyu Choi Commit migrated from https://github.com/dotnet/coreclr/commit/12b5f6cfc4e4fed885b090ae9177e0c0286550de --- src/coreclr/src/jit/lsra.cpp | 16 ++++++++++------ src/coreclr/src/jit/lsra.h | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/coreclr/src/jit/lsra.cpp b/src/coreclr/src/jit/lsra.cpp index 1fd2d26..16672cc 100644 --- a/src/coreclr/src/jit/lsra.cpp +++ b/src/coreclr/src/jit/lsra.cpp @@ -6823,6 +6823,15 @@ bool LinearScan::canRestorePreviousInterval(RegRecord* regRec, Interval* assigne return retVal; } +bool LinearScan::isAssignedToInterval(Interval* interval, RegRecord* regRec) +{ + bool isAssigned = (interval->assignedReg == regRec); +#ifdef _TARGET_ARM_ + isAssigned |= isSecondHalfReg(regRec, interval); +#endif + return isAssigned; +} + //------------------------------------------------------------------------ // processBlockStartLocations: Update var locations on entry to 'currentBlock' and clear constant // registers. @@ -7005,12 +7014,7 @@ void LinearScan::processBlockStartLocations(BasicBlock* currentBlock, bool alloc // Is there another interval currently assigned to this register? If so unassign it. if (assignedInterval != nullptr) { -#ifdef _TARGET_ARM_ - if (assignedInterval->assignedReg == targetRegRecord || - isSecondHalfReg(targetRegRecord, assignedInterval)) -#else - if (assignedInterval->assignedReg == targetRegRecord) -#endif + if (isAssignedToInterval(assignedInterval, targetRegRecord)) { regNumber assignedRegNum = assignedInterval->assignedReg->regNum; diff --git a/src/coreclr/src/jit/lsra.h b/src/coreclr/src/jit/lsra.h index 14a986f..bb7b52f 100644 --- a/src/coreclr/src/jit/lsra.h +++ b/src/coreclr/src/jit/lsra.h @@ -700,6 +700,7 @@ private: void updateAssignedInterval(RegRecord* reg, Interval* interval, RegisterType regType); #endif bool canRestorePreviousInterval(RegRecord* regRec, Interval* assignedInterval); + bool isAssignedToInterval(Interval* interval, RegRecord* regRec); RefType CheckBlockType(BasicBlock* block, BasicBlock* prevBlock); -- 2.7.4