[RyuJIT/ARM32] Fix register allocation for split GT_FIELD_LIST struct
authorHyeongseok Oh <hseok82.oh@samsung.com>
Mon, 10 Jul 2017 10:29:16 +0000 (19:29 +0900)
committerHyeongseok Oh <hseok82.oh@samsung.com>
Mon, 10 Jul 2017 10:29:16 +0000 (19:29 +0900)
To fix register allocation for split GT_FIELD_LIST struct,
set source register for each node of GT_FIELD_LIST

src/jit/lsraarmarch.cpp

index 7080614..a42ef4b 100644 (file)
@@ -824,6 +824,18 @@ void Lowering::TreeNodeInfoInitPutArgSplit(GenTreePutArgSplit* argNode, TreeNode
         //
         argNode->gtLsraInfo.srcCount = argInfo->numRegs + argInfo->numSlots;
 
+        // To avoid redundant moves, have the argument operand computed in the
+        // register in which the argument is passed to the call.
+        GenTreeFieldList* fieldListPtr = putArgChild->AsFieldList();
+        for (unsigned idx = 0; fieldListPtr != nullptr; fieldListPtr = fieldListPtr->Rest(), idx++)
+        {
+            if (idx < argInfo->numRegs)
+            {
+                GenTreePtr node = fieldListPtr->gtGetOp1();
+                node->gtLsraInfo.setSrcCandidates(m_lsra, genRegMask((regNumber)((unsigned)argReg + idx)));
+            }
+        }
+
         putArgChild->SetContained();
     }
     else