summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Forstall <brucefo@microsoft.com>2019-01-09 11:07:20 -0800
committerGitHub <noreply@github.com>2019-01-09 11:07:20 -0800
commit867d7c93ea9dbabfc7262e747ecb3823983606e3 (patch)
tree7cfaa97f495d2ca2a75fca47901d2802bb096d6a /src
parent03e2c029f7bbd36e06bcad3822b1dd3866772170 (diff)
parent4b68c59aa18e0af3c770e1bdf22993a252d19a46 (diff)
downloadcoreclr-867d7c93ea9dbabfc7262e747ecb3823983606e3.tar.gz
coreclr-867d7c93ea9dbabfc7262e747ecb3823983606e3.tar.bz2
coreclr-867d7c93ea9dbabfc7262e747ecb3823983606e3.zip
Merge pull request #20772 from mikedn/ir-cleanup
Some IR cleanup
Diffstat (limited to 'src')
-rw-r--r--src/jit/codegen.h2
-rw-r--r--src/jit/codegenarmarch.cpp3
-rw-r--r--src/jit/codegencommon.cpp5
-rw-r--r--src/jit/codegenxarch.cpp3
-rw-r--r--src/jit/compiler.cpp11
-rw-r--r--src/jit/compiler.h6
-rw-r--r--src/jit/compiler.hpp77
-rw-r--r--src/jit/decomposelongs.cpp4
-rw-r--r--src/jit/earlyprop.cpp2
-rw-r--r--src/jit/gentree.cpp101
-rw-r--r--src/jit/gentree.h70
-rw-r--r--src/jit/gtlist.h2
-rw-r--r--src/jit/gtstructs.h4
-rw-r--r--src/jit/importer.cpp20
-rw-r--r--src/jit/lir.cpp2
-rw-r--r--src/jit/liveness.cpp3
-rw-r--r--src/jit/lower.cpp36
-rw-r--r--src/jit/morph.cpp19
-rw-r--r--src/jit/scopeinfo.cpp7
19 files changed, 77 insertions, 300 deletions
diff --git a/src/jit/codegen.h b/src/jit/codegen.h
index 6b2e702914..0a6f262a02 100644
--- a/src/jit/codegen.h
+++ b/src/jit/codegen.h
@@ -250,7 +250,7 @@ protected:
void genExitCode(BasicBlock* block);
- void genJumpToThrowHlpBlk(emitJumpKind jumpKind, SpecialCodeKind codeKind, GenTree* failBlk = nullptr);
+ void genJumpToThrowHlpBlk(emitJumpKind jumpKind, SpecialCodeKind codeKind, BasicBlock* failBlk = nullptr);
void genCheckOverflow(GenTree* tree);
diff --git a/src/jit/codegenarmarch.cpp b/src/jit/codegenarmarch.cpp
index 494234b8ea..65a7ad7b65 100644
--- a/src/jit/codegenarmarch.cpp
+++ b/src/jit/codegenarmarch.cpp
@@ -397,8 +397,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
break;
case GT_LABEL:
- genPendingCallLabel = genCreateTempLabel();
- treeNode->gtLabel.gtLabBB = genPendingCallLabel;
+ genPendingCallLabel = genCreateTempLabel();
emit->emitIns_R_L(INS_adr, EA_PTRSIZE, genPendingCallLabel, targetReg);
break;
diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp
index 4f8b3f24f1..99dc2904ca 100644
--- a/src/jit/codegencommon.cpp
+++ b/src/jit/codegencommon.cpp
@@ -1967,7 +1967,7 @@ void CodeGen::genExitCode(BasicBlock* block)
// codeKind - the special throw-helper kind;
// failBlk - optional fail target block, if it is already known;
//
-void CodeGen::genJumpToThrowHlpBlk(emitJumpKind jumpKind, SpecialCodeKind codeKind, GenTree* failBlk)
+void CodeGen::genJumpToThrowHlpBlk(emitJumpKind jumpKind, SpecialCodeKind codeKind, BasicBlock* failBlk)
{
bool useThrowHlpBlk = compiler->fgUseThrowHelperBlocks();
#if defined(UNIX_X86_ABI) && FEATURE_EH_FUNCLETS
@@ -1985,8 +1985,7 @@ void CodeGen::genJumpToThrowHlpBlk(emitJumpKind jumpKind, SpecialCodeKind codeKi
if (failBlk != nullptr)
{
// We already know which block to jump to. Use that.
- assert(failBlk->gtOper == GT_LABEL);
- excpRaisingBlock = failBlk->gtLabel.gtLabBB;
+ excpRaisingBlock = failBlk;
#ifdef DEBUG
Compiler::AddCodeDsc* add =
diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp
index 5c4d7bd9cb..37cd2661f7 100644
--- a/src/jit/codegenxarch.cpp
+++ b/src/jit/codegenxarch.cpp
@@ -1940,8 +1940,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
break;
case GT_LABEL:
- genPendingCallLabel = genCreateTempLabel();
- treeNode->gtLabel.gtLabBB = genPendingCallLabel;
+ genPendingCallLabel = genCreateTempLabel();
emit->emitIns_R_L(INS_lea, EA_PTR_DSP_RELOC, genPendingCallLabel, treeNode->gtRegNum);
break;
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index 40c31c6870..6b31cfaefe 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -9151,7 +9151,6 @@ int cTreeFlagsIR(Compiler* comp, GenTree* tree)
CLANG_FORMAT_COMMENT_ANCHOR;
#if defined(DEBUG)
-#if SMALL_TREE_NODES
if (comp->dumpIRNodes)
{
if (tree->gtDebugFlags & GTF_DEBUG_NODE_LARGE)
@@ -9163,7 +9162,6 @@ int cTreeFlagsIR(Compiler* comp, GenTree* tree)
chars += printf("[NODE_SMALL]");
}
}
-#endif // SMALL_TREE_NODES
if (tree->gtDebugFlags & GTF_DEBUG_NODE_MORPHED)
{
chars += printf("[MORPHED]");
@@ -10169,15 +10167,6 @@ int cLeafIR(Compiler* comp, GenTree* tree)
break;
case GT_LABEL:
-
- if (tree->gtLabel.gtLabBB)
- {
- chars += printf(FMT_BB, tree->gtLabel.gtLabBB->bbNum);
- }
- else
- {
- chars += printf("BB?");
- }
break;
case GT_IL_OFFSET:
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index 601c27b9e3..1fc90679b4 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -2385,7 +2385,8 @@ public:
GenTreeCall* gtNewHelperCallNode(unsigned helper, var_types type, GenTreeArgList* args = nullptr);
- GenTree* gtNewLclvNode(unsigned lnum, var_types type, IL_OFFSETX ILoffs = BAD_IL_OFFSET);
+ GenTree* gtNewLclvNode(unsigned lnum, var_types type DEBUGARG(IL_OFFSETX ILoffs = BAD_IL_OFFSET));
+ GenTree* gtNewLclLNode(unsigned lnum, var_types type DEBUGARG(IL_OFFSETX ILoffs = BAD_IL_OFFSET));
#ifdef FEATURE_SIMD
GenTreeSIMD* gtNewSIMDNode(
@@ -2430,12 +2431,9 @@ public:
CORINFO_CLASS_HANDLE gtGetStructHandleForHWSIMD(var_types simdType, var_types simdBaseType);
#endif // FEATURE_HW_INTRINSICS
- GenTree* gtNewLclLNode(unsigned lnum, var_types type, IL_OFFSETX ILoffs = BAD_IL_OFFSET);
GenTreeLclFld* gtNewLclFldNode(unsigned lnum, var_types type, unsigned offset);
GenTree* gtNewInlineCandidateReturnExpr(GenTree* inlineCandidate, var_types type);
- GenTree* gtNewCodeRef(BasicBlock* block);
-
GenTree* gtNewFieldRef(var_types typ, CORINFO_FIELD_HANDLE fldHnd, GenTree* obj = nullptr, DWORD offset = 0);
GenTree* gtNewIndexRef(var_types typ, GenTree* arrayOp, GenTree* indexOp);
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp
index b15190983f..71d5e6b3f6 100644
--- a/src/jit/compiler.hpp
+++ b/src/jit/compiler.hpp
@@ -871,11 +871,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
void* GenTree::operator new(size_t sz, Compiler* comp, genTreeOps oper)
{
-#if SMALL_TREE_NODES
size_t size = GenTree::s_gtNodeSizes[oper];
-#else
- size_t size = TREE_NODE_SZ_LARGE;
-#endif
#if MEASURE_NODE_SIZE
genNodeSizeStats.genTreeNodeCnt += 1;
@@ -916,7 +912,6 @@ inline GenTree::GenTree(genTreeOps oper, var_types type DEBUGARG(bool largeNode)
INDEBUG(gtCostsInitialized = false;)
#ifdef DEBUG
-#if SMALL_TREE_NODES
size_t size = GenTree::s_gtNodeSizes[oper];
if (size == TREE_NODE_SZ_SMALL && !largeNode)
{
@@ -931,7 +926,6 @@ inline GenTree::GenTree(genTreeOps oper, var_types type DEBUGARG(bool largeNode)
assert(!"bogus node size");
}
#endif
-#endif
#if COUNT_AST_OPERS
InterlockedIncrement(&s_gtNodeCounts[oper]);
@@ -1011,10 +1005,7 @@ inline GenTree* Compiler::gtNewOperNode(genTreeOps oper, var_types type, GenTree
// Returns an opcode that is of the largest node size in use.
inline genTreeOps LargeOpOpcode()
{
-#if SMALL_TREE_NODES
- // Allocate a large node
assert(GenTree::s_gtNodeSizes[GT_CALL] == TREE_NODE_SZ_LARGE);
-#endif
return GT_CALL;
}
@@ -1026,18 +1017,11 @@ inline genTreeOps LargeOpOpcode()
inline GenTree* Compiler::gtNewLargeOperNode(genTreeOps oper, var_types type, GenTree* op1, GenTree* op2)
{
assert((GenTree::OperKind(oper) & (GTK_UNOP | GTK_BINOP)) != 0);
- assert((GenTree::OperKind(oper) & GTK_EXOP) ==
- 0); // Can't use this to construct any types that extend unary/binary operator.
-#if SMALL_TREE_NODES
- // Allocate a large node
-
+ // Can't use this to construct any types that extend unary/binary operator.
+ assert((GenTree::OperKind(oper) & GTK_EXOP) == 0);
assert(GenTree::s_gtNodeSizes[oper] == TREE_NODE_SZ_SMALL);
-
+ // Allocate a large node
GenTree* node = new (this, LargeOpOpcode()) GenTreeOp(oper, type, op1, op2 DEBUGARG(/*largeNode*/ true));
-#else
- GenTree* node = new (this, oper) GenTreeOp(oper, type, op1, op2);
-#endif
-
return node;
}
@@ -1061,7 +1045,7 @@ inline GenTree* Compiler::gtNewIconHandleNode(size_t value, unsigned flags, Fiel
#if defined(LATE_DISASM)
node = new (this, LargeOpOpcode()) GenTreeIntCon(TYP_I_IMPL, value, fields DEBUGARG(/*largeNode*/ true));
#else
- node = new (this, GT_CNS_INT) GenTreeIntCon(TYP_I_IMPL, value, fields);
+ node = new (this, GT_CNS_INT) GenTreeIntCon(TYP_I_IMPL, value, fields);
#endif
node->gtFlags |= flags;
return node;
@@ -1192,14 +1176,6 @@ inline GenTree* Compiler::gtNewRuntimeLookup(CORINFO_GENERIC_HANDLE hnd, CorInfo
return node;
}
-/*****************************************************************************/
-
-inline GenTree* Compiler::gtNewCodeRef(BasicBlock* block)
-{
- GenTree* node = new (this, GT_LABEL) GenTreeLabel(block);
- return node;
-}
-
/*****************************************************************************
*
* A little helper to create a data member reference node.
@@ -1207,10 +1183,8 @@ inline GenTree* Compiler::gtNewCodeRef(BasicBlock* block)
inline GenTree* Compiler::gtNewFieldRef(var_types typ, CORINFO_FIELD_HANDLE fldHnd, GenTree* obj, DWORD offset)
{
-#if SMALL_TREE_NODES
/* 'GT_FIELD' nodes may later get transformed into 'GT_IND' */
assert(GenTree::s_gtNodeSizes[GT_IND] <= GenTree::s_gtNodeSizes[GT_FIELD]);
-#endif // SMALL_TREE_NODES
GenTree* tree = new (this, GT_FIELD) GenTreeField(typ, obj, fldHnd, offset);
@@ -1356,8 +1330,6 @@ inline void Compiler::gtSetStmtInfo(GenTree* stmt)
}
/*****************************************************************************/
-#if SMALL_TREE_NODES
-/*****************************************************************************/
inline void GenTree::SetOper(genTreeOps oper, ValueNumberUpdate vnUpdate)
{
@@ -1441,47 +1413,6 @@ inline GenTreeCast* Compiler::gtNewCastNodeL(var_types typ, GenTree* op1, bool f
}
/*****************************************************************************/
-#else // SMALL_TREE_NODES
-/*****************************************************************************/
-
-inline void GenTree::InitNodeSize()
-{
-}
-
-inline void GenTree::SetOper(genTreeOps oper, ValueNumberUpdate vnUpdate)
-{
- SetOperRaw(oper);
-
- if (vnUpdate == CLEAR_VN)
- {
- // Clear the ValueNum field.
- gtVNPair.SetBoth(ValueNumStore::NoVN);
- }
-}
-
-inline void GenTree::ReplaceWith(GenTree* src)
-{
- RecordOperBashing(OperGet(), src->OperGet()); // nop unless NODEBASH_STATS is enabled
- *this = *src;
-#ifdef DEBUG
- gtSeqNum = 0;
-#endif
-}
-
-inline GenTree* Compiler::gtNewCastNode(var_types typ, GenTree* op1, var_types castType)
-{
- GenTree* tree = gtNewOperNode(GT_CAST, typ, op1);
- tree->gtCast.gtCastType = castType;
-}
-
-inline GenTree* Compiler::gtNewCastNodeL(var_types typ, GenTree* op1, var_types castType)
-{
- return gtNewCastNode(typ, op1, castType);
-}
-
-/*****************************************************************************/
-#endif // SMALL_TREE_NODES
-/*****************************************************************************/
/*****************************************************************************/
diff --git a/src/jit/decomposelongs.cpp b/src/jit/decomposelongs.cpp
index cd12182018..4a0f27b555 100644
--- a/src/jit/decomposelongs.cpp
+++ b/src/jit/decomposelongs.cpp
@@ -805,7 +805,7 @@ GenTree* DecomposeLongs::DecomposeStoreInd(LIR::Use& use)
storeIndLow->gtType = TYP_INT;
GenTree* addrBaseHigh = new (m_compiler, GT_LCL_VAR)
- GenTreeLclVar(GT_LCL_VAR, addrBase->TypeGet(), addrBase->AsLclVarCommon()->GetLclNum(), BAD_IL_OFFSET);
+ GenTreeLclVar(GT_LCL_VAR, addrBase->TypeGet(), addrBase->AsLclVarCommon()->GetLclNum());
GenTree* addrHigh =
new (m_compiler, GT_LEA) GenTreeAddrMode(TYP_REF, addrBaseHigh, nullptr, 0, genTypeSize(TYP_INT));
GenTree* storeIndHigh = new (m_compiler, GT_STOREIND) GenTreeStoreInd(TYP_INT, addrHigh, dataHigh);
@@ -857,7 +857,7 @@ GenTree* DecomposeLongs::DecomposeInd(LIR::Use& use)
// Create tree of ind(addr+4)
GenTree* addrBase = indLow->gtGetOp1();
GenTree* addrBaseHigh = new (m_compiler, GT_LCL_VAR)
- GenTreeLclVar(GT_LCL_VAR, addrBase->TypeGet(), addrBase->AsLclVarCommon()->GetLclNum(), BAD_IL_OFFSET);
+ GenTreeLclVar(GT_LCL_VAR, addrBase->TypeGet(), addrBase->AsLclVarCommon()->GetLclNum());
GenTree* addrHigh =
new (m_compiler, GT_LEA) GenTreeAddrMode(TYP_REF, addrBaseHigh, nullptr, 0, genTypeSize(TYP_INT));
GenTree* indHigh = new (m_compiler, GT_IND) GenTreeIndir(GT_IND, TYP_INT, addrHigh, nullptr);
diff --git a/src/jit/earlyprop.cpp b/src/jit/earlyprop.cpp
index 0131aa6e21..26a50d894b 100644
--- a/src/jit/earlyprop.cpp
+++ b/src/jit/earlyprop.cpp
@@ -290,9 +290,7 @@ GenTree* Compiler::optEarlyPropRewriteTree(GenTree* tree)
{
assert((propKind == optPropKind::OPK_ARRAYLEN) || (propKind == optPropKind::OPK_OBJ_GETTYPE));
assert(actualVal->IsCnsIntOrI());
-#if SMALL_TREE_NODES
assert(actualVal->GetNodeSize() == TREE_NODE_SZ_SMALL);
-#endif
ssize_t actualConstVal = actualVal->AsIntCon()->IconValue();
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp
index 893695a194..3783ea8d36 100644
--- a/src/jit/gentree.cpp
+++ b/src/jit/gentree.cpp
@@ -182,7 +182,7 @@ const char* GenTree::OpName(genTreeOps op)
#endif
-#if MEASURE_NODE_SIZE && SMALL_TREE_NODES
+#if MEASURE_NODE_SIZE
static const char* opStructNames[] = {
#define GTNODE(en, st, cm, ok) #st,
@@ -198,14 +198,12 @@ const char* GenTree::OpStructName(genTreeOps op)
#endif
-/*****************************************************************************
- *
- * When 'SMALL_TREE_NODES' is enabled, we allocate tree nodes in 2 different
- * sizes: 'TREE_NODE_SZ_SMALL' for most nodes and 'TREE_NODE_SZ_LARGE' for the
- * few nodes (such as calls) that have more fields and take up a lot more space.
- */
-
-#if SMALL_TREE_NODES
+//
+// We allocate tree nodes in 2 different sizes:
+// - TREE_NODE_SZ_SMALL for most nodes
+// - TREE_NODE_SZ_LARGE for the few nodes (such as calls) that have
+// more fields and take up a lot more space.
+//
/* GT_COUNT'th oper is overloaded as 'undefined oper', so allocate storage for GT_COUNT'th oper also */
/* static */
@@ -303,7 +301,6 @@ void GenTree::InitNodeSize()
static_assert_no_msg(sizeof(GenTreeVal) <= TREE_NODE_SZ_SMALL);
static_assert_no_msg(sizeof(GenTreeIntConCommon) <= TREE_NODE_SZ_SMALL);
static_assert_no_msg(sizeof(GenTreePhysReg) <= TREE_NODE_SZ_SMALL);
- static_assert_no_msg(sizeof(GenTreeJumpTable) <= TREE_NODE_SZ_SMALL);
static_assert_no_msg(sizeof(GenTreeIntCon) <= TREE_NODE_SZ_SMALL);
static_assert_no_msg(sizeof(GenTreeLngCon) <= TREE_NODE_SZ_SMALL);
static_assert_no_msg(sizeof(GenTreeDblCon) <= TREE_NODE_SZ_SMALL);
@@ -338,7 +335,6 @@ void GenTree::InitNodeSize()
static_assert_no_msg(sizeof(GenTreeStmt) <= TREE_NODE_SZ_LARGE); // *** large node
static_assert_no_msg(sizeof(GenTreeClsVar) <= TREE_NODE_SZ_SMALL);
static_assert_no_msg(sizeof(GenTreeArgPlace) <= TREE_NODE_SZ_SMALL);
- static_assert_no_msg(sizeof(GenTreeLabel) <= TREE_NODE_SZ_SMALL);
static_assert_no_msg(sizeof(GenTreePhiArg) <= TREE_NODE_SZ_SMALL);
static_assert_no_msg(sizeof(GenTreeAllocObj) <= TREE_NODE_SZ_LARGE); // *** large node
#ifndef FEATURE_PUT_STRUCT_ARG_STK
@@ -386,7 +382,6 @@ bool GenTree::IsNodeProperlySized() const
}
#endif
-#if SMALL_TREE_NODES
//------------------------------------------------------------------------
// ReplaceWith: replace this with the src node. The source must be an isolated node
// and cannot be used after the replacement.
@@ -426,8 +421,6 @@ void GenTree::ReplaceWith(GenTree* src, Compiler* comp)
DEBUG_DESTROY_NODE(src);
}
-#endif
-
/*****************************************************************************
*
* When 'NODEBASH_STATS' is enabled in "jit.h" we record all instances of
@@ -510,33 +503,18 @@ void GenTree::ReportOperBashing(FILE* f)
#endif // NODEBASH_STATS
-#else // SMALL_TREE_NODES
-
-#ifdef DEBUG
-bool GenTree::IsNodeProperlySized() const
-{
- return true;
-}
-#endif
-
-#endif // SMALL_TREE_NODES
-
/*****************************************************************************/
#if MEASURE_NODE_SIZE
void GenTree::DumpNodeSizes(FILE* fp)
{
-// Dump the sizes of the various GenTree flavors
+ // Dump the sizes of the various GenTree flavors
-#if SMALL_TREE_NODES
fprintf(fp, "Small tree node size = %3u bytes\n", TREE_NODE_SZ_SMALL);
-#endif
fprintf(fp, "Large tree node size = %3u bytes\n", TREE_NODE_SZ_LARGE);
fprintf(fp, "\n");
-#if SMALL_TREE_NODES
-
// Verify that node sizes are set kosherly and dump sizes
for (unsigned op = GT_NONE + 1; op < GT_COUNT; op++)
{
@@ -581,8 +559,6 @@ void GenTree::DumpNodeSizes(FILE* fp)
fprintf(fp, "\n");
}
}
-
-#endif
}
#endif // MEASURE_NODE_SIZE
@@ -4574,10 +4550,6 @@ GenTree** GenTree::gtGetChildPointer(GenTree* parent) const
{
return &(parent->gtBoundsChk.gtArrLen);
}
- if (this == parent->gtBoundsChk.gtIndRngFailBB)
- {
- return &(parent->gtBoundsChk.gtIndRngFailBB);
- }
break;
case GT_ARR_ELEM:
@@ -5482,9 +5454,7 @@ GenTree* Compiler::gtNewPhysRegNode(regNumber reg, var_types type)
GenTree* Compiler::gtNewJmpTableNode()
{
- GenTree* node = new (this, GT_JMPTABLE) GenTreeJumpTable(TYP_INT);
- node->gtJumpTable.gtJumpTableAddr = 0;
- return node;
+ return new (this, GT_JMPTABLE) GenTree(GT_JMPTABLE, TYP_I_IMPL);
}
/*****************************************************************************
@@ -5677,18 +5647,9 @@ GenTree* Compiler::gtNewDconNode(double value)
GenTree* Compiler::gtNewSconNode(int CPX, CORINFO_MODULE_HANDLE scpHandle)
{
-
-#if SMALL_TREE_NODES
-
- /* 'GT_CNS_STR' nodes later get transformed into 'GT_CALL' */
-
+ // 'GT_CNS_STR' nodes later get transformed into 'GT_CALL'
assert(GenTree::s_gtNodeSizes[GT_CALL] > GenTree::s_gtNodeSizes[GT_CNS_STR]);
-
GenTree* node = new (this, GT_CALL) GenTreeStrCon(CPX, scpHandle DEBUGARG(/*largeNode*/ true));
-#else
- GenTree* node = new (this, GT_CNS_STR) GenTreeStrCon(CPX, scpHandle DEBUGARG(/*largeNode*/ true));
-#endif
-
return node;
}
@@ -5909,7 +5870,7 @@ GenTreeCall* Compiler::gtNewCallNode(
return node;
}
-GenTree* Compiler::gtNewLclvNode(unsigned lnum, var_types type, IL_OFFSETX ILoffs)
+GenTree* Compiler::gtNewLclvNode(unsigned lnum, var_types type DEBUGARG(IL_OFFSETX ILoffs))
{
// We need to ensure that all struct values are normalized.
// It might be nice to assert this in general, but we have assignments of int to long.
@@ -5921,7 +5882,7 @@ GenTree* Compiler::gtNewLclvNode(unsigned lnum, var_types type, IL_OFFSETX ILoff
assert(type == lvaTable[lnum].lvType ||
(lvaIsImplicitByRefLocal(lnum) && fgGlobalMorph && (lvaTable[lnum].lvType == TYP_BYREF)));
}
- GenTree* node = new (this, GT_LCL_VAR) GenTreeLclVar(type, lnum, ILoffs);
+ GenTree* node = new (this, GT_LCL_VAR) GenTreeLclVar(type, lnum DEBUGARG(ILoffs));
/* Cannot have this assert because the inliner uses this function
* to add temporaries */
@@ -5931,7 +5892,7 @@ GenTree* Compiler::gtNewLclvNode(unsigned lnum, var_types type, IL_OFFSETX ILoff
return node;
}
-GenTree* Compiler::gtNewLclLNode(unsigned lnum, var_types type, IL_OFFSETX ILoffs)
+GenTree* Compiler::gtNewLclLNode(unsigned lnum, var_types type DEBUGARG(IL_OFFSETX ILoffs))
{
// We need to ensure that all struct values are normalized.
// It might be nice to assert this in general, but we have assignments of int to long.
@@ -5943,16 +5904,9 @@ GenTree* Compiler::gtNewLclLNode(unsigned lnum, var_types type, IL_OFFSETX ILoff
assert(type == lvaTable[lnum].lvType ||
(lvaIsImplicitByRefLocal(lnum) && fgGlobalMorph && (lvaTable[lnum].lvType == TYP_BYREF)));
}
-#if SMALL_TREE_NODES
- /* This local variable node may later get transformed into a large node */
-
- // assert(GenTree::s_gtNodeSizes[GT_CALL] > GenTree::s_gtNodeSizes[GT_LCL_VAR]);
-
- GenTree* node = new (this, GT_CALL) GenTreeLclVar(type, lnum, ILoffs DEBUGARG(/*largeNode*/ true));
-#else
- GenTree* node = new (this, GT_LCL_VAR) GenTreeLclVar(type, lnum, ILoffs DEBUGARG(/*largeNode*/ true));
-#endif
-
+ // This local variable node may later get transformed into a large node
+ assert(GenTree::s_gtNodeSizes[GT_CALL] > GenTree::s_gtNodeSizes[GT_LCL_VAR]);
+ GenTree* node = new (this, GT_CALL) GenTreeLclVar(type, lnum DEBUGARG(ILoffs) DEBUGARG(/*largeNode*/ true));
return node;
}
@@ -6799,7 +6753,7 @@ GenTree* Compiler::gtClone(GenTree* tree, bool complexOK)
// Remember that the LclVar node has been cloned. The flag will be set
// on 'copy' as well.
tree->gtFlags |= GTF_VAR_CLONED;
- copy = gtNewLclvNode(tree->gtLclVarCommon.gtLclNum, tree->gtType, tree->gtLclVar.gtLclILoffs);
+ copy = gtNewLclvNode(tree->gtLclVarCommon.gtLclNum, tree->gtType DEBUGARG(tree->gtLclVar.gtLclILoffs));
break;
case GT_LCL_FLD:
@@ -6983,7 +6937,7 @@ GenTree* Compiler::gtCloneExpr(
// Remember that the LclVar node has been cloned. The flag will
// be set on 'copy' as well.
tree->gtFlags |= GTF_VAR_CLONED;
- copy = gtNewLclvNode(tree->gtLclVar.gtLclNum, tree->gtType, tree->gtLclVar.gtLclILoffs);
+ copy = gtNewLclvNode(tree->gtLclVar.gtLclNum, tree->gtType DEBUGARG(tree->gtLclVar.gtLclILoffs));
copy->AsLclVarCommon()->SetSsaNum(tree->AsLclVarCommon()->GetSsaNum());
}
copy->gtFlags = tree->gtFlags;
@@ -7036,6 +6990,7 @@ GenTree* Compiler::gtCloneExpr(
case GT_CATCH_ARG:
case GT_NO_OP:
+ case GT_LABEL:
copy = new (this, oper) GenTree(oper, tree->gtType);
goto DONE;
@@ -7046,10 +7001,6 @@ GenTree* Compiler::gtCloneExpr(
copy = new (this, oper) GenTreeVal(oper, tree->gtType, tree->gtVal.gtVal1);
goto DONE;
- case GT_LABEL:
- copy = new (this, oper) GenTreeLabel(tree->gtLabel.gtLabBB);
- goto DONE;
-
default:
NO_WAY("Cloning of node not supported");
goto DONE;
@@ -7063,7 +7014,6 @@ GenTree* Compiler::gtCloneExpr(
/* If necessary, make sure we allocate a "fat" tree node */
CLANG_FORMAT_COMMENT_ANCHOR;
-#if SMALL_TREE_NODES
switch (oper)
{
/* These nodes sometimes get bashed to "fat" ones */
@@ -7259,10 +7209,6 @@ GenTree* Compiler::gtCloneExpr(
}
break;
}
-#else
- // We're in the SimpleOp case, so it's always unary or binary.
- copy = gtNewOperNode(oper, tree->TypeGet(), tree->gtOp.gtOp1, tree->gtOp.gtOp2);
-#endif
// Some flags are conceptually part of the gtOper, and should be copied immediately.
if (tree->gtOverflowEx())
@@ -10400,15 +10346,6 @@ void Compiler::gtDispLeaf(GenTree* tree, IndentStack* indentStack)
break;
case GT_LABEL:
- if (tree->gtLabel.gtLabBB)
- {
- printf(" dst=" FMT_BB, tree->gtLabel.gtLabBB->bbNum);
- }
- else
- {
- printf(" dst=<null>");
- }
-
break;
case GT_FTN_ADDR:
diff --git a/src/jit/gentree.h b/src/jit/gentree.h
index 39c9e678bd..2405e822ce 100644
--- a/src/jit/gentree.h
+++ b/src/jit/gentree.h
@@ -128,10 +128,6 @@ enum genTreeKinds
/*****************************************************************************/
-#define SMALL_TREE_NODES 1
-
-/*****************************************************************************/
-
enum gtCallTypes : BYTE
{
CT_USER_FUNC, // User function
@@ -1748,7 +1744,6 @@ public:
bool IsAddWithI32Const(GenTree** addr, int* offset);
public:
-#if SMALL_TREE_NODES
static unsigned char s_gtNodeSizes[];
#if NODEBASH_STATS || MEASURE_NODE_SIZE || COUNT_AST_OPERS
static unsigned char s_gtTrueSizes[];
@@ -1756,7 +1751,6 @@ public:
#if COUNT_AST_OPERS
static LONG s_gtNodeCounts[];
#endif
-#endif // SMALL_TREE_NODES
static void InitNodeSize();
@@ -1780,7 +1774,7 @@ public:
static const char* OpName(genTreeOps op);
#endif
-#if MEASURE_NODE_SIZE && SMALL_TREE_NODES
+#if MEASURE_NODE_SIZE
static const char* OpStructName(genTreeOps op);
#endif
@@ -1818,7 +1812,6 @@ public:
}
}
-#if SMALL_TREE_NODES
#if NODEBASH_STATS
static void RecordOperBashing(genTreeOps operOld, genTreeOps operNew);
static void ReportOperBashing(FILE* fp);
@@ -1830,7 +1823,6 @@ public:
{ /* do nothing */
}
#endif
-#endif
bool IsLocal() const
{
@@ -2496,28 +2488,6 @@ struct GenTreePhysReg : public GenTree
#endif
};
-// gtJumpTable - Switch Jump Table
-//
-// This node stores a DWORD constant that represents the
-// absolute address of a jump table for switches. The code
-// generator uses this table to code the destination for every case
-// in an array of addresses which starting position is stored in
-// this constant.
-struct GenTreeJumpTable : public GenTreeIntConCommon
-{
- ssize_t gtJumpTableAddr;
-
- GenTreeJumpTable(var_types type DEBUGARG(bool largeNode = false))
- : GenTreeIntConCommon(GT_JMPTABLE, type DEBUGARG(largeNode))
- {
- }
-#if DEBUGGABLE_GENTREE
- GenTreeJumpTable() : GenTreeIntConCommon()
- {
- }
-#endif // DEBUG
-};
-
/* gtIntCon -- integer constant (GT_CNS_INT) */
struct GenTreeIntCon : public GenTreeIntConCommon
{
@@ -2755,15 +2725,18 @@ public:
struct GenTreeLclVar : public GenTreeLclVarCommon
{
- IL_OFFSET gtLclILoffs; // instr offset of ref (only for debug info)
+ INDEBUG(IL_OFFSET gtLclILoffs;) // instr offset of ref (only for JIT dumps)
- GenTreeLclVar(var_types type, unsigned lclNum, IL_OFFSET ilOffs DEBUGARG(bool largeNode = false))
- : GenTreeLclVarCommon(GT_LCL_VAR, type, lclNum DEBUGARG(largeNode)), gtLclILoffs(ilOffs)
+ GenTreeLclVar(var_types type,
+ unsigned lclNum DEBUGARG(IL_OFFSET ilOffs = BAD_IL_OFFSET) DEBUGARG(bool largeNode = false))
+ : GenTreeLclVarCommon(GT_LCL_VAR, type, lclNum DEBUGARG(largeNode)) DEBUGARG(gtLclILoffs(ilOffs))
{
}
- GenTreeLclVar(genTreeOps oper, var_types type, unsigned lclNum, IL_OFFSET ilOffs DEBUGARG(bool largeNode = false))
- : GenTreeLclVarCommon(oper, type, lclNum DEBUGARG(largeNode)), gtLclILoffs(ilOffs)
+ GenTreeLclVar(genTreeOps oper,
+ var_types type,
+ unsigned lclNum DEBUGARG(IL_OFFSET ilOffs = BAD_IL_OFFSET) DEBUGARG(bool largeNode = false))
+ : GenTreeLclVarCommon(oper, type, lclNum DEBUGARG(largeNode)) DEBUGARG(gtLclILoffs(ilOffs))
{
assert(OperIsLocal(oper) || OperIsLocalAddr(oper));
}
@@ -4190,7 +4163,7 @@ struct GenTreeIndexAddr : public GenTreeOp
CORINFO_CLASS_HANDLE gtStructElemClass; // If the element type is a struct, this is the struct type.
- GenTree* gtIndRngFailBB; // Label to jump to for array-index-out-of-range
+ BasicBlock* gtIndRngFailBB; // Basic block to jump to for array-index-out-of-range
var_types gtElemType; // The element type of the array.
unsigned gtElemSize; // size of elements in the array
@@ -4276,7 +4249,7 @@ struct GenTreeBoundsChk : public GenTree
GenTree* gtIndex; // The index expression.
GenTree* gtArrLen; // An expression for the length of the array being indexed.
- GenTree* gtIndRngFailBB; // Label to jump to for array-index-out-of-range
+ BasicBlock* gtIndRngFailBB; // Basic block to jump to for array-index-out-of-range
SpecialCodeKind gtThrowKind; // Kind of throw block to branch to on failure
GenTreeBoundsChk(genTreeOps oper, var_types type, GenTree* index, GenTree* arrLen, SpecialCodeKind kind)
@@ -4999,22 +4972,6 @@ struct GenTreeArgPlace : public GenTree
#endif
};
-/* gtLabel -- code label target (GT_LABEL) */
-
-struct GenTreeLabel : public GenTree
-{
- BasicBlock* gtLabBB;
-
- GenTreeLabel(BasicBlock* bb) : GenTree(GT_LABEL, TYP_VOID), gtLabBB(bb)
- {
- }
-#if DEBUGGABLE_GENTREE
- GenTreeLabel() : GenTree()
- {
- }
-#endif
-};
-
/* gtPhiArg -- phi node rhs argument, var = phi(phiarg, phiarg, phiarg...); GT_PHI_ARG */
struct GenTreePhiArg : public GenTreeLclVarCommon
{
@@ -6306,13 +6263,8 @@ inline bool GenTree::isUsedFromSpillTemp() const
/*****************************************************************************/
-#if SMALL_TREE_NODES
-
// In debug, on some platforms (e.g., when LATE_DISASM is defined), GenTreeIntCon is bigger than GenTreeLclFld.
const size_t TREE_NODE_SZ_SMALL = max(sizeof(GenTreeIntCon), sizeof(GenTreeLclFld));
-
-#endif // SMALL_TREE_NODES
-
const size_t TREE_NODE_SZ_LARGE = sizeof(GenTreeCall);
enum varRefKinds
diff --git a/src/jit/gtlist.h b/src/jit/gtlist.h
index 18859268fc..eb8b0a883a 100644
--- a/src/jit/gtlist.h
+++ b/src/jit/gtlist.h
@@ -27,7 +27,7 @@ GTNODE(LCL_FLD_ADDR , GenTreeLclFld ,0,GTK_LEAF) // addre
GTNODE(STORE_LCL_VAR , GenTreeLclVar ,0,GTK_UNOP|GTK_LOCAL|GTK_NOVALUE) // store to local variable
GTNODE(STORE_LCL_FLD , GenTreeLclFld ,0,GTK_UNOP|GTK_LOCAL|GTK_NOVALUE) // store to field in a non-primitive variable
GTNODE(CATCH_ARG , GenTree ,0,GTK_LEAF) // Exception object in a catch block
-GTNODE(LABEL , GenTreeLabel ,0,GTK_LEAF) // Jump-target
+GTNODE(LABEL , GenTree ,0,GTK_LEAF) // Jump-target
GTNODE(FTN_ADDR , GenTreeFptrVal ,0,GTK_LEAF) // Address of a function
GTNODE(RET_EXPR , GenTreeRetExpr ,0,GTK_LEAF) // Place holder for the return expression from an inline candidate
diff --git a/src/jit/gtstructs.h b/src/jit/gtstructs.h
index e6041c9324..17de69f164 100644
--- a/src/jit/gtstructs.h
+++ b/src/jit/gtstructs.h
@@ -56,8 +56,7 @@ GTSTRUCT_2(Val , GT_END_LFIN, GT_JMP)
#else
GTSTRUCT_1(Val , GT_JMP)
#endif
-GTSTRUCT_3_SPECIAL(IntConCommon, GT_CNS_INT, GT_CNS_LNG, GT_JMPTABLE)
-GTSTRUCT_1(JumpTable , GT_JMPTABLE)
+GTSTRUCT_2_SPECIAL(IntConCommon, GT_CNS_INT, GT_CNS_LNG)
GTSTRUCT_1(IntCon , GT_CNS_INT)
GTSTRUCT_1(LngCon , GT_CNS_LNG)
GTSTRUCT_1(DblCon , GT_CNS_DBL)
@@ -94,7 +93,6 @@ GTSTRUCT_2(Stmt , GT_STMT, GT_IL_OFFSET)
GTSTRUCT_2(CopyOrReload, GT_COPY, GT_RELOAD)
GTSTRUCT_2(ClsVar , GT_CLS_VAR, GT_CLS_VAR_ADDR)
GTSTRUCT_1(ArgPlace , GT_ARGPLACE)
-GTSTRUCT_1(Label , GT_LABEL)
GTSTRUCT_1(CmpXchg , GT_CMPXCHG)
GTSTRUCT_1(AddrMode , GT_LEA)
GTSTRUCT_N(Blk , GT_BLK, GT_STORE_BLK, GT_OBJ, GT_STORE_OBJ, GT_DYN_BLK, GT_STORE_DYN_BLK)
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index 76844307f7..47ed202e1b 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -11481,7 +11481,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
/* Create the assignment node */
- op2 = gtNewLclvNode(lclNum, lclTyp, opcodeOffs + sz + 1);
+ op2 = gtNewLclvNode(lclNum, lclTyp DEBUGARG(opcodeOffs + sz + 1));
/* If the local is aliased or pinned, we need to spill calls and
indirections from the stack. */
@@ -11597,7 +11597,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
ADRVAR:
- op1 = gtNewLclvNode(lclNum, lvaGetActualType(lclNum), opcodeOffs + sz + 1);
+ op1 = gtNewLclvNode(lclNum, lvaGetActualType(lclNum) DEBUGARG(opcodeOffs + sz + 1));
_PUSH_ADRVAR:
assert(op1->gtOper == GT_LCL_VAR);
@@ -11653,7 +11653,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
assertImp(0 < numArgs);
assert(lvaTable[lvaVarargsHandleArg].lvAddrExposed);
lclNum = lvaVarargsHandleArg;
- op1 = gtNewLclvNode(lclNum, TYP_I_IMPL, opcodeOffs + sz + 1);
+ op1 = gtNewLclvNode(lclNum, TYP_I_IMPL DEBUGARG(opcodeOffs + sz + 1));
op1 = gtNewOperNode(GT_ADDR, TYP_BYREF, op1);
impPushOnStack(op1, tiRetVal);
break;
@@ -12447,7 +12447,6 @@ void Compiler::impImportBlockCode(BasicBlock* block)
}
}
-#if SMALL_TREE_NODES
if (callNode)
{
/* These operators can later be transformed into 'GT_CALL' */
@@ -12469,7 +12468,6 @@ void Compiler::impImportBlockCode(BasicBlock* block)
op1 = new (this, GT_CALL) GenTreeOp(oper, type, op1, op2 DEBUGARG(/*largeNode*/ true));
}
else
-#endif // SMALL_TREE_NODES
{
op1 = gtNewOperNode(oper, type, op1, op2);
}
@@ -13188,13 +13186,11 @@ void Compiler::impImportBlockCode(BasicBlock* block)
// Work is evidently required, add cast node
else
{
-#if SMALL_TREE_NODES
if (callNode)
{
op1 = gtNewCastNodeL(type, op1, uns, lclTyp);
}
else
-#endif // SMALL_TREE_NODES
{
op1 = gtNewCastNode(type, op1, uns, lclTyp);
}
@@ -16325,7 +16321,7 @@ void Compiler::impLoadVar(unsigned lclNum, IL_OFFSET offset, typeInfo tiRetVal)
lclTyp = lvaGetActualType(lclNum);
}
- impPushVar(gtNewLclvNode(lclNum, lclTyp, offset), tiRetVal);
+ impPushVar(gtNewLclvNode(lclNum, lclTyp DEBUGARG(offset)), tiRetVal);
}
// Load an argument on the operand stack
@@ -16888,7 +16884,7 @@ bool Compiler::impReturnInstruction(BasicBlock* block, int prefixFlags, OPCODE&
else if (info.compRetBuffArg != BAD_VAR_NUM)
{
// Assign value to return buff (first param)
- GenTree* retBuffAddr = gtNewLclvNode(info.compRetBuffArg, TYP_BYREF, impCurStmtOffs);
+ GenTree* retBuffAddr = gtNewLclvNode(info.compRetBuffArg, TYP_BYREF DEBUGARG(impCurStmtOffs));
op2 = impAssignStructPtr(retBuffAddr, op2, retClsHnd, (unsigned)CHECK_SPILL_ALL);
impAppendTree(op2, (unsigned)CHECK_SPILL_NONE, impCurStmtOffs);
@@ -18877,7 +18873,7 @@ void Compiler::impInlineRecordArgInfo(InlineInfo* pInlineInfo,
inlCurArgInfo->argIsLclVar = true;
/* Remember the "original" argument number */
- curArgVal->gtLclVar.gtLclILoffs = argNum;
+ INDEBUG(curArgVal->gtLclVar.gtLclILoffs = argNum;)
}
if ((curArgVal->OperKind() & GTK_CONST) ||
@@ -19539,7 +19535,7 @@ GenTree* Compiler::impInlineFetchArg(unsigned lclNum, InlArgInfo* inlArgInfo, In
}
// Create a new lcl var node - remember the argument lclNum
- op1 = gtNewLclvNode(op1->gtLclVarCommon.gtLclNum, newTyp, op1->gtLclVar.gtLclILoffs);
+ op1 = gtNewLclvNode(op1->gtLclVarCommon.gtLclNum, newTyp DEBUGARG(op1->gtLclVar.gtLclILoffs));
}
}
else if (argInfo.argIsByRefToStructLocal && !argInfo.argHasStargOp)
@@ -19652,7 +19648,7 @@ GenTree* Compiler::impInlineFetchArg(unsigned lclNum, InlArgInfo* inlArgInfo, In
!argInfo.argHasCallerLocalRef)
{
/* Get a *LARGE* LCL_VAR node */
- op1 = gtNewLclLNode(tmpNum, genActualType(lclTyp), lclNum);
+ op1 = gtNewLclLNode(tmpNum, genActualType(lclTyp) DEBUGARG(lclNum));
/* Record op1 as the very first use of this argument.
If there are no further uses of the arg, we may be
diff --git a/src/jit/lir.cpp b/src/jit/lir.cpp
index 480a5d3e95..79d6379084 100644
--- a/src/jit/lir.cpp
+++ b/src/jit/lir.cpp
@@ -270,7 +270,7 @@ unsigned LIR::Use::ReplaceWithLclVar(Compiler* compiler, unsigned blockWeight, u
assert(store->gtOp1 == node);
GenTree* const load =
- new (compiler, GT_LCL_VAR) GenTreeLclVar(store->TypeGet(), store->AsLclVarCommon()->GetLclNum(), BAD_IL_OFFSET);
+ new (compiler, GT_LCL_VAR) GenTreeLclVar(store->TypeGet(), store->AsLclVarCommon()->GetLclNum());
m_range->InsertAfter(node, store, load);
diff --git a/src/jit/liveness.cpp b/src/jit/liveness.cpp
index 039f8641aa..0f24d825d2 100644
--- a/src/jit/liveness.cpp
+++ b/src/jit/liveness.cpp
@@ -993,8 +993,7 @@ void Compiler::fgExtendDbgLifetimes()
}
else
{
- GenTree* store =
- new (this, GT_STORE_LCL_VAR) GenTreeLclVar(GT_STORE_LCL_VAR, type, varNum, BAD_IL_OFFSET);
+ GenTree* store = new (this, GT_STORE_LCL_VAR) GenTreeLclVar(GT_STORE_LCL_VAR, type, varNum);
store->gtOp.gtOp1 = zero;
store->gtFlags |= (GTF_VAR_DEF | GTF_ASG);
diff --git a/src/jit/lower.cpp b/src/jit/lower.cpp
index 3c38a5775f..2ea2c9a5cf 100644
--- a/src/jit/lower.cpp
+++ b/src/jit/lower.cpp
@@ -481,10 +481,9 @@ GenTree* Lowering::LowerSwitch(GenTree* node)
unsigned lclNum = comp->lvaGrabTemp(true DEBUGARG("Lowering is creating a new local variable"));
comp->lvaTable[lclNum].lvType = rhs->TypeGet();
- GenTreeLclVar* store =
- new (comp, GT_STORE_LCL_VAR) GenTreeLclVar(GT_STORE_LCL_VAR, rhs->TypeGet(), lclNum, BAD_IL_OFFSET);
- store->gtOp1 = rhs;
- store->gtFlags = (rhs->gtFlags & GTF_COMMON_MASK);
+ GenTreeLclVar* store = new (comp, GT_STORE_LCL_VAR) GenTreeLclVar(GT_STORE_LCL_VAR, rhs->TypeGet(), lclNum);
+ store->gtOp1 = rhs;
+ store->gtFlags = (rhs->gtFlags & GTF_COMMON_MASK);
store->gtFlags |= GTF_VAR_DEF;
switchBBRange.InsertAfter(node, store);
@@ -2077,9 +2076,8 @@ void Lowering::LowerFastTailCall(GenTreeCall* call)
if (tmpLclNum != BAD_VAR_NUM)
{
assert(tmpType != TYP_UNDEF);
- GenTreeLclVar* local =
- new (comp, GT_LCL_VAR) GenTreeLclVar(GT_LCL_VAR, tmpType, callerArgLclNum, BAD_IL_OFFSET);
- GenTree* assignExpr = comp->gtNewTempAssign(tmpLclNum, local);
+ GenTreeLclVar* local = new (comp, GT_LCL_VAR) GenTreeLclVar(GT_LCL_VAR, tmpType, callerArgLclNum);
+ GenTree* assignExpr = comp->gtNewTempAssign(tmpLclNum, local);
ContainCheckRange(local, assignExpr);
BlockRange().InsertBefore(firstPutArgStk, LIR::SeqTree(comp, assignExpr));
}
@@ -3183,7 +3181,7 @@ GenTree* Lowering::LowerDelegateInvoke(GenTreeCall* call)
// the control target is
// [originalThis + firstTgtOffs]
- GenTree* base = new (comp, GT_LCL_VAR) GenTreeLclVar(originalThisExpr->TypeGet(), lclNum, BAD_IL_OFFSET);
+ GenTree* base = new (comp, GT_LCL_VAR) GenTreeLclVar(originalThisExpr->TypeGet(), lclNum);
unsigned targetOffs = comp->eeGetEEInfo()->offsetOfDelegateFirstTarget;
GenTree* result = new (comp, GT_LEA) GenTreeAddrMode(TYP_REF, base, nullptr, 0, targetOffs);
@@ -3269,7 +3267,7 @@ GenTree* Lowering::SetGCState(int state)
const CORINFO_EE_INFO* pInfo = comp->eeGetEEInfo();
- GenTree* base = new (comp, GT_LCL_VAR) GenTreeLclVar(TYP_I_IMPL, comp->info.compLvFrameListRoot, -1);
+ GenTree* base = new (comp, GT_LCL_VAR) GenTreeLclVar(TYP_I_IMPL, comp->info.compLvFrameListRoot);
GenTree* stateNode = new (comp, GT_CNS_INT) GenTreeIntCon(TYP_BYTE, state);
GenTree* addr = new (comp, GT_LEA) GenTreeAddrMode(TYP_I_IMPL, base, nullptr, 1, pInfo->offsetOfGCState);
@@ -3294,8 +3292,7 @@ GenTree* Lowering::CreateFrameLinkUpdate(FrameLinkAction action)
const CORINFO_EE_INFO* pInfo = comp->eeGetEEInfo();
const CORINFO_EE_INFO::InlinedCallFrameInfo& callFrameInfo = pInfo->inlinedCallFrameInfo;
- GenTree* TCB = new (comp, GT_LCL_VAR) GenTreeLclVar(GT_LCL_VAR, TYP_I_IMPL, comp->info.compLvFrameListRoot,
- (IL_OFFSET)-1); // cast to resolve ambiguity.
+ GenTree* TCB = new (comp, GT_LCL_VAR) GenTreeLclVar(GT_LCL_VAR, TYP_I_IMPL, comp->info.compLvFrameListRoot);
// Thread->m_pFrame
GenTree* addr = new (comp, GT_LEA) GenTreeAddrMode(TYP_I_IMPL, TCB, nullptr, 1, pInfo->offsetOfThreadFrame);
@@ -3402,8 +3399,7 @@ void Lowering::InsertPInvokeMethodProlog()
noway_assert(varDsc->lvType == TYP_I_IMPL);
GenTree* store =
- new (comp, GT_STORE_LCL_VAR) GenTreeLclVar(GT_STORE_LCL_VAR, TYP_I_IMPL, comp->info.compLvFrameListRoot,
- (IL_OFFSET)-1); // cast to resolve ambiguity.
+ new (comp, GT_STORE_LCL_VAR) GenTreeLclVar(GT_STORE_LCL_VAR, TYP_I_IMPL, comp->info.compLvFrameListRoot);
store->gtOp.gtOp1 = call;
store->gtFlags |= GTF_VAR_DEF;
@@ -3570,8 +3566,8 @@ void Lowering::InsertPInvokeCallProlog(GenTreeCall* call)
if (comp->opts.ShouldUsePInvokeHelpers())
{
// First argument is the address of the frame variable.
- GenTree* frameAddr = new (comp, GT_LCL_VAR_ADDR)
- GenTreeLclVar(GT_LCL_VAR_ADDR, TYP_BYREF, comp->lvaInlinedPInvokeFrameVar, BAD_IL_OFFSET);
+ GenTree* frameAddr =
+ new (comp, GT_LCL_VAR_ADDR) GenTreeLclVar(GT_LCL_VAR_ADDR, TYP_BYREF, comp->lvaInlinedPInvokeFrameVar);
// Insert call to CORINFO_HELP_JIT_PINVOKE_BEGIN
GenTree* helperCall =
@@ -3669,11 +3665,7 @@ void Lowering::InsertPInvokeCallProlog(GenTreeCall* call)
new (comp, GT_STORE_LCL_FLD) GenTreeLclFld(GT_STORE_LCL_FLD, TYP_I_IMPL, comp->lvaInlinedPInvokeFrameVar,
callFrameInfo.offsetOfReturnAddress);
- // We don't have a real label, and inserting one is hard (even if we made a special node),
- // so for now we will just 'know' what this means in codegen.
- GenTreeLabel* labelRef = new (comp, GT_LABEL) GenTreeLabel(nullptr);
- labelRef->gtType = TYP_I_IMPL;
- storeLab->gtOp1 = labelRef;
+ storeLab->gtOp1 = new (comp, GT_LABEL) GenTree(GT_LABEL, TYP_I_IMPL);
storeLab->gtFlags |= GTF_VAR_DEF;
InsertTreeBeforeAndContainCheck(insertBefore, storeLab);
@@ -3725,7 +3717,7 @@ void Lowering::InsertPInvokeCallEpilog(GenTreeCall* call)
// First argument is the address of the frame variable.
GenTree* frameAddr =
- new (comp, GT_LCL_VAR) GenTreeLclVar(GT_LCL_VAR, TYP_BYREF, comp->lvaInlinedPInvokeFrameVar, BAD_IL_OFFSET);
+ new (comp, GT_LCL_VAR) GenTreeLclVar(GT_LCL_VAR, TYP_BYREF, comp->lvaInlinedPInvokeFrameVar);
frameAddr->SetOperRaw(GT_LCL_VAR_ADDR);
// Insert call to CORINFO_HELP_JIT_PINVOKE_END
@@ -3969,7 +3961,7 @@ GenTree* Lowering::LowerVirtualVtableCall(GenTreeCall* call)
}
else
{
- local = new (comp, GT_LCL_VAR) GenTreeLclVar(GT_LCL_VAR, thisPtr->TypeGet(), lclNum, BAD_IL_OFFSET);
+ local = new (comp, GT_LCL_VAR) GenTreeLclVar(GT_LCL_VAR, thisPtr->TypeGet(), lclNum);
}
// pointer to virtual table = [REG_CALL_THIS + offs]
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index ee31beb698..3009f887e8 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -2560,13 +2560,13 @@ GenTree* Compiler::fgInsertCommaFormTemp(GenTree** ppTree, CORINFO_CLASS_HANDLE
// setting type of lcl vars created.
GenTree* asg = gtNewTempAssign(lclNum, subTree);
- GenTree* load = new (this, GT_LCL_VAR) GenTreeLclVar(subTree->TypeGet(), lclNum, BAD_IL_OFFSET);
+ GenTree* load = new (this, GT_LCL_VAR) GenTreeLclVar(subTree->TypeGet(), lclNum);
GenTree* comma = gtNewOperNode(GT_COMMA, subTree->TypeGet(), asg, load);
*ppTree = comma;
- return new (this, GT_LCL_VAR) GenTreeLclVar(subTree->TypeGet(), lclNum, BAD_IL_OFFSET);
+ return new (this, GT_LCL_VAR) GenTreeLclVar(subTree->TypeGet(), lclNum);
}
//------------------------------------------------------------------------
@@ -4732,8 +4732,8 @@ GenTree* Compiler::fgMorphMultiregStructArg(GenTree* arg, fgArgTabEntry* fgEntry
{
// We can use the struct promoted field as the two arguments
- GenTree* loLclVar = gtNewLclvNode(loVarNum, loType, loVarNum);
- GenTree* hiLclVar = gtNewLclvNode(hiVarNum, hiType, hiVarNum);
+ GenTree* loLclVar = gtNewLclvNode(loVarNum, loType);
+ GenTree* hiLclVar = gtNewLclvNode(hiVarNum, hiType);
// Create a new tree for 'arg'
// replace the existing LDOBJ(ADDR(LCLVAR))
@@ -5480,7 +5480,7 @@ void Compiler::fgSetRngChkTarget(GenTree* tree, bool delay)
BasicBlock* const failBlock = fgSetRngChkTargetInner(boundsChk->gtThrowKind, delay);
if (failBlock != nullptr)
{
- boundsChk->gtIndRngFailBB = gtNewCodeRef(failBlock);
+ boundsChk->gtIndRngFailBB = failBlock;
}
}
else if (tree->OperIs(GT_INDEX_ADDR))
@@ -5489,7 +5489,7 @@ void Compiler::fgSetRngChkTarget(GenTree* tree, bool delay)
BasicBlock* const failBlock = fgSetRngChkTargetInner(SCK_RNGCHK_FAIL, delay);
if (failBlock != nullptr)
{
- indexAddr->gtIndRngFailBB = gtNewCodeRef(failBlock);
+ indexAddr->gtIndRngFailBB = failBlock;
}
}
else
@@ -5791,9 +5791,8 @@ GenTree* Compiler::fgMorphArrayIndex(GenTree* tree)
addr = gtNewOperNode(GT_ADD, TYP_BYREF, arrRef, addr);
-#if SMALL_TREE_NODES
- assert((tree->gtDebugFlags & GTF_DEBUG_NODE_LARGE) || GenTree::s_gtNodeSizes[GT_IND] == TREE_NODE_SZ_SMALL);
-#endif
+ assert(((tree->gtDebugFlags & GTF_DEBUG_NODE_LARGE) != 0) ||
+ (GenTree::s_gtNodeSizes[GT_IND] == TREE_NODE_SZ_SMALL));
// Change the orginal GT_INDEX node into a GT_IND node
tree->SetOper(GT_IND);
@@ -14695,13 +14694,11 @@ GenTree* Compiler::fgMorphTree(GenTree* tree, MorphAddrContext* mac)
{
GenTree* copy;
-#ifdef SMALL_TREE_NODES
if (GenTree::s_gtNodeSizes[tree->gtOper] == TREE_NODE_SZ_SMALL)
{
copy = gtNewLargeOperNode(GT_ADD, TYP_INT);
}
else
-#endif
{
copy = new (this, GT_CALL) GenTreeCall(TYP_INT);
}
diff --git a/src/jit/scopeinfo.cpp b/src/jit/scopeinfo.cpp
index f152bf5bc6..21122bb0b3 100644
--- a/src/jit/scopeinfo.cpp
+++ b/src/jit/scopeinfo.cpp
@@ -702,13 +702,6 @@ void CodeGen::siUpdate()
}
/*****************************************************************************
- * In optimized code, we may not have access to gtLclVar.gtLclILoffs.
- * So there may be ambiguity as to which entry in compiler->info.compVarScopes
- * to use. We search the entire table and find the entry whose life
- * begins closest to the given offset.
- */
-
-/*****************************************************************************
* siCheckVarScope
*
* For non-debuggable code, whenever we come across a GenTree which is an