Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Replace gtLclNum with GetLclNum() #26853

Merged
merged 3 commits into from
Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Compiler::fgWalkResult Compiler::optAddCopiesCallback(GenTree** pTree, fgWalkDat
GenTree* op1 = tree->gtOp.gtOp1;
Compiler* comp = data->compiler;

if ((op1->gtOper == GT_LCL_VAR) && (op1->gtLclVarCommon.gtLclNum == comp->optAddCopyLclNum))
if ((op1->gtOper == GT_LCL_VAR) && (op1->gtLclVarCommon.GetLclNum() == comp->optAddCopyLclNum))
{
comp->optAddCopyAsgnNode = tree;
return WALK_ABORT;
Expand Down Expand Up @@ -450,7 +450,7 @@ void Compiler::optAddCopies()
GenTree* op1 = tree->gtOp.gtOp1;

noway_assert(tree && op1 && tree->OperIs(GT_ASG) && (op1->gtOper == GT_LCL_VAR) &&
(op1->gtLclVarCommon.gtLclNum == lclNum));
(op1->gtLclVarCommon.GetLclNum() == lclNum));

/* Assign the old expression into the new temp */

Expand Down Expand Up @@ -886,7 +886,7 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
goto DONE_ASSERTION; // Don't make an assertion
}

unsigned lclNum = op1->gtLclVarCommon.gtLclNum;
unsigned lclNum = op1->gtLclVarCommon.GetLclNum();
noway_assert(lclNum < lvaCount);
LclVarDsc* lclVar = &lvaTable[lclNum];

Expand Down Expand Up @@ -965,7 +965,7 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
//
else if (op1->gtOper == GT_LCL_VAR)
{
unsigned lclNum = op1->gtLclVarCommon.gtLclNum;
unsigned lclNum = op1->gtLclVarCommon.GetLclNum();
noway_assert(lclNum < lvaCount);
LclVarDsc* lclVar = &lvaTable[lclNum];

Expand Down Expand Up @@ -1138,7 +1138,7 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
goto DONE_ASSERTION; // Don't make an assertion
}

unsigned lclNum2 = op2->gtLclVarCommon.gtLclNum;
unsigned lclNum2 = op2->gtLclVarCommon.GetLclNum();
noway_assert(lclNum2 < lvaCount);
LclVarDsc* lclVar2 = &lvaTable[lclNum2];

Expand Down Expand Up @@ -1278,7 +1278,7 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
//
if (op1->gtOper == GT_LCL_VAR)
{
unsigned lclNum = op1->gtLclVarCommon.gtLclNum;
unsigned lclNum = op1->gtLclVarCommon.GetLclNum();
noway_assert(lclNum < lvaCount);

// If the local variable is not in SSA then bail
Expand Down Expand Up @@ -2593,7 +2593,7 @@ GenTree* Compiler::optConstantAssertionProp(AssertionDsc* curAssertion,
GenTree* tree,
Statement* stmt DEBUGARG(AssertionIndex index))
{
unsigned lclNum = tree->gtLclVarCommon.gtLclNum;
unsigned lclNum = tree->gtLclVarCommon.GetLclNum();

if (lclNumIsCSE(lclNum))
{
Expand Down Expand Up @@ -3238,9 +3238,9 @@ GenTree* Compiler::optAssertionPropGlobal_RelOp(ASSERT_VALARG_TP assertions, Gen
if (verbose)
{
printf("\nVN relop based copy assertion prop in " FMT_BB ":\n", compCurBB->bbNum);
printf("Assertion index=#%02u: V%02d.%02d %s V%02d.%02d\n", index, op1->gtLclVar.gtLclNum,
printf("Assertion index=#%02u: V%02d.%02d %s V%02d.%02d\n", index, op1->gtLclVar.GetLclNum(),
op1->gtLclVar.GetSsaNum(), (curAssertion->assertionKind == OAK_EQUAL) ? "==" : "!=",
op2->gtLclVar.gtLclNum, op2->gtLclVar.GetSsaNum());
op2->gtLclVar.GetLclNum(), op2->gtLclVar.GetSsaNum());
gtDispTree(tree, nullptr, nullptr, true);
}
#endif
Expand Down Expand Up @@ -3326,7 +3326,7 @@ GenTree* Compiler::optAssertionPropLocal_RelOp(ASSERT_VALARG_TP assertions, GenT
}

// Find an equal or not equal assertion about op1 var.
unsigned lclNum = op1->gtLclVarCommon.gtLclNum;
unsigned lclNum = op1->gtLclVarCommon.GetLclNum();
noway_assert(lclNum < lvaCount);
AssertionIndex index = optLocalAssertionIsEqualOrNotEqual(op1Kind, lclNum, op2Kind, cnsVal, assertions);

Expand Down Expand Up @@ -3425,7 +3425,7 @@ GenTree* Compiler::optAssertionProp_Cast(ASSERT_VALARG_TP assertions, GenTree* t
AssertionIndex index = optAssertionIsSubrange(lcl, fromType, toType, assertions);
if (index != NO_ASSERTION_INDEX)
{
LclVarDsc* varDsc = &lvaTable[lcl->gtLclVarCommon.gtLclNum];
LclVarDsc* varDsc = &lvaTable[lcl->gtLclVarCommon.GetLclNum()];
if (varDsc->lvNormalizeOnLoad() || varTypeIsLong(varDsc->TypeGet()))
{
// For normalize on load variables it must be a narrowing cast to remove
Expand Down
2 changes: 1 addition & 1 deletion src/jit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
{
return false;
}
const LclVarDsc* varDsc = &compiler->lvaTable[tree->gtLclVarCommon.gtLclNum];
const LclVarDsc* varDsc = &compiler->lvaTable[tree->gtLclVarCommon.GetLclNum()];
return (varDsc->lvIsRegCandidate());
}

Expand Down
8 changes: 4 additions & 4 deletions src/jit/codegenarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,14 +966,14 @@ void CodeGen::genCodeForLclVar(GenTreeLclVar* tree)
// lcl_vars are not defs
assert((tree->gtFlags & GTF_VAR_DEF) == 0);

bool isRegCandidate = compiler->lvaTable[tree->gtLclNum].lvIsRegCandidate();
bool isRegCandidate = compiler->lvaTable[tree->GetLclNum()].lvIsRegCandidate();

// If this is a register candidate that has been spilled, genConsumeReg() will
// reload it at the point of use. Otherwise, if it's not in a register, we load it here.

if (!isRegCandidate && !(tree->gtFlags & GTF_SPILLED))
{
GetEmitter()->emitIns_R_S(ins_Load(tree->TypeGet()), emitTypeSize(tree), tree->gtRegNum, tree->gtLclNum, 0);
GetEmitter()->emitIns_R_S(ins_Load(tree->TypeGet()), emitTypeSize(tree), tree->gtRegNum, tree->GetLclNum(), 0);
genProduceReg(tree);
}
}
Expand All @@ -998,7 +998,7 @@ void CodeGen::genCodeForStoreLclFld(GenTreeLclFld* tree)
// We must have a stack store with GT_STORE_LCL_FLD
noway_assert(targetReg == REG_NA);

unsigned varNum = tree->gtLclNum;
unsigned varNum = tree->GetLclNum();
assert(varNum < compiler->lvaCount);
LclVarDsc* varDsc = &(compiler->lvaTable[varNum]);

Expand Down Expand Up @@ -1030,7 +1030,7 @@ void CodeGen::genCodeForStoreLclVar(GenTreeLclVar* tree)
regNumber targetReg = tree->gtRegNum;
emitter* emit = GetEmitter();

unsigned varNum = tree->gtLclNum;
unsigned varNum = tree->GetLclNum();
assert(varNum < compiler->lvaCount);
LclVarDsc* varDsc = &(compiler->lvaTable[varNum]);

Expand Down
28 changes: 14 additions & 14 deletions src/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1828,7 +1828,7 @@ void CodeGen::genCodeForLclVar(GenTreeLclVar* tree)
var_types targetType = tree->TypeGet();
emitter* emit = GetEmitter();

unsigned varNum = tree->gtLclNum;
unsigned varNum = tree->GetLclNum();
assert(varNum < compiler->lvaCount);
LclVarDsc* varDsc = &(compiler->lvaTable[varNum]);
bool isRegCandidate = varDsc->lvIsRegCandidate();
Expand Down Expand Up @@ -1880,7 +1880,7 @@ void CodeGen::genCodeForStoreLclFld(GenTreeLclFld* tree)
// We must have a stack store with GT_STORE_LCL_FLD
noway_assert(targetReg == REG_NA);

unsigned varNum = tree->gtLclNum;
unsigned varNum = tree->GetLclNum();
assert(varNum < compiler->lvaCount);
LclVarDsc* varDsc = &(compiler->lvaTable[varNum]);

Expand Down Expand Up @@ -1926,7 +1926,7 @@ void CodeGen::genCodeForStoreLclVar(GenTreeLclVar* tree)
regNumber targetReg = tree->gtRegNum;
emitter* emit = GetEmitter();

unsigned varNum = tree->gtLclNum;
unsigned varNum = tree->GetLclNum();
assert(varNum < compiler->lvaCount);
LclVarDsc* varDsc = &(compiler->lvaTable[varNum]);

Expand Down Expand Up @@ -2031,12 +2031,12 @@ void CodeGen::genSimpleReturn(GenTree* treeNode)
if (op1->OperGet() == GT_LCL_VAR)
{
GenTreeLclVarCommon* lcl = op1->AsLclVarCommon();
bool isRegCandidate = compiler->lvaTable[lcl->gtLclNum].lvIsRegCandidate();
bool isRegCandidate = compiler->lvaTable[lcl->GetLclNum()].lvIsRegCandidate();
if (isRegCandidate && ((op1->gtFlags & GTF_SPILLED) == 0))
{
// We may need to generate a zero-extending mov instruction to load the value from this GT_LCL_VAR

unsigned lclNum = lcl->gtLclNum;
unsigned lclNum = lcl->GetLclNum();
LclVarDsc* varDsc = &(compiler->lvaTable[lclNum]);
var_types op1Type = genActualType(op1->TypeGet());
var_types lclType = genActualType(varDsc->TypeGet());
Expand Down Expand Up @@ -2571,7 +2571,7 @@ void CodeGen::genCodeForLoadPairOffset(regNumber dst, regNumber dst2, GenTree* b
if (base->gtOper == GT_LCL_FLD_ADDR)
offset += base->gtLclFld.gtLclOffs;

emit->emitIns_R_R_S_S(INS_ldp, EA_8BYTE, EA_8BYTE, dst, dst2, base->gtLclVarCommon.gtLclNum, offset);
emit->emitIns_R_R_S_S(INS_ldp, EA_8BYTE, EA_8BYTE, dst, dst2, base->gtLclVarCommon.GetLclNum(), offset);
}
else
{
Expand All @@ -2591,7 +2591,7 @@ void CodeGen::genCodeForStorePairOffset(regNumber src, regNumber src2, GenTree*
if (base->gtOper == GT_LCL_FLD_ADDR)
offset += base->gtLclFld.gtLclOffs;

emit->emitIns_S_S_R_R(INS_stp, EA_8BYTE, EA_8BYTE, src, src2, base->gtLclVarCommon.gtLclNum, offset);
emit->emitIns_S_S_R_R(INS_stp, EA_8BYTE, EA_8BYTE, src, src2, base->gtLclVarCommon.GetLclNum(), offset);
}
else
{
Expand Down Expand Up @@ -3301,10 +3301,10 @@ void CodeGen::genCodeForSwap(GenTreeOp* tree)
assert(genIsRegCandidateLocal(tree->gtOp1) && genIsRegCandidateLocal(tree->gtOp2));

GenTreeLclVarCommon* lcl1 = tree->gtOp1->AsLclVarCommon();
LclVarDsc* varDsc1 = &(compiler->lvaTable[lcl1->gtLclNum]);
LclVarDsc* varDsc1 = &(compiler->lvaTable[lcl1->GetLclNum()]);
var_types type1 = varDsc1->TypeGet();
GenTreeLclVarCommon* lcl2 = tree->gtOp2->AsLclVarCommon();
LclVarDsc* varDsc2 = &(compiler->lvaTable[lcl2->gtLclNum]);
LclVarDsc* varDsc2 = &(compiler->lvaTable[lcl2->GetLclNum()]);
var_types type2 = varDsc2->TypeGet();

// We must have both int or both fp regs
Expand Down Expand Up @@ -4712,7 +4712,7 @@ void CodeGen::genSIMDIntrinsicGetItem(GenTreeSIMD* simdNode)

if (op1->OperIsLocal())
{
unsigned varNum = op1->gtLclVarCommon.gtLclNum;
unsigned varNum = op1->gtLclVarCommon.GetLclNum();

GetEmitter()->emitIns_R_S(ins, emitActualTypeSize(baseType), targetReg, varNum, offset);
}
Expand Down Expand Up @@ -4771,7 +4771,7 @@ void CodeGen::genSIMDIntrinsicGetItem(GenTreeSIMD* simdNode)
assert(!op1->isUsedFromReg());
if (op1->OperIsLocal())
{
unsigned varNum = op1->gtLclVarCommon.gtLclNum;
unsigned varNum = op1->gtLclVarCommon.GetLclNum();

baseReg = simdNode->ExtractTempReg();

Expand Down Expand Up @@ -4926,7 +4926,7 @@ void CodeGen::genSIMDIntrinsicUpperSave(GenTreeSIMD* simdNode)
{
// This is not a normal spill; we'll spill it to the lclVar location.
// The localVar must have a stack home.
unsigned varNum = op1->AsLclVarCommon()->gtLclNum;
unsigned varNum = op1->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = compiler->lvaGetDesc(varNum);
assert(varDsc->lvOnFrame);
// We want to store this to the upper 8 bytes of this localVar's home.
Expand Down Expand Up @@ -4967,7 +4967,7 @@ void CodeGen::genSIMDIntrinsicUpperRestore(GenTreeSIMD* simdNode)
assert(emitTypeSize(op1->TypeGet()) == 16);
regNumber srcReg = simdNode->gtRegNum;
regNumber lclVarReg = genConsumeReg(op1);
unsigned varNum = op1->AsLclVarCommon()->gtLclNum;
unsigned varNum = op1->AsLclVarCommon()->GetLclNum();
assert(lclVarReg != REG_NA);
assert(srcReg != REG_NA);
if (simdNode->gtFlags & GTF_SPILLED)
Expand Down Expand Up @@ -5083,7 +5083,7 @@ void CodeGen::genStoreLclTypeSIMD12(GenTree* treeNode)
assert((treeNode->OperGet() == GT_STORE_LCL_FLD) || (treeNode->OperGet() == GT_STORE_LCL_VAR));

unsigned offs = 0;
unsigned varNum = treeNode->gtLclVarCommon.gtLclNum;
unsigned varNum = treeNode->gtLclVarCommon.GetLclNum();
assert(varNum < compiler->lvaCount);

if (treeNode->OperGet() == GT_STORE_LCL_FLD)
Expand Down
22 changes: 11 additions & 11 deletions src/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ void CodeGen::genPutArgSplit(GenTreePutArgSplit* treeNode)

if (varNode != nullptr)
{
srcVarNum = varNode->gtLclNum;
srcVarNum = varNode->GetLclNum();
assert(srcVarNum < compiler->lvaCount);

// handle promote situation
Expand Down Expand Up @@ -1340,7 +1340,7 @@ void CodeGen::genMultiRegCallStoreToLocal(GenTree* treeNode)
// Assumption: current implementation requires that a multi-reg
// var in 'var = call' is flagged as lvIsMultiRegRet to prevent it from
// being promoted.
unsigned lclNum = treeNode->AsLclVarCommon()->gtLclNum;
unsigned lclNum = treeNode->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = &(compiler->lvaTable[lclNum]);
noway_assert(varDsc->lvIsMultiRegRet);

Expand Down Expand Up @@ -1750,7 +1750,7 @@ void CodeGen::genCodeForLclFld(GenTreeLclFld* tree)

emitAttr size = emitTypeSize(targetType);
unsigned offs = tree->gtLclOffs;
unsigned varNum = tree->gtLclNum;
unsigned varNum = tree->GetLclNum();
assert(varNum < compiler->lvaCount);

emit->emitIns_R_S(ins_Load(targetType), emitActualTypeSize(targetType), targetReg, varNum, offs);
Expand Down Expand Up @@ -2106,7 +2106,7 @@ void CodeGen::genCodeForLoadOffset(instruction ins, emitAttr size, regNumber dst
{
if (base->gtOper == GT_LCL_FLD_ADDR)
offset += base->gtLclFld.gtLclOffs;
emit->emitIns_R_S(ins, size, dst, base->gtLclVarCommon.gtLclNum, offset);
emit->emitIns_R_S(ins, size, dst, base->gtLclVarCommon.GetLclNum(), offset);
}
else
{
Expand All @@ -2125,7 +2125,7 @@ void CodeGen::genCodeForStoreOffset(instruction ins, emitAttr size, regNumber sr
{
if (base->gtOper == GT_LCL_FLD_ADDR)
offset += base->gtLclFld.gtLclOffs;
emit->emitIns_S_R(ins, size, src, base->gtLclVarCommon.gtLclNum, offset);
emit->emitIns_S_R(ins, size, src, base->gtLclVarCommon.GetLclNum(), offset);
}
else
{
Expand Down Expand Up @@ -2233,7 +2233,7 @@ void CodeGen::genRegCopy(GenTree* treeNode)

if ((lcl->gtFlags & GTF_VAR_DEATH) == 0 && (treeNode->gtFlags & GTF_VAR_DEATH) == 0)
{
LclVarDsc* varDsc = &compiler->lvaTable[lcl->gtLclNum];
LclVarDsc* varDsc = &compiler->lvaTable[lcl->GetLclNum()];

// If we didn't just spill it (in genConsumeReg, above), then update the register info
if (varDsc->lvRegNum != REG_STK)
Expand All @@ -2247,11 +2247,11 @@ void CodeGen::genRegCopy(GenTree* treeNode)

#ifdef USING_VARIABLE_LIVE_RANGE
// Report the home change for this variable
varLiveKeeper->siUpdateVariableLiveRange(varDsc, lcl->gtLclNum);
varLiveKeeper->siUpdateVariableLiveRange(varDsc, lcl->GetLclNum())
#endif // USING_VARIABLE_LIVE_RANGE

// The new location is going live
genUpdateRegLife(varDsc, /*isBorn*/ true, /*isDying*/ false DEBUGARG(treeNode));
// The new location is going live
genUpdateRegLife(varDsc, /*isBorn*/ true, /*isDying*/ false DEBUGARG(treeNode));
}
}
}
Expand Down Expand Up @@ -3602,7 +3602,7 @@ void CodeGen::genStructReturn(GenTree* treeNode)
if (op1->OperGet() == GT_LCL_VAR)
{
GenTreeLclVarCommon* lclVar = op1->AsLclVarCommon();
LclVarDsc* varDsc = &(compiler->lvaTable[lclVar->gtLclNum]);
LclVarDsc* varDsc = &(compiler->lvaTable[lclVar->GetLclNum()]);
var_types lclType = genActualType(varDsc->TypeGet());

assert(varTypeIsStruct(lclType));
Expand All @@ -3627,7 +3627,7 @@ void CodeGen::genStructReturn(GenTree* treeNode)
{
var_types type = retTypeDesc.GetReturnRegType(i);
regNumber reg = retTypeDesc.GetABIReturnReg(i);
GetEmitter()->emitIns_R_S(ins_Load(type), emitTypeSize(type), reg, lclVar->gtLclNum, offset);
GetEmitter()->emitIns_R_S(ins_Load(type), emitTypeSize(type), reg, lclVar->GetLclNum(), offset);
offset += genTypeSize(type);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ regMaskTP CodeGenInterface::genGetRegMask(GenTree* tree)
assert(tree->gtOper == GT_LCL_VAR);

regMaskTP regMask = RBM_NONE;
const LclVarDsc* varDsc = compiler->lvaTable + tree->gtLclVarCommon.gtLclNum;
const LclVarDsc* varDsc = compiler->lvaTable + tree->gtLclVarCommon.GetLclNum();
if (varDsc->lvPromoted)
{
for (unsigned i = varDsc->lvFieldLclStart; i < varDsc->lvFieldLclStart + varDsc->lvFieldCnt; ++i)
Expand Down Expand Up @@ -1142,7 +1142,7 @@ unsigned CodeGenInterface::InferStructOpSizeAlign(GenTree* op, unsigned* alignme
}
else if (op->gtOper == GT_LCL_VAR)
{
unsigned varNum = op->gtLclVarCommon.gtLclNum;
unsigned varNum = op->gtLclVarCommon.GetLclNum();
LclVarDsc* varDsc = compiler->lvaTable + varNum;
assert(varDsc->lvType == TYP_STRUCT);
opSize = varDsc->lvSize();
Expand Down
Loading