From 3f042ad92cdf5f20eb8f53cf172dca28e2b9e05a Mon Sep 17 00:00:00 2001 From: TIHan Date: Wed, 12 Jul 2023 12:49:16 -0700 Subject: [PATCH 1/3] Added BEGIN and END anchors for disasm output --- 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 b25b8da4b606cd..0fc90a1aadad6a 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 ANCHOR %s\n", compiler->info.compFullName); + } + 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 ANCHOR %s\n", compiler->info.compFullName); + } + #ifdef DEBUG if (compiler->opts.disAsm || verbose) { diff --git a/src/coreclr/tools/SuperFileCheck/Program.cs b/src/coreclr/tools/SuperFileCheck/Program.cs index 64203bedcf3e0e..e1a964f2a32da5 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 ANCHOR {methodName}"; + var endAnchorText = $"// {checkPrefixes[0]}: END METHOD ANCHOR {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); From c894491493a1a1e74730af2b825a2f883c512bed Mon Sep 17 00:00:00 2001 From: TIHan Date: Wed, 12 Jul 2023 14:36:58 -0700 Subject: [PATCH 2/3] Fixing build --- src/coreclr/jit/codegencommon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp index 0fc90a1aadad6a..3457b5b2dc31d6 100644 --- a/src/coreclr/jit/codegencommon.cpp +++ b/src/coreclr/jit/codegencommon.cpp @@ -1968,7 +1968,7 @@ void CodeGen::genEmitMachineCode() if (compiler->opts.disAsm) { - printf("; BEGIN METHOD ANCHOR %s\n", compiler->info.compFullName); + printf("; BEGIN METHOD ANCHOR %s\n", compiler->eeGetMethodFullName(compiler->info.compMethodHnd)); } codeSize = GetEmitter()->emitEndCodeGen(compiler, trackedStackPtrsContig, GetInterruptible(), @@ -1992,7 +1992,7 @@ void CodeGen::genEmitMachineCode() if (compiler->opts.disAsm) { - printf("; END METHOD ANCHOR %s\n", compiler->info.compFullName); + printf("; END METHOD ANCHOR %s\n", compiler->eeGetMethodFullName(compiler->info.compMethodHnd)); } #ifdef DEBUG From 0405d847229174aaf1e42b61dfd178526149c599 Mon Sep 17 00:00:00 2001 From: TIHan Date: Thu, 13 Jul 2023 11:07:40 -0700 Subject: [PATCH 3/3] Feedback --- src/coreclr/jit/codegencommon.cpp | 4 ++-- src/coreclr/tools/SuperFileCheck/Program.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp index 3457b5b2dc31d6..7509ddc74f2f9f 100644 --- a/src/coreclr/jit/codegencommon.cpp +++ b/src/coreclr/jit/codegencommon.cpp @@ -1968,7 +1968,7 @@ void CodeGen::genEmitMachineCode() if (compiler->opts.disAsm) { - printf("; BEGIN METHOD ANCHOR %s\n", compiler->eeGetMethodFullName(compiler->info.compMethodHnd)); + printf("; BEGIN METHOD %s\n", compiler->eeGetMethodFullName(compiler->info.compMethodHnd)); } codeSize = GetEmitter()->emitEndCodeGen(compiler, trackedStackPtrsContig, GetInterruptible(), @@ -1992,7 +1992,7 @@ void CodeGen::genEmitMachineCode() if (compiler->opts.disAsm) { - printf("; END METHOD ANCHOR %s\n", compiler->eeGetMethodFullName(compiler->info.compMethodHnd)); + printf("; END METHOD %s\n", compiler->eeGetMethodFullName(compiler->info.compMethodHnd)); } #ifdef DEBUG diff --git a/src/coreclr/tools/SuperFileCheck/Program.cs b/src/coreclr/tools/SuperFileCheck/Program.cs index e1a964f2a32da5..540f1df989d8aa 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 beginAnchorText = $"// {checkPrefixes[0]}-LABEL: BEGIN METHOD ANCHOR {methodName}"; - var endAnchorText = $"// {checkPrefixes[0]}: END METHOD ANCHOR {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