summaryrefslogtreecommitdiff
path: root/src/jit/compiler.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jit/compiler.hpp')
-rw-r--r--src/jit/compiler.hpp68
1 files changed, 62 insertions, 6 deletions
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp
index e8358fd..6baf601 100644
--- a/src/jit/compiler.hpp
+++ b/src/jit/compiler.hpp
@@ -500,6 +500,52 @@ inline regNumber genRegNumFromMask(regMaskTP mask)
return regNum;
}
+//------------------------------------------------------------------------------
+// genTypeCanRepresentValue: Checks if a value can be represented by a given type.
+//
+// Arguments:
+// value - the value to check
+// type - the type
+//
+// Return Value:
+// True if the value is representable, false otherwise.
+//
+// Notes:
+// If the type is not integral or ref like (ref/byref/array) then false is
+// always returned.
+
+template <typename TValue>
+inline bool genTypeCanRepresentValue(var_types type, TValue value)
+{
+ switch (type)
+ {
+ case TYP_UBYTE:
+ case TYP_BOOL:
+ return FitsIn<UINT8>(value);
+ case TYP_BYTE:
+ return FitsIn<INT8>(value);
+ case TYP_USHORT:
+ case TYP_CHAR:
+ return FitsIn<UINT16>(value);
+ case TYP_SHORT:
+ return FitsIn<INT16>(value);
+ case TYP_UINT:
+ return FitsIn<UINT32>(value);
+ case TYP_INT:
+ return FitsIn<INT32>(value);
+ case TYP_ULONG:
+ return FitsIn<UINT64>(value);
+ case TYP_LONG:
+ return FitsIn<INT64>(value);
+ case TYP_REF:
+ case TYP_BYREF:
+ case TYP_ARRAY:
+ return FitsIn<UINT_PTR>(value);
+ default:
+ return false;
+ }
+}
+
/*****************************************************************************
*
* Return the size in bytes of the given type.
@@ -1137,7 +1183,6 @@ inline GenTreePtr Compiler::gtNewFieldRef(
tree->gtField.gtFldObj = obj;
tree->gtField.gtFldHnd = fldHnd;
tree->gtField.gtFldOffset = offset;
- tree->gtFlags |= GTF_GLOB_REF;
#ifdef FEATURE_READYTORUN_COMPILER
tree->gtField.gtFieldLookup.addr = nullptr;
@@ -1154,6 +1199,18 @@ inline GenTreePtr Compiler::gtNewFieldRef(
{
unsigned lclNum = obj->gtOp.gtOp1->gtLclVarCommon.gtLclNum;
lvaTable[lclNum].lvFieldAccessed = 1;
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+ // These structs are passed by reference; we should probably be able to treat these
+ // as non-global refs, but downstream logic expects these to be marked this way.
+ if (lvaTable[lclNum].lvIsParam)
+ {
+ tree->gtFlags |= GTF_GLOB_REF;
+ }
+#endif // defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+ }
+ else
+ {
+ tree->gtFlags |= GTF_GLOB_REF;
}
return tree;
@@ -4626,15 +4683,14 @@ inline void BasicBlock::InitVarSets(Compiler* comp)
{
VarSetOps::AssignNoCopy(comp, bbVarUse, VarSetOps::MakeEmpty(comp));
VarSetOps::AssignNoCopy(comp, bbVarDef, VarSetOps::MakeEmpty(comp));
- VarSetOps::AssignNoCopy(comp, bbVarTmp, VarSetOps::MakeEmpty(comp));
VarSetOps::AssignNoCopy(comp, bbLiveIn, VarSetOps::MakeEmpty(comp));
VarSetOps::AssignNoCopy(comp, bbLiveOut, VarSetOps::MakeEmpty(comp));
VarSetOps::AssignNoCopy(comp, bbScope, VarSetOps::MakeEmpty(comp));
- bbHeapUse = false;
- bbHeapDef = false;
- bbHeapLiveIn = false;
- bbHeapLiveOut = false;
+ bbMemoryUse = emptyMemoryKindSet;
+ bbMemoryDef = emptyMemoryKindSet;
+ bbMemoryLiveIn = emptyMemoryKindSet;
+ bbMemoryLiveOut = emptyMemoryKindSet;
}
// Returns true if the basic block ends with GT_JMP