Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: display AST IR in ssa.html #26662

Closed
ysmolsky opened this issue Jul 28, 2018 · 3 comments
Closed

cmd/compile: display AST IR in ssa.html #26662

ysmolsky opened this issue Jul 28, 2018 · 3 comments
Assignees
Milestone

Comments

@ysmolsky
Copy link
Member

@ysmolsky ysmolsky commented Jul 28, 2018

To finish work on ssa.html, it would be great to display AST IR as a second column in ssa.html.

But for that I would like to gather requirements, what exactly should be displayed there. Just copy the stuff GOSSAFUNC spews into stdout as AST IR? Or should we refine it to contain some subset of fields?

Please state your opinions and "use-cases" for this AST IR. How do you use it and what is the most important to you?

/CC @randall77 @josharian

I am talking about this:

generating SSA for f
buildssa-enter
buildssa-body
.   DCL l(9)
.   .   NAME-inline.i a(true) l(13) x(0) class(PAUTO) tc(1) assigned used uint16

.   DCL l(9)
.   .   NAME-inline.~r1 a(true) l(13) x(0) class(PAUTO) tc(1) assigned used uint16

.   BLOCK l(9)
.   BLOCK-list
.   .   AS l(9) tc(1)
.   .   .   NAME-inline.i a(true) l(13) x(0) class(PAUTO) tc(1) assigned used uint16
.   .   .   NAME-inline.x a(true) l(5) x(0) class(PEXTERN) tc(1) assigned used uint16

.   AS l(9) tc(1)
.   .   NAME-inline.~r1 a(true) l(13) x(0) class(PAUTO) tc(1) assigned used uint16

.   BLOCK-init
.   .   AS l(9) tc(1)
.   .   .   NAME-inline..autotmp_5 a(true) l(9) x(0) class(PAUTO) esc(N) tc(1) assigned used uint16
.   .   .   ADD l(14) tc(1) uint16
.   .   .   .   NAME-inline.i a(true) l(13) x(0) class(PAUTO) tc(1) assigned used uint16
.   .   .   .   MUL l(14) tc(1) uint16
.   .   .   .   .   LITERAL-2 l(14) tc(1) uint16
.   .   .   .   .   NAME-inline.i a(true) l(13) x(0) class(PAUTO) tc(1) assigned used uint16
.   BLOCK l(9) hascall
.   BLOCK-list
.   .   AS l(9) tc(1)
.   .   .   NAME-inline.~r1 a(true) l(13) x(0) class(PAUTO) tc(1) assigned used uint16
.   .   .   NAME-inline..autotmp_5 a(true) l(9) x(0) class(PAUTO) esc(N) tc(1) assigned used uint16

.   GOTO l(9) tc(1)
.   .   NAME-inline..i0 a(true) l(9) x(0)

.   LABEL l(9) tc(1)
.   .   NAME-inline..i0 a(true) l(9) x(0)

.   AS l(9) tc(1)
.   .   NAME-inline.x a(true) l(5) x(0) class(PEXTERN) tc(1) assigned used uint16
.   .   ADD l(9) tc(1) uint16
.   .   .   CONVNOP l(9) tc(1) uint16
.   .   .   .   NAME-inline.~r1 a(true) l(13) x(0) class(PAUTO) tc(1) assigned used uint16
.   .   .   LITERAL-123 l(9) tc(1) uint16

.   DCL l(10)
.   .   NAME-binary.b a(true) l(104) x(0) class(PAUTO) tc(1) assigned used SLICE-[]byte

.   DCL l(10)
.   .   NAME-binary.v a(true) l(104) x(0) class(PAUTO) tc(1) assigned used uint16

.   AS l(10) tc(1)
.   .   NAME-_ a(true) x(0) tc(1) assigned blank
.   .   NAME-binary.BigEndian a(true) l(47) x(0) class(PEXTERN) tc(1) used binary.bigEndian

.   AS l(10) tc(1) hascall
.   .   NAME-inline..autotmp_4 a(true) l(10) x(0) class(PAUTO) esc(N) tc(1) assigned used SLICE-[]byte
.   .   SLICEARR l(10) tc(1) hascall SLICE-[]byte
.   .   .   ADDR l(10) esc(no) tc(1) implicit(true) PTR64-*[2]byte
.   .   .   .   NAME-inline.b a(true) l(6) x(0) class(PEXTERN) tc(1) addrtaken used ARRAY-[2]byte

.   BLOCK l(10)
.   BLOCK-list
.   .   AS l(10) tc(1)
.   .   .   NAME-inline..autotmp_6 a(true) l(10) x(0) class(PAUTO) esc(N) tc(1) assigned used uint16
.   .   .   NAME-inline.x a(true) l(5) x(0) class(PEXTERN) tc(1) assigned used uint16

.   .   AS l(10) tc(1)
.   .   .   NAME-binary.b a(true) l(104) x(0) class(PAUTO) tc(1) assigned used SLICE-[]byte
.   .   .   NAME-inline..autotmp_4 a(true) l(10) x(0) class(PAUTO) esc(N) tc(1) assigned used SLICE-[]byte

.   .   AS l(10) tc(1)
.   .   .   NAME-binary.v a(true) l(104) x(0) class(PAUTO) tc(1) assigned used uint16
.   .   .   NAME-inline..autotmp_6 a(true) l(10) x(0) class(PAUTO) esc(N) tc(1) assigned used uint16

.   VARKILL l(10) tc(1)
.   .   NAME-inline..autotmp_4 a(true) l(10) x(0) class(PAUTO) esc(N) tc(1) assigned used SLICE-[]byte

.   AS l(105) tc(1) hascall
.   .   NAME-_ a(true) x(0) tc(1) assigned blank
.   .   INDEX l(105) tc(1) hascall byte
.   .   .   NAME-binary.b a(true) l(104) x(0) class(PAUTO) tc(1) assigned used SLICE-[]byte
.   .   .   LITERAL-1 l(105) tc(1) int

.   AS l(106) tc(1) hascall
.   .   INDEX l(106) tc(1) assigned hascall byte
.   .   .   NAME-binary.b a(true) l(104) x(0) class(PAUTO) tc(1) assigned used SLICE-[]byte
.   .   .   LITERAL-0 l(106) tc(1) int
.   .   CONV l(106) tc(1) byte
.   .   .   RSH l(106) tc(1) bounded uint16
.   .   .   .   NAME-binary.v a(true) l(104) x(0) class(PAUTO) tc(1) assigned used uint16
.   .   .   .   LITERAL-8 l(106) tc(1) uint

.   AS l(107) tc(1) hascall
.   .   INDEX l(107) tc(1) assigned hascall byte
.   .   .   NAME-binary.b a(true) l(104) x(0) class(PAUTO) tc(1) assigned used SLICE-[]byte
.   .   .   LITERAL-1 l(107) tc(1) int
.   .   CONV l(107) tc(1) byte
.   .   .   NAME-binary.v a(true) l(104) x(0) class(PAUTO) tc(1) assigned used uint16

.   LABEL l(10) tc(1)
.   .   NAME-inline..i1 a(true) l(10) x(0)
buildssa-exit
@ysmolsky ysmolsky added this to the Go1.12 milestone Jul 28, 2018
@josharian

This comment has been minimized.

Copy link
Contributor

@josharian josharian commented Jul 28, 2018

Given the nightmare that is fmt.go, I’m inclined to keep that format unchanged. One small thing that would be really nice would be if it were line number aware somehow to help correlate with the rest of the page. Not sure about feasibility of that, though.

@ysmolsky

This comment has been minimized.

Copy link
Member Author

@ysmolsky ysmolsky commented Jul 31, 2018

Preview:
screen shot 2018-07-31 at 18 20 34

@ysmolsky ysmolsky self-assigned this Jul 31, 2018
@ysmolsky ysmolsky added NeedsFix and removed NeedsDecision labels Jul 31, 2018
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jul 31, 2018

Change https://golang.org/cl/126858 mentions this issue: cmd/compile: display AST IR in ssa.html

@gopherbot gopherbot closed this in 4cc027f Aug 24, 2018
@golang golang locked and limited conversation to collaborators Aug 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.