diff options
author | Andy Ayers <andya@microsoft.com> | 2018-07-23 11:47:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-23 11:47:17 -0700 |
commit | 456d22753b62b5e46b61fa13bef75847229d30ca (patch) | |
tree | 52ed64cb20be51d1eac453c61870451a49dc7fc6 /src/jit/compiler.hpp | |
parent | 92d2c4bde42569d2aa22e44550d69f7d743bf9a0 (diff) | |
download | coreclr-456d22753b62b5e46b61fa13bef75847229d30ca.tar.gz coreclr-456d22753b62b5e46b61fa13bef75847229d30ca.tar.bz2 coreclr-456d22753b62b5e46b61fa13bef75847229d30ca.zip |
JIT: some lclvars related cleanup (#19077)
Consolidate various compiler globals used when setting local var ref
counts by folding them into the visitor:
* lvaMarkRefsCurBlock
* lvaMarkRefsCurStmt
* lvaMarkRefsWeight
Remove the largely vestigial `lvPrefReg` and associated methods to set
or modify this field. Haven't verified but this is likely a remmant of
the legacy backend.
In the one remaning use (lcl var sorting predicates), swap in `lvIsRegArg`
instead, which gets most of the same cases.
Diffstat (limited to 'src/jit/compiler.hpp')
-rw-r--r-- | src/jit/compiler.hpp | 112 |
1 files changed, 5 insertions, 107 deletions
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp index 0385e1035c..165255a639 100644 --- a/src/jit/compiler.hpp +++ b/src/jit/compiler.hpp @@ -1885,7 +1885,7 @@ inline void LclVarDsc::decRefCnts(BasicBlock::weight_t weight, Compiler* comp, R { for (unsigned i = lvFieldLclStart; i < lvFieldLclStart + lvFieldCnt; ++i) { - comp->lvaTable[i].decRefCnts(comp->lvaMarkRefsWeight, comp, state, false); // Don't propagate + comp->lvaTable[i].decRefCnts(weight, comp, state, false); // Don't propagate } } } @@ -1898,7 +1898,7 @@ inline void LclVarDsc::decRefCnts(BasicBlock::weight_t weight, Compiler* comp, R assert(!parentvarDsc->lvRegStruct); if (promotionType == Compiler::PROMOTION_TYPE_DEPENDENT) { - parentvarDsc->decRefCnts(comp->lvaMarkRefsWeight, comp, state, false); // Don't propagate + parentvarDsc->decRefCnts(weight, comp, state, false); // Don't propagate } } @@ -1942,7 +1942,7 @@ inline void LclVarDsc::incRefCnts(BasicBlock::weight_t weight, Compiler* comp, R setLvRefCnt((unsigned short)newRefCnt, state); } - // This fires when an uninitialize value for 'weight' is used (see lvaMarkRefsWeight) + // This fires when an uninitialize value for 'weight' is used assert(weight != 0xdddddddd); // // Increment lvRefCntWtd @@ -1976,7 +1976,7 @@ inline void LclVarDsc::incRefCnts(BasicBlock::weight_t weight, Compiler* comp, R { for (unsigned i = lvFieldLclStart; i < lvFieldLclStart + lvFieldCnt; ++i) { - comp->lvaTable[i].incRefCnts(comp->lvaMarkRefsWeight, comp, state, false); // Don't propagate + comp->lvaTable[i].incRefCnts(weight, comp, state, false); // Don't propagate } } } @@ -1989,7 +1989,7 @@ inline void LclVarDsc::incRefCnts(BasicBlock::weight_t weight, Compiler* comp, R assert(!parentvarDsc->lvRegStruct); if (promotionType == Compiler::PROMOTION_TYPE_DEPENDENT) { - parentvarDsc->incRefCnts(comp->lvaMarkRefsWeight, comp, state, false); // Don't propagate + parentvarDsc->incRefCnts(weight, comp, state, false); // Don't propagate } } @@ -2008,108 +2008,6 @@ inline void LclVarDsc::incRefCnts(BasicBlock::weight_t weight, Compiler* comp, R /***************************************************************************** * - * Set the lvPrefReg field to reg - */ - -inline void LclVarDsc::setPrefReg(regNumber regNum, Compiler* comp) -{ - regMaskTP regMask; - if (isFloatRegType(TypeGet())) - { - // Check for FP struct-promoted field being passed in integer register - // - if (!genIsValidFloatReg(regNum)) - { - return; - } - regMask = genRegMaskFloat(regNum, TypeGet()); - } - else - { - regMask = genRegMask(regNum); - } - -#ifdef _TARGET_ARM_ - // Don't set a preferred register for a TYP_STRUCT that takes more than one register slot - if ((TypeGet() == TYP_STRUCT) && (lvSize() > REGSIZE_BYTES)) - return; -#endif - - /* Only interested if we have a new register bit set */ - if (lvPrefReg & regMask) - { - return; - } - -#ifdef DEBUG - if (comp->verbose) - { - if (lvPrefReg) - { - printf("Change preferred register for V%02u from ", this - comp->lvaTable); - dspRegMask(lvPrefReg); - } - else - { - printf("Set preferred register for V%02u", this - comp->lvaTable); - } - printf(" to "); - dspRegMask(regMask); - printf("\n"); - } -#endif - - /* Overwrite the lvPrefReg field */ - - lvPrefReg = (regMaskSmall)regMask; -} - -/***************************************************************************** - * - * Add regMask to the lvPrefReg field - */ - -inline void LclVarDsc::addPrefReg(regMaskTP regMask, Compiler* comp) -{ - assert(regMask != RBM_NONE); - -#ifdef _TARGET_ARM_ - // Don't set a preferred register for a TYP_STRUCT that takes more than one register slot - if ((lvType == TYP_STRUCT) && (lvSize() > REGSIZE_BYTES)) - return; -#endif - - /* Only interested if we have a new register bit set */ - if (lvPrefReg & regMask) - { - return; - } - -#ifdef DEBUG - if (comp->verbose) - { - if (lvPrefReg) - { - printf("Additional preferred register for V%02u from ", this - comp->lvaTable); - dspRegMask(lvPrefReg); - } - else - { - printf("Set preferred register for V%02u", this - comp->lvaTable); - } - printf(" to "); - dspRegMask(lvPrefReg | regMask); - printf("\n"); - } -#endif - - /* Update the lvPrefReg field */ - - lvPrefReg |= regMask; -} - -/***************************************************************************** - * * The following returns the mask of all tracked locals * referenced in a statement. */ |