summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jit/codegen.h2
-rw-r--r--src/jit/codegencommon.cpp23
-rw-r--r--src/jit/codegenlinear.cpp10
-rw-r--r--src/jit/codegenxarch.cpp6
-rw-r--r--src/jit/compiler.cpp65
-rw-r--r--src/jit/compiler.h238
-rw-r--r--src/jit/compiler.hpp12
-rw-r--r--src/jit/emitarm.cpp2
-rw-r--r--src/jit/emitarm64.cpp4
-rw-r--r--src/jit/emitxarch.cpp6
-rw-r--r--src/jit/flowgraph.cpp4
-rw-r--r--src/jit/gcencode.cpp10
-rw-r--r--src/jit/gcinfo.cpp4
-rw-r--r--src/jit/hashbv.cpp27
-rw-r--r--src/jit/hashbv.h26
-rw-r--r--src/jit/hwintrinsic.cpp54
-rw-r--r--src/jit/hwintrinsiccodegenxarch.cpp12
-rw-r--r--src/jit/importer.cpp29
-rw-r--r--src/jit/jit.h1
-rw-r--r--src/jit/lclvars.cpp23
-rw-r--r--src/jit/liveness.cpp3
-rw-r--r--src/jit/lsra.cpp8
-rw-r--r--src/jit/morph.cpp10
-rw-r--r--src/jit/optimizer.cpp42
-rw-r--r--src/jit/regset.cpp34
-rw-r--r--src/jit/regset.h56
-rw-r--r--src/jit/scopeinfo.cpp26
-rw-r--r--src/jit/simd.cpp266
-rw-r--r--src/jit/target.h4
29 files changed, 452 insertions, 555 deletions
diff --git a/src/jit/codegen.h b/src/jit/codegen.h
index 755859ad0b..ef2094347e 100644
--- a/src/jit/codegen.h
+++ b/src/jit/codegen.h
@@ -626,7 +626,7 @@ protected:
// Tracks the last entry for each tracked register variable
- siScope* siLatestTrackedScopes[lclMAX_TRACKED];
+ siScope** siLatestTrackedScopes;
IL_OFFSET siLastEndOffs; // IL offset of the (exclusive) end of the last block processed
diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp
index 56cebe0efd..5ed6a633df 100644
--- a/src/jit/codegencommon.cpp
+++ b/src/jit/codegencommon.cpp
@@ -121,7 +121,7 @@ CodeGen::CodeGen(Compiler* theCompiler) : CodeGenInterface(theCompiler)
setVerbose(compiler->verbose);
#endif // DEBUG
- compiler->tmpInit();
+ regSet.tmpInit();
instInit();
@@ -2314,7 +2314,7 @@ void CodeGen::genGenerateCode(void** codePtr, ULONG* nativeSizeOfCode)
genFinalizeFrame();
- unsigned maxTmpSize = compiler->tmpSize; // This is precise after LSRA has pre-allocated the temps.
+ unsigned maxTmpSize = regSet.tmpGetTotalSize(); // This is precise after LSRA has pre-allocated the temps.
getEmitter()->emitBegFN(isFramePointerUsed()
#if defined(DEBUG)
@@ -2581,7 +2581,7 @@ void CodeGen::genGenerateCode(void** codePtr, ULONG* nativeSizeOfCode)
/* Shut down the temp logic */
- compiler->tmpDone();
+ regSet.tmpDone();
#if DISPLAY_SIZES
@@ -4781,8 +4781,8 @@ void CodeGen::genCheckUseBlockInit()
if (!TRACK_GC_TEMP_LIFETIMES)
{
- assert(compiler->tmpAllFree());
- for (TempDsc* tempThis = compiler->tmpListBeg(); tempThis != nullptr; tempThis = compiler->tmpListNxt(tempThis))
+ assert(regSet.tmpAllFree());
+ for (TempDsc* tempThis = regSet.tmpListBeg(); tempThis != nullptr; tempThis = regSet.tmpListNxt(tempThis))
{
if (varTypeIsGC(tempThis->tdTempType()))
{
@@ -6542,9 +6542,8 @@ void CodeGen::genZeroInitFrame(int untrLclHi, int untrLclLo, regNumber initReg,
if (!TRACK_GC_TEMP_LIFETIMES)
{
- assert(compiler->tmpAllFree());
- for (TempDsc* tempThis = compiler->tmpListBeg(); tempThis != nullptr;
- tempThis = compiler->tmpListNxt(tempThis))
+ assert(regSet.tmpAllFree());
+ for (TempDsc* tempThis = regSet.tmpListBeg(); tempThis != nullptr; tempThis = regSet.tmpListNxt(tempThis))
{
if (!varTypeIsGC(tempThis->tdTempType()))
{
@@ -7695,7 +7694,7 @@ void CodeGen::genFinalizeFrame()
here (where we have committed to the final numbers for the frame offsets)
This will ensure that the prolog size is always correct
*/
- getEmitter()->emitMaxTmpSize = compiler->tmpSize;
+ getEmitter()->emitMaxTmpSize = regSet.tmpGetTotalSize();
#ifdef DEBUG
if (compiler->opts.dspCode || compiler->opts.disAsm || compiler->opts.disAsm2 || verbose)
@@ -7970,8 +7969,8 @@ void CodeGen::genFnProlog()
if (!TRACK_GC_TEMP_LIFETIMES)
{
- assert(compiler->tmpAllFree());
- for (TempDsc* tempThis = compiler->tmpListBeg(); tempThis != nullptr; tempThis = compiler->tmpListNxt(tempThis))
+ assert(regSet.tmpAllFree());
+ for (TempDsc* tempThis = regSet.tmpListBeg(); tempThis != nullptr; tempThis = regSet.tmpListNxt(tempThis))
{
if (!varTypeIsGC(tempThis->tdTempType()))
{
@@ -8552,7 +8551,7 @@ void CodeGen::genFnProlog()
getEmitter()->emitEndProlog();
compiler->unwindEndProlog();
- noway_assert(getEmitter()->emitMaxTmpSize == compiler->tmpSize);
+ noway_assert(getEmitter()->emitMaxTmpSize == regSet.tmpGetTotalSize());
}
#ifdef _PREFAST_
#pragma warning(pop)
diff --git a/src/jit/codegenlinear.cpp b/src/jit/codegenlinear.cpp
index 36a6fc8210..428b107e70 100644
--- a/src/jit/codegenlinear.cpp
+++ b/src/jit/codegenlinear.cpp
@@ -676,7 +676,7 @@ void CodeGen::genCodeForBBlist()
/* Finalize the temp tracking logic */
- compiler->tmpEnd();
+ regSet.tmpEnd();
#ifdef DEBUG
if (compiler->verbose)
@@ -991,7 +991,7 @@ void CodeGen::genUnspillRegIfNeeded(GenTree* tree)
TempDsc* t = regSet.rsUnspillInPlace(call, unspillTreeReg, i);
getEmitter()->emitIns_R_S(ins_Load(dstType), emitActualTypeSize(dstType), dstReg, t->tdTempNum(),
0);
- compiler->tmpRlsTemp(t);
+ regSet.tmpRlsTemp(t);
gcInfo.gcMarkRegPtrVal(dstReg, dstType);
}
}
@@ -1019,7 +1019,7 @@ void CodeGen::genUnspillRegIfNeeded(GenTree* tree)
TempDsc* t = regSet.rsUnspillInPlace(splitArg, dstReg, i);
getEmitter()->emitIns_R_S(ins_Load(dstType), emitActualTypeSize(dstType), dstReg, t->tdTempNum(),
0);
- compiler->tmpRlsTemp(t);
+ regSet.tmpRlsTemp(t);
gcInfo.gcMarkRegPtrVal(dstReg, dstType);
}
}
@@ -1046,7 +1046,7 @@ void CodeGen::genUnspillRegIfNeeded(GenTree* tree)
TempDsc* t = regSet.rsUnspillInPlace(multiReg, dstReg, i);
getEmitter()->emitIns_R_S(ins_Load(dstType), emitActualTypeSize(dstType), dstReg, t->tdTempNum(),
0);
- compiler->tmpRlsTemp(t);
+ regSet.tmpRlsTemp(t);
gcInfo.gcMarkRegPtrVal(dstReg, dstType);
}
}
@@ -1060,7 +1060,7 @@ void CodeGen::genUnspillRegIfNeeded(GenTree* tree)
TempDsc* t = regSet.rsUnspillInPlace(unspillTree, unspillTree->gtRegNum);
getEmitter()->emitIns_R_S(ins_Load(unspillTree->gtType), emitActualTypeSize(unspillTree->TypeGet()), dstReg,
t->tdTempNum(), 0);
- compiler->tmpRlsTemp(t);
+ regSet.tmpRlsTemp(t);
unspillTree->gtFlags &= ~GTF_SPILLED;
gcInfo.gcMarkRegPtrVal(dstReg, unspillTree->TypeGet());
diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp
index e74abeb5e9..1ceb928778 100644
--- a/src/jit/codegenxarch.cpp
+++ b/src/jit/codegenxarch.cpp
@@ -1294,7 +1294,7 @@ void CodeGen::genFloatReturn(GenTree* treeNode)
TempDsc* t = regSet.rsUnspillInPlace(op1, op1->gtRegNum);
inst_FS_ST(INS_fld, emitActualTypeSize(op1->gtType), t, 0);
op1->gtFlags &= ~GTF_SPILLED;
- compiler->tmpRlsTemp(t);
+ regSet.tmpRlsTemp(t);
}
}
#endif // _TARGET_X86_
@@ -7277,7 +7277,7 @@ void CodeGen::genSSE41RoundOp(GenTreeOp* treeNode)
varNum = tmpDsc->tdTempNum();
offset = 0;
- compiler->tmpRlsTemp(tmpDsc);
+ regSet.tmpRlsTemp(tmpDsc);
}
else if (srcNode->isIndir())
{
@@ -7766,7 +7766,7 @@ void CodeGen::genPutArgStkFieldList(GenTreePutArgStk* putArgStk)
assert(fieldNode->IsRegOptional());
TempDsc* tmp = getSpillTempDsc(fieldNode);
getEmitter()->emitIns_S(INS_push, emitActualTypeSize(fieldNode->TypeGet()), tmp->tdTempNum(), 0);
- compiler->tmpRlsTemp(tmp);
+ regSet.tmpRlsTemp(tmp);
}
else
{
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index 4bafdfd2c4..8f803b993e 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -1486,13 +1486,6 @@ void Compiler::compShutdown()
}
#endif // FEATURE_JIT_METHOD_PERF
-#if COUNT_RANGECHECKS
- if (optRangeChkAll > 0)
- {
- fprintf(fout, "Removed %u of %u range checks\n", optRangeChkRmv, optRangeChkAll);
- }
-#endif // COUNT_RANGECHECKS
-
#if COUNT_AST_OPERS
// Add up all the counts so that we can show percentages of total
@@ -2007,9 +2000,7 @@ void Compiler::compInit(ArenaAllocator* pAlloc, InlineInfo* inlineInfo)
compQmarkUsed = false;
compFloatingPointUsed = false;
compUnsafeCastUsed = false;
-#if CPU_USES_BLOCK_MOVE
- compBlkOpUsed = false;
-#endif
+
compNeedsGSSecurityCookie = false;
compGSReorderStackLayout = false;
#if STACK_PROBES
@@ -2035,11 +2026,6 @@ void Compiler::compInit(ArenaAllocator* pAlloc, InlineInfo* inlineInfo)
// Used to track when we should consider running EarlyProp
optMethodFlags = 0;
- for (unsigned i = 0; i < MAX_LOOP_NUM; i++)
- {
- AllVarSetOps::AssignNoCopy(this, optLoopTable[i].lpAsgVars, AllVarSetOps::UninitVal());
- }
-
#ifdef DEBUG
m_nodeTestData = nullptr;
m_loopHoistCSEClass = FIRST_LOOP_HOIST_CSE_CLASS;
@@ -2076,54 +2062,7 @@ void Compiler::compInit(ArenaAllocator* pAlloc, InlineInfo* inlineInfo)
fgOrder = FGOrderTree;
#ifdef FEATURE_SIMD
- // SIMD Types
- SIMDFloatHandle = nullptr;
- SIMDDoubleHandle = nullptr;
- SIMDIntHandle = nullptr;
- SIMDUShortHandle = nullptr;
- SIMDUByteHandle = nullptr;
- SIMDShortHandle = nullptr;
- SIMDByteHandle = nullptr;
- SIMDLongHandle = nullptr;
- SIMDUIntHandle = nullptr;
- SIMDULongHandle = nullptr;
- SIMDVector2Handle = nullptr;
- SIMDVector3Handle = nullptr;
- SIMDVector4Handle = nullptr;
- SIMDVectorHandle = nullptr;
-#ifdef FEATURE_HW_INTRINSICS
-#if defined(_TARGET_ARM64_)
- Vector64FloatHandle = nullptr;
- Vector64UIntHandle = nullptr;
- Vector64UShortHandle = nullptr;
- Vector64UByteHandle = nullptr;
- Vector64IntHandle = nullptr;
- Vector64ShortHandle = nullptr;
- Vector64ByteHandle = nullptr;
-#endif // defined(_TARGET_ARM64_)
- Vector128FloatHandle = nullptr;
- Vector128DoubleHandle = nullptr;
- Vector128IntHandle = nullptr;
- Vector128UShortHandle = nullptr;
- Vector128UByteHandle = nullptr;
- Vector128ShortHandle = nullptr;
- Vector128ByteHandle = nullptr;
- Vector128LongHandle = nullptr;
- Vector128UIntHandle = nullptr;
- Vector128ULongHandle = nullptr;
-#if defined(_TARGET_XARCH_)
- Vector256FloatHandle = nullptr;
- Vector256DoubleHandle = nullptr;
- Vector256IntHandle = nullptr;
- Vector256UShortHandle = nullptr;
- Vector256UByteHandle = nullptr;
- Vector256ShortHandle = nullptr;
- Vector256ByteHandle = nullptr;
- Vector256LongHandle = nullptr;
- Vector256UIntHandle = nullptr;
- Vector256ULongHandle = nullptr;
-#endif // defined(_TARGET_XARCH_)
-#endif // FEATURE_HW_INTRINSICS
+ m_simdHandleCache = nullptr;
#endif // FEATURE_SIMD
compUsesThrowHelper = false;
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index da134dfb42..ec1e2acb43 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -128,17 +128,6 @@ unsigned ReinterpretHexAsDecimal(unsigned);
/*****************************************************************************/
-#if defined(FEATURE_SIMD)
-#if defined(_TARGET_XARCH_)
-const unsigned TEMP_MAX_SIZE = YMM_REGSIZE_BYTES;
-#elif defined(_TARGET_ARM64_)
-const unsigned TEMP_MAX_SIZE = FP_REGSIZE_BYTES;
-#endif // defined(_TARGET_XARCH_) || defined(_TARGET_ARM64_)
-#else // !FEATURE_SIMD
-const unsigned TEMP_MAX_SIZE = sizeof(double);
-#endif // !FEATURE_SIMD
-const unsigned TEMP_SLOT_COUNT = (TEMP_MAX_SIZE / sizeof(int));
-
const unsigned FLG_CCTOR = (CORINFO_FLG_CONSTRUCTOR | CORINFO_FLG_STATIC);
#ifdef DEBUG
@@ -1331,7 +1320,7 @@ public:
#ifdef _TARGET_ARM_
unsigned int regSize = (hfaType == TYP_DOUBLE) ? 2 : 1;
#else
- unsigned int regSize = 1;
+ unsigned int regSize = 1;
#endif
for (unsigned int regIndex = 1; regIndex < numRegs; regIndex++)
{
@@ -2546,7 +2535,7 @@ public:
}
// reverse map of tracked number to var number
- unsigned lvaTrackedToVarNum[lclMAX_TRACKED];
+ unsigned* lvaTrackedToVarNum;
#if DOUBLE_ALIGN
#ifdef DEBUG
@@ -3015,8 +3004,6 @@ protected:
#define SMALL_STACK_SIZE 16 // number of elements in impSmallStack
- StackEntry impSmallStack[SMALL_STACK_SIZE]; // Use this array if possible
-
struct SavedStack // used to save/restore stack contents.
{
unsigned ssDepth; // number of values on stack
@@ -3769,19 +3756,13 @@ public:
unsigned fgMeasureIR();
-#if OPT_BOOL_OPS // Used to detect multiple logical "not" assignments.
- bool fgMultipleNots;
-#endif
-
bool fgModified; // True if the flow graph has been modified recently
bool fgComputePredsDone; // Have we computed the bbPreds list
bool fgCheapPredsValid; // Is the bbCheapPreds list valid?
bool fgDomsComputed; // Have we computed the dominator sets?
bool fgOptimizedFinally; // Did we optimize any try-finallys?
- bool fgHasSwitch; // any BBJ_SWITCH jumps?
- bool fgHasPostfix; // any postfix ++/-- found?
- unsigned fgIncrCount; // number of increment nodes found
+ bool fgHasSwitch; // any BBJ_SWITCH jumps?
BlockSet fgEnterBlks; // Set of blocks which have a special transfer of control; the "entry" blocks plus EH handler
// begin blocks.
@@ -3959,11 +3940,6 @@ public:
void fgLiveVarAnalysis(bool updateInternalOnly = false);
- // This is used in the liveness computation, as a temporary. When we use the
- // arbitrary-length VarSet representation, it is better not to allocate a new one
- // at each call.
- VARSET_TP fgMarkIntfUnionVS;
-
void fgUpdateRefCntForClone(BasicBlock* addedToBlock, GenTree* clonedTree);
void fgUpdateRefCntForExtract(GenTree* wholeTree, GenTree* keptTree);
@@ -5506,8 +5482,8 @@ protected:
bool fgHasLoops; // True if this method has any loops, set in fgComputeReachability
public:
- LoopDsc optLoopTable[MAX_LOOP_NUM]; // loop descriptor table
- unsigned char optLoopCount; // number of tracked loops
+ LoopDsc* optLoopTable; // loop descriptor table
+ unsigned char optLoopCount; // number of tracked loops
bool optRecordLoop(BasicBlock* head,
BasicBlock* first,
@@ -6331,33 +6307,7 @@ public:
BasicBlock* slow);
void optInsertLoopCloningStress(BasicBlock* head);
-#if COUNT_RANGECHECKS
- static unsigned optRangeChkRmv;
- static unsigned optRangeChkAll;
-#endif
-
protected:
- struct arraySizes
- {
- unsigned arrayVar;
- int arrayDim;
-
-#define MAX_ARRAYS 4 // a magic max number of arrays tracked for bounds check elimination
- };
-
- struct RngChkDsc
- {
- RngChkDsc* rcdNextInBucket; // used by the hash table
-
- unsigned short rcdHashValue; // to make matching faster
- unsigned short rcdIndex; // 0..optRngChkCount-1
-
- GenTree* rcdTree; // the array index tree
- };
-
- unsigned optRngChkCount;
- static const size_t optRngChkHashSize;
-
ssize_t optGetArrayRefScaleAndIndex(GenTree* mul, GenTree** pIndex DEBUGARG(bool bRngChk));
GenTree* optFindLocalInit(BasicBlock* block, GenTree* local, VARSET_TP* pKilledInOut, bool* isKilledAfterInit);
@@ -6871,45 +6821,6 @@ public:
/*****************************************************************************/
-public:
- void tmpInit();
-
- enum TEMP_USAGE_TYPE
- {
- TEMP_USAGE_FREE,
- TEMP_USAGE_USED
- };
-
- static var_types tmpNormalizeType(var_types type);
- TempDsc* tmpGetTemp(var_types type); // get temp for the given type
- void tmpRlsTemp(TempDsc* temp);
- TempDsc* tmpFindNum(int temp, TEMP_USAGE_TYPE usageType = TEMP_USAGE_FREE) const;
-
- void tmpEnd();
- TempDsc* tmpListBeg(TEMP_USAGE_TYPE usageType = TEMP_USAGE_FREE) const;
- TempDsc* tmpListNxt(TempDsc* curTemp, TEMP_USAGE_TYPE usageType = TEMP_USAGE_FREE) const;
- void tmpDone();
-
-#ifdef DEBUG
- bool tmpAllFree() const;
-#endif // DEBUG
-
- void tmpPreAllocateTemps(var_types type, unsigned count);
-
-protected:
- unsigned tmpCount; // Number of temps
- unsigned tmpSize; // Size of all the temps
-#ifdef DEBUG
-public:
- // Used by RegSet::rsSpillChk()
- unsigned tmpGetCount; // Temps which haven't been released yet
-#endif
-private:
- static unsigned tmpSlot(unsigned size); // which slot in tmpFree[] or tmpUsed[] to use
-
- TempDsc* tmpFree[TEMP_MAX_SIZE / sizeof(int)];
- TempDsc* tmpUsed[TEMP_MAX_SIZE / sizeof(int)];
-
/*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -7294,71 +7205,89 @@ private:
// by the hardware. It is allocated when/if such situations are encountered during Lowering.
unsigned lvaSIMDInitTempVarNum;
- // SIMD Types
- CORINFO_CLASS_HANDLE SIMDFloatHandle;
- CORINFO_CLASS_HANDLE SIMDDoubleHandle;
- CORINFO_CLASS_HANDLE SIMDIntHandle;
- CORINFO_CLASS_HANDLE SIMDUShortHandle;
- CORINFO_CLASS_HANDLE SIMDUByteHandle;
- CORINFO_CLASS_HANDLE SIMDShortHandle;
- CORINFO_CLASS_HANDLE SIMDByteHandle;
- CORINFO_CLASS_HANDLE SIMDLongHandle;
- CORINFO_CLASS_HANDLE SIMDUIntHandle;
- CORINFO_CLASS_HANDLE SIMDULongHandle;
- CORINFO_CLASS_HANDLE SIMDVector2Handle;
- CORINFO_CLASS_HANDLE SIMDVector3Handle;
- CORINFO_CLASS_HANDLE SIMDVector4Handle;
- CORINFO_CLASS_HANDLE SIMDVectorHandle;
+ struct SIMDHandlesCache
+ {
+ // SIMD Types
+ CORINFO_CLASS_HANDLE SIMDFloatHandle;
+ CORINFO_CLASS_HANDLE SIMDDoubleHandle;
+ CORINFO_CLASS_HANDLE SIMDIntHandle;
+ CORINFO_CLASS_HANDLE SIMDUShortHandle;
+ CORINFO_CLASS_HANDLE SIMDUByteHandle;
+ CORINFO_CLASS_HANDLE SIMDShortHandle;
+ CORINFO_CLASS_HANDLE SIMDByteHandle;
+ CORINFO_CLASS_HANDLE SIMDLongHandle;
+ CORINFO_CLASS_HANDLE SIMDUIntHandle;
+ CORINFO_CLASS_HANDLE SIMDULongHandle;
+ CORINFO_CLASS_HANDLE SIMDVector2Handle;
+ CORINFO_CLASS_HANDLE SIMDVector3Handle;
+ CORINFO_CLASS_HANDLE SIMDVector4Handle;
+ CORINFO_CLASS_HANDLE SIMDVectorHandle;
#ifdef FEATURE_HW_INTRINSICS
#if defined(_TARGET_ARM64_)
- CORINFO_CLASS_HANDLE Vector64FloatHandle;
- CORINFO_CLASS_HANDLE Vector64UIntHandle;
- CORINFO_CLASS_HANDLE Vector64UShortHandle;
- CORINFO_CLASS_HANDLE Vector64UByteHandle;
- CORINFO_CLASS_HANDLE Vector64ShortHandle;
- CORINFO_CLASS_HANDLE Vector64ByteHandle;
- CORINFO_CLASS_HANDLE Vector64IntHandle;
+ CORINFO_CLASS_HANDLE Vector64FloatHandle;
+ CORINFO_CLASS_HANDLE Vector64UIntHandle;
+ CORINFO_CLASS_HANDLE Vector64UShortHandle;
+ CORINFO_CLASS_HANDLE Vector64UByteHandle;
+ CORINFO_CLASS_HANDLE Vector64ShortHandle;
+ CORINFO_CLASS_HANDLE Vector64ByteHandle;
+ CORINFO_CLASS_HANDLE Vector64IntHandle;
#endif // defined(_TARGET_ARM64_)
- CORINFO_CLASS_HANDLE Vector128FloatHandle;
- CORINFO_CLASS_HANDLE Vector128DoubleHandle;
- CORINFO_CLASS_HANDLE Vector128IntHandle;
- CORINFO_CLASS_HANDLE Vector128UShortHandle;
- CORINFO_CLASS_HANDLE Vector128UByteHandle;
- CORINFO_CLASS_HANDLE Vector128ShortHandle;
- CORINFO_CLASS_HANDLE Vector128ByteHandle;
- CORINFO_CLASS_HANDLE Vector128LongHandle;
- CORINFO_CLASS_HANDLE Vector128UIntHandle;
- CORINFO_CLASS_HANDLE Vector128ULongHandle;
+ CORINFO_CLASS_HANDLE Vector128FloatHandle;
+ CORINFO_CLASS_HANDLE Vector128DoubleHandle;
+ CORINFO_CLASS_HANDLE Vector128IntHandle;
+ CORINFO_CLASS_HANDLE Vector128UShortHandle;
+ CORINFO_CLASS_HANDLE Vector128UByteHandle;
+ CORINFO_CLASS_HANDLE Vector128ShortHandle;
+ CORINFO_CLASS_HANDLE Vector128ByteHandle;
+ CORINFO_CLASS_HANDLE Vector128LongHandle;
+ CORINFO_CLASS_HANDLE Vector128UIntHandle;
+ CORINFO_CLASS_HANDLE Vector128ULongHandle;
#if defined(_TARGET_XARCH_)
- CORINFO_CLASS_HANDLE Vector256FloatHandle;
- CORINFO_CLASS_HANDLE Vector256DoubleHandle;
- CORINFO_CLASS_HANDLE Vector256IntHandle;
- CORINFO_CLASS_HANDLE Vector256UShortHandle;
- CORINFO_CLASS_HANDLE Vector256UByteHandle;
- CORINFO_CLASS_HANDLE Vector256ShortHandle;
- CORINFO_CLASS_HANDLE Vector256ByteHandle;
- CORINFO_CLASS_HANDLE Vector256LongHandle;
- CORINFO_CLASS_HANDLE Vector256UIntHandle;
- CORINFO_CLASS_HANDLE Vector256ULongHandle;
+ CORINFO_CLASS_HANDLE Vector256FloatHandle;
+ CORINFO_CLASS_HANDLE Vector256DoubleHandle;
+ CORINFO_CLASS_HANDLE Vector256IntHandle;
+ CORINFO_CLASS_HANDLE Vector256UShortHandle;
+ CORINFO_CLASS_HANDLE Vector256UByteHandle;
+ CORINFO_CLASS_HANDLE Vector256ShortHandle;
+ CORINFO_CLASS_HANDLE Vector256ByteHandle;
+ CORINFO_CLASS_HANDLE Vector256LongHandle;
+ CORINFO_CLASS_HANDLE Vector256UIntHandle;
+ CORINFO_CLASS_HANDLE Vector256ULongHandle;
#endif // defined(_TARGET_XARCH_)
#endif // FEATURE_HW_INTRINSICS
+ SIMDHandlesCache()
+ {
+ memset(this, 0, sizeof(*this));
+ }
+ };
+
+ SIMDHandlesCache* m_simdHandleCache;
+
// Get the handle for a SIMD type.
CORINFO_CLASS_HANDLE gtGetStructHandleForSIMD(var_types simdType, var_types simdBaseType)
{
+ if (m_simdHandleCache == nullptr)
+ {
+ // This may happen if the JIT generates SIMD node on its own, without importing them.
+ // Otherwise getBaseTypeAndSizeOfSIMDType should have created the cache.
+ return NO_CLASS_HANDLE;
+ }
+
if (simdBaseType == TYP_FLOAT)
{
switch (simdType)
{
case TYP_SIMD8:
- return SIMDVector2Handle;
+ return m_simdHandleCache->SIMDVector2Handle;
case TYP_SIMD12:
- return SIMDVector3Handle;
+ return m_simdHandleCache->SIMDVector3Handle;
case TYP_SIMD16:
- if ((getSIMDVectorType() == TYP_SIMD32) || (SIMDVector4Handle != NO_CLASS_HANDLE))
+ if ((getSIMDVectorType() == TYP_SIMD32) ||
+ (m_simdHandleCache->SIMDVector4Handle != NO_CLASS_HANDLE))
{
- return SIMDVector4Handle;
+ return m_simdHandleCache->SIMDVector4Handle;
}
break;
case TYP_SIMD32:
@@ -7371,36 +7300,31 @@ private:
switch (simdBaseType)
{
case TYP_FLOAT:
- return SIMDFloatHandle;
+ return m_simdHandleCache->SIMDFloatHandle;
case TYP_DOUBLE:
- return SIMDDoubleHandle;
+ return m_simdHandleCache->SIMDDoubleHandle;
case TYP_INT:
- return SIMDIntHandle;
+ return m_simdHandleCache->SIMDIntHandle;
case TYP_USHORT:
- return SIMDUShortHandle;
+ return m_simdHandleCache->SIMDUShortHandle;
case TYP_UBYTE:
- return SIMDUByteHandle;
+ return m_simdHandleCache->SIMDUByteHandle;
case TYP_SHORT:
- return SIMDShortHandle;
+ return m_simdHandleCache->SIMDShortHandle;
case TYP_BYTE:
- return SIMDByteHandle;
+ return m_simdHandleCache->SIMDByteHandle;
case TYP_LONG:
- return SIMDLongHandle;
+ return m_simdHandleCache->SIMDLongHandle;
case TYP_UINT:
- return SIMDUIntHandle;
+ return m_simdHandleCache->SIMDUIntHandle;
case TYP_ULONG:
- return SIMDULongHandle;
+ return m_simdHandleCache->SIMDULongHandle;
default:
assert(!"Didn't find a class handle for simdType");
}
return NO_CLASS_HANDLE;
}
- // SIMD Methods
- CORINFO_METHOD_HANDLE SIMDVectorFloat_set_Item;
- CORINFO_METHOD_HANDLE SIMDVectorFloat_get_Length;
- CORINFO_METHOD_HANDLE SIMDVectorFloat_op_Addition;
-
// Returns true if the tree corresponds to a TYP_SIMD lcl var.
// Note that both SIMD vector args and locals are mared as lvSIMDType = true, but
// type of an arg node is TYP_BYREF and a local node is TYP_SIMD or TYP_STRUCT.
@@ -7870,10 +7794,6 @@ public:
// NOTE: These values are only reliable after
// the importing is completely finished.
-#if CPU_USES_BLOCK_MOVE
- bool compBlkOpUsed; // Does the method do a COPYBLK or INITBLK
-#endif
-
#ifdef DEBUG
// State information - which phases have completed?
// These are kept together for easy discoverability
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp
index d873eadaa8..7ae64603d7 100644
--- a/src/jit/compiler.hpp
+++ b/src/jit/compiler.hpp
@@ -2354,11 +2354,11 @@ inline
FPbased = isFramePointerUsed();
if (lvaDoneFrameLayout == Compiler::FINAL_FRAME_LAYOUT)
{
- TempDsc* tmpDsc = tmpFindNum(varNum);
+ TempDsc* tmpDsc = codeGen->regSet.tmpFindNum(varNum);
// The temp might be in use, since this might be during code generation.
if (tmpDsc == nullptr)
{
- tmpDsc = tmpFindNum(varNum, Compiler::TEMP_USAGE_USED);
+ tmpDsc = codeGen->regSet.tmpFindNum(varNum, RegSet::TEMP_USAGE_USED);
}
assert(tmpDsc != nullptr);
offset = tmpDsc->tdTempOffs();
@@ -3063,7 +3063,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/*****************************************************************************/
-/* static */ inline unsigned Compiler::tmpSlot(unsigned size)
+/* static */ inline unsigned RegSet::tmpSlot(unsigned size)
{
noway_assert(size >= sizeof(int));
noway_assert(size <= TEMP_MAX_SIZE);
@@ -3079,10 +3079,10 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
* over a function body.
*/
-inline void Compiler::tmpEnd()
+inline void RegSet::tmpEnd()
{
#ifdef DEBUG
- if (verbose && (tmpCount > 0))
+ if (m_rsCompiler->verbose && (tmpCount > 0))
{
printf("%d tmps used\n", tmpCount);
}
@@ -3095,7 +3095,7 @@ inline void Compiler::tmpEnd()
* compiled.
*/
-inline void Compiler::tmpDone()
+inline void RegSet::tmpDone()
{
#ifdef DEBUG
unsigned count;
diff --git a/src/jit/emitarm.cpp b/src/jit/emitarm.cpp
index 0ed5bceea1..b425caa088 100644
--- a/src/jit/emitarm.cpp
+++ b/src/jit/emitarm.cpp
@@ -6351,7 +6351,7 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp)
}
else
{
- TempDsc* tmpDsc = emitComp->tmpFindNum(varNum);
+ TempDsc* tmpDsc = codeGen->regSet.tmpFindNum(varNum);
vt = tmpDsc->tdTempType();
}
if (vt == TYP_REF || vt == TYP_BYREF)
diff --git a/src/jit/emitarm64.cpp b/src/jit/emitarm64.cpp
index 992cffbb20..fed3b5d8a5 100644
--- a/src/jit/emitarm64.cpp
+++ b/src/jit/emitarm64.cpp
@@ -10164,7 +10164,7 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp)
}
else
{
- TempDsc* tmpDsc = emitComp->tmpFindNum(varNum);
+ TempDsc* tmpDsc = codeGen->regSet.tmpFindNum(varNum);
vt = tmpDsc->tdTempType();
}
if (vt == TYP_REF || vt == TYP_BYREF)
@@ -10188,7 +10188,7 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp)
}
else
{
- TempDsc* tmpDsc = emitComp->tmpFindNum(varNum);
+ TempDsc* tmpDsc = codeGen->regSet.tmpFindNum(varNum);
vt = tmpDsc->tdTempType();
}
if (vt == TYP_REF || vt == TYP_BYREF)
diff --git a/src/jit/emitxarch.cpp b/src/jit/emitxarch.cpp
index bbc086d58d..0be0daeccf 100644
--- a/src/jit/emitxarch.cpp
+++ b/src/jit/emitxarch.cpp
@@ -1865,11 +1865,11 @@ inline UNATIVE_OFFSET emitter::emitInsSizeSV(code_t code, int var, int dsp)
}
// The offset is already assigned. Find the temp.
- TempDsc* tmp = emitComp->tmpFindNum(var, Compiler::TEMP_USAGE_USED);
+ TempDsc* tmp = codeGen->regSet.tmpFindNum(var, RegSet::TEMP_USAGE_USED);
if (tmp == nullptr)
{
// It might be in the free lists, if we're working on zero initializing the temps.
- tmp = emitComp->tmpFindNum(var, Compiler::TEMP_USAGE_FREE);
+ tmp = codeGen->regSet.tmpFindNum(var, RegSet::TEMP_USAGE_FREE);
}
assert(tmp != nullptr);
offs = tmp->tdTempOffs();
@@ -3131,7 +3131,7 @@ regNumber emitter::emitInsBinary(instruction ins, emitAttr attr, GenTree* dst, G
varNum = tmpDsc->tdTempNum();
offset = 0;
- emitComp->tmpRlsTemp(tmpDsc);
+ codeGen->regSet.tmpRlsTemp(tmpDsc);
}
else if (memOp->isIndir())
{
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp
index 7516792b3f..46eefa4167 100644
--- a/src/jit/flowgraph.cpp
+++ b/src/jit/flowgraph.cpp
@@ -126,8 +126,6 @@ void Compiler::fgInit()
/* This global flag is set whenever we add a throw block for a RngChk */
fgRngChkThrowAdded = false; /* reset flag for fgIsCodeAdded() */
- fgIncrCount = 0;
-
/* We will record a list of all BBJ_RETURN blocks here */
fgReturnBlocks = nullptr;
@@ -6808,8 +6806,6 @@ unsigned Compiler::fgGetNestingLevel(BasicBlock* block, unsigned* pFinallyNestin
void Compiler::fgImport()
{
- fgHasPostfix = false;
-
impImport(fgFirstBB);
if (!opts.jitFlags->IsSet(JitFlags::JIT_FLAG_SKIP_VERIFICATION))
diff --git a/src/jit/gcencode.cpp b/src/jit/gcencode.cpp
index 9cd478bb3a..bc38f64b54 100644
--- a/src/jit/gcencode.cpp
+++ b/src/jit/gcencode.cpp
@@ -2365,8 +2365,9 @@ size_t GCInfo::gcMakeRegPtrTable(BYTE* dest, int mask, const InfoHdr& header, un
/* Count&Write spill temps that hold pointers */
- assert(compiler->tmpAllFree());
- for (TempDsc* tempItem = compiler->tmpListBeg(); tempItem != nullptr; tempItem = compiler->tmpListNxt(tempItem))
+ assert(compiler->codeGen->regSet.tmpAllFree());
+ for (TempDsc* tempItem = compiler->codeGen->regSet.tmpListBeg(); tempItem != nullptr;
+ tempItem = compiler->codeGen->regSet.tmpListNxt(tempItem))
{
if (varTypeIsGC(tempItem->tdTempType()))
{
@@ -4330,8 +4331,9 @@ void GCInfo::gcMakeRegPtrTable(
{
// Count&Write spill temps that hold pointers.
- assert(compiler->tmpAllFree());
- for (TempDsc* tempItem = compiler->tmpListBeg(); tempItem != nullptr; tempItem = compiler->tmpListNxt(tempItem))
+ assert(compiler->codeGen->regSet.tmpAllFree());
+ for (TempDsc* tempItem = compiler->codeGen->regSet.tmpListBeg(); tempItem != nullptr;
+ tempItem = compiler->codeGen->regSet.tmpListNxt(tempItem))
{
if (varTypeIsGC(tempItem->tdTempType()))
{
diff --git a/src/jit/gcinfo.cpp b/src/jit/gcinfo.cpp
index 36c7de0dcf..ee9f91df7e 100644
--- a/src/jit/gcinfo.cpp
+++ b/src/jit/gcinfo.cpp
@@ -499,8 +499,8 @@ void GCInfo::gcCountForHeader(UNALIGNED unsigned int* untrackedCount, UNALIGNED
/* Also count spill temps that hold pointers */
- assert(compiler->tmpAllFree());
- for (TempDsc* tempThis = compiler->tmpListBeg(); tempThis != nullptr; tempThis = compiler->tmpListNxt(tempThis))
+ assert(regSet->tmpAllFree());
+ for (TempDsc* tempThis = regSet->tmpListBeg(); tempThis != nullptr; tempThis = regSet->tmpListNxt(tempThis))
{
if (varTypeIsGC(tempThis->tdTempType()) == false)
{
diff --git a/src/jit/hashbv.cpp b/src/jit/hashbv.cpp
index db8dda1a7b..6aee93ee33 100644
--- a/src/jit/hashbv.cpp
+++ b/src/jit/hashbv.cpp
@@ -358,7 +358,7 @@ bool hashBvNode::sameAs(hashBvNode* other)
hashBv::hashBv(Compiler* comp)
{
this->compiler = comp;
- this->log2_hashSize = globalData()->hbvHashSizeLog2;
+ this->log2_hashSize = 0;
int hts = hashtable_size();
nodeArr = getNewVector(hts);
@@ -424,20 +424,6 @@ hashBv*& hashBv::hbvFreeList(hashBvGlobalData* data)
return data->hbvFreeList;
}
-void hashBv::freeVector(hashBvNode* vect, int vectorLength)
-{
- // not enough space to do anything with it
- if (vectorLength < 2)
- {
- return;
- }
-
- hbvFreeListNode* f = (hbvFreeListNode*)vect;
- f->next = globalData()->hbvFreeVectorList;
- globalData()->hbvFreeVectorList = f;
- f->size = vectorLength;
-}
-
void hashBv::hbvFree()
{
Compiler* comp = this->compiler;
@@ -547,7 +533,6 @@ void hashBv::Resize(int newSize)
return;
}
- int oldSizeLog2 = log2_hashSize;
int log2_newSize = genLog2((unsigned)newSize);
hashBvNode** newNodes = this->getNewVector(newSize);
@@ -1297,7 +1282,6 @@ bool hashBv::MultiTraverseLHSBigger(hashBv* other)
// this is larger
hashBvNode*** cursors;
- int shiftFactor = this->log2_hashSize - other->log2_hashSize;
int expansionFactor = hts / ots;
cursors = (hashBvNode***)alloca(expansionFactor * sizeof(void*));
@@ -2016,12 +2000,3 @@ more_data:
goto more_data;
}
}
-
-indexType HbvNext(hashBv* bv, Compiler* comp)
-{
- if (bv)
- {
- bv->globalData()->hashBvNextIterator.initFrom(bv);
- }
- return bv->globalData()->hashBvNextIterator.nextBit();
-}
diff --git a/src/jit/hashbv.h b/src/jit/hashbv.h
index cadb182cc6..b07b3d89c8 100644
--- a/src/jit/hashbv.h
+++ b/src/jit/hashbv.h
@@ -186,8 +186,6 @@ public:
public:
hashBv(Compiler* comp);
- hashBv(hashBv* other);
- // hashBv() {}
static hashBv* Create(Compiler* comp);
static void Init(Compiler* comp);
static hashBv* CreateFrom(hashBv* other, Compiler* comp);
@@ -215,11 +213,8 @@ private:
// maintain free lists for vectors
hashBvNode** getNewVector(int vectorLength);
- void freeVector(hashBvNode* vect, int vectorLength);
int getNodeCount();
- hashBvNode* getFreeList();
-
public:
inline hashBvNode* getOrAddNodeForIndex(indexType index)
{
@@ -281,16 +276,6 @@ public:
// --------------------------------------------------------------------
// --------------------------------------------------------------------
-class hbvFreeListNode
-{
-public:
- hbvFreeListNode* next;
- int size;
-};
-
-// --------------------------------------------------------------------
-// --------------------------------------------------------------------
-
class hashBvIterator
{
public:
@@ -318,17 +303,10 @@ class hashBvGlobalData
friend class hashBv;
friend class hashBvNode;
- hashBvNode* hbvNodeFreeList;
- hashBv* hbvFreeList;
- unsigned short hbvHashSizeLog2;
- hbvFreeListNode* hbvFreeVectorList;
-
-public:
- hashBvIterator hashBvNextIterator;
+ hashBvNode* hbvNodeFreeList;
+ hashBv* hbvFreeList;
};
-indexType HbvNext(hashBv* bv, Compiler* comp);
-
// clang-format off
#define FOREACH_HBV_BIT_SET(index, bv) \
{ \
diff --git a/src/jit/hwintrinsic.cpp b/src/jit/hwintrinsic.cpp
index e3b36d9189..a2f741e1e0 100644
--- a/src/jit/hwintrinsic.cpp
+++ b/src/jit/hwintrinsic.cpp
@@ -57,25 +57,25 @@ CORINFO_CLASS_HANDLE Compiler::gtGetStructHandleForHWSIMD(var_types simdType, va
switch (simdBaseType)
{
case TYP_FLOAT:
- return Vector128FloatHandle;
+ return m_simdHandleCache->Vector128FloatHandle;
case TYP_DOUBLE:
- return Vector128DoubleHandle;
+ return m_simdHandleCache->Vector128DoubleHandle;
case TYP_INT:
- return Vector128IntHandle;
+ return m_simdHandleCache->Vector128IntHandle;
case TYP_USHORT:
- return Vector128UShortHandle;
+ return m_simdHandleCache->Vector128UShortHandle;
case TYP_UBYTE:
- return Vector128UByteHandle;
+ return m_simdHandleCache->Vector128UByteHandle;
case TYP_SHORT:
- return Vector128ShortHandle;
+ return m_simdHandleCache->Vector128ShortHandle;
case TYP_BYTE:
- return Vector128ByteHandle;
+ return m_simdHandleCache->Vector128ByteHandle;
case TYP_LONG:
- return Vector128LongHandle;
+ return m_simdHandleCache->Vector128LongHandle;
case TYP_UINT:
- return Vector128UIntHandle;
+ return m_simdHandleCache->Vector128UIntHandle;
case TYP_ULONG:
- return Vector128ULongHandle;
+ return m_simdHandleCache->Vector128ULongHandle;
default:
assert(!"Didn't find a class handle for simdType");
}
@@ -86,25 +86,25 @@ CORINFO_CLASS_HANDLE Compiler::gtGetStructHandleForHWSIMD(var_types simdType, va
switch (simdBaseType)
{
case TYP_FLOAT:
- return Vector256FloatHandle;
+ return m_simdHandleCache->Vector256FloatHandle;
case TYP_DOUBLE:
- return Vector256DoubleHandle;
+ return m_simdHandleCache->Vector256DoubleHandle;
case TYP_INT:
- return Vector256IntHandle;
+ return m_simdHandleCache->Vector256IntHandle;
case TYP_USHORT:
- return Vector256UShortHandle;
+ return m_simdHandleCache->Vector256UShortHandle;
case TYP_UBYTE:
- return Vector256UByteHandle;
+ return m_simdHandleCache->Vector256UByteHandle;
case TYP_SHORT:
- return Vector256ShortHandle;
+ return m_simdHandleCache->Vector256ShortHandle;
case TYP_BYTE:
- return Vector256ByteHandle;
+ return m_simdHandleCache->Vector256ByteHandle;
case TYP_LONG:
- return Vector256LongHandle;
+ return m_simdHandleCache->Vector256LongHandle;
case TYP_UINT:
- return Vector256UIntHandle;
+ return m_simdHandleCache->Vector256UIntHandle;
case TYP_ULONG:
- return Vector256ULongHandle;
+ return m_simdHandleCache->Vector256ULongHandle;
default:
assert(!"Didn't find a class handle for simdType");
}
@@ -116,19 +116,19 @@ CORINFO_CLASS_HANDLE Compiler::gtGetStructHandleForHWSIMD(var_types simdType, va
switch (simdBaseType)
{
case TYP_FLOAT:
- return Vector64FloatHandle;
+ return m_simdHandleCache->Vector64FloatHandle;
case TYP_UINT:
- return Vector64UIntHandle;
+ return m_simdHandleCache->Vector64UIntHandle;
case TYP_USHORT:
- return Vector64UShortHandle;
+ return m_simdHandleCache->Vector64UShortHandle;
case TYP_UBYTE:
- return Vector64UByteHandle;
+ return m_simdHandleCache->Vector64UByteHandle;
case TYP_SHORT:
- return Vector64ShortHandle;
+ return m_simdHandleCache->Vector64ShortHandle;
case TYP_BYTE:
- return Vector64ByteHandle;
+ return m_simdHandleCache->Vector64ByteHandle;
case TYP_INT:
- return Vector64IntHandle;
+ return m_simdHandleCache->Vector64IntHandle;
default:
assert(!"Didn't find a class handle for simdType");
}
diff --git a/src/jit/hwintrinsiccodegenxarch.cpp b/src/jit/hwintrinsiccodegenxarch.cpp
index 0a03df24dc..ce58f8b43d 100644
--- a/src/jit/hwintrinsiccodegenxarch.cpp
+++ b/src/jit/hwintrinsiccodegenxarch.cpp
@@ -393,7 +393,7 @@ void CodeGen::genHWIntrinsic_R_RM(GenTreeHWIntrinsic* node, instruction ins, emi
varNum = tmpDsc->tdTempNum();
offset = 0;
- compiler->tmpRlsTemp(tmpDsc);
+ regSet.tmpRlsTemp(tmpDsc);
}
else if (op1->OperIsHWIntrinsic())
{
@@ -517,7 +517,7 @@ void CodeGen::genHWIntrinsic_R_RM_I(GenTreeHWIntrinsic* node, instruction ins, i
varNum = tmpDsc->tdTempNum();
offset = 0;
- compiler->tmpRlsTemp(tmpDsc);
+ regSet.tmpRlsTemp(tmpDsc);
}
else if (op1->OperIsHWIntrinsic())
{
@@ -641,7 +641,7 @@ void CodeGen::genHWIntrinsic_R_R_RM(GenTreeHWIntrinsic* node, instruction ins)
varNum = tmpDsc->tdTempNum();
offset = 0;
- compiler->tmpRlsTemp(tmpDsc);
+ regSet.tmpRlsTemp(tmpDsc);
}
else if (op2->OperIsHWIntrinsic())
{
@@ -797,7 +797,7 @@ void CodeGen::genHWIntrinsic_R_R_RM_I(GenTreeHWIntrinsic* node, instruction ins,
varNum = tmpDsc->tdTempNum();
offset = 0;
- compiler->tmpRlsTemp(tmpDsc);
+ regSet.tmpRlsTemp(tmpDsc);
}
else if (op2->OperIsHWIntrinsic())
{
@@ -953,7 +953,7 @@ void CodeGen::genHWIntrinsic_R_R_RM_R(GenTreeHWIntrinsic* node, instruction ins)
varNum = tmpDsc->tdTempNum();
offset = 0;
- compiler->tmpRlsTemp(tmpDsc);
+ regSet.tmpRlsTemp(tmpDsc);
}
else if (op2->OperIsHWIntrinsic())
{
@@ -1072,7 +1072,7 @@ void CodeGen::genHWIntrinsic_R_R_R_RM(
varNum = tmpDsc->tdTempNum();
offset = 0;
- compiler->tmpRlsTemp(tmpDsc);
+ regSet.tmpRlsTemp(tmpDsc);
}
else if (op3->OperIsHWIntrinsic())
{
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index 6f6bd21398..3837a96923 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -17438,26 +17438,39 @@ void Compiler::impImport(BasicBlock* method)
}
#endif
- /* Allocate the stack contents */
+ Compiler* inlineRoot = impInlineRoot();
- if (info.compMaxStack <= _countof(impSmallStack))
+ if (info.compMaxStack <= SMALL_STACK_SIZE)
{
- /* Use local variable, don't waste time allocating on the heap */
-
- impStkSize = _countof(impSmallStack);
- verCurrentState.esStack = impSmallStack;
+ impStkSize = SMALL_STACK_SIZE;
}
else
{
- impStkSize = info.compMaxStack;
+ impStkSize = info.compMaxStack;
+ }
+
+ if (this == inlineRoot)
+ {
+ // Allocate the stack contents
verCurrentState.esStack = new (this, CMK_ImpStack) StackEntry[impStkSize];
}
+ else
+ {
+ // This is the inlinee compiler, steal the stack from the inliner compiler
+ // (after ensuring that it is large enough).
+ if (inlineRoot->impStkSize < impStkSize)
+ {
+ inlineRoot->impStkSize = impStkSize;
+ inlineRoot->verCurrentState.esStack = new (this, CMK_ImpStack) StackEntry[impStkSize];
+ }
+
+ verCurrentState.esStack = inlineRoot->verCurrentState.esStack;
+ }
// initialize the entry state at start of method
verInitCurrentState();
// Initialize stuff related to figuring "spill cliques" (see spec comment for impGetSpillTmpBase).
- Compiler* inlineRoot = impInlineRoot();
if (this == inlineRoot) // These are only used on the root of the inlining tree.
{
// We have initialized these previously, but to size 0. Make them larger.
diff --git a/src/jit/jit.h b/src/jit/jit.h
index f6a575d262..f09b31d49d 100644
--- a/src/jit/jit.h
+++ b/src/jit/jit.h
@@ -471,7 +471,6 @@ typedef ptrdiff_t ssize_t;
// case of single block methods.
#define COUNT_LOOPS 0 // Collect stats about loops, such as the total number of natural loops, a histogram of
// the number of loop exits, etc.
-#define COUNT_RANGECHECKS 0 // Count range checks removed (in lexical CSE?).
#define DATAFLOW_ITER 0 // Count iterations in lexical CSE and constant folding dataflow.
#define DISPLAY_SIZES 0 // Display generated code, data, and GC information sizes.
#define MEASURE_BLOCK_SIZE 0 // Collect stats about basic block and flowList node sizes and memory allocations.
diff --git a/src/jit/lclvars.cpp b/src/jit/lclvars.cpp
index 0e141fe549..a6c63304a9 100644
--- a/src/jit/lclvars.cpp
+++ b/src/jit/lclvars.cpp
@@ -40,6 +40,8 @@ void Compiler::lvaInit()
lvaGenericsContextUseCount = 0;
+ lvaTrackedToVarNum = nullptr;
+
lvaSortAgain = false; // false: We don't need to call lvaSortOnly()
lvaTrackedFixed = false; // false: We can still add new tracked variables
@@ -3508,9 +3510,14 @@ void Compiler::lvaSortByRefCount()
}
}
+ if (lvaTrackedToVarNum == nullptr)
+ {
+ lvaTrackedToVarNum = new (getAllocator(CMK_LvaTable)) unsigned[lclMAX_TRACKED];
+ }
+
#ifdef DEBUG
// Re-Initialize to -1 for safety in debug build.
- memset(lvaTrackedToVarNum, -1, sizeof(lvaTrackedToVarNum));
+ memset(lvaTrackedToVarNum, -1, lclMAX_TRACKED * sizeof(unsigned));
#endif
/* Assign indices to all the variables we've decided to track */
@@ -4226,7 +4233,7 @@ unsigned Compiler::lvaGetMaxSpillTempSize()
if (lvaDoneFrameLayout >= REGALLOC_FRAME_LAYOUT)
{
- result = tmpSize;
+ result = codeGen->regSet.tmpGetTotalSize();
}
else
{
@@ -4795,8 +4802,8 @@ void Compiler::lvaFixVirtualFrameOffsets()
}
}
- assert(tmpAllFree());
- for (TempDsc* temp = tmpListBeg(); temp != nullptr; temp = tmpListNxt(temp))
+ assert(codeGen->regSet.tmpAllFree());
+ for (TempDsc* temp = codeGen->regSet.tmpListBeg(); temp != nullptr; temp = codeGen->regSet.tmpListNxt(temp))
{
temp->tdAdjustTempOffs(delta);
}
@@ -6511,11 +6518,11 @@ int Compiler::lvaAllocateTemps(int stkOffs, bool mustDoubleAlign)
assignDone = true;
}
- assert(tmpAllFree());
+ assert(codeGen->regSet.tmpAllFree());
AGAIN2:
- for (TempDsc* temp = tmpListBeg(); temp != nullptr; temp = tmpListNxt(temp))
+ for (TempDsc* temp = codeGen->regSet.tmpListBeg(); temp != nullptr; temp = codeGen->regSet.tmpListNxt(temp))
{
var_types tempType = temp->tdTempType();
unsigned size;
@@ -6997,8 +7004,8 @@ void Compiler::lvaTableDump(FrameLayoutState curState)
//-------------------------------------------------------------------------
// Display the code-gen temps
- assert(tmpAllFree());
- for (TempDsc* temp = tmpListBeg(); temp != nullptr; temp = tmpListNxt(temp))
+ assert(codeGen->regSet.tmpAllFree());
+ for (TempDsc* temp = codeGen->regSet.tmpListBeg(); temp != nullptr; temp = codeGen->regSet.tmpListNxt(temp))
{
printf("; TEMP_%02u %26s%*s%7s -> ", -temp->tdTempNum(), " ", refCntWtdWidth, " ",
varTypeName(temp->tdTempType()));
diff --git a/src/jit/liveness.cpp b/src/jit/liveness.cpp
index a959358db5..c99df5cc70 100644
--- a/src/jit/liveness.cpp
+++ b/src/jit/liveness.cpp
@@ -2511,9 +2511,6 @@ void Compiler::fgInterBlockLocalVarLiveness()
* Now fill in liveness info within each basic block - Backward DataFlow
*/
- // This is used in the liveness computation, as a temporary.
- VarSetOps::AssignNoCopy(this, fgMarkIntfUnionVS, VarSetOps::MakeEmpty(this));
-
for (block = fgFirstBB; block; block = block->bbNext)
{
/* Tell everyone what block we're working on */
diff --git a/src/jit/lsra.cpp b/src/jit/lsra.cpp
index 654b3406e3..3338cbd2ae 100644
--- a/src/jit/lsra.cpp
+++ b/src/jit/lsra.cpp
@@ -6339,7 +6339,7 @@ void LinearScan::recordMaxSpill()
// only a few types should actually be seen here.
JITDUMP("Recording the maximum number of concurrent spills:\n");
#ifdef _TARGET_X86_
- var_types returnType = compiler->tmpNormalizeType(compiler->info.compRetType);
+ var_types returnType = RegSet::tmpNormalizeType(compiler->info.compRetType);
if (needDoubleTmpForFPCall || (returnType == TYP_DOUBLE))
{
JITDUMP("Adding a spill temp for moving a double call/return value between xmm reg and x87 stack.\n");
@@ -6353,7 +6353,7 @@ void LinearScan::recordMaxSpill()
#endif // _TARGET_X86_
for (int i = 0; i < TYP_COUNT; i++)
{
- if (var_types(i) != compiler->tmpNormalizeType(var_types(i)))
+ if (var_types(i) != RegSet::tmpNormalizeType(var_types(i)))
{
// Only normalized types should have anything in the maxSpill array.
// We assume here that if type 'i' does not normalize to itself, then
@@ -6363,7 +6363,7 @@ void LinearScan::recordMaxSpill()
if (maxSpill[i] != 0)
{
JITDUMP(" %s: %d\n", varTypeName(var_types(i)), maxSpill[i]);
- compiler->tmpPreAllocateTemps(var_types(i), maxSpill[i]);
+ compiler->codeGen->regSet.tmpPreAllocateTemps(var_types(i), maxSpill[i]);
}
}
JITDUMP("\n");
@@ -6445,7 +6445,7 @@ void LinearScan::updateMaxSpill(RefPosition* refPosition)
{
typ = treeNode->TypeGet();
}
- typ = compiler->tmpNormalizeType(typ);
+ typ = RegSet::tmpNormalizeType(typ);
}
if (refPosition->spillAfter && !refPosition->reload)
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index 6fd800eadc..ffd25d3421 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -9644,9 +9644,6 @@ GenTree* Compiler::fgMorphInitBlock(GenTree* tree)
//
if (!destDoFldAsg)
{
-#if CPU_USES_BLOCK_MOVE
- compBlkOpUsed = true;
-#endif
dest = fgMorphBlockOperand(dest, dest->TypeGet(), blockWidth, true);
tree->gtOp.gtOp1 = dest;
tree->gtFlags |= (dest->gtFlags & GTF_ALL_EFFECT);
@@ -10588,9 +10585,6 @@ GenTree* Compiler::fgMorphCopyBlock(GenTree* tree)
if (requiresCopyBlock)
{
-#if CPU_USES_BLOCK_MOVE
- compBlkOpUsed = true;
-#endif
var_types asgType = dest->TypeGet();
dest = fgMorphBlockOperand(dest, asgType, blockWidth, true /*isDest*/);
asg->gtOp.gtOp1 = dest;
@@ -17062,10 +17056,6 @@ void Compiler::fgMorph()
fgAddInternal();
-#if OPT_BOOL_OPS
- fgMultipleNots = false;
-#endif
-
#ifdef DEBUG
/* Inliner could add basic blocks. Check that the flowgraph data is up-to-date */
fgDebugCheckBBlist(false, false);
diff --git a/src/jit/optimizer.cpp b/src/jit/optimizer.cpp
index a23623a406..6b7c3b1cbe 100644
--- a/src/jit/optimizer.cpp
+++ b/src/jit/optimizer.cpp
@@ -19,15 +19,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/*****************************************************************************/
-#if COUNT_RANGECHECKS
-/* static */
-unsigned Compiler::optRangeChkRmv = 0;
-/* static */
-unsigned Compiler::optRangeChkAll = 0;
-#endif
-
-/*****************************************************************************/
-
void Compiler::optInit()
{
optLoopsMarked = false;
@@ -35,6 +26,8 @@ void Compiler::optInit()
/* Initialize the # of tracked loops to 0 */
optLoopCount = 0;
+ optLoopTable = nullptr;
+
/* Keep track of the number of calls and indirect calls made by this method */
optCallCount = 0;
optIndirectCallCount = 0;
@@ -1148,20 +1141,29 @@ bool Compiler::optRecordLoop(BasicBlock* head,
assert(entry->bbNum <= bottom->bbNum);
assert(head->bbNum < top->bbNum || head->bbNum > bottom->bbNum);
- // If the new loop contains any existing ones, add it in the right place.
unsigned char loopInd = optLoopCount;
- for (unsigned char prevPlus1 = optLoopCount; prevPlus1 > 0; prevPlus1--)
+
+ if (optLoopTable == nullptr)
{
- unsigned char prev = prevPlus1 - 1;
- if (optLoopTable[prev].lpContainedBy(first, bottom))
- {
- loopInd = prev;
- }
+ assert(loopInd == 0);
+ optLoopTable = getAllocator(CMK_LoopOpt).allocate<LoopDsc>(MAX_LOOP_NUM);
}
- // Move up any loops if necessary.
- for (unsigned j = optLoopCount; j > loopInd; j--)
+ else
{
- optLoopTable[j] = optLoopTable[j - 1];
+ // If the new loop contains any existing ones, add it in the right place.
+ for (unsigned char prevPlus1 = optLoopCount; prevPlus1 > 0; prevPlus1--)
+ {
+ unsigned char prev = prevPlus1 - 1;
+ if (optLoopTable[prev].lpContainedBy(first, bottom))
+ {
+ loopInd = prev;
+ }
+ }
+ // Move up any loops if necessary.
+ for (unsigned j = optLoopCount; j > loopInd; j--)
+ {
+ optLoopTable[j] = optLoopTable[j - 1];
+ }
}
#ifdef DEBUG
@@ -1191,6 +1193,8 @@ bool Compiler::optRecordLoop(BasicBlock* head,
optLoopTable[loopInd].lpChild = BasicBlock::NOT_IN_LOOP;
optLoopTable[loopInd].lpSibling = BasicBlock::NOT_IN_LOOP;
+ optLoopTable[loopInd].lpAsgVars = AllVarSetOps::UninitVal();
+
optLoopTable[loopInd].lpFlags = 0;
// We haven't yet recorded any side effects.
diff --git a/src/jit/regset.cpp b/src/jit/regset.cpp
index 7896fa25b8..81887cc94e 100644
--- a/src/jit/regset.cpp
+++ b/src/jit/regset.cpp
@@ -325,7 +325,7 @@ void RegSet::rsSpillTree(regNumber reg, GenTree* tree, unsigned regIdx /* =0 */)
treeType = tree->TypeGet();
}
- var_types tempType = Compiler::tmpNormalizeType(treeType);
+ var_types tempType = RegSet::tmpNormalizeType(treeType);
regMaskTP mask;
bool floatSpill = false;
@@ -390,7 +390,7 @@ void RegSet::rsSpillTree(regNumber reg, GenTree* tree, unsigned regIdx /* =0 */)
SpillDsc* spill = SpillDsc::alloc(m_rsCompiler, this, tempType);
// Grab a temp to store the spilled value
- TempDsc* temp = m_rsCompiler->tmpGetTemp(tempType);
+ TempDsc* temp = tmpGetTemp(tempType);
spill->spillTemp = temp;
tempType = temp->tdTempType();
@@ -464,7 +464,7 @@ void RegSet::rsSpillFPStack(GenTreeCall* call)
/* Grab a temp to store the spilled value */
- spill->spillTemp = temp = m_rsCompiler->tmpGetTemp(treeType);
+ spill->spillTemp = temp = tmpGetTemp(treeType);
/* Remember what it is we have spilled */
@@ -602,7 +602,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/
-void Compiler::tmpInit()
+void RegSet::tmpInit()
{
tmpCount = 0;
tmpSize = 0;
@@ -615,7 +615,7 @@ void Compiler::tmpInit()
}
/* static */
-var_types Compiler::tmpNormalizeType(var_types type)
+var_types RegSet::tmpNormalizeType(var_types type)
{
type = genActualType(type);
@@ -638,7 +638,7 @@ var_types Compiler::tmpNormalizeType(var_types type)
* the garbage collector).
*/
-TempDsc* Compiler::tmpGetTemp(var_types type)
+TempDsc* RegSet::tmpGetTemp(var_types type)
{
type = tmpNormalizeType(type);
unsigned size = genTypeSize(type);
@@ -676,7 +676,7 @@ TempDsc* Compiler::tmpGetTemp(var_types type)
noway_assert(temp != nullptr);
#ifdef DEBUG
- if (verbose)
+ if (m_rsCompiler->verbose)
{
printf("%s temp #%u, slot %u, size = %u\n", isNewTemp ? "created" : "reused", -temp->tdTempNum(), slot,
temp->tdTempSize());
@@ -700,7 +700,7 @@ TempDsc* Compiler::tmpGetTemp(var_types type)
* has been preallocated, it is a fatal error.
*/
-void Compiler::tmpPreAllocateTemps(var_types type, unsigned count)
+void RegSet::tmpPreAllocateTemps(var_types type, unsigned count)
{
assert(type == tmpNormalizeType(type));
unsigned size = genTypeSize(type);
@@ -728,10 +728,10 @@ void Compiler::tmpPreAllocateTemps(var_types type, unsigned count)
}
#endif // _TARGET_ARM_
- TempDsc* temp = new (this, CMK_Unknown) TempDsc(-((int)tmpCount), size, type);
+ TempDsc* temp = new (m_rsCompiler, CMK_Unknown) TempDsc(-((int)tmpCount), size, type);
#ifdef DEBUG
- if (verbose)
+ if (m_rsCompiler->verbose)
{
printf("pre-allocated temp #%u, slot %u, size = %u\n", -temp->tdTempNum(), slot, temp->tdTempSize());
}
@@ -748,7 +748,7 @@ void Compiler::tmpPreAllocateTemps(var_types type, unsigned count)
* Release the given temp.
*/
-void Compiler::tmpRlsTemp(TempDsc* temp)
+void RegSet::tmpRlsTemp(TempDsc* temp)
{
assert(temp != nullptr);
@@ -759,7 +759,7 @@ void Compiler::tmpRlsTemp(TempDsc* temp)
slot = tmpSlot(temp->tdTempSize());
#ifdef DEBUG
- if (verbose)
+ if (m_rsCompiler->verbose)
{
printf("release temp #%u, slot %u, size = %u\n", -temp->tdTempNum(), slot, temp->tdTempSize());
}
@@ -798,7 +798,7 @@ void Compiler::tmpRlsTemp(TempDsc* temp)
*
* When looking for temps on the "used" list, this can be used any time.
*/
-TempDsc* Compiler::tmpFindNum(int tnum, TEMP_USAGE_TYPE usageType /* = TEMP_USAGE_FREE */) const
+TempDsc* RegSet::tmpFindNum(int tnum, TEMP_USAGE_TYPE usageType /* = TEMP_USAGE_FREE */) const
{
assert(tnum < 0); // temp numbers are negative
@@ -818,7 +818,7 @@ TempDsc* Compiler::tmpFindNum(int tnum, TEMP_USAGE_TYPE usageType /* = TEMP_USAG
* A helper function is used to iterate over all the temps.
*/
-TempDsc* Compiler::tmpListBeg(TEMP_USAGE_TYPE usageType /* = TEMP_USAGE_FREE */) const
+TempDsc* RegSet::tmpListBeg(TEMP_USAGE_TYPE usageType /* = TEMP_USAGE_FREE */) const
{
TempDsc* const* tmpLists;
if (usageType == TEMP_USAGE_FREE)
@@ -845,7 +845,7 @@ TempDsc* Compiler::tmpListBeg(TEMP_USAGE_TYPE usageType /* = TEMP_USAGE_FREE */)
* Used with tmpListBeg() to iterate over the list of temps.
*/
-TempDsc* Compiler::tmpListNxt(TempDsc* curTemp, TEMP_USAGE_TYPE usageType /* = TEMP_USAGE_FREE */) const
+TempDsc* RegSet::tmpListNxt(TempDsc* curTemp, TEMP_USAGE_TYPE usageType /* = TEMP_USAGE_FREE */) const
{
assert(curTemp != nullptr);
@@ -884,7 +884,7 @@ TempDsc* Compiler::tmpListNxt(TempDsc* curTemp, TEMP_USAGE_TYPE usageType /* = T
/*****************************************************************************
* Return 'true' if all allocated temps are free (not in use).
*/
-bool Compiler::tmpAllFree() const
+bool RegSet::tmpAllFree() const
{
// The 'tmpGetCount' should equal the number of things in the 'tmpUsed' lists. This is a convenient place
// to assert that.
@@ -1093,7 +1093,7 @@ void RegSet::SpillDsc::freeDsc(RegSet* regSet, RegSet::SpillDsc* spillDsc)
void RegSet::rsSpillChk()
{
// All grabbed temps should have been released
- assert(m_rsCompiler->tmpGetCount == 0);
+ assert(tmpGetCount == 0);
for (regNumber reg = REG_FIRST; reg < REG_COUNT; reg = REG_NEXT(reg))
{
diff --git a/src/jit/regset.h b/src/jit/regset.h
index 88889d946d..469178dce4 100644
--- a/src/jit/regset.h
+++ b/src/jit/regset.h
@@ -172,6 +172,62 @@ private:
TempDsc* rsUnspillInPlace(GenTree* tree, regNumber oldReg, unsigned regIdx = 0);
void rsMarkSpill(GenTree* tree, regNumber reg);
+
+public:
+ void tmpInit();
+
+ enum TEMP_USAGE_TYPE
+ {
+ TEMP_USAGE_FREE,
+ TEMP_USAGE_USED
+ };
+
+ static var_types tmpNormalizeType(var_types type);
+ TempDsc* tmpGetTemp(var_types type); // get temp for the given type
+ void tmpRlsTemp(TempDsc* temp);
+ TempDsc* tmpFindNum(int temp, TEMP_USAGE_TYPE usageType = TEMP_USAGE_FREE) const;
+
+ void tmpEnd();
+ TempDsc* tmpListBeg(TEMP_USAGE_TYPE usageType = TEMP_USAGE_FREE) const;
+ TempDsc* tmpListNxt(TempDsc* curTemp, TEMP_USAGE_TYPE usageType = TEMP_USAGE_FREE) const;
+ void tmpDone();
+
+#ifdef DEBUG
+ bool tmpAllFree() const;
+#endif // DEBUG
+
+ void tmpPreAllocateTemps(var_types type, unsigned count);
+
+ unsigned tmpGetTotalSize()
+ {
+ return tmpSize;
+ }
+
+private:
+ unsigned tmpCount; // Number of temps
+ unsigned tmpSize; // Size of all the temps
+#ifdef DEBUG
+ // Used by RegSet::rsSpillChk()
+ unsigned tmpGetCount; // Temps which haven't been released yet
+#endif
+ static unsigned tmpSlot(unsigned size); // which slot in tmpFree[] or tmpUsed[] to use
+
+ enum TEMP_CONSTANTS : unsigned
+ {
+#if defined(FEATURE_SIMD)
+#if defined(_TARGET_XARCH_)
+ TEMP_MAX_SIZE = YMM_REGSIZE_BYTES,
+#elif defined(_TARGET_ARM64_)
+ TEMP_MAX_SIZE = FP_REGSIZE_BYTES,
+#endif // defined(_TARGET_XARCH_) || defined(_TARGET_ARM64_)
+#else // !FEATURE_SIMD
+ TEMP_MAX_SIZE = sizeof(double),
+#endif // !FEATURE_SIMD
+ TEMP_SLOT_COUNT = (TEMP_MAX_SIZE / sizeof(int))
+ };
+
+ TempDsc* tmpFree[TEMP_MAX_SIZE / sizeof(int)];
+ TempDsc* tmpUsed[TEMP_MAX_SIZE / sizeof(int)];
};
#endif // _REGSET_H
diff --git a/src/jit/scopeinfo.cpp b/src/jit/scopeinfo.cpp
index 366a060d54..66f52a2758 100644
--- a/src/jit/scopeinfo.cpp
+++ b/src/jit/scopeinfo.cpp
@@ -377,19 +377,27 @@ void CodeGen::siInit()
if (compiler->info.compVarScopesCount == 0)
{
- return;
+ siLatestTrackedScopes = nullptr;
}
-
+ else
+ {
#if FEATURE_EH_FUNCLETS
- siInFuncletRegion = false;
+ siInFuncletRegion = false;
#endif // FEATURE_EH_FUNCLETS
- for (unsigned i = 0; i < lclMAX_TRACKED; i++)
- {
- siLatestTrackedScopes[i] = nullptr;
- }
+ unsigned scopeCount = compiler->lvaTrackedCount;
- compiler->compResetScopeLists();
+ if (scopeCount == 0)
+ {
+ siLatestTrackedScopes = nullptr;
+ }
+ else
+ {
+ siLatestTrackedScopes = new (compiler->getAllocator(CMK_SiScope)) siScope* [scopeCount] {};
+ }
+
+ compiler->compResetScopeLists();
+ }
}
/*****************************************************************************
@@ -669,8 +677,6 @@ void CodeGen::siUpdate()
LclVarDsc* lclVar = &compiler->lvaTable[lclNum];
assert(lclVar->lvTracked);
#endif
-
- siScope* scope = siLatestTrackedScopes[varIndex];
siEndTrackedScope(varIndex);
}
diff --git a/src/jit/simd.cpp b/src/jit/simd.cpp
index 60082434cf..224c340720 100644
--- a/src/jit/simd.cpp
+++ b/src/jit/simd.cpp
@@ -122,6 +122,26 @@ int Compiler::getSIMDTypeAlignment(var_types simdType)
var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, unsigned* sizeBytes /*= nullptr */)
{
assert(featureSIMD);
+
+ if (m_simdHandleCache == nullptr)
+ {
+ if (impInlineInfo == nullptr)
+ {
+ m_simdHandleCache = new (this, CMK_Generic) SIMDHandlesCache();
+ }
+ else
+ {
+ // Steal the inliner compiler's cache (create it if not available).
+
+ if (impInlineInfo->InlineRoot->m_simdHandleCache == nullptr)
+ {
+ impInlineInfo->InlineRoot->m_simdHandleCache = new (this, CMK_Generic) SIMDHandlesCache();
+ }
+
+ m_simdHandleCache = impInlineInfo->InlineRoot->m_simdHandleCache;
+ }
+ }
+
if (typeHnd == nullptr)
{
return TYP_UNKNOWN;
@@ -136,77 +156,77 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u
{
// The most likely to be used type handles are looked up first followed by
// less likely to be used type handles
- if (typeHnd == SIMDFloatHandle)
+ if (typeHnd == m_simdHandleCache->SIMDFloatHandle)
{
simdBaseType = TYP_FLOAT;
JITDUMP(" Known type SIMD Vector<Float>\n");
}
- else if (typeHnd == SIMDIntHandle)
+ else if (typeHnd == m_simdHandleCache->SIMDIntHandle)
{
simdBaseType = TYP_INT;
JITDUMP(" Known type SIMD Vector<Int>\n");
}
- else if (typeHnd == SIMDVector2Handle)
+ else if (typeHnd == m_simdHandleCache->SIMDVector2Handle)
{
simdBaseType = TYP_FLOAT;
size = 2 * genTypeSize(TYP_FLOAT);
assert(size == roundUp(info.compCompHnd->getClassSize(typeHnd), TARGET_POINTER_SIZE));
JITDUMP(" Known type Vector2\n");
}
- else if (typeHnd == SIMDVector3Handle)
+ else if (typeHnd == m_simdHandleCache->SIMDVector3Handle)
{
simdBaseType = TYP_FLOAT;
size = 3 * genTypeSize(TYP_FLOAT);
assert(size == info.compCompHnd->getClassSize(typeHnd));
JITDUMP(" Known type Vector3\n");
}
- else if (typeHnd == SIMDVector4Handle)
+ else if (typeHnd == m_simdHandleCache->SIMDVector4Handle)
{
simdBaseType = TYP_FLOAT;
size = 4 * genTypeSize(TYP_FLOAT);
assert(size == roundUp(info.compCompHnd->getClassSize(typeHnd), TARGET_POINTER_SIZE));
JITDUMP(" Known type Vector4\n");
}
- else if (typeHnd == SIMDVectorHandle)
+ else if (typeHnd == m_simdHandleCache->SIMDVectorHandle)
{
JITDUMP(" Known type Vector\n");
}
- else if (typeHnd == SIMDUShortHandle)
+ else if (typeHnd == m_simdHandleCache->SIMDUShortHandle)
{
simdBaseType = TYP_USHORT;
JITDUMP(" Known type SIMD Vector<ushort>\n");
}
- else if (typeHnd == SIMDUByteHandle)
+ else if (typeHnd == m_simdHandleCache->SIMDUByteHandle)
{
simdBaseType = TYP_UBYTE;
JITDUMP(" Known type SIMD Vector<ubyte>\n");
}
- else if (typeHnd == SIMDDoubleHandle)
+ else if (typeHnd == m_simdHandleCache->SIMDDoubleHandle)
{
simdBaseType = TYP_DOUBLE;
JITDUMP(" Known type SIMD Vector<Double>\n");
}
- else if (typeHnd == SIMDLongHandle)
+ else if (typeHnd == m_simdHandleCache->SIMDLongHandle)
{
simdBaseType = TYP_LONG;
JITDUMP(" Known type SIMD Vector<Long>\n");
}
- else if (typeHnd == SIMDShortHandle)
+ else if (typeHnd == m_simdHandleCache->SIMDShortHandle)
{
simdBaseType = TYP_SHORT;
JITDUMP(" Known type SIMD Vector<short>\n");
}
- else if (typeHnd == SIMDByteHandle)
+ else if (typeHnd == m_simdHandleCache->SIMDByteHandle)
{
simdBaseType = TYP_BYTE;
JITDUMP(" Known type SIMD Vector<byte>\n");
}
- else if (typeHnd == SIMDUIntHandle)
+ else if (typeHnd == m_simdHandleCache->SIMDUIntHandle)
{
simdBaseType = TYP_UINT;
JITDUMP(" Known type SIMD Vector<uint>\n");
}
- else if (typeHnd == SIMDULongHandle)
+ else if (typeHnd == m_simdHandleCache->SIMDULongHandle)
{
simdBaseType = TYP_ULONG;
JITDUMP(" Known type SIMD Vector<ulong>\n");
@@ -232,62 +252,62 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u
{
if (wcsncmp(&(className[25]), W("System.Single"), 13) == 0)
{
- SIMDFloatHandle = typeHnd;
- simdBaseType = TYP_FLOAT;
+ m_simdHandleCache->SIMDFloatHandle = typeHnd;
+ simdBaseType = TYP_FLOAT;
JITDUMP(" Found type SIMD Vector<Float>\n");
}
else if (wcsncmp(&(className[25]), W("System.Int32"), 12) == 0)
{
- SIMDIntHandle = typeHnd;
- simdBaseType = TYP_INT;
+ m_simdHandleCache->SIMDIntHandle = typeHnd;
+ simdBaseType = TYP_INT;
JITDUMP(" Found type SIMD Vector<Int>\n");
}
else if (wcsncmp(&(className[25]), W("System.UInt16"), 13) == 0)
{
- SIMDUShortHandle = typeHnd;
- simdBaseType = TYP_USHORT;
+ m_simdHandleCache->SIMDUShortHandle = typeHnd;
+ simdBaseType = TYP_USHORT;
JITDUMP(" Found type SIMD Vector<ushort>\n");
}
else if (wcsncmp(&(className[25]), W("System.Byte"), 11) == 0)
{
- SIMDUByteHandle = typeHnd;
- simdBaseType = TYP_UBYTE;
+ m_simdHandleCache->SIMDUByteHandle = typeHnd;
+ simdBaseType = TYP_UBYTE;
JITDUMP(" Found type SIMD Vector<ubyte>\n");
}
else if (wcsncmp(&(className[25]), W("System.Double"), 13) == 0)
{
- SIMDDoubleHandle = typeHnd;
- simdBaseType = TYP_DOUBLE;
+ m_simdHandleCache->SIMDDoubleHandle = typeHnd;
+ simdBaseType = TYP_DOUBLE;
JITDUMP(" Found type SIMD Vector<Double>\n");
}
else if (wcsncmp(&(className[25]), W("System.Int64"), 12) == 0)
{
- SIMDLongHandle = typeHnd;
- simdBaseType = TYP_LONG;
+ m_simdHandleCache->SIMDLongHandle = typeHnd;
+ simdBaseType = TYP_LONG;
JITDUMP(" Found type SIMD Vector<Long>\n");
}
else if (wcsncmp(&(className[25]), W("System.Int16"), 12) == 0)
{
- SIMDShortHandle = typeHnd;
- simdBaseType = TYP_SHORT;
+ m_simdHandleCache->SIMDShortHandle = typeHnd;
+ simdBaseType = TYP_SHORT;
JITDUMP(" Found type SIMD Vector<short>\n");
}
else if (wcsncmp(&(className[25]), W("System.SByte"), 12) == 0)
{
- SIMDByteHandle = typeHnd;
- simdBaseType = TYP_BYTE;
+ m_simdHandleCache->SIMDByteHandle = typeHnd;
+ simdBaseType = TYP_BYTE;
JITDUMP(" Found type SIMD Vector<byte>\n");
}
else if (wcsncmp(&(className[25]), W("System.UInt32"), 13) == 0)
{
- SIMDUIntHandle = typeHnd;
- simdBaseType = TYP_UINT;
+ m_simdHandleCache->SIMDUIntHandle = typeHnd;
+ simdBaseType = TYP_UINT;
JITDUMP(" Found type SIMD Vector<uint>\n");
}
else if (wcsncmp(&(className[25]), W("System.UInt64"), 13) == 0)
{
- SIMDULongHandle = typeHnd;
- simdBaseType = TYP_ULONG;
+ m_simdHandleCache->SIMDULongHandle = typeHnd;
+ simdBaseType = TYP_ULONG;
JITDUMP(" Found type SIMD Vector<ulong>\n");
}
else
@@ -297,7 +317,7 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u
}
else if (wcsncmp(&(className[16]), W("Vector2"), 8) == 0)
{
- SIMDVector2Handle = typeHnd;
+ m_simdHandleCache->SIMDVector2Handle = typeHnd;
simdBaseType = TYP_FLOAT;
size = 2 * genTypeSize(TYP_FLOAT);
@@ -306,7 +326,7 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u
}
else if (wcsncmp(&(className[16]), W("Vector3"), 8) == 0)
{
- SIMDVector3Handle = typeHnd;
+ m_simdHandleCache->SIMDVector3Handle = typeHnd;
simdBaseType = TYP_FLOAT;
size = 3 * genTypeSize(TYP_FLOAT);
@@ -315,7 +335,7 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u
}
else if (wcsncmp(&(className[16]), W("Vector4"), 8) == 0)
{
- SIMDVector4Handle = typeHnd;
+ m_simdHandleCache->SIMDVector4Handle = typeHnd;
simdBaseType = TYP_FLOAT;
size = 4 * genTypeSize(TYP_FLOAT);
@@ -324,7 +344,7 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u
}
else if (wcsncmp(&(className[16]), W("Vector"), 6) == 0)
{
- SIMDVectorHandle = typeHnd;
+ m_simdHandleCache->SIMDVectorHandle = typeHnd;
JITDUMP(" Found type Vector\n");
}
else
@@ -357,67 +377,67 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u
static_assert_no_msg(YMM_REGSIZE_BYTES == Vector256SizeBytes);
static_assert_no_msg(XMM_REGSIZE_BYTES == Vector128SizeBytes);
- if (typeHnd == Vector256FloatHandle)
+ if (typeHnd == m_simdHandleCache->Vector256FloatHandle)
{
simdBaseType = TYP_FLOAT;
size = Vector256SizeBytes;
JITDUMP(" Known type Vector256<float>\n");
}
- else if (typeHnd == Vector256DoubleHandle)
+ else if (typeHnd == m_simdHandleCache->Vector256DoubleHandle)
{
simdBaseType = TYP_DOUBLE;
size = Vector256SizeBytes;
JITDUMP(" Known type Vector256<double>\n");
}
- else if (typeHnd == Vector256IntHandle)
+ else if (typeHnd == m_simdHandleCache->Vector256IntHandle)
{
simdBaseType = TYP_INT;
size = Vector256SizeBytes;
JITDUMP(" Known type Vector256<int>\n");
}
- else if (typeHnd == Vector256UIntHandle)
+ else if (typeHnd == m_simdHandleCache->Vector256UIntHandle)
{
simdBaseType = TYP_UINT;
size = Vector256SizeBytes;
JITDUMP(" Known type Vector256<uint>\n");
}
- else if (typeHnd == Vector256ShortHandle)
+ else if (typeHnd == m_simdHandleCache->Vector256ShortHandle)
{
simdBaseType = TYP_SHORT;
size = Vector256SizeBytes;
JITDUMP(" Known type Vector256<short>\n");
}
- else if (typeHnd == Vector256UShortHandle)
+ else if (typeHnd == m_simdHandleCache->Vector256UShortHandle)
{
simdBaseType = TYP_USHORT;
size = Vector256SizeBytes;
JITDUMP(" Known type Vector256<ushort>\n");
}
- else if (typeHnd == Vector256ByteHandle)
+ else if (typeHnd == m_simdHandleCache->Vector256ByteHandle)
{
simdBaseType = TYP_BYTE;
size = Vector256SizeBytes;
JITDUMP(" Known type Vector256<sbyte>\n");
}
- else if (typeHnd == Vector256UByteHandle)
+ else if (typeHnd == m_simdHandleCache->Vector256UByteHandle)
{
simdBaseType = TYP_UBYTE;
size = Vector256SizeBytes;
JITDUMP(" Known type Vector256<byte>\n");
}
- else if (typeHnd == Vector256LongHandle)
+ else if (typeHnd == m_simdHandleCache->Vector256LongHandle)
{
simdBaseType = TYP_LONG;
size = Vector256SizeBytes;
JITDUMP(" Known type Vector256<long>\n");
}
- else if (typeHnd == Vector256ULongHandle)
+ else if (typeHnd == m_simdHandleCache->Vector256ULongHandle)
{
simdBaseType = TYP_ULONG;
size = Vector256SizeBytes;
JITDUMP(" Known type Vector256<ulong>\n");
}
- else if (typeHnd == Vector256FloatHandle)
+ else if (typeHnd == m_simdHandleCache->Vector256FloatHandle)
{
simdBaseType = TYP_FLOAT;
size = Vector256SizeBytes;
@@ -425,92 +445,92 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u
}
else
#endif // defined(_TARGET_XARCH)
- if (typeHnd == Vector128DoubleHandle)
+ if (typeHnd == m_simdHandleCache->Vector128DoubleHandle)
{
simdBaseType = TYP_DOUBLE;
size = Vector128SizeBytes;
JITDUMP(" Known type Vector128<double>\n");
}
- else if (typeHnd == Vector128IntHandle)
+ else if (typeHnd == m_simdHandleCache->Vector128IntHandle)
{
simdBaseType = TYP_INT;
size = Vector128SizeBytes;
JITDUMP(" Known type Vector128<int>\n");
}
- else if (typeHnd == Vector128UIntHandle)
+ else if (typeHnd == m_simdHandleCache->Vector128UIntHandle)
{
simdBaseType = TYP_UINT;
size = Vector128SizeBytes;
JITDUMP(" Known type Vector128<uint>\n");
}
- else if (typeHnd == Vector128ShortHandle)
+ else if (typeHnd == m_simdHandleCache->Vector128ShortHandle)
{
simdBaseType = TYP_SHORT;
size = Vector128SizeBytes;
JITDUMP(" Known type Vector128<short>\n");
}
- else if (typeHnd == Vector128UShortHandle)
+ else if (typeHnd == m_simdHandleCache->Vector128UShortHandle)
{
simdBaseType = TYP_USHORT;
size = Vector128SizeBytes;
JITDUMP(" Known type Vector128<ushort>\n");
}
- else if (typeHnd == Vector128ByteHandle)
+ else if (typeHnd == m_simdHandleCache->Vector128ByteHandle)
{
simdBaseType = TYP_BYTE;
size = Vector128SizeBytes;
JITDUMP(" Known type Vector128<sbyte>\n");
}
- else if (typeHnd == Vector128UByteHandle)
+ else if (typeHnd == m_simdHandleCache->Vector128UByteHandle)
{
simdBaseType = TYP_UBYTE;
size = Vector128SizeBytes;
JITDUMP(" Known type Vector128<byte>\n");
}
- else if (typeHnd == Vector128LongHandle)
+ else if (typeHnd == m_simdHandleCache->Vector128LongHandle)
{
simdBaseType = TYP_LONG;
size = Vector128SizeBytes;
JITDUMP(" Known type Vector128<long>\n");
}
- else if (typeHnd == Vector128ULongHandle)
+ else if (typeHnd == m_simdHandleCache->Vector128ULongHandle)
{
simdBaseType = TYP_ULONG;
size = Vector128SizeBytes;
JITDUMP(" Known type Vector128<ulong>\n");
}
#if defined(_TARGET_ARM64_)
- else if (typeHnd == Vector64IntHandle)
+ else if (typeHnd == m_simdHandleCache->Vector64IntHandle)
{
simdBaseType = TYP_INT;
size = Vector64SizeBytes;
JITDUMP(" Known type Vector64<int>\n");
}
- else if (typeHnd == Vector64UIntHandle)
+ else if (typeHnd == m_simdHandleCache->Vector64UIntHandle)
{
simdBaseType = TYP_UINT;
size = Vector64SizeBytes;
JITDUMP(" Known type Vector64<uint>\n");
}
- else if (typeHnd == Vector64ShortHandle)
+ else if (typeHnd == m_simdHandleCache->Vector64ShortHandle)
{
simdBaseType = TYP_SHORT;
size = Vector64SizeBytes;
JITDUMP(" Known type Vector64<short>\n");
}
- else if (typeHnd == Vector64UShortHandle)
+ else if (typeHnd == m_simdHandleCache->Vector64UShortHandle)
{
simdBaseType = TYP_USHORT;
size = Vector64SizeBytes;
JITDUMP(" Known type Vector64<ushort>\n");
}
- else if (typeHnd == Vector64ByteHandle)
+ else if (typeHnd == m_simdHandleCache->Vector64ByteHandle)
{
simdBaseType = TYP_BYTE;
size = Vector64SizeBytes;
JITDUMP(" Known type Vector64<sbyte>\n");
}
- else if (typeHnd == Vector64UByteHandle)
+ else if (typeHnd == m_simdHandleCache->Vector64UByteHandle)
{
simdBaseType = TYP_UBYTE;
size = Vector64SizeBytes;
@@ -539,53 +559,53 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u
switch (type)
{
case CORINFO_TYPE_FLOAT:
- Vector256FloatHandle = typeHnd;
- simdBaseType = TYP_FLOAT;
+ m_simdHandleCache->Vector256FloatHandle = typeHnd;
+ simdBaseType = TYP_FLOAT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector256<float>\n");
break;
case CORINFO_TYPE_DOUBLE:
- Vector256DoubleHandle = typeHnd;
- simdBaseType = TYP_DOUBLE;
+ m_simdHandleCache->Vector256DoubleHandle = typeHnd;
+ simdBaseType = TYP_DOUBLE;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector256<double>\n");
break;
case CORINFO_TYPE_INT:
- Vector256IntHandle = typeHnd;
- simdBaseType = TYP_INT;
+ m_simdHandleCache->Vector256IntHandle = typeHnd;
+ simdBaseType = TYP_INT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector256<int>\n");
break;
case CORINFO_TYPE_UINT:
- Vector256UIntHandle = typeHnd;
- simdBaseType = TYP_UINT;
+ m_simdHandleCache->Vector256UIntHandle = typeHnd;
+ simdBaseType = TYP_UINT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector256<uint>\n");
break;
case CORINFO_TYPE_SHORT:
- Vector256ShortHandle = typeHnd;
- simdBaseType = TYP_SHORT;
+ m_simdHandleCache->Vector256ShortHandle = typeHnd;
+ simdBaseType = TYP_SHORT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector256<short>\n");
break;
case CORINFO_TYPE_USHORT:
- Vector256UShortHandle = typeHnd;
- simdBaseType = TYP_USHORT;
+ m_simdHandleCache->Vector256UShortHandle = typeHnd;
+ simdBaseType = TYP_USHORT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector256<ushort>\n");
break;
case CORINFO_TYPE_LONG:
- Vector256LongHandle = typeHnd;
- simdBaseType = TYP_LONG;
+ m_simdHandleCache->Vector256LongHandle = typeHnd;
+ simdBaseType = TYP_LONG;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector256<long>\n");
break;
case CORINFO_TYPE_ULONG:
- Vector256ULongHandle = typeHnd;
- simdBaseType = TYP_ULONG;
+ m_simdHandleCache->Vector256ULongHandle = typeHnd;
+ simdBaseType = TYP_ULONG;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector256<ulong>\n");
break;
case CORINFO_TYPE_UBYTE:
- Vector256UByteHandle = typeHnd;
- simdBaseType = TYP_UBYTE;
+ m_simdHandleCache->Vector256UByteHandle = typeHnd;
+ simdBaseType = TYP_UBYTE;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector256<byte>\n");
break;
case CORINFO_TYPE_BYTE:
- Vector256ByteHandle = typeHnd;
- simdBaseType = TYP_BYTE;
+ m_simdHandleCache->Vector256ByteHandle = typeHnd;
+ simdBaseType = TYP_BYTE;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector256<sbyte>\n");
break;
@@ -601,53 +621,53 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u
switch (type)
{
case CORINFO_TYPE_FLOAT:
- Vector128FloatHandle = typeHnd;
- simdBaseType = TYP_FLOAT;
+ m_simdHandleCache->Vector128FloatHandle = typeHnd;
+ simdBaseType = TYP_FLOAT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector128<float>\n");
break;
case CORINFO_TYPE_DOUBLE:
- Vector128DoubleHandle = typeHnd;
- simdBaseType = TYP_DOUBLE;
+ m_simdHandleCache->Vector128DoubleHandle = typeHnd;
+ simdBaseType = TYP_DOUBLE;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector128<double>\n");
break;
case CORINFO_TYPE_INT:
- Vector128IntHandle = typeHnd;
- simdBaseType = TYP_INT;
+ m_simdHandleCache->Vector128IntHandle = typeHnd;
+ simdBaseType = TYP_INT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector128<int>\n");
break;
case CORINFO_TYPE_UINT:
- Vector128UIntHandle = typeHnd;
- simdBaseType = TYP_UINT;
+ m_simdHandleCache->Vector128UIntHandle = typeHnd;
+ simdBaseType = TYP_UINT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector128<uint>\n");
break;
case CORINFO_TYPE_SHORT:
- Vector128ShortHandle = typeHnd;
- simdBaseType = TYP_SHORT;
+ m_simdHandleCache->Vector128ShortHandle = typeHnd;
+ simdBaseType = TYP_SHORT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector128<short>\n");
break;
case CORINFO_TYPE_USHORT:
- Vector128UShortHandle = typeHnd;
- simdBaseType = TYP_USHORT;
+ m_simdHandleCache->Vector128UShortHandle = typeHnd;
+ simdBaseType = TYP_USHORT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector128<ushort>\n");
break;
case CORINFO_TYPE_LONG:
- Vector128LongHandle = typeHnd;
- simdBaseType = TYP_LONG;
+ m_simdHandleCache->Vector128LongHandle = typeHnd;
+ simdBaseType = TYP_LONG;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector128<long>\n");
break;
case CORINFO_TYPE_ULONG:
- Vector128ULongHandle = typeHnd;
- simdBaseType = TYP_ULONG;
+ m_simdHandleCache->Vector128ULongHandle = typeHnd;
+ simdBaseType = TYP_ULONG;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector128<ulong>\n");
break;
case CORINFO_TYPE_UBYTE:
- Vector128UByteHandle = typeHnd;
- simdBaseType = TYP_UBYTE;
+ m_simdHandleCache->Vector128UByteHandle = typeHnd;
+ simdBaseType = TYP_UBYTE;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector128<byte>\n");
break;
case CORINFO_TYPE_BYTE:
- Vector128ByteHandle = typeHnd;
- simdBaseType = TYP_BYTE;
+ m_simdHandleCache->Vector128ByteHandle = typeHnd;
+ simdBaseType = TYP_BYTE;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector128<sbyte>\n");
break;
@@ -662,38 +682,38 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u
switch (type)
{
case CORINFO_TYPE_FLOAT:
- Vector64FloatHandle = typeHnd;
- simdBaseType = TYP_FLOAT;
+ m_simdHandleCache->Vector64FloatHandle = typeHnd;
+ simdBaseType = TYP_FLOAT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector64<float>\n");
break;
case CORINFO_TYPE_INT:
- Vector64IntHandle = typeHnd;
- simdBaseType = TYP_INT;
+ m_simdHandleCache->Vector64IntHandle = typeHnd;
+ simdBaseType = TYP_INT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector64<int>\n");
break;
case CORINFO_TYPE_UINT:
- Vector64UIntHandle = typeHnd;
- simdBaseType = TYP_UINT;
+ m_simdHandleCache->Vector64UIntHandle = typeHnd;
+ simdBaseType = TYP_UINT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector64<uint>\n");
break;
case CORINFO_TYPE_SHORT:
- Vector64ShortHandle = typeHnd;
- simdBaseType = TYP_SHORT;
+ m_simdHandleCache->Vector64ShortHandle = typeHnd;
+ simdBaseType = TYP_SHORT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector64<short>\n");
break;
case CORINFO_TYPE_USHORT:
- Vector64UShortHandle = typeHnd;
- simdBaseType = TYP_USHORT;
+ m_simdHandleCache->Vector64UShortHandle = typeHnd;
+ simdBaseType = TYP_USHORT;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector64<ushort>\n");
break;
case CORINFO_TYPE_UBYTE:
- Vector64UByteHandle = typeHnd;
- simdBaseType = TYP_UBYTE;
+ m_simdHandleCache->Vector64UByteHandle = typeHnd;
+ simdBaseType = TYP_UBYTE;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector64<byte>\n");
break;
case CORINFO_TYPE_BYTE:
- Vector64ByteHandle = typeHnd;
- simdBaseType = TYP_BYTE;
+ m_simdHandleCache->Vector64ByteHandle = typeHnd;
+ simdBaseType = TYP_BYTE;
JITDUMP(" Found type Hardware Intrinsic SIMD Vector64<sbyte>\n");
break;
@@ -762,7 +782,7 @@ const SIMDIntrinsicInfo* Compiler::getSIMDIntrinsicInfo(CORINFO_CLASS_HANDLE* in
CORINFO_CLASS_HANDLE typeHnd = *inOutTypeHnd;
*baseType = getBaseTypeAndSizeOfSIMDType(typeHnd, sizeBytes);
- if (typeHnd == SIMDVectorHandle)
+ if (typeHnd == m_simdHandleCache->SIMDVectorHandle)
{
// All of the supported intrinsics on this static class take a first argument that's a vector,
// which determines the baseType.
@@ -846,22 +866,22 @@ const SIMDIntrinsicInfo* Compiler::getSIMDIntrinsicInfo(CORINFO_CLASS_HANDLE* in
{
if (i == SIMDIntrinsicInitN)
{
- if (*argCount == 3 && typeHnd == SIMDVector2Handle)
+ if (*argCount == 3 && typeHnd == m_simdHandleCache->SIMDVector2Handle)
{
expectedArgCnt = 3;
}
- else if (*argCount == 4 && typeHnd == SIMDVector3Handle)
+ else if (*argCount == 4 && typeHnd == m_simdHandleCache->SIMDVector3Handle)
{
expectedArgCnt = 4;
}
- else if (*argCount == 5 && typeHnd == SIMDVector4Handle)
+ else if (*argCount == 5 && typeHnd == m_simdHandleCache->SIMDVector4Handle)
{
expectedArgCnt = 5;
}
}
else if (i == SIMDIntrinsicInitFixed)
{
- if (*argCount == 4 && typeHnd == SIMDVector4Handle)
+ if (*argCount == 4 && typeHnd == m_simdHandleCache->SIMDVector4Handle)
{
expectedArgCnt = 4;
}
diff --git a/src/jit/target.h b/src/jit/target.h
index c374b0dbd7..9771f9a5d9 100644
--- a/src/jit/target.h
+++ b/src/jit/target.h
@@ -225,7 +225,6 @@ typedef unsigned char regNumberSmall;
#define CPU_HAS_FP_SUPPORT 1
#define ROUND_FLOAT 1 // round intermed float expression results
#define CPU_HAS_BYTE_REGS 1
- #define CPU_USES_BLOCK_MOVE 1
// TODO-CQ: Fine tune the following xxBlk threshold values:
@@ -513,7 +512,6 @@ typedef unsigned char regNumberSmall;
#define CPU_HAS_FP_SUPPORT 1
#define ROUND_FLOAT 0 // Do not round intermed float expression results
#define CPU_HAS_BYTE_REGS 0
- #define CPU_USES_BLOCK_MOVE 1
#define CPBLK_MOVS_LIMIT 16 // When generating code for CpBlk, this is the buffer size
// threshold to stop generating rep movs and switch to the helper call.
@@ -918,7 +916,6 @@ typedef unsigned char regNumberSmall;
#define CPU_HAS_FP_SUPPORT 1
#define ROUND_FLOAT 0 // Do not round intermed float expression results
#define CPU_HAS_BYTE_REGS 0
- #define CPU_USES_BLOCK_MOVE 0
#define CPBLK_UNROLL_LIMIT 32 // Upper bound to let the code generator to loop unroll CpBlk.
#define INITBLK_UNROLL_LIMIT 32 // Upper bound to let the code generator to loop unroll InitBlk.
@@ -1219,7 +1216,6 @@ typedef unsigned char regNumberSmall;
#define CPU_HAS_FP_SUPPORT 1
#define ROUND_FLOAT 0 // Do not round intermed float expression results
#define CPU_HAS_BYTE_REGS 0
- #define CPU_USES_BLOCK_MOVE 0
#define CPBLK_UNROLL_LIMIT 64 // Upper bound to let the code generator to loop unroll CpBlk.
#define INITBLK_UNROLL_LIMIT 64 // Upper bound to let the code generator to loop unroll InitBlk.