-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
1. Use the LIR node dumper to display nodes to be generated by codegen, since we're in LIR form at that point. Add a new "prefix message" argument to allow "Generating: " to prefix all such lines. 2. Fix off-by-one error in LIR dump due to `#ifdef` versus `#if`. 3. Remove extra trailing line for each LIR node. This interfered with #1. But I always thought it was unnecessarily verbose; I don't believe there is any ambiguity without that extra space. 4. Add dTreeLIR()/cTreeLIR() functions for use in the debugger.
@dotnet/jit-contrib PTAL |
@@ -501,11 +501,13 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode) | |||
|
|||
#ifdef DEBUG | |||
lastConsumedNode = nullptr; | |||
if (compiler->verbose) | |||
{ | |||
unsigned seqNum = treeNode->gtSeqNum; // Useful for setting a conditional break in Visual Studio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you not set a breakpoint on treeNode->gtSeqNum
itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it. I just copy-and-pasted that from the other codegen files. Since it doesn't hurt, it made sense to keep it the same.
src/jit/gentree.cpp
Outdated
assert(operand != nullptr); | ||
assert(message != nullptr); | ||
|
||
if (prefixMsg != nullptr) | ||
{ | ||
printf("%s", prefixMsg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: you could capture the length of prefixMsg
and use it to adjust the alignment below. I'd be interested to see how the codegen dumps looked in both cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that the prefixMsg is output for both the operand (here), and the operator (below), and the operator doesn't have any leading space. And, I want the operator and operands to be indented by the same amount, when a prefixMsg is given.
Here's an example from codegen:
Generating: N037 ( 1, 4) [000034] ------------ t34 = const(h) int 0x8B6604 ftn REG NA
Generating: /--* t34 int
Generating: N039 ( 3, 6) [000035] ------------ t35 = * indir int REG NA
Generating: /--* t35 int control expr
Generating: N041 ( 69, 33) [000008] --C-G------- * call void System.Console.WriteLine $VN.Void
A "full dump" looks like:
/--* t32 int control expr
N029 ( 45, 22) [000005] --C-G------- t5 = * call float Program.f2 $c3
/--* t5 float
N031 ( 49, 25) [000021] DAC-G-----L- * st.lclVar float V02 tmp1 d:2 REG NA
N033 ( 3, 2) [000022] ------------ t22 = lclVar float V02 tmp1 u:2 (last use) REG NA $c3
/--* t22 float
N035 (???,???) [000033] ------------ * putarg_stk [+0x00] float REG NA
N037 ( 1, 4) [000034] ------------ t34 = const(h) int 0x8B6604 ftn REG NA
/--* t34 int
N039 ( 3, 6) [000035] ------------ t35 = * indir int REG NA
/--* t35 int control expr
N041 ( 69, 33) [000008] --C-G------- * call void System.Console.WriteLine $VN.Void
N043 ( 2, 2) [000013] ------------ il_offset void IL offset: 25 REG NA
N045 ( 1, 1) [000011] ------------ t11 = const int 100 REG NA $42
/--* t11 int
N047 ( 2, 2) [000012] ------------ * return int REG NA $1c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is hugely picky of me, but is there any chance we could avoid printing the message before the operands? No big deal if there isn't.
@pgavlin @dotnet/jit-contrib any additional comments? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM aside from one super-picky nit :)
@pgavlin Done. Sample codegen output now:
|
LGTM. Thanks for making the change! |
1. Use the LIR node dumper to display nodes to be generated by codegen, since we're in LIR form at that point. Add a new "prefix message" argument to allow "Generating: " to prefix all such lines. 2. Fix off-by-one error in LIR dump due to `#ifdef` versus `#if`. 3. Remove extra trailing line for each LIR node. This interfered with dotnet#1. But I always thought it was unnecessarily verbose; I don't believe there is any ambiguity without that extra space. 4. Add dTreeLIR()/cTreeLIR() functions for use in the debugger.
codegen, since we're in LIR form at that point. Add a new
"prefix message" argument to allow "Generating: " to prefix all
such lines.
#ifdef
versus#if
.with (1). But I always thought it was unnecessarily verbose; I don't
believe there is any ambiguity without that extra space.