Skip to content

Commit

Permalink
[JIT] Added BEGIN and END anchors for disasm output (#88782)
Browse files Browse the repository at this point in the history
* Added BEGIN and END anchors for disasm output

* Fixing build

* Feedback
  • Loading branch information
TIHan authored Jul 13, 2023
1 parent 62d6335 commit 36e32f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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)
{
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/tools/SuperFileCheck/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down

0 comments on commit 36e32f8

Please sign in to comment.