[JIT] Added BEGIN and END anchors for disasm output (#88782)
authorWill Smith <lol.tihan@gmail.com>
Thu, 13 Jul 2023 19:08:40 +0000 (12:08 -0700)
committerGitHub <noreply@github.com>
Thu, 13 Jul 2023 19:08:40 +0000 (12:08 -0700)
* Added BEGIN and END anchors for disasm output

* Fixing build

* Feedback

src/coreclr/jit/codegencommon.cpp
src/coreclr/tools/SuperFileCheck/Program.cs

index b25b8da..7509ddc 100644 (file)
@@ -1966,6 +1966,11 @@ void CodeGen::genEmitMachineCode()
     trackedStackPtrsContig = !compiler->opts.compDbgEnC;
 #endif
 
+    if (compiler->opts.disAsm)
+    {
+        printf("; BEGIN METHOD %s\n", compiler->eeGetMethodFullName(compiler->info.compMethodHnd));
+    }
+
     codeSize = GetEmitter()->emitEndCodeGen(compiler, trackedStackPtrsContig, GetInterruptible(),
                                             IsFullPtrRegMapRequired(), compiler->compHndBBtabCount, &prologSize,
                                             &epilogSize, codePtr, &coldCodePtr, &consPtr DEBUGARG(&instrCount));
@@ -1985,6 +1990,11 @@ void CodeGen::genEmitMachineCode()
         ((double)compiler->info.compTotalColdCodeSize * (double)PERFSCORE_CODESIZE_COST_COLD);
 #endif // DEBUG || LATE_DISASM
 
+    if (compiler->opts.disAsm)
+    {
+        printf("; END METHOD %s\n", compiler->eeGetMethodFullName(compiler->info.compMethodHnd));
+    }
+
 #ifdef DEBUG
     if (compiler->opts.disAsm || verbose)
     {
index 64203be..540f1df 100644 (file)
@@ -391,8 +391,8 @@ namespace SuperFileCheck
             var methodName = methodDeclInfo.FullyQualifiedName.Replace("*", "{{.*}}"); // Change wild-card to FileCheck wild-card syntax.
 
             // Create anchors from the first prefix.
-            var startAnchorText = $"// {checkPrefixes[0]}-LABEL: for method {methodName}";
-            var endAnchorText = $"// {checkPrefixes[0]}: for method {methodName}";
+            var beginAnchorText = $"// {checkPrefixes[0]}-LABEL: BEGIN METHOD {methodName}";
+            var endAnchorText = $"// {checkPrefixes[0]}: END METHOD {methodName}";
 
             // Create temp source file based on the source text of the method.
             // Newlines are added to pad the text so FileCheck's error messages will correspond
@@ -404,7 +404,7 @@ namespace SuperFileCheck
             {
                 tmpSrc.AppendLine(String.Empty);
             }
-            tmpSrc.AppendLine(startAnchorText);
+            tmpSrc.AppendLine(beginAnchorText);
             tmpSrc.AppendLine(TransformMethod(methodDecl, checkPrefixes));
             tmpSrc.AppendLine(endAnchorText);