Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Forstall <brucefo@microsoft.com>2021-06-17 01:50:31 +0300
committerGitHub <noreply@github.com>2021-06-17 01:50:31 +0300
commita02b668214e9711cb3d5f426f085601698a24b92 (patch)
treebcc7dfa547bec37b597d48edf4df96a07d75783e /src/coreclr/jit
parentafcbd8c897b42941cb7a55182116380475b4f746 (diff)
Improve live variable JitDump output (#54256)
The variable live range output is unnecessarily verbose. Simplify it; clean it up; make it smaller; use standard dumpers. Example, before: ``` //////////////////////////////////////// //////////////////////////////////////// Variable Live Range History Dump for Block 2 IL Var Num 0: [rcx [ (G_M13669_IG02,ins#0,ofs#0), (G_M13669_IG03,ins#1,ofs#2) ]; rbp[16] (1 slot) [ (G_M13669_IG03,ins#1,ofs#2), NON_CLOSED_RANGE ]; ] IL Var Num 1: [rsi [ (G_M13669_IG03,ins#1,ofs#2), NON_CLOSED_RANGE ]; ] //////////////////////////////////////// //////////////////////////////////////// End Generating code for Block 2 ``` After: ``` Variable Live Range History Dump for BB02 V00 this: rcx [(G_M13669_IG02,ins#0,ofs#0), (G_M13669_IG03,ins#1,ofs#2)]; rbp[16] (1 slot) [(G_M13669_IG03,ins#1,ofs#2), ...] V01 loc0: rsi [(G_M13669_IG03,ins#1,ofs#2), ...] ``` And the end-of-dump output, before: ``` //////////////////////////////////////// //////////////////////////////////////// PRINTING VARIABLE LIVE RANGES: IL Var Num 0: [rsi [18 , B5 )rsi [100 , 13A )rsi [14D , 186 )rsi [196 , 1C5 )rsi [1E3 , 271 )rsi [280 , 285 )] IL Var Num 1: [rdi [18 , B9 )rdi [100 , 137 )rdi [14D , 184 )rdi [196 , 1C2 )rdi [1E3 , 271 )rdi [280 , 288 )] IL Var Num 2: [rbx [18 , CA )rbx [100 , 10D )rbx [14D , 15A )rbx [196 , 1C7 )rbx [1E3 , 271 )rbx [280 , 28B )] IL Var Num 3: [rbp [3A , F0 )rbp [100 , 141 )rbp [14D , 18C )rbp [196 , 1D6 )rbp [1E3 , 275 )] IL Var Num 4: [r14 [3E , EC )r14 [100 , 13D )r14 [14D , 188 )r14 [196 , 1D2 )r14 [1E3 , 271 )] IL Var Num 5: [rcx [22A , 263 )] //////////////////////////////////////// //////////////////////////////////////// ``` After: ``` VARIABLE LIVE RANGES: V00 arg0: rsi [18, B5); rsi [100, 13A); rsi [14D, 186); rsi [196, 1C5); rsi [1E3, 271); rsi [280, 285) V01 arg1: rdi [18, B9); rdi [100, 137); rdi [14D, 184); rdi [196, 1C2); rdi [1E3, 271); rdi [280, 288) V02 arg2: rbx [18, CA); rbx [100, 10D); rbx [14D, 15A); rbx [196, 1C7); rbx [1E3, 271); rbx [280, 28B) V03 loc0: rbp [3A, F0); rbp [100, 141); rbp [14D, 18C); rbp [196, 1D6); rbp [1E3, 275) V04 loc1: r14 [3E, EC); r14 [100, 13D); r14 [14D, 188); r14 [196, 1D2); r14 [1E3, 271) V05 loc2: rcx [22A, 263) ```
Diffstat (limited to 'src/coreclr/jit')
-rw-r--r--src/coreclr/jit/codegencommon.cpp109
1 files changed, 51 insertions, 58 deletions
diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp
index b6ed8c9ea99..f977ddfe6f3 100644
--- a/src/coreclr/jit/codegencommon.cpp
+++ b/src/coreclr/jit/codegencommon.cpp
@@ -11700,7 +11700,8 @@ void CodeGenInterface::VariableLiveKeeper::VariableLiveRange::dumpVariableLiveRa
const CodeGenInterface* codeGen) const
{
codeGen->dumpSiVarLoc(&m_VarLocation);
- printf(" [ ");
+
+ printf(" [");
m_StartEmitLocation.Print(codeGen->GetCompiler()->compMethodID);
printf(", ");
if (m_EndEmitLocation.Valid())
@@ -11709,9 +11710,9 @@ void CodeGenInterface::VariableLiveKeeper::VariableLiveRange::dumpVariableLiveRa
}
else
{
- printf("NON_CLOSED_RANGE");
+ printf("...");
}
- printf(" ]; ");
+ printf("]");
}
// Dump "VariableLiveRange" when code has been generated and we have the assembly native offset of each "emitLocation"
@@ -11727,7 +11728,7 @@ void CodeGenInterface::VariableLiveKeeper::VariableLiveRange::dumpVariableLiveRa
// If this is an open "VariableLiveRange", "m_EndEmitLocation" is non-valid and print -1
UNATIVE_OFFSET endAssemblyOffset = m_EndEmitLocation.Valid() ? m_EndEmitLocation.CodeOffset(emit) : -1;
- printf(" [%X , %X )", m_StartEmitLocation.CodeOffset(emit), m_EndEmitLocation.CodeOffset(emit));
+ printf(" [%X, %X)", m_StartEmitLocation.CodeOffset(emit), m_EndEmitLocation.CodeOffset(emit));
}
//------------------------------------------------------------------------
@@ -11971,25 +11972,31 @@ void CodeGenInterface::VariableLiveKeeper::VariableLiveDescriptor::updateLiveRan
void CodeGenInterface::VariableLiveKeeper::VariableLiveDescriptor::dumpAllRegisterLiveRangesForBlock(
emitter* emit, const CodeGenInterface* codeGen) const
{
- printf("[");
+ bool first = true;
for (LiveRangeListIterator it = m_VariableLiveRanges->begin(); it != m_VariableLiveRanges->end(); it++)
{
+ if (!first)
+ {
+ printf("; ");
+ }
it->dumpVariableLiveRange(emit, codeGen);
+ first = false;
}
- printf("]\n");
}
void CodeGenInterface::VariableLiveKeeper::VariableLiveDescriptor::dumpRegisterLiveRangesForBlockBeforeCodeGenerated(
const CodeGenInterface* codeGen) const
{
- noway_assert(codeGen != nullptr);
-
- printf("[");
+ bool first = true;
for (LiveRangeListIterator it = m_VariableLifeBarrier->getStartForDump(); it != m_VariableLiveRanges->end(); it++)
{
+ if (!first)
+ {
+ printf("; ");
+ }
it->dumpVariableLiveRange(codeGen);
+ first = false;
}
- printf("]\n");
}
// Returns true if a live range for this variable has been recorded
@@ -12428,41 +12435,33 @@ void CodeGenInterface::VariableLiveKeeper::psiClosePrologVariableRanges()
#ifdef DEBUG
void CodeGenInterface::VariableLiveKeeper::dumpBlockVariableLiveRanges(const BasicBlock* block)
{
- // "block" will be dereferenced
- noway_assert(block != nullptr);
+ assert(block != nullptr);
bool hasDumpedHistory = false;
- if (m_Compiler->verbose)
- {
- printf("////////////////////////////////////////\n");
- printf("////////////////////////////////////////\n");
- printf("Variable Live Range History Dump for Block %d \n", block->bbNum);
+ printf("\nVariable Live Range History Dump for " FMT_BB "\n", block->bbNum);
- if (m_Compiler->opts.compDbgInfo)
+ if (m_Compiler->opts.compDbgInfo)
+ {
+ for (unsigned int varNum = 0; varNum < m_LiveDscCount; varNum++)
{
- for (unsigned int varNum = 0; varNum < m_LiveDscCount; varNum++)
- {
- VariableLiveDescriptor* varLiveDsc = m_vlrLiveDsc + varNum;
+ VariableLiveDescriptor* varLiveDsc = m_vlrLiveDsc + varNum;
- if (varLiveDsc->hasVarLiveRangesFromLastBlockToDump())
- {
- hasDumpedHistory = true;
- printf("IL Var Num %d:\n", m_Compiler->compMap2ILvarNum(varNum));
- varLiveDsc->dumpRegisterLiveRangesForBlockBeforeCodeGenerated(m_Compiler->codeGen);
- varLiveDsc->endBlockLiveRanges();
- }
+ if (varLiveDsc->hasVarLiveRangesFromLastBlockToDump())
+ {
+ hasDumpedHistory = true;
+ m_Compiler->gtDispLclVar(varNum, false);
+ printf(": ");
+ varLiveDsc->dumpRegisterLiveRangesForBlockBeforeCodeGenerated(m_Compiler->codeGen);
+ varLiveDsc->endBlockLiveRanges();
+ printf("\n");
}
}
+ }
- if (!hasDumpedHistory)
- {
- printf("..None..\n");
- }
-
- printf("////////////////////////////////////////\n");
- printf("////////////////////////////////////////\n");
- printf("End Generating code for Block %d \n", block->bbNum);
+ if (!hasDumpedHistory)
+ {
+ printf("..None..\n");
}
}
@@ -12470,34 +12469,28 @@ void CodeGenInterface::VariableLiveKeeper::dumpLvaVariableLiveRanges() const
{
bool hasDumpedHistory = false;
- if (m_Compiler->verbose)
- {
- printf("////////////////////////////////////////\n");
- printf("////////////////////////////////////////\n");
- printf("PRINTING VARIABLE LIVE RANGES:\n");
+ printf("VARIABLE LIVE RANGES:\n");
- if (m_Compiler->opts.compDbgInfo)
+ if (m_Compiler->opts.compDbgInfo)
+ {
+ for (unsigned int varNum = 0; varNum < m_LiveDscCount; varNum++)
{
- for (unsigned int varNum = 0; varNum < m_LiveDscCount; varNum++)
- {
- VariableLiveDescriptor* varLiveDsc = m_vlrLiveDsc + varNum;
+ VariableLiveDescriptor* varLiveDsc = m_vlrLiveDsc + varNum;
- if (varLiveDsc->hasVarLiveRangesToDump())
- {
- hasDumpedHistory = true;
- printf("IL Var Num %d:\n", m_Compiler->compMap2ILvarNum(varNum));
- varLiveDsc->dumpAllRegisterLiveRangesForBlock(m_Compiler->GetEmitter(), m_Compiler->codeGen);
- }
+ if (varLiveDsc->hasVarLiveRangesToDump())
+ {
+ hasDumpedHistory = true;
+ m_Compiler->gtDispLclVar(varNum, false);
+ printf(": ");
+ varLiveDsc->dumpAllRegisterLiveRangesForBlock(m_Compiler->GetEmitter(), m_Compiler->codeGen);
+ printf("\n");
}
}
+ }
- if (!hasDumpedHistory)
- {
- printf("..None..\n");
- }
-
- printf("////////////////////////////////////////\n");
- printf("////////////////////////////////////////\n");
+ if (!hasDumpedHistory)
+ {
+ printf("..None..\n");
}
}
#endif // DEBUG