@@ -235,6 +235,43 @@ class LocationInfoList final
235235 // from the useList being constructed. Note that, if the user knows the order of the operands,
236236 // it is expected that they should just retrieve them directly.
237237
238+ LocationInfoListNode* removeListNode (GenTree* node)
239+ {
240+ LocationInfoListNode* prevListNode = nullptr ;
241+ for (LocationInfoListNode *listNode = Begin (), *end = End (); listNode != end; listNode = listNode->Next ())
242+ {
243+ if (listNode->treeNode == node)
244+ {
245+ LocationInfoListNode* nextNode = listNode->Next ();
246+ if (prevListNode == nullptr )
247+ {
248+ m_head = nextNode;
249+ }
250+ else
251+ {
252+ prevListNode->m_next = nextNode;
253+ }
254+ if (nextNode == nullptr )
255+ {
256+ m_tail = prevListNode;
257+ }
258+ listNode->m_next = nullptr ;
259+ return listNode;
260+ }
261+ prevListNode = listNode;
262+ }
263+ assert (!" GetTreeNodeInfo didn't find the node" );
264+ unreached ();
265+ }
266+
267+ // ------------------------------------------------------------------------
268+ // GetTreeNodeInfo - retrieve the TreeNodeInfo for the given node
269+ //
270+ // Notes:
271+ // The TreeNodeInfoInit methods use this helper to retrieve the TreeNodeInfo for child nodes
272+ // from the useList being constructed. Note that, if the user knows the order of the operands,
273+ // it is expected that they should just retrieve them directly.
274+
238275 TreeNodeInfo& GetTreeNodeInfo (GenTree* node)
239276 {
240277 for (LocationInfoListNode *listNode = Begin (), *end = End (); listNode != end; listNode = listNode->Next ())
@@ -843,7 +880,7 @@ class LinearScan : public LinearScanInterface
843880 }
844881
845882 // Dump support
846- void dumpOperandToLocationInfoMap ();
883+ void dumpDefList ();
847884 void lsraDumpIntervals (const char * msg);
848885 void dumpRefPositions (const char * msg);
849886 void dumpVarRefPositions (const char * msg);
@@ -1445,30 +1482,28 @@ class LinearScan : public LinearScanInterface
14451482 // TreeNodeInfo methods
14461483 // -----------------------------------------------------------------------
14471484
1448- // The operandToLocationInfoMap is used for the transient TreeNodeInfo that is computed by
1485+ // The defList is used for the transient TreeNodeInfo that is computed by
14491486 // the TreeNodeInfoInit methods, and used in building RefPositions.
1450- typedef SmallHashTable<GenTree*, LocationInfoListNode*, 32 > OperandToLocationInfoMap;
1451- OperandToLocationInfoMap* operandToLocationInfoMap;
1487+ // When Def RefPositions are built for a node, their NodeInfo is placed
1488+ // in the defList. As the consuming node is handled, it moves the NodeInfo
1489+ // into an ordered useList corresponding to the uses for that node.
1490+ LocationInfoList defList;
14521491 // The useList is constructed for each node by the TreeNodeInfoInit methods.
14531492 // It contains the TreeNodeInfo for its operands, in their order of use.
14541493 LocationInfoList useList;
14551494
1456- // Get the LocationInfoListNode for the given node, and put it into the useList.
1495+ // Remove the LocationInfoListNode for the given node from the defList , and put it into the useList.
14571496 // The node must not be contained, and must have been processed by buildRefPositionsForNode().
14581497 void appendLocationInfoToList (GenTree* node)
14591498 {
1460- LocationInfoListNode* locationInfo;
1461- bool found = operandToLocationInfoMap->TryRemove (node, &locationInfo);
1462- assert (found);
1499+ LocationInfoListNode* locationInfo = defList.removeListNode (node);
14631500 useList.Append (locationInfo);
14641501 }
14651502 // Get the LocationInfoListNodes for the given node, and return it, but don't put it into the useList.
14661503 // The node must not be contained, and must have been processed by buildRefPositionsForNode().
14671504 LocationInfoListNode* getLocationInfo (GenTree* node)
14681505 {
1469- LocationInfoListNode* locationInfo;
1470- bool found = operandToLocationInfoMap->TryRemove (node, &locationInfo);
1471- assert (found);
1506+ LocationInfoListNode* locationInfo = defList.removeListNode (node);
14721507 return locationInfo;
14731508 }
14741509 // ------------------------------------------------------------------------
@@ -1483,7 +1518,7 @@ class LinearScan : public LinearScanInterface
14831518 //
14841519 // Notes:
14851520 // The operands must already have been processed by buildRefPositionsForNode, and their
1486- // LocationInfoListNodes placed in the operandToLocationInfoMap .
1521+ // LocationInfoListNodes placed in the defList .
14871522 //
14881523 int appendBinaryLocationInfoToList (GenTreeOp* node)
14891524 {
0 commit comments