From 36e32f83aac67edcd89c0c384317fb2d5a885e62 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 13 Jul 2023 12:08:40 -0700 Subject: [PATCH] [JIT] Added BEGIN and END anchors for disasm output (#88782) * Added BEGIN and END anchors for disasm output * Fixing build * Feedback --- src/coreclr/jit/codegencommon.cpp | 10 ++++++++++ src/coreclr/tools/SuperFileCheck/Program.cs | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp index b25b8da4b606c..7509ddc74f2f9 100644 --- a/src/coreclr/jit/codegencommon.cpp +++ b/src/coreclr/jit/codegencommon.cpp @@ -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) { diff --git a/src/coreclr/tools/SuperFileCheck/Program.cs b/src/coreclr/tools/SuperFileCheck/Program.cs index 64203bedcf3e0..540f1df989d8a 100644 --- a/src/coreclr/tools/SuperFileCheck/Program.cs +++ b/src/coreclr/tools/SuperFileCheck/Program.cs @@ -391,8 +391,8 @@ static string PreProcessMethod(MethodDeclarationInfo methodDeclInfo, string[] ch 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 @@ static string PreProcessMethod(MethodDeclarationInfo methodDeclInfo, string[] ch { tmpSrc.AppendLine(String.Empty); } - tmpSrc.AppendLine(startAnchorText); + tmpSrc.AppendLine(beginAnchorText); tmpSrc.AppendLine(TransformMethod(methodDecl, checkPrefixes)); tmpSrc.AppendLine(endAnchorText);