[RyuJIT/armel] Introduce GetRegCount() for MultiRegOp
authorHanjoung Lee <hanjoung.lee@samsung.com>
Thu, 10 Aug 2017 06:35:38 +0000 (15:35 +0900)
committerHanjoung Lee <hanjoung.lee@samsung.com>
Thu, 10 Aug 2017 06:40:11 +0000 (15:40 +0900)
Abstract getting reg count with method GetRegCount()
Added the case when the reg count is 0.

Commit migrated from https://github.com/dotnet/coreclr/commit/7c3b04a5ef20104e842135ac59ec11309123147e

src/coreclr/src/jit/codegenlinear.cpp
src/coreclr/src/jit/gentree.h

index dfe0458..eb49edb 100644 (file)
@@ -1037,7 +1037,7 @@ void CodeGen::genUnspillRegIfNeeded(GenTree* tree)
         else if (unspillTree->OperIsMultiRegOp())
         {
             GenTreeMultiRegOp* multiReg = unspillTree->AsMultiRegOp();
-            unsigned           regCount = multiReg->gtOtherReg == REG_NA ? 1 : 2;
+            unsigned           regCount = multiReg->GetRegCount();
 
             // In case of split struct argument node, GTF_SPILLED flag on it indicates that
             // one or more of its result regs are spilled.  Call node needs to be
@@ -1685,7 +1685,7 @@ void CodeGen::genProduceReg(GenTree* tree)
             else if (tree->OperIsMultiRegOp())
             {
                 GenTreeMultiRegOp* multiReg = tree->AsMultiRegOp();
-                unsigned           regCount = multiReg->gtOtherReg == REG_NA ? 1 : 2;
+                unsigned           regCount = multiReg->GetRegCount();
 
                 for (unsigned i = 0; i < regCount; ++i)
                 {
index 54545aa..fb447f5 100644 (file)
@@ -3921,6 +3921,15 @@ struct GenTreeMultiRegOp : public GenTreeOp
         ClearOtherRegFlags();
     }
 
+    unsigned GetRegCount() const
+    {
+        if (gtRegNum == REG_NA || gtRegNum == REG_STK)
+        {
+            return 0;
+        }
+        return (gtOtherReg == REG_NA || gtOtherReg == REG_STK) ? 1 : 2;
+    }
+
     //---------------------------------------------------------------------------
     // GetRegNumByIdx: get ith register allocated to this struct argument.
     //