Stringify RMWStatus for the dump (#53148)
authorSingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
Mon, 24 May 2021 16:59:01 +0000 (19:59 +0300)
committerGitHub <noreply@github.com>
Mon, 24 May 2021 16:59:01 +0000 (09:59 -0700)
* Stringify RMWStatus for the dump

* Use a simpler switch-based implementation

* Made the string into a description

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

index 856fe78..669a798 100644 (file)
@@ -5798,6 +5798,31 @@ enum RMWStatus
     STOREIND_RMW_INDIR_UNEQUAL     // Indir to read value is not equivalent to indir that writes the value
 };
 
+#ifdef DEBUG
+inline const char* RMWStatusDescription(RMWStatus status)
+{
+    switch (status)
+    {
+        case STOREIND_RMW_STATUS_UNKNOWN:
+            return "RMW status unknown";
+        case STOREIND_RMW_DST_IS_OP1:
+            return "dst candidate is op1";
+        case STOREIND_RMW_DST_IS_OP2:
+            return "dst candidate is op2";
+        case STOREIND_RMW_UNSUPPORTED_ADDR:
+            return "address mode is not supported";
+        case STOREIND_RMW_UNSUPPORTED_OPER:
+            return "oper is not supported";
+        case STOREIND_RMW_UNSUPPORTED_TYPE:
+            return "type is not supported";
+        case STOREIND_RMW_INDIR_UNEQUAL:
+            return "read indir is not equivalent to write indir";
+        default:
+            unreached();
+    }
+}
+#endif
+
 // StoreInd is just a BinOp, with additional RMW status
 struct GenTreeStoreInd : public GenTreeIndir
 {
index 4dfce51..09cd7c0 100644 (file)
@@ -5074,8 +5074,8 @@ bool Lowering::LowerRMWMemOp(GenTreeIndir* storeInd)
 
     if (!IsRMWMemOpRootedAtStoreInd(storeInd, &indirCandidate, &indirOpSource))
     {
-        JITDUMP("Lower of StoreInd didn't mark the node as self contained for reason: %d\n",
-                storeInd->AsStoreInd()->GetRMWStatus());
+        JITDUMP("Lower of StoreInd didn't mark the node as self contained for reason: %s\n",
+                RMWStatusDescription(storeInd->AsStoreInd()->GetRMWStatus()));
         DISPTREERANGE(BlockRange(), storeInd);
         return false;
     }