Skip to content

Commit

Permalink
Remove more ASG terminlogy from the codebase (dotnet#86760)
Browse files Browse the repository at this point in the history
* Excise 'assignment' terminology from the codebase

* Standardize on the 'value' terminology for store operands

But only in the frontend; backend has lots of "data"s, and it did not seem purposeful renaming them.
  • Loading branch information
SingleAccretion authored and matouskozak committed Apr 30, 2024
1 parent e49b6b1 commit 75c85e9
Show file tree
Hide file tree
Showing 38 changed files with 398 additions and 404 deletions.
52 changes: 26 additions & 26 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3020,14 +3020,15 @@ class Compiler

GenTree* gtNewConWithPattern(var_types type, uint8_t pattern);

GenTreeLclVar* gtNewStoreLclVarNode(unsigned lclNum, GenTree* data);
GenTreeLclVar* gtNewStoreLclVarNode(unsigned lclNum, GenTree* value);

GenTreeLclFld* gtNewStoreLclFldNode(
unsigned lclNum, var_types type, ClassLayout* layout, unsigned offset, GenTree* data);
unsigned lclNum, var_types type, ClassLayout* layout, unsigned offset, GenTree* value);

GenTreeLclFld* gtNewStoreLclFldNode(unsigned lclNum, var_types type, unsigned offset, GenTree* data)
GenTreeLclFld* gtNewStoreLclFldNode(unsigned lclNum, var_types type, unsigned offset, GenTree* value)
{
return gtNewStoreLclFldNode(lclNum, type, (type == TYP_STRUCT) ? data->GetLayout(this) : nullptr, offset, data);
return gtNewStoreLclFldNode(
lclNum, type, (type == TYP_STRUCT) ? value->GetLayout(this) : nullptr, offset, value);
}

GenTree* gtNewPutArgReg(var_types type, GenTree* arg, regNumber argReg);
Expand Down Expand Up @@ -3382,7 +3383,7 @@ class Compiler

GenTreeMDArr* gtNewMDArrLowerBound(GenTree* arrayOp, unsigned dim, unsigned rank, BasicBlock* block);

void gtInitializeStoreNode(GenTree* store, GenTree* data);
void gtInitializeStoreNode(GenTree* store, GenTree* value);

void gtInitializeIndirNode(GenTreeIndir* indir, GenTreeFlags indirFlags);

Expand All @@ -3391,10 +3392,10 @@ class Compiler
GenTreeIndir* gtNewIndir(var_types typ, GenTree* addr, GenTreeFlags indirFlags = GTF_EMPTY);

GenTreeBlk* gtNewStoreBlkNode(
ClassLayout* layout, GenTree* addr, GenTree* data, GenTreeFlags indirFlags = GTF_EMPTY);
ClassLayout* layout, GenTree* addr, GenTree* value, GenTreeFlags indirFlags = GTF_EMPTY);

GenTreeStoreInd* gtNewStoreIndNode(
var_types type, GenTree* addr, GenTree* data, GenTreeFlags indirFlags = GTF_EMPTY);
var_types type, GenTree* addr, GenTree* value, GenTreeFlags indirFlags = GTF_EMPTY);

GenTree* gtNewLoadValueNode(
var_types type, ClassLayout* layout, GenTree* addr, GenTreeFlags indirFlags = GTF_EMPTY);
Expand All @@ -3410,16 +3411,17 @@ class Compiler
}

GenTree* gtNewStoreValueNode(
var_types type, ClassLayout* layout, GenTree* addr, GenTree* data, GenTreeFlags indirFlags = GTF_EMPTY);
var_types type, ClassLayout* layout, GenTree* addr, GenTree* value, GenTreeFlags indirFlags = GTF_EMPTY);

GenTree* gtNewStoreValueNode(ClassLayout* layout, GenTree* addr, GenTree* data, GenTreeFlags indirFlags = GTF_EMPTY)
GenTree* gtNewStoreValueNode(
ClassLayout* layout, GenTree* addr, GenTree* value, GenTreeFlags indirFlags = GTF_EMPTY)
{
return gtNewStoreValueNode(layout->GetType(), layout, addr, data, indirFlags);
return gtNewStoreValueNode(layout->GetType(), layout, addr, value, indirFlags);
}

GenTree* gtNewStoreValueNode(var_types type, GenTree* addr, GenTree* data, GenTreeFlags indirFlags = GTF_EMPTY)
GenTree* gtNewStoreValueNode(var_types type, GenTree* addr, GenTree* value, GenTreeFlags indirFlags = GTF_EMPTY)
{
return gtNewStoreValueNode(type, nullptr, addr, data, indirFlags);
return gtNewStoreValueNode(type, nullptr, addr, value, indirFlags);
}

GenTree* gtNewNullCheck(GenTree* addr, BasicBlock* basicBlock);
Expand All @@ -3442,7 +3444,7 @@ class Compiler
CORINFO_ACCESS_FLAGS access,
CORINFO_FIELD_INFO* pFieldInfo,
var_types lclTyp,
GenTree* assg);
GenTree* value);

GenTree* gtNewNothingNode();

Expand Down Expand Up @@ -4625,12 +4627,12 @@ class Compiler
void impAppendStmt(Statement* stmt);
void impInsertStmtBefore(Statement* stmt, Statement* stmtBefore);
Statement* impAppendTree(GenTree* tree, unsigned chkLevel, const DebugInfo& di, bool checkConsumedDebugInfo = true);
void impStoreTemp(unsigned lclNum,
GenTree* val,
unsigned curLevel,
Statement** pAfterStmt = nullptr,
const DebugInfo& di = DebugInfo(),
BasicBlock* block = nullptr);
void impStoreToTemp(unsigned lclNum,
GenTree* val,
unsigned curLevel,
Statement** pAfterStmt = nullptr,
const DebugInfo& di = DebugInfo(),
BasicBlock* block = nullptr);
Statement* impExtractLastStmt();
GenTree* impCloneExpr(GenTree* tree,
GenTree** clone,
Expand Down Expand Up @@ -5637,8 +5639,6 @@ class Compiler
void fgUpdateConstTreeValueNumber(GenTree* tree);

// Assumes that all inputs to "tree" have had value numbers assigned; assigns a VN to tree.
// (With some exceptions: the VN of the lhs of an assignment is assigned as part of the
// assignment.)
void fgValueNumberTree(GenTree* tree);

void fgValueNumberStore(GenTree* tree);
Expand Down Expand Up @@ -6332,7 +6332,7 @@ class Compiler
// Create a new temporary variable to hold the result of *ppTree,
// and transform the graph accordingly.
GenTree* fgInsertCommaFormTemp(GenTree** ppTree);
TempInfo fgMakeTemp(GenTree* rhs);
TempInfo fgMakeTemp(GenTree* value);
GenTree* fgMakeMultiUse(GenTree** ppTree);

// Recognize a bitwise rotation pattern and convert into a GT_ROL or a GT_ROR node.
Expand Down Expand Up @@ -6429,7 +6429,7 @@ class Compiler
bool fgMorphCombineSIMDFieldStores(BasicBlock* block, Statement* stmt);
void impMarkContiguousSIMDFieldStores(Statement* stmt);

// fgPreviousCandidateSIMDFieldStoreStmt is only used for tracking previous simd field assignment
// fgPreviousCandidateSIMDFieldStoreStmt is only used for tracking previous simd field store
// in function: Compiler::impMarkContiguousSIMDFieldStores.
Statement* fgPreviousCandidateSIMDFieldStoreStmt;

Expand Down Expand Up @@ -6557,7 +6557,7 @@ class Compiler

//----------------------- Liveness analysis -------------------------------

VARSET_TP fgCurUseSet; // vars used by block (before an assignment)
VARSET_TP fgCurUseSet; // vars used by block (before a def)
VARSET_TP fgCurDefSet; // vars assigned by block (before a use)

MemoryKindSet fgCurMemoryUse; // True iff the current basic block uses memory.
Expand Down Expand Up @@ -7551,7 +7551,7 @@ class Compiler
} op1;
struct AssertionDscOp2
{
optOp2Kind kind; // a const or copy assignment
optOp2Kind kind; // a const or copy assertion
private:
uint16_t m_encodedIconFlags; // encoded icon gtFlags, don't use directly
public:
Expand Down Expand Up @@ -7770,7 +7770,7 @@ class Compiler
AssertionIndex* optComplementaryAssertionMap;
JitExpandArray<ASSERT_TP>* optAssertionDep; // table that holds dependent assertions (assertions
// using the value of a local var) for each local var
AssertionDsc* optAssertionTabPrivate; // table that holds info about value assignments
AssertionDsc* optAssertionTabPrivate; // table that holds info about assertions
AssertionIndex optAssertionCount; // total number of assertions in the assertion table
AssertionIndex optMaxAssertionCount;
bool optCrossBlockLocalAssertionProp;
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3548,8 +3548,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

/*****************************************************************************
*
* The following resets the value assignment table
* used only during local assertion prop
* The following resets the assertions table used only during local assertion prop
*/

inline void Compiler::optAssertionReset(AssertionIndex limit)
Expand Down Expand Up @@ -3602,7 +3601,7 @@ inline void Compiler::optAssertionReset(AssertionIndex limit)

/*****************************************************************************
*
* The following removes the i-th entry in the value assignment table
* The following removes the i-th entry in the assertions table
* used only during local assertion prop
*/

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/copyprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ void Compiler::optCopyPropPushDef(GenTree* defNode, GenTreeLclVarCommon* lclNode
{
unsigned lclNum = lclNode->GetLclNum();

// Shadowed parameters are special: they will (at most) have one use, that is one on the RHS of an
// assignment to their shadow, and we must not substitute them anywhere. So we'll not push any defs.
// Shadowed parameters are special: they will (at most) have one use, as values in a store
// to their shadow, and we must not substitute them anywhere. So we'll not push any defs.
if ((gsShadowVarInfo != nullptr) && lvaGetDesc(lclNum)->lvIsParam &&
(gsShadowVarInfo[lclNum].shadowCopy != BAD_VAR_NUM))
{
Expand Down
15 changes: 8 additions & 7 deletions src/coreclr/jit/earlyprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,21 +371,22 @@ GenTree* Compiler::optPropGetValueRec(unsigned lclNum, unsigned ssaNum, optPropK
{
assert(ssaDefStore->OperIsLocalStore());

GenTree* data = ssaDefStore->Data();
GenTree* defValue = ssaDefStore->Data();

// Recursively track the Rhs for "entire" stores.
if (ssaDefStore->OperIs(GT_STORE_LCL_VAR) && (ssaDefStore->GetLclNum() == lclNum) && data->OperIs(GT_LCL_VAR))
// Recursively track the value for "entire" stores.
if (ssaDefStore->OperIs(GT_STORE_LCL_VAR) && (ssaDefStore->GetLclNum() == lclNum) &&
defValue->OperIs(GT_LCL_VAR))
{
unsigned dataLclNum = data->AsLclVarCommon()->GetLclNum();
unsigned dataSsaNum = data->AsLclVarCommon()->GetSsaNum();
unsigned defValueLclNum = defValue->AsLclVar()->GetLclNum();
unsigned defValueSsaNum = defValue->AsLclVar()->GetSsaNum();

value = optPropGetValueRec(dataLclNum, dataSsaNum, valueKind, walkDepth + 1);
value = optPropGetValueRec(defValueLclNum, defValueSsaNum, valueKind, walkDepth + 1);
}
else
{
if (valueKind == optPropKind::OPK_ARRAYLEN)
{
value = getArrayLengthFromAllocation(data DEBUGARG(ssaVarDsc->GetBlock()));
value = getArrayLengthFromAllocation(defValue DEBUGARG(ssaVarDsc->GetBlock()));
if (value != nullptr)
{
if (!value->IsCnsIntOrI())
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/fginline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class SubstitutePlaceholdersAndDevirtualizeWalker : public GenTreeVisitor<Substi
GenTree* dst = store;
GenTree* inlinee = store->Data();

// We need to force all assignments from multi-reg nodes into the "lcl = node()" form.
// We need to force all stores from multi-reg nodes into the "lcl = node()" form.
if (inlinee->IsMultiRegNode())
{
// Special case: we already have a local, the only thing to do is mark it appropriately. Except
Expand Down Expand Up @@ -607,7 +607,7 @@ class SubstitutePlaceholdersAndDevirtualizeWalker : public GenTreeVisitor<Substi
//
if (value->OperIs(GT_LCL_VAR) && (value->AsLclVar()->GetLclNum() == lclNum))
{
JITDUMP("... removing self-assignment\n");
JITDUMP("... removing self-store\n");
DISPTREE(tree);
tree->gtBashToNOP();
m_madeChanges = true;
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/jit/fgopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2092,7 +2092,7 @@ bool Compiler::fgBlockEndFavorsTailDuplication(BasicBlock* block, unsigned lclNu
}

// Tail duplication tends to pay off when the last statement
// is an assignment of a constant, arraylength, or a relop.
// is a local store of a constant, arraylength, or a relop.
// This is because these statements produce information about values
// that would otherwise be lost at the upcoming merge point.
//
Expand All @@ -2108,8 +2108,8 @@ bool Compiler::fgBlockEndFavorsTailDuplication(BasicBlock* block, unsigned lclNu
GenTree* const tree = stmt->GetRootNode();
if (tree->OperIsLocalStore() && !tree->OperIsBlkOp() && (tree->AsLclVarCommon()->GetLclNum() == lclNum))
{
GenTree* const data = tree->Data();
if (data->OperIsArrLength() || data->OperIsConst() || data->OperIsCompare())
GenTree* const value = tree->Data();
if (value->OperIsArrLength() || value->OperIsConst() || value->OperIsCompare())
{
return true;
}
Expand Down Expand Up @@ -2158,7 +2158,7 @@ bool Compiler::fgBlockIsGoodTailDuplicationCandidate(BasicBlock* target, unsigne
// ultimately feeds a simple conditional branch.
//
// These blocks are small, and when duplicated onto the tail of blocks that end in
// assignments, there is a high probability of the branch completely going away.
// local stores, there is a high probability of the branch completely going away.
//
// This is by no means the only kind of tail that it is beneficial to duplicate,
// just the only one we recognize for now.
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/jit/fgstmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ bool Compiler::fgBlockContainsStatementBounded(BasicBlock* block,
// stmt - the statement to be inserted.
//
// Notes:
// We always insert phi statements at the beginning.
// In other cases, if there are any phi assignments and/or an assignment of
// the GT_CATCH_ARG, we insert after those.
// We always insert phi statements at the beginning. In other cases, if
// there are any phi stores and/or a store of the GT_CATCH_ARG, we insert
// after those.
//
void Compiler::fgInsertStmtAtBeg(BasicBlock* block, Statement* stmt)
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/gcinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ GCInfo::WriteBarrierForm GCInfo::gcIsWriteBarrierCandidate(GenTreeStoreInd* stor
}

// Ignore any assignments of NULL or nongc object
GenTree* const data = store->Data()->gtSkipReloadOrCopy();
if (data->IsIntegralConst(0) || data->IsIconHandle(GTF_ICON_OBJ_HDL))
GenTree* const value = store->Data()->gtSkipReloadOrCopy();
if (value->IsIntegralConst(0) || value->IsIconHandle(GTF_ICON_OBJ_HDL))
{
return WBF_NoBarrier;
}
Expand Down
Loading

0 comments on commit 75c85e9

Please sign in to comment.