aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/html.go
diff options
context:
space:
mode:
authorYury Smolsky <yury@smolsky.by>2018-07-24 10:39:00 +0300
committerJosh Bleecher Snyder <josharian@gmail.com>2018-08-23 05:11:17 +0000
commitc35069d6428d29b12088731aab35cbff1e504a28 (patch)
treed8101cb41691402d632f5a9bf89772be0a9552d1 /src/cmd/compile/internal/ssa/html.go
parenteeb8aebed6d158ad55cea346fdd659f6d6112de5 (diff)
downloadgo-c35069d6428d29b12088731aab35cbff1e504a28.tar.gz
go-c35069d6428d29b12088731aab35cbff1e504a28.zip
cmd/compile: clean the output of GOSSAFUNC
Since we print almost everything to ssa.html in the GOSSAFUNC mode, there is a need to stop spamming stdout when user just wants to see ssa.html. This changes cleans output of the GOSSAFUNC debug mode. To enable the dump of the debug data to stdout, one must put suffix + after the function name like that: GOSSAFUNC=Foo+ Otherwise gc will not print the IR and ASM to stdout after each phase. AST IR is still sent to stdout because it is not included into ssa.html. It will be fixed in a separate change. The change adds printing out the full path to the ssa.html file. Updates #25942 Change-Id: I711e145e05f0443c7df5459ca528dced273a62ee Reviewed-on: https://go-review.googlesource.com/126603 Run-TryBot: Yury Smolsky <yury@smolsky.by> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/html.go')
-rw-r--r--src/cmd/compile/internal/ssa/html.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/ssa/html.go b/src/cmd/compile/internal/ssa/html.go
index 8125909349..2e48e8105b 100644
--- a/src/cmd/compile/internal/ssa/html.go
+++ b/src/cmd/compile/internal/ssa/html.go
@@ -11,12 +11,14 @@ import (
"html"
"io"
"os"
+ "path/filepath"
"strings"
)
type HTMLWriter struct {
Logger
- w io.WriteCloser
+ w io.WriteCloser
+ path string
}
func NewHTMLWriter(path string, logger Logger, funcname string) *HTMLWriter {
@@ -24,7 +26,11 @@ func NewHTMLWriter(path string, logger Logger, funcname string) *HTMLWriter {
if err != nil {
logger.Fatalf(src.NoXPos, "%v", err)
}
- html := HTMLWriter{w: out, Logger: logger}
+ pwd, err := os.Getwd()
+ if err != nil {
+ logger.Fatalf(src.NoXPos, "%v", err)
+ }
+ html := HTMLWriter{w: out, Logger: logger, path: filepath.Join(pwd, path)}
html.start(funcname)
return &html
}
@@ -439,6 +445,7 @@ func (w *HTMLWriter) Close() {
io.WriteString(w.w, "</body>")
io.WriteString(w.w, "</html>")
w.w.Close()
+ fmt.Printf("dumped SSA to %v\n", w.path)
}
// WriteFunc writes f in a column headed by title.