GenTree* op1 = tree->AsOp()->gtOp1;
Compiler* comp = data->compiler;
- if ((op1->gtOper == GT_LCL_VAR) && (op1->gtLclVarCommon.GetLclNum() == comp->optAddCopyLclNum))
+ if ((op1->gtOper == GT_LCL_VAR) && (op1->AsLclVarCommon()->GetLclNum() == comp->optAddCopyLclNum))
{
comp->optAddCopyAsgnNode = tree;
return WALK_ABORT;
GenTree* op1 = tree->AsOp()->gtOp1;
noway_assert(tree && op1 && tree->OperIs(GT_ASG) && (op1->gtOper == GT_LCL_VAR) &&
- (op1->gtLclVarCommon.GetLclNum() == lclNum));
+ (op1->AsLclVarCommon()->GetLclNum() == lclNum));
/* Assign the old expression into the new temp */
goto DONE_ASSERTION; // Don't make an assertion
}
- unsigned lclNum = op1->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = op1->AsLclVarCommon()->GetLclNum();
noway_assert(lclNum < lvaCount);
LclVarDsc* lclVar = &lvaTable[lclNum];
//
else if (op1->gtOper == GT_LCL_VAR)
{
- unsigned lclNum = op1->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = op1->AsLclVarCommon()->GetLclNum();
noway_assert(lclNum < lvaCount);
LclVarDsc* lclVar = &lvaTable[lclNum];
goto DONE_ASSERTION; // Don't make an assertion
}
- unsigned lclNum2 = op2->gtLclVarCommon.GetLclNum();
+ unsigned lclNum2 = op2->AsLclVarCommon()->GetLclNum();
noway_assert(lclNum2 < lvaCount);
LclVarDsc* lclVar2 = &lvaTable[lclNum2];
//
if (op1->gtOper == GT_LCL_VAR)
{
- unsigned lclNum = op1->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = op1->AsLclVarCommon()->GetLclNum();
noway_assert(lclNum < lvaCount);
// If the local variable is not in SSA then bail
GenTree* tree,
Statement* stmt DEBUGARG(AssertionIndex index))
{
- unsigned lclNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = tree->AsLclVarCommon()->GetLclNum();
if (lclNumIsCSE(lclNum))
{
noway_assert(op1.lcl.lclNum != op2.lcl.lclNum);
- unsigned lclNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = tree->AsLclVarCommon()->GetLclNum();
// Make sure one of the lclNum of the assertion matches with that of the tree.
if (op1.lcl.lclNum != lclNum && op2.lcl.lclNum != lclNum)
return nullptr;
}
- tree->gtLclVarCommon.SetSsaNum(copySsaNum);
- tree->gtLclVarCommon.SetLclNum(copyLclNum);
+ tree->AsLclVarCommon()->SetSsaNum(copySsaNum);
+ tree->AsLclVarCommon()->SetLclNum(copyLclNum);
#ifdef DEBUG
if (verbose)
// gtFoldExpr, specifically the case of a cast, where the fold operation changes the type of the LclVar
// node. In such a case is not safe to perform the substitution since later on the JIT will assert mismatching
// types between trees.
- else if (curAssertion->op1.lcl.lclNum == tree->gtLclVarCommon.GetLclNum() &&
- tree->gtType == lvaTable[tree->gtLclVarCommon.GetLclNum()].lvType)
+ else if (curAssertion->op1.lcl.lclNum == tree->AsLclVarCommon()->GetLclNum() &&
+ tree->gtType == lvaTable[tree->AsLclVarCommon()->GetLclNum()].lvType)
{
// If local assertion prop just, perform constant prop.
if (optLocalAssertionProp)
}
// Find an equal or not equal assertion about op1 var.
- unsigned lclNum = op1->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = op1->AsLclVarCommon()->GetLclNum();
noway_assert(lclNum < lvaCount);
AssertionIndex index = optLocalAssertionIsEqualOrNotEqual(op1Kind, lclNum, op2Kind, cnsVal, assertions);
AssertionIndex index = optAssertionIsSubrange(lcl, fromType, toType, assertions);
if (index != NO_ASSERTION_INDEX)
{
- LclVarDsc* varDsc = &lvaTable[lcl->gtLclVarCommon.GetLclNum()];
+ LclVarDsc* varDsc = &lvaTable[lcl->AsLclVarCommon()->GetLclNum()];
if (varDsc->lvNormalizeOnLoad() || varTypeIsLong(varDsc->TypeGet()))
{
// For normalize on load variables it must be a narrowing cast to remove
{
return false;
}
- const LclVarDsc* varDsc = &compiler->lvaTable[tree->gtLclVarCommon.GetLclNum()];
+ const LclVarDsc* varDsc = &compiler->lvaTable[tree->AsLclVarCommon()->GetLclNum()];
return (varDsc->lvIsRegCandidate());
}
if (op1->OperIsLocal())
{
- unsigned varNum = op1->gtLclVarCommon.GetLclNum();
+ unsigned varNum = op1->AsLclVarCommon()->GetLclNum();
GetEmitter()->emitIns_R_S(ins, emitActualTypeSize(baseType), targetReg, varNum, offset);
}
assert(!op1->isUsedFromReg());
if (op1->OperIsLocal())
{
- unsigned varNum = op1->gtLclVarCommon.GetLclNum();
+ unsigned varNum = op1->AsLclVarCommon()->GetLclNum();
baseReg = simdNode->ExtractTempReg();
assert((treeNode->OperGet() == GT_STORE_LCL_FLD) || (treeNode->OperGet() == GT_STORE_LCL_VAR));
unsigned offs = 0;
- unsigned varNum = treeNode->gtLclVarCommon.GetLclNum();
+ unsigned varNum = treeNode->AsLclVarCommon()->GetLclNum();
assert(varNum < compiler->lvaCount);
if (treeNode->OperGet() == GT_STORE_LCL_FLD)
assert(tree->gtOper == GT_LCL_VAR);
regMaskTP regMask = RBM_NONE;
- const LclVarDsc* varDsc = compiler->lvaTable + tree->gtLclVarCommon.GetLclNum();
+ const LclVarDsc* varDsc = compiler->lvaTable + tree->AsLclVarCommon()->GetLclNum();
if (varDsc->lvPromoted)
{
for (unsigned i = varDsc->lvFieldLclStart; i < varDsc->lvFieldLclStart + varDsc->lvFieldCnt; ++i)
}
else if (op->gtOper == GT_LCL_VAR)
{
- unsigned varNum = op->gtLclVarCommon.GetLclNum();
+ unsigned varNum = op->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = compiler->lvaTable + varNum;
assert(varDsc->lvType == TYP_STRUCT);
opSize = varDsc->lvSize();
void CodeGen::genSpillVar(GenTree* tree)
{
- unsigned varNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned varNum = tree->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = &(compiler->lvaTable[varNum]);
assert(varDsc->lvIsRegCandidate());
{
// Store local variable to its home location.
// Ensure that lclVar stores are typed correctly.
- unsigned varNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned varNum = tree->AsLclVarCommon()->GetLclNum();
assert(!compiler->lvaTable[varNum].lvNormalizeOnStore() ||
(tree->TypeGet() == genActualType(compiler->lvaTable[varNum].TypeGet())));
inst_TT_RV(ins_Store(tree->gtType, compiler->isSIMDTypeLocalAligned(varNum)), tree, tree->GetRegNum());
GenTree* op1 = treeNode->gtGetOp1();
// Spill the return value register from an XMM register to the stack, then load it on the x87 stack.
// If it already has a home location, use that. Otherwise, we need a temp.
- if (genIsRegCandidateLocal(op1) && compiler->lvaTable[op1->gtLclVarCommon.GetLclNum()].lvOnFrame)
+ if (genIsRegCandidateLocal(op1) && compiler->lvaTable[op1->AsLclVarCommon()->GetLclNum()].lvOnFrame)
{
- if (compiler->lvaTable[op1->gtLclVarCommon.GetLclNum()].GetRegNum() != REG_STK)
+ if (compiler->lvaTable[op1->AsLclVarCommon()->GetLclNum()].GetRegNum() != REG_STK)
{
op1->gtFlags |= GTF_SPILL;
- inst_TT_RV(ins_Store(op1->gtType, compiler->isSIMDTypeLocalAligned(op1->gtLclVarCommon.GetLclNum())), op1,
- op1->GetRegNum());
+ inst_TT_RV(ins_Store(op1->gtType, compiler->isSIMDTypeLocalAligned(op1->AsLclVarCommon()->GetLclNum())),
+ op1, op1->GetRegNum());
}
// Now, load it to the fp stack.
GetEmitter()->emitIns_S(INS_fld, emitTypeSize(op1), op1->AsLclVarCommon()->GetLclNum(), 0);
{
offset += baseNode->AsLclFld()->gtLclOffs;
}
- emit->emitIns_R_S(ins, size, dst, baseNode->gtLclVarCommon.GetLclNum(), offset);
+ emit->emitIns_R_S(ins, size, dst, baseNode->AsLclVarCommon()->GetLclNum(), offset);
}
else
{
{
int chars = 0;
- if (tree->gtLclVarCommon.HasSsaName())
+ if (tree->AsLclVarCommon()->HasSsaName())
{
if (tree->gtFlags & GTF_VAR_USEASG)
{
assert(tree->gtFlags & GTF_VAR_DEF);
- chars += printf("<u:%d><d:%d>", tree->gtLclVarCommon.GetSsaNum(), comp->GetSsaNumForLocalVarDef(tree));
+ chars += printf("<u:%d><d:%d>", tree->AsLclVarCommon()->GetSsaNum(), comp->GetSsaNumForLocalVarDef(tree));
}
else
{
- chars += printf("<%s:%d>", (tree->gtFlags & GTF_VAR_DEF) ? "d" : "u", tree->gtLclVarCommon.GetSsaNum());
+ chars += printf("<%s:%d>", (tree->gtFlags & GTF_VAR_DEF) ? "d" : "u", tree->AsLclVarCommon()->GetSsaNum());
}
}
case GT_LCL_VAR:
case GT_LCL_VAR_ADDR:
case GT_STORE_LCL_VAR:
- lclNum = tree->gtLclVarCommon.GetLclNum();
+ lclNum = tree->AsLclVarCommon()->GetLclNum();
comp->gtGetLclVarNameInfo(lclNum, &ilKind, &ilName, &ilNum);
if (ilName != nullptr)
{
case GT_LCL_FLD_ADDR:
case GT_STORE_LCL_FLD:
- lclNum = tree->gtLclVarCommon.GetLclNum();
+ lclNum = tree->AsLclVarCommon()->GetLclNum();
comp->gtGetLclVarNameInfo(lclNum, &ilKind, &ilName, &ilNum);
if (ilName != nullptr)
{
if (obj != nullptr && obj->OperGet() == GT_ADDR && varTypeIsStruct(obj->AsOp()->gtOp1) &&
obj->AsOp()->gtOp1->OperGet() == GT_LCL_VAR)
{
- unsigned lclNum = obj->AsOp()->gtOp1->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = obj->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum();
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
continue;
}
- varNum = tree->gtLclVarCommon.GetLclNum();
+ varNum = tree->AsLclVarCommon()->GetLclNum();
assert(varNum < lvaCount);
varDsc = lvaTable + varNum;
inline unsigned Compiler::LoopDsc::lpIterVar()
{
VERIFY_lpIterTree();
- return lpIterTree->AsOp()->gtOp1->gtLclVarCommon.GetLclNum();
+ return lpIterTree->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum();
}
//-----------------------------------------------------------------------------
GenTree* limit = lpLimit();
assert(limit->OperGet() == GT_LCL_VAR);
- return limit->gtLclVarCommon.GetLclNum();
+ return limit->AsLclVarCommon()->GetLclNum();
}
//-----------------------------------------------------------------------------
// Check if we have a.length or a[i][j].length
if (limit->AsArrLen()->ArrRef()->gtOper == GT_LCL_VAR)
{
- index->arrLcl = limit->AsArrLen()->ArrRef()->gtLclVarCommon.GetLclNum();
+ index->arrLcl = limit->AsArrLen()->ArrRef()->AsLclVarCommon()->GetLclNum();
index->rank = 0;
return true;
}
else
{
return ((obj != nullptr) && (obj->gtOper == GT_LCL_VAR) &&
- lvaIsOriginalThisArg(obj->gtLclVarCommon.GetLclNum()));
+ lvaIsOriginalThisArg(obj->AsLclVarCommon()->GetLclNum()));
}
}
{
continue;
}
- unsigned lclNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = tree->AsLclVarCommon()->GetLclNum();
if (!lvaInSsa(lclNum))
{
continue;
}
#endif
- tree->gtLclVarCommon.SetLclNum(newLclNum);
+ tree->AsLclVarCommon()->SetLclNum(newLclNum);
tree->AsLclVarCommon()->SetSsaNum(newSsaNum);
gtUpdateSideEffects(stmt, tree);
#ifdef DEBUG
//
if (optIsSsaLocal(tree) && (tree->gtFlags & GTF_VAR_DEF))
{
- VarSetOps::AddElemD(this, optCopyPropKillSet, lvaTable[tree->gtLclVarCommon.GetLclNum()].lvVarIndex);
+ VarSetOps::AddElemD(this, optCopyPropKillSet, lvaTable[tree->AsLclVarCommon()->GetLclNum()].lvVarIndex);
}
}
continue;
}
- unsigned lclNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = tree->AsLclVarCommon()->GetLclNum();
// As we encounter a definition add it to the stack as a live definition.
if (tree->gtFlags & GTF_VAR_DEF)
{
GenTree* additionNode = defRHS->gtGetOp2();
if ((additionNode->gtGetOp1()->OperGet() == GT_LCL_VAR) &&
- (additionNode->gtGetOp1()->gtLclVarCommon.GetLclNum() == nullCheckLclNum))
+ (additionNode->gtGetOp1()->AsLclVarCommon()->GetLclNum() == nullCheckLclNum))
{
GenTree* offset = additionNode->gtGetOp2();
if (offset->IsCnsIntOrI())
// Small-typed arguments and aliased locals are normalized on load.
// Other small-typed locals are normalized on store.
// If it is an assignment to one of the latter, insert the cast on RHS
- unsigned varNum = op1->gtLclVarCommon.GetLclNum();
+ unsigned varNum = op1->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = &lvaTable[varNum];
if (varDsc->lvNormalizeOnStore())
assert(tree->gtOper == GT_LCL_VAR || tree->gtOper == GT_LCL_FLD);
- unsigned int lclNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned int lclNum = tree->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = lvaTable + lclNum;
if (varDsc->lvTracked)
{
// If it is a multireg return on x64/ux, the local variable should be marked as lvIsMultiRegRet
if (child->AsCall()->HasMultiRegRetVal())
{
- unsigned lclNum = tree->AsOp()->gtOp1->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = tree->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum();
lvaTable[lclNum].lvIsMultiRegRet = true;
}
return;
if ((lhs->OperGet() == GT_LCL_VAR) && (lhs->TypeGet() == TYP_REF))
{
- const unsigned lclNum = lhs->gtLclVarCommon.GetLclNum();
+ const unsigned lclNum = lhs->AsLclVarCommon()->GetLclNum();
LclVarDsc* lcl = comp->lvaGetDesc(lclNum);
if (lcl->lvSingleDef)
switch (oper)
{
case GT_LCL_VAR:
- if (op1->gtLclVarCommon.GetLclNum() != op2->gtLclVarCommon.GetLclNum())
+ if (op1->AsLclVarCommon()->GetLclNum() != op2->AsLclVarCommon()->GetLclNum())
{
break;
}
{
if (oper == GT_LCL_VAR)
{
- if (tree->gtLclVarCommon.GetLclNum() == (unsigned)lclNum)
+ if (tree->AsLclVarCommon()->GetLclNum() == (unsigned)lclNum)
{
if (!defOnly)
{
// 'tree' is the gtOp1 of an assignment node. So we can handle
// the case where defOnly is either true or false.
- if (tree->gtOper == GT_LCL_VAR && tree->gtLclVarCommon.GetLclNum() == (unsigned)lclNum)
+ if (tree->gtOper == GT_LCL_VAR && tree->AsLclVarCommon()->GetLclNum() == (unsigned)lclNum)
{
return true;
}
if (tree->gtOper == GT_LCL_VAR)
{
- unsigned lclNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = tree->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = &comp->lvaTable[lclNum];
if (varDsc->lvHasLdAddrOp || varDsc->lvAddrExposed)
}
if (currSrc->OperGet() == GT_LCL_VAR && currDst->OperGet() == GT_LCL_VAR &&
- currSrc->gtLclVarCommon.GetLclNum() == currDst->gtLclVarCommon.GetLclNum())
+ currSrc->AsLclVarCommon()->GetLclNum() == currDst->AsLclVarCommon()->GetLclNum())
{
// Make this a NOP
// TODO-Cleanup: probably doesn't matter, but could do this earlier and avoid creating a GT_ASG
// 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.GetLclNum(), tree->gtType DEBUGARG(tree->AsLclVar()->gtLclILoffs));
+ copy = gtNewLclvNode(tree->AsLclVarCommon()->GetLclNum(),
+ tree->gtType DEBUGARG(tree->AsLclVar()->gtLclILoffs));
break;
case GT_LCL_FLD:
case GT_LCL_VAR:
- if (tree->gtLclVarCommon.GetLclNum() == varNum)
+ if (tree->AsLclVarCommon()->GetLclNum() == varNum)
{
copy = gtNewIconNode(varVal, tree->gtType);
if (tree->gtFlags & GTF_VAR_ARR_INDEX)
break;
case GT_LCL_VAR:
- if (op1->gtLclVarCommon.GetLclNum() == op2->gtLclVarCommon.GetLclNum())
+ if (op1->AsLclVarCommon()->GetLclNum() == op2->AsLclVarCommon()->GetLclNum())
{
return true;
}
printf(" %-6s", varTypeName(tree->TypeGet()));
if (tree->gtOper == GT_LCL_VAR || tree->gtOper == GT_STORE_LCL_VAR)
{
- LclVarDsc* varDsc = &lvaTable[tree->gtLclVarCommon.GetLclNum()];
+ LclVarDsc* varDsc = &lvaTable[tree->AsLclVarCommon()->GetLclNum()];
if (varDsc->lvAddrExposed)
{
printf("(AX)"); // Variable has address exposed.
case GT_LCL_VAR_ADDR:
case GT_STORE_LCL_VAR:
printf(" ");
- varNum = tree->gtLclVarCommon.GetLclNum();
+ varNum = tree->AsLclVarCommon()->GetLclNum();
varDsc = &lvaTable[varNum];
gtDispLclVar(varNum);
- if (tree->gtLclVarCommon.HasSsaName())
+ if (tree->AsLclVarCommon()->HasSsaName())
{
if (tree->gtFlags & GTF_VAR_USEASG)
{
assert(tree->gtFlags & GTF_VAR_DEF);
- printf("ud:%d->%d", tree->gtLclVarCommon.GetSsaNum(), GetSsaNumForLocalVarDef(tree));
+ printf("ud:%d->%d", tree->AsLclVarCommon()->GetSsaNum(), GetSsaNumForLocalVarDef(tree));
}
else
{
- printf("%s:%d", (tree->gtFlags & GTF_VAR_DEF) ? "d" : "u", tree->gtLclVarCommon.GetSsaNum());
+ printf("%s:%d", (tree->gtFlags & GTF_VAR_DEF) ? "d" : "u", tree->AsLclVarCommon()->GetSsaNum());
}
}
printf(" ");
printIndent(indentStack);
printf(" %-6s V%02u.%s (offs=0x%02x) -> ", varTypeName(fieldVarDsc->TypeGet()),
- tree->gtLclVarCommon.GetLclNum(), fieldName, fieldVarDsc->lvFldOffset);
+ tree->AsLclVarCommon()->GetLclNum(), fieldName, fieldVarDsc->lvFldOffset);
gtDispLclVar(i);
if (fieldVarDsc->lvRegister)
}
GenTree* copyDstAddrOp1 = copyDstAddr->AsOp()->gtOp1;
- if ((copyDstAddrOp1->OperGet() != GT_LCL_VAR) || (copyDstAddrOp1->gtLclVarCommon.GetLclNum() != boxTempLcl))
+ if ((copyDstAddrOp1->OperGet() != GT_LCL_VAR) || (copyDstAddrOp1->AsLclVarCommon()->GetLclNum() != boxTempLcl))
{
JITDUMP("Unexpected copy dest address 1st addend\n");
return nullptr;
unsigned tmp, GenTree* val, Statement** pAfterStmt, IL_OFFSETX ilOffset, BasicBlock* block)
{
// Self-assignment is a nop.
- if (val->OperGet() == GT_LCL_VAR && val->gtLclVarCommon.GetLclNum() == tmp)
+ if (val->OperGet() == GT_LCL_VAR && val->AsLclVarCommon()->GetLclNum() == tmp)
{
return gtNewNothingNode();
}
bool GenTree::IsPartialLclFld(Compiler* comp)
{
return ((gtOper == GT_LCL_FLD) &&
- (comp->lvaTable[this->gtLclVarCommon.GetLclNum()].lvExactSize != genTypeSize(gtType)));
+ (comp->lvaTable[this->AsLclVarCommon()->GetLclNum()].lvExactSize != genTypeSize(gtType)));
}
bool GenTree::DefinesLocal(Compiler* comp, GenTreeLclVarCommon** pLclVarTree, bool* pIsEntire)
// local vars and param uses
case GT_LCL_VAR:
case GT_LCL_FLD:
- lclNum = tree->gtLclVarCommon.GetLclNum();
+ lclNum = tree->AsLclVarCommon()->GetLclNum();
if (pState->isUnderIndir)
{
if ((isLocVar || isLocFld) && tree->AsOp()->gtOp2)
{
- lclNum = tree->AsOp()->gtOp1->gtLclVarCommon.GetLclNum();
+ lclNum = tree->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum();
newState.lvAssignDef = lclNum;
newState.isAssignSrc = true;
}
if (tree->AsOp()->gtOp1->gtOper == GT_LCL_VAR)
{
- unsigned lclNum = tree->AsOp()->gtOp1->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = tree->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum();
for (unsigned level = 0; level < chkLevel; level++)
{
assert(!gtHasRef(verCurrentState.esStack[level].val, lclNum, false));
// Return a NOP if this is a self-assignment.
if (dest->OperGet() == GT_LCL_VAR && src->OperGet() == GT_LCL_VAR &&
- src->gtLclVarCommon.GetLclNum() == dest->gtLclVarCommon.GetLclNum())
+ src->AsLclVarCommon()->GetLclNum() == dest->AsLclVarCommon()->GetLclNum())
{
return gtNewNothingNode();
}
// TODO-1stClassStructs: Eliminate this pessimization when we can more generally
// handle multireg returns.
lcl->gtFlags |= GTF_DONT_CSE;
- lvaTable[lcl->gtLclVarCommon.GetLclNum()].lvIsMultiRegRet = true;
+ lvaTable[lcl->AsLclVarCommon()->GetLclNum()].lvIsMultiRegRet = true;
}
else if (lcl->gtType != src->gtType)
{
// We change this to a GT_LCL_FLD (from a GT_ADDR of a GT_LCL_VAR)
lcl->ChangeOper(GT_LCL_FLD);
- fgLclFldAssign(lcl->gtLclVarCommon.GetLclNum());
+ fgLclFldAssign(lcl->AsLclVarCommon()->GetLclNum());
lcl->gtType = src->gtType;
asgType = src->gtType;
}
#if defined(_TARGET_ARM_)
// TODO-Cleanup: This should have been taken care of in the above HasMultiRegRetVal() case,
// but that method has not been updadted to include ARM.
- impMarkLclDstNotPromotable(lcl->gtLclVarCommon.GetLclNum(), src, structHnd);
+ impMarkLclDstNotPromotable(lcl->AsLclVarCommon()->GetLclNum(), src, structHnd);
lcl->gtFlags |= GTF_DONT_CSE;
#elif defined(UNIX_AMD64_ABI)
// Not allowed for FEATURE_CORCLR which is the only SKU available for System V OSs.
// TODO-Cleanup: Why is this needed here? This seems that it will set this even for
// non-multireg returns.
lcl->gtFlags |= GTF_DONT_CSE;
- lvaTable[lcl->gtLclVarCommon.GetLclNum()].lvIsMultiRegRet = true;
+ lvaTable[lcl->AsLclVarCommon()->GetLclNum()].lvIsMultiRegRet = true;
#endif
}
else // we don't have a GT_ADDR of a GT_LCL_VAR
unsigned tmp;
if (handleCopy->IsLocal())
{
- tmp = handleCopy->gtLclVarCommon.GetLclNum();
+ tmp = handleCopy->AsLclVarCommon()->GetLclNum();
}
else
{
// Temps introduced by the importer itself don't need to be spilled
- bool isTempLcl = (tree->OperGet() == GT_LCL_VAR) && (tree->gtLclVarCommon.GetLclNum() >= info.compLocalsCount);
+ bool isTempLcl =
+ (tree->OperGet() == GT_LCL_VAR) && (tree->AsLclVarCommon()->GetLclNum() >= info.compLocalsCount);
if (isTempLcl)
{
if ((tree->gtOper == GT_ASG) && (tree->AsOp()->gtOp1->gtOper == GT_LCL_VAR) &&
(tree->AsOp()->gtOp2->gtOper == GT_CATCH_ARG))
{
- tree = gtNewLclvNode(tree->AsOp()->gtOp1->gtLclVarCommon.GetLclNum(), TYP_REF);
+ tree = gtNewLclvNode(tree->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum(), TYP_REF);
impPushOnStack(tree, typeInfo(TI_REF, clsHnd));
#if defined(JIT32_GCENCODER)
const bool forceInsertNewBlock = isSingleBlockFilter || compStressCompile(STRESS_CATCH_ARG, 5);
#else
- const bool forceInsertNewBlock = compStressCompile(STRESS_CATCH_ARG, 5);
+ const bool forceInsertNewBlock = compStressCompile(STRESS_CATCH_ARG, 5);
#endif // defined(JIT32_GCENCODER)
/* Spill GT_CATCH_ARG to a temp if there are jumps to the beginning of the handler */
//
GenTree* arrayAssignment = impLastStmt->GetRootNode();
if ((arrayAssignment->gtOper != GT_ASG) || (arrayAssignment->AsOp()->gtOp1->gtOper != GT_LCL_VAR) ||
- (arrayLocalNode->gtOper != GT_LCL_VAR) ||
- (arrayAssignment->AsOp()->gtOp1->gtLclVarCommon.GetLclNum() != arrayLocalNode->gtLclVarCommon.GetLclNum()))
+ (arrayLocalNode->gtOper != GT_LCL_VAR) || (arrayAssignment->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum() !=
+ arrayLocalNode->AsLclVarCommon()->GetLclNum()))
{
return nullptr;
}
if (fptr->OperGet() == GT_LCL_VAR)
{
- lvaTable[fptr->gtLclVarCommon.GetLclNum()].lvKeepType = 1;
+ lvaTable[fptr->AsLclVarCommon()->GetLclNum()].lvKeepType = 1;
}
#endif
{
assert(newobjThis->gtOper == GT_ADDR && newobjThis->AsOp()->gtOp1->gtOper == GT_LCL_VAR);
- unsigned tmp = newobjThis->AsOp()->gtOp1->gtLclVarCommon.GetLclNum();
+ unsigned tmp = newobjThis->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum();
impPushOnStack(gtNewLclvNode(tmp, lvaGetRealType(tmp)), verMakeTypeInfo(clsHnd).NormaliseForStack());
}
else
}
assert(newobjThis->gtOper == GT_LCL_VAR);
- impPushOnStack(gtNewLclvNode(newobjThis->gtLclVarCommon.GetLclNum(), TYP_REF),
+ impPushOnStack(gtNewLclvNode(newobjThis->AsLclVarCommon()->GetLclNum(), TYP_REF),
typeInfo(TI_REF, clsHnd));
}
}
if (op->gtOper == GT_LCL_VAR)
{
// Make sure that this struct stays in memory and doesn't get promoted.
- unsigned lclNum = op->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = op->AsLclVarCommon()->GetLclNum();
lvaTable[lclNum].lvIsMultiRegRet = true;
// TODO-1stClassStructs: Handle constant propagation and CSE-ing of multireg returns.
if (op->gtOper == GT_LCL_VAR)
{
// This LCL_VAR is an HFA return value, it stays as a TYP_STRUCT
- unsigned lclNum = op->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = op->AsLclVarCommon()->GetLclNum();
// Make sure this struct type stays as struct so that we can return it as an HFA
lvaTable[lclNum].lvIsMultiRegRet = true;
if (op->gtOper == GT_LCL_VAR)
{
// This LCL_VAR stays as a TYP_STRUCT
- unsigned lclNum = op->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = op->AsLclVarCommon()->GetLclNum();
if (!lvaIsImplicitByRefLocal(lclNum))
{
/* Filter out simple assignments to itself */
- if (op1->gtOper == GT_LCL_VAR && lclNum == op1->gtLclVarCommon.GetLclNum())
+ if (op1->gtOper == GT_LCL_VAR && lclNum == op1->AsLclVarCommon()->GetLclNum())
{
if (opts.compDbgCode)
{
// Some other block(s) have seen the CEE_RET first.
// Better they spilled to the same temp.
assert(impInlineInfo->retExpr->gtOper == GT_LCL_VAR);
- assert(impInlineInfo->retExpr->gtLclVarCommon.GetLclNum() == op2->gtLclVarCommon.GetLclNum());
+ assert(impInlineInfo->retExpr->AsLclVarCommon()->GetLclNum() ==
+ op2->AsLclVarCommon()->GetLclNum());
}
#endif
}
GenTree* tree = es->esStack[level].val;
if ((tree->gtOper == GT_LCL_VAR) || (tree->gtOper == GT_LCL_FLD))
{
- unsigned lclNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = tree->AsLclVarCommon()->GetLclNum();
noway_assert(lclNum < lvaCount);
LclVarDsc* varDsc = lvaTable + lclNum;
es->esStack[level].val->gtType = varDsc->TypeGet();
/* Narrowing cast */
if (inlArgNode->gtOper == GT_LCL_VAR &&
- !lvaTable[inlArgNode->gtLclVarCommon.GetLclNum()].lvNormalizeOnLoad() &&
- sigType == lvaGetRealType(inlArgNode->gtLclVarCommon.GetLclNum()))
+ !lvaTable[inlArgNode->AsLclVarCommon()->GetLclNum()].lvNormalizeOnLoad() &&
+ sigType == lvaGetRealType(inlArgNode->AsLclVarCommon()->GetLclNum()))
{
/* We don't need to insert a cast here as the variable
was assigned a normalized value of the right type */
//
// Use the caller-supplied node if this is the first use.
op1 = argInfo.argNode;
- argInfo.argTmpNum = op1->gtLclVarCommon.GetLclNum();
+ argInfo.argTmpNum = op1->AsLclVarCommon()->GetLclNum();
// Use an equivalent copy if this is the second or subsequent
// use, or if we need to retype.
var_types newTyp = lclTyp;
- if (!lvaTable[op1->gtLclVarCommon.GetLclNum()].lvNormalizeOnLoad())
+ if (!lvaTable[op1->AsLclVarCommon()->GetLclNum()].lvNormalizeOnLoad())
{
newTyp = genActualType(lclTyp);
}
// Create a new lcl var node - remember the argument lclNum
- op1 = gtNewLclvNode(op1->gtLclVarCommon.GetLclNum(), newTyp DEBUGARG(op1->AsLclVar()->gtLclILoffs));
+ op1 = gtNewLclvNode(op1->AsLclVarCommon()->GetLclNum(), newTyp DEBUGARG(op1->AsLclVar()->gtLclILoffs));
}
}
else if (argInfo.argIsByRefToStructLocal && !argInfo.argHasStargOp)
BOOL Compiler::impInlineIsThis(GenTree* tree, InlArgInfo* inlArgInfo)
{
assert(compIsForInlining());
- return (tree->gtOper == GT_LCL_VAR && tree->gtLclVarCommon.GetLclNum() == inlArgInfo[0].argTmpNum);
+ return (tree->gtOper == GT_LCL_VAR && tree->AsLclVarCommon()->GetLclNum() == inlArgInfo[0].argTmpNum);
}
//-----------------------------------------------------------------------------
{
#ifdef DEBUG
assert(tree && (tree->gtOper == GT_LCL_VAR || tree->gtOper == GT_LCL_VAR_ADDR || tree->gtOper == GT_STORE_LCL_VAR));
- assert(tree->gtLclVarCommon.GetLclNum() < compiler->lvaCount);
+ assert(tree->AsLclVarCommon()->GetLclNum() < compiler->lvaCount);
GetEmitter()->emitVarRefOffs = tree->AsLclVar()->gtLclILoffs;
goto LCL;
LCL:
- varNum = tree->gtLclVarCommon.GetLclNum();
+ varNum = tree->AsLclVarCommon()->GetLclNum();
assert(varNum < compiler->lvaCount);
if (shfv)
LCL:
- varNum = tree->gtLclVarCommon.GetLclNum();
+ varNum = tree->AsLclVarCommon()->GetLclNum();
assert(varNum < compiler->lvaCount);
#if CPU_LOAD_STORE_ARCH
goto LCL;
LCL:
- varNum = tree->gtLclVarCommon.GetLclNum();
+ varNum = tree->AsLclVarCommon()->GetLclNum();
assert(varNum < compiler->lvaCount);
#ifdef _TARGET_ARM_
NOT_BOOL:
- lclNum = op1->gtLclVarCommon.GetLclNum();
+ lclNum = op1->AsLclVarCommon()->GetLclNum();
noway_assert(lclNum < lvaCount);
lvaTable[lclNum].lvIsBoolean = false;
/* This must be a local variable reference */
assert((tree->gtOper == GT_LCL_VAR) || (tree->gtOper == GT_LCL_FLD));
- unsigned lclNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = tree->AsLclVarCommon()->GetLclNum();
noway_assert(lclNum < lvaCount);
LclVarDsc* varDsc = lvaTable + lclNum;
Compiler* pComp = ((lvaStressLclFldArgs*)data->pCallbackData)->m_pCompiler;
bool bFirstPass = ((lvaStressLclFldArgs*)data->pCallbackData)->m_bFirstPass;
noway_assert(lcl->gtOper == GT_LCL_VAR);
- unsigned lclNum = lcl->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = lcl->AsLclVarCommon()->GetLclNum();
var_types type = lcl->TypeGet();
LclVarDsc* varDsc = &pComp->lvaTable[lclNum];
// fgGetHandlerLiveVars(compCurBB), but seems excessive
//
assert(VarSetOps::IsEmptyIntersection(this, newLiveSet, varBits) || opts.compDbgCode ||
- lvaTable[tree->gtLclVarCommon.GetLclNum()].lvAddrExposed ||
+ lvaTable[tree->AsLclVarCommon()->GetLclNum()].lvAddrExposed ||
(compCurBB != nullptr && ehBlockHasExnFlowDsc(compCurBB)));
VarSetOps::UnionD(this, newLiveSet, varBits);
}
// `true` if the local var node corresponds to a dead store; `false` otherwise.
bool Compiler::fgComputeLifeLocal(VARSET_TP& life, VARSET_VALARG_TP keepAliveVars, GenTree* lclVarNode)
{
- unsigned lclNum = lclVarNode->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = lclVarNode->AsLclVarCommon()->GetLclNum();
assert(lclNum < lvaCount);
LclVarDsc& varDsc = lvaTable[lclNum];
bool isDeadStore = fgComputeLifeLocal(life, keepAliveVars, tree);
if (isDeadStore)
{
- LclVarDsc* varDsc = &lvaTable[tree->gtLclVarCommon.GetLclNum()];
+ LclVarDsc* varDsc = &lvaTable[tree->AsLclVarCommon()->GetLclNum()];
bool doAgain = false;
if (fgRemoveDeadStore(&tree, varDsc, life, &doAgain, pStmtInfoDirty DEBUGARG(treeModf)))
index->rank = arrElem->gtArrRank;
for (unsigned i = 0; i < dim; ++i)
{
- index->indLcls.Push(arrElem->gtArrInds[i]->gtLclVarCommon.GetLclNum());
+ index->indLcls.Push(arrElem->gtArrInds[i]->AsLclVarCommon()->GetLclNum());
}
- index->arrLcl = arrElem->gtArrObj->gtLclVarCommon.GetLclNum();
+ index->arrLcl = arrElem->gtArrObj->AsLclVarCommon()->GetLclNum();
}
return index;
}
assert(node->gtOper == GT_SWITCH);
GenTree* temp = node->AsOp()->gtOp1;
assert(temp->gtOper == GT_LCL_VAR);
- unsigned tempLclNum = temp->gtLclVarCommon.GetLclNum();
+ unsigned tempLclNum = temp->AsLclVarCommon()->GetLclNum();
var_types tempLclType = temp->TypeGet();
BasicBlock* defaultBB = jumpTab[jumpCnt - 1];
unsigned lclNum;
if (thisPtr->IsLocal())
{
- lclNum = thisPtr->gtLclVarCommon.GetLclNum();
+ lclNum = thisPtr->AsLclVarCommon()->GetLclNum();
}
else
{
tree1->IsIconHandle() == tree2->IsIconHandle();
case GT_LCL_VAR:
case GT_LCL_VAR_ADDR:
- return tree1->gtLclVarCommon.GetLclNum() == tree2->gtLclVarCommon.GetLclNum();
+ return tree1->AsLclVarCommon()->GetLclNum() == tree2->AsLclVarCommon()->GetLclNum();
case GT_CLS_VAR_ADDR:
return tree1->AsClsVar()->gtClsVarHnd == tree2->AsClsVar()->gtClsVarHnd;
default:
unsigned varNum = UINT_MAX;
if (tree->IsLocal())
{
- varNum = tree->gtLclVarCommon.GetLclNum();
+ varNum = tree->AsLclVarCommon()->GetLclNum();
varDsc = &(compiler->lvaTable[varNum]);
if (varDsc->lvLRACandidate)
{
{
if (tree->IsLocal())
{
- unsigned int lclNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned int lclNum = tree->AsLclVarCommon()->GetLclNum();
assert(lclNum < compiler->lvaCount);
- LclVarDsc* varDsc = compiler->lvaTable + tree->gtLclVarCommon.GetLclNum();
+ LclVarDsc* varDsc = compiler->lvaTable + tree->AsLclVarCommon()->GetLclNum();
return isCandidateVar(varDsc);
}
if (oper->OperGet() == GT_LCL_VAR && varTypeIsSmall(dstType))
{
- unsigned varNum = oper->gtLclVarCommon.GetLclNum();
+ unsigned varNum = oper->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = &lvaTable[varNum];
if (varDsc->TypeGet() == dstType && varDsc->lvNormalizeOnStore())
{
assert(argEntry->structDesc.passedInRegisters);
if (lclVar != nullptr)
{
- if (lvaGetPromotionType(lclVar->gtLclVarCommon.GetLclNum()) == PROMOTION_TYPE_INDEPENDENT)
+ if (lvaGetPromotionType(lclVar->AsLclVarCommon()->GetLclNum()) ==
+ PROMOTION_TYPE_INDEPENDENT)
{
copyBlkClass = objClass;
}
#ifdef _TARGET_ARM_
// TODO-1stClassStructs: Unify these conditions across targets.
if (((lclVar != nullptr) &&
- (lvaGetPromotionType(lclVar->gtLclVarCommon.GetLclNum()) == PROMOTION_TYPE_INDEPENDENT)) ||
+ (lvaGetPromotionType(lclVar->AsLclVarCommon()->GetLclNum()) == PROMOTION_TYPE_INDEPENDENT)) ||
((argObj->OperIs(GT_OBJ)) && (passingSize != structSize)))
{
copyBlkClass = objClass;
}
if (argObj->gtOper == GT_LCL_VAR)
{
- unsigned lclNum = argObj->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = argObj->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = &lvaTable[lclNum];
if (varDsc->lvPromoted)
if (genTypeSize(fieldVarDsc->TypeGet()) >= originalSize)
{
// we will use the first and only promoted field
- argObj->gtLclVarCommon.SetLclNum(varDsc->lvFieldLclStart);
+ argObj->AsLclVarCommon()->SetLclNum(varDsc->lvFieldLclStart);
if (varTypeIsEnregisterable(fieldVarDsc->TypeGet()) &&
(genTypeSize(fieldVarDsc->TypeGet()) == originalSize))
{
assert(tree->gtOper == GT_LCL_VAR);
- unsigned lclNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = tree->AsLclVarCommon()->GetLclNum();
var_types varType = lvaGetRealType(lclNum);
LclVarDsc* varDsc = &lvaTable[lclNum];
bool addExplicitNullCheck = false;
// Implicit byref locals are never null.
- if (!((objRef->gtOper == GT_LCL_VAR) && lvaIsImplicitByRefLocal(objRef->gtLclVarCommon.GetLclNum())))
+ if (!((objRef->gtOper == GT_LCL_VAR) && lvaIsImplicitByRefLocal(objRef->AsLclVarCommon()->GetLclNum())))
{
// If the objRef is a GT_ADDR node, it, itself, never requires null checking. The expression
// whose address is being taken is either a local or static variable, whose address is necessarily
}
else
{
- lclNum = objRef->gtLclVarCommon.GetLclNum();
+ lclNum = objRef->AsLclVarCommon()->GetLclNum();
}
// Create the "nullchk" node.
{
noway_assert(call->TypeGet() == TYP_VOID);
GenTree* retValBuf = call->gtCallArgs->GetNode();
- if (retValBuf->gtOper != GT_LCL_VAR || retValBuf->gtLclVarCommon.GetLclNum() != info.compRetBuffArg)
+ if (retValBuf->gtOper != GT_LCL_VAR || retValBuf->AsLclVarCommon()->GetLclNum() != info.compRetBuffArg)
{
failTailCall("Need to copy return buffer");
return nullptr;
{
// The source argument of the copyblk can potentially be accessed only through indir(addr(lclVar))
// or indir(lclVarAddr) so it must be on the stack.
- unsigned lclVarNum = srcLclVarTree->gtLclVarCommon.GetLclNum();
+ unsigned lclVarNum = srcLclVarTree->AsLclVarCommon()->GetLclNum();
lvaSetVarDoNotEnregister(lclVarNum DEBUGARG(DNER_BlockOp));
GenTree* srcAddr;
if (src == srcLclVarTree)
// We will *not* consider this to define the local, but rather have each individual field assign
// be a definition.
addrSpill->AsOp()->gtOp1->gtFlags &= ~(GTF_LIVENESS_MASK);
- assert(lvaGetPromotionType(addrSpill->AsOp()->gtOp1->gtLclVarCommon.GetLclNum()) !=
+ assert(lvaGetPromotionType(addrSpill->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum()) !=
PROMOTION_TYPE_INDEPENDENT);
addrSpillIsStackDest = true; // addrSpill represents the address of LclVar[varNum] in our
// local stack frame
GenTree* addrOp = addrSpill->AsOp()->gtOp1;
if (addrOp->IsLocal())
{
- unsigned lclVarNum = addrOp->gtLclVarCommon.GetLclNum();
+ unsigned lclVarNum = addrOp->AsLclVarCommon()->GetLclNum();
lvaTable[lclVarNum].lvAddrExposed = true;
lvaSetVarDoNotEnregister(lclVarNum DEBUGARG(DNER_AddrExposed));
}
if (isSIMDTypeLocal(obj))
{
- unsigned lclNum = obj->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = obj->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = &lvaTable[lclNum];
if (varDsc->lvIsUsedInSIMDIntrinsic() || ignoreUsedInSIMDIntrinsic)
{
// When we introduce the CSE we remove the GT_IND and subsitute a GT_LCL_VAR in it place.
else if (op2->OperIsCompare() && (op2->gtType == TYP_BYTE) && (op1->gtOper == GT_LCL_VAR))
{
- unsigned varNum = op1->gtLclVarCommon.GetLclNum();
+ unsigned varNum = op1->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = &lvaTable[varNum];
/* We again need to zero extend the setcc instruction */
goto SKIP;
}
- unsigned lclNum = lcl->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = lcl->AsLclVarCommon()->GetLclNum();
noway_assert(lclNum < lvaCount);
/* If the LCL_VAR is not a temp then bail, a temp has a single def */
}
/* Both of the LCL_VAR must match */
- if (asg->AsOp()->gtOp1->gtLclVarCommon.GetLclNum() != lclNum)
+ if (asg->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum() != lclNum)
{
goto SKIP;
}
}
else if (temp->OperIsLocal())
{
- unsigned lclNum = temp->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = temp->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = &lvaTable[lclNum];
// We will try to optimize when we have a promoted struct promoted with a zero lvFldOffset
if (fieldVarDsc->TypeGet() == typ && (fieldVarDsc->lvFldOffset == 0))
{
// We can just use the existing promoted field LclNum
- temp->gtLclVarCommon.SetLclNum(lclNumFld);
+ temp->AsLclVarCommon()->SetLclNum(lclNumFld);
temp->gtType = fieldVarDsc->TypeGet();
foldAndReturnTemp = true;
}
// The emitter can get confused by invalid offsets
- if (ival1 >= Compiler::lvaLclSize(temp->gtLclVarCommon.GetLclNum()))
+ if (ival1 >= Compiler::lvaLclSize(temp->AsLclVarCommon()->GetLclNum()))
{
break;
}
if ((obj != nullptr) && (obj->gtOper == GT_LCL_VAR))
{
- unsigned lclNum = obj->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = obj->AsLclVarCommon()->GetLclNum();
const LclVarDsc* varDsc = &lvaTable[lclNum];
if (varTypeIsStruct(obj))
}
tree->SetOper(GT_LCL_VAR);
- tree->gtLclVarCommon.SetLclNum(fieldLclIndex);
+ tree->AsLclVarCommon()->SetLclNum(fieldLclIndex);
tree->gtType = fieldType;
tree->gtFlags &= GTF_NODE_MASK;
tree->gtFlags &= ~GTF_GLOB_REF;
if (tree->TypeGet() == obj->TypeGet())
{
tree->ChangeOper(GT_LCL_VAR);
- tree->gtLclVarCommon.SetLclNum(lclNum);
+ tree->AsLclVarCommon()->SetLclNum(lclNum);
tree->gtFlags &= GTF_NODE_MASK;
if ((parent->gtOper == GT_ASG) && (parent->AsOp()->gtOp1 == tree))
(varTypeIsEnregisterable(fieldType) || varTypeIsSIMD(fieldType)));
tree->ChangeOper(GT_LCL_VAR);
- assert(tree->gtLclVarCommon.GetLclNum() == fieldLclIndex);
+ assert(tree->AsLclVarCommon()->GetLclNum() == fieldLclIndex);
tree->gtType = fldVarDsc->TypeGet();
#ifdef DEBUG
if (verbose)
assert(isAddr == (tree->gtOper == GT_ADDR));
GenTree* lclVarTree = isAddr ? tree->AsOp()->gtOp1 : tree;
- unsigned lclNum = lclVarTree->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = lclVarTree->AsLclVarCommon()->GetLclNum();
LclVarDsc* lclVarDsc = &lvaTable[lclNum];
CORINFO_FIELD_HANDLE fieldHnd;
{
// change &(X.f) [i.e. GT_ADDR of local for promoted arg field]
// into &(X, f) [i.e. GT_ADDR of GT_FIELD off ptr param]
- lclVarTree->gtLclVarCommon.SetLclNum(lclNum);
+ lclVarTree->AsLclVarCommon()->SetLclNum(lclNum);
lclVarTree->gtType = TYP_BYREF;
tree->AsOp()->gtOp1 = gtNewFieldRef(fieldRefType, fieldHnd, lclVarTree, fieldOffset);
}
if (fieldHnd)
{
- tree->gtLclVarCommon.SetLclNum(lclNum);
+ tree->AsLclVarCommon()->SetLclNum(lclNum);
tree = gtNewFieldRef(fieldRefType, fieldHnd, tree, fieldOffset);
}
else
cse = m_pCompiler->gtNewLclvNode(cseLclVarNum, cseLclVarTyp);
// Assign the ssa num for the use. Note it may be the reserved num.
- cse->gtLclVarCommon.SetSsaNum(cseSsaNum);
+ cse->AsLclVarCommon()->SetSsaNum(cseSsaNum);
// assign the proper ValueNumber, A CSE use discards any exceptions
cse->gtVNPair = vnStore->VNPNormalPair(exp->gtVNPair);
ref->gtVNPair = val->gtVNPair; // The new 'ref' is the same as 'val'
// Assign the ssa num for the ref use. Note it may be the reserved num.
- ref->gtLclVarCommon.SetSsaNum(cseSsaNum);
+ ref->AsLclVarCommon()->SetSsaNum(cseSsaNum);
// If it has a zero-offset field seq, copy annotation to the ref
if (hasZeroMapAnnotation)
GenTree* lhs = init->AsOp()->gtOp1;
GenTree* rhs = init->AsOp()->gtOp2;
// LHS has to be local and should equal iterVar.
- if (lhs->gtOper != GT_LCL_VAR || lhs->gtLclVarCommon.GetLclNum() != iterVar)
+ if (lhs->gtOper != GT_LCL_VAR || lhs->AsLclVarCommon()->GetLclNum() != iterVar)
{
return false;
}
else if (rhs->gtOper == GT_LCL_VAR)
{
optLoopTable[loopInd].lpFlags |= LPFLG_VAR_INIT;
- optLoopTable[loopInd].lpVarInit = rhs->gtLclVarCommon.GetLclNum();
+ optLoopTable[loopInd].lpVarInit = rhs->AsLclVarCommon()->GetLclNum();
}
else
{
GenTree* limitOp;
// Make sure op1 or op2 is the iterVar.
- if (opr1->gtOper == GT_LCL_VAR && opr1->gtLclVarCommon.GetLclNum() == iterVar)
+ if (opr1->gtOper == GT_LCL_VAR && opr1->AsLclVarCommon()->GetLclNum() == iterVar)
{
iterOp = opr1;
limitOp = opr2;
}
- else if (opr2->gtOper == GT_LCL_VAR && opr2->gtLclVarCommon.GetLclNum() == iterVar)
+ else if (opr2->gtOper == GT_LCL_VAR && opr2->AsLclVarCommon()->GetLclNum() == iterVar)
{
iterOp = opr2;
limitOp = opr1;
optLoopTable[loopInd].lpFlags |= LPFLG_SIMD_LIMIT;
}
}
- else if (limitOp->gtOper == GT_LCL_VAR && !optIsVarAssigned(from, to, nullptr, limitOp->gtLclVarCommon.GetLclNum()))
+ else if (limitOp->gtOper == GT_LCL_VAR &&
+ !optIsVarAssigned(from, to, nullptr, limitOp->AsLclVarCommon()->GetLclNum()))
{
optLoopTable[loopInd].lpFlags |= LPFLG_VAR_LIMIT;
}
/* Make sure everything looks ok */
if ((init->gtOper != GT_ASG) || (init->AsOp()->gtOp1->gtOper != GT_LCL_VAR) ||
- (init->AsOp()->gtOp1->gtLclVarCommon.GetLclNum() != lvar) || (init->AsOp()->gtOp2->gtOper != GT_CNS_INT) ||
- (init->AsOp()->gtOp2->AsIntCon()->gtIconVal != lbeg) ||
+ (init->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum() != lvar) ||
+ (init->AsOp()->gtOp2->gtOper != GT_CNS_INT) || (init->AsOp()->gtOp2->AsIntCon()->gtIconVal != lbeg) ||
!((incr->gtOper == GT_ADD) || (incr->gtOper == GT_SUB)) || (incr->AsOp()->gtOp1->gtOper != GT_LCL_VAR) ||
- (incr->AsOp()->gtOp1->gtLclVarCommon.GetLclNum() != lvar) || (incr->AsOp()->gtOp2->gtOper != GT_CNS_INT) ||
- (incr->AsOp()->gtOp2->AsIntCon()->gtIconVal != iterInc) ||
+ (incr->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum() != lvar) ||
+ (incr->AsOp()->gtOp2->gtOper != GT_CNS_INT) || (incr->AsOp()->gtOp2->AsIntCon()->gtIconVal != iterInc) ||
(testStmt->GetRootNode()->gtOper != GT_JTRUE))
{
if (destOper == GT_LCL_VAR)
{
- unsigned tvar = dest->gtLclVarCommon.GetLclNum();
+ unsigned tvar = dest->AsLclVarCommon()->GetLclNum();
if (tvar < lclMAX_ALLSET_TRACKED)
{
AllVarSetOps::AddElemD(data->compiler, desc->ivaMaskVal, tvar);
#ifdef DEBUG
GenTree* op1 = pLoop->lpIterator();
- noway_assert((op1->gtOper == GT_LCL_VAR) && (op1->gtLclVarCommon.GetLclNum() == ivLclNum));
+ noway_assert((op1->gtOper == GT_LCL_VAR) && (op1->AsLclVarCommon()->GetLclNum() == ivLclNum));
#endif
JITDUMP("Checking blocks " FMT_BB ".." FMT_BB " for optimization candidates\n", beg->bbNum,
{
return false;
}
- unsigned arrLcl = arrBndsChk->gtArrLen->gtGetOp1()->gtLclVarCommon.GetLclNum();
+ unsigned arrLcl = arrBndsChk->gtArrLen->gtGetOp1()->AsLclVarCommon()->GetLclNum();
if (lhsNum != BAD_VAR_NUM && arrLcl != lhsNum)
{
return false;
}
- unsigned indLcl = arrBndsChk->gtIndex->gtLclVarCommon.GetLclNum();
+ unsigned indLcl = arrBndsChk->gtIndex->AsLclVarCommon()->GetLclNum();
GenTree* after = tree->gtGetOp2();
}
GenTree* base = sibo->gtGetOp1();
GenTree* sio = sibo->gtGetOp2(); // sio == scale*index + offset
- if (base->OperGet() != GT_LCL_VAR || base->gtLclVarCommon.GetLclNum() != arrLcl)
+ if (base->OperGet() != GT_LCL_VAR || base->AsLclVarCommon()->GetLclNum() != arrLcl)
{
return false;
}
#else
GenTree* indexVar = index;
#endif
- if (indexVar->gtOper != GT_LCL_VAR || indexVar->gtLclVarCommon.GetLclNum() != indLcl)
+ if (indexVar->gtOper != GT_LCL_VAR || indexVar->AsLclVarCommon()->GetLclNum() != indLcl)
{
return false;
}
{
return false;
}
- unsigned lhsNum = lhs->gtLclVarCommon.GetLclNum();
+ unsigned lhsNum = lhs->AsLclVarCommon()->GetLclNum();
GenTree* after = tree->gtGetOp2();
// Pass the "lhsNum", so we can verify if indeed it is used as the array base.
return optExtractArrIndex(after, result, lhsNum);
if (tree->gtOper == GT_LCL_VAR)
{
- if (pData->pCompiler->lvaTable[tree->gtLclVarCommon.GetLclNum()].lvAddrExposed)
+ if (pData->pCompiler->lvaTable[tree->AsLclVarCommon()->GetLclNum()].lvAddrExposed)
{
pData->bValidIndex = false;
return WALK_ABORT;
else
{
noway_assert(pArray->gtType == TYP_REF);
- noway_assert(pArray->gtLclVarCommon.GetLclNum() < lvaCount);
+ noway_assert(pArray->AsLclVarCommon()->GetLclNum() < lvaCount);
- if (lvaTable[pArray->gtLclVarCommon.GetLclNum()].lvAddrExposed)
+ if (lvaTable[pArray->AsLclVarCommon()->GetLclNum()].lvAddrExposed)
{
// If the array address has been taken, don't do the optimization
// (this restriction can be lowered a bit, but i don't think it's worth it)
{
/* is it a boolean local variable */
- unsigned lclNum = opr1->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = opr1->AsLclVarCommon()->GetLclNum();
noway_assert(lclNum < lvaCount);
if (lvaTable[lclNum].lvIsBoolean)
if (op1->OperGet() == GT_LCL_VAR)
{
- op1LclNum = op1->gtLclVarCommon.GetLclNum();
+ op1LclNum = op1->AsLclVarCommon()->GetLclNum();
op1Assign = nullptr;
}
else
assert(newobjThis->gtOper == GT_ADDR && newobjThis->AsOp()->gtOp1->gtOper == GT_LCL_VAR);
// push newobj result on type stack
- unsigned tmp = op1->AsOp()->gtOp1->gtLclVarCommon.GetLclNum();
+ unsigned tmp = op1->AsOp()->gtOp1->AsLclVarCommon()->GetLclNum();
impPushOnStack(gtNewLclvNode(tmp, lvaGetRealType(tmp)), verMakeTypeInfo(clsHnd).NormaliseForStack());
}
else
else if (op1->OperIsLocalAddr())
{
unsigned offset = (op1->OperGet() == GT_LCL_FLD_ADDR) ? op1->AsLclFld()->gtLclOffs : 0;
- GetEmitter()->emitIns_R_S(ins, emitTypeSize(targetType), targetReg, op1->gtLclVarCommon.GetLclNum(),
+ GetEmitter()->emitIns_R_S(ins, emitTypeSize(targetType), targetReg, op1->AsLclVarCommon()->GetLclNum(),
offset);
}
else
// There are three parts to the total offset here:
// {offset of local} + {offset of SIMD Vector field (lclFld only)} + {offset of element within SIMD vector}.
bool isEBPbased;
- unsigned varNum = op1->gtLclVarCommon.GetLclNum();
+ unsigned varNum = op1->AsLclVarCommon()->GetLclNum();
offset += compiler->lvaFrameAddress(varNum, &isEBPbased);
if (op1->OperGet() == GT_LCL_FLD)
{
assert((treeNode->OperGet() == GT_STORE_LCL_FLD) || (treeNode->OperGet() == GT_STORE_LCL_VAR));
unsigned offs = 0;
- unsigned varNum = treeNode->gtLclVarCommon.GetLclNum();
+ unsigned varNum = treeNode->AsLclVarCommon()->GetLclNum();
assert(varNum < compiler->lvaCount);
if (treeNode->OperGet() == GT_STORE_LCL_FLD)
regNumber targetReg = treeNode->GetRegNum();
unsigned offs = 0;
- unsigned varNum = treeNode->gtLclVarCommon.GetLclNum();
+ unsigned varNum = treeNode->AsLclVarCommon()->GetLclNum();
assert(varNum < compiler->lvaCount);
if (treeNode->OperGet() == GT_LCL_FLD)
{
if (tree->IsLocal())
{
- tree->gtLclVarCommon.SetSsaNum(SsaConfig::RESERVED_SSA_NUM);
+ tree->AsLclVarCommon()->SetSsaNum(SsaConfig::RESERVED_SSA_NUM);
continue;
}
}
GenTree* phiLhs = tree->AsOp()->gtOp1;
assert(phiLhs->OperGet() == GT_LCL_VAR);
- if (phiLhs->gtLclVarCommon.GetLclNum() == lclNum)
+ if (phiLhs->AsLclVarCommon()->GetLclNum() == lclNum)
{
return tree->AsOp()->gtOp2;
}
return;
}
- unsigned lclNum = tree->gtLclVarCommon.GetLclNum();
+ unsigned lclNum = tree->AsLclVarCommon()->GetLclNum();
// Is this a variable we exclude from SSA?
if (!m_pCompiler->lvaInSsa(lclNum))
{
- tree->gtLclVarCommon.SetSsaNum(SsaConfig::RESERVED_SSA_NUM);
+ tree->AsLclVarCommon()->SetSsaNum(SsaConfig::RESERVED_SSA_NUM);
return;
}
}
else
{
- tree->gtLclVarCommon.SetSsaNum(SsaConfig::RESERVED_SSA_NUM);
+ tree->AsLclVarCommon()->SetSsaNum(SsaConfig::RESERVED_SSA_NUM);
return;
}
}
{
lclVarTree = tree;
}
- unsigned int lclNum = lclVarTree->gtLclVarCommon.GetLclNum();
+ unsigned int lclNum = lclVarTree->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = compiler->lvaTable + lclNum;
#ifdef DEBUG
{
FieldSeqNode* fieldSeq = nullptr;
ValueNum newVN = ValueNumStore::NoVN;
- if (!lvaInSsa(arg->gtLclVarCommon.GetLclNum()))
+ if (!lvaInSsa(arg->AsLclVarCommon()->GetLclNum()))
{
newVN = vnStore->VNForExpr(compCurBB, TYP_BYREF);
}
}
if (newVN == ValueNumStore::NoVN)
{
- assert(arg->gtLclVarCommon.GetSsaNum() != ValueNumStore::NoVN);
+ assert(arg->AsLclVarCommon()->GetSsaNum() != ValueNumStore::NoVN);
newVN = vnStore->VNForFunc(TYP_BYREF, VNF_PtrToLoc,
- vnStore->VNForIntCon(arg->gtLclVarCommon.GetLclNum()),
+ vnStore->VNForIntCon(arg->AsLclVarCommon()->GetLclNum()),
vnStore->VNForFieldSeq(fieldSeq));
}
tree->gtVNPair.SetBoth(newVN);