mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: enable flag-specified dump of specific phase+function
For very large input files, use of GOSSAFUNC to obtain a dump after compilation steps can lead to both unwieldy large output files and unwieldy larger processes (because the output is buffered in a string). This flag -d=ssa/<phase>/dump:<function name> provides finer control of what is dumped, into a smaller file, and with less memory overhead in the running compiler. The special phase name "build" is added to allow printing of the just-built ssa before any transformations are applied. This was helpful in making sense of the gogo/protobuf problems. The output format was tweaked to remove gratuitous spaces, and a crude -d=ssa/help help text was added. Change-Id: If7516e22203420eb6ed3614f7cee44cb9260f43e Reviewed-on: https://go-review.googlesource.com/23044 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
10560afb54
commit
a190f3c8a3
3 changed files with 99 additions and 8 deletions
|
|
@ -246,6 +246,7 @@ func Main() {
|
|||
continue
|
||||
}
|
||||
val := 1
|
||||
valstring := ""
|
||||
if i := strings.Index(name, "="); i >= 0 {
|
||||
var err error
|
||||
val, err = strconv.Atoi(name[i+1:])
|
||||
|
|
@ -253,6 +254,9 @@ func Main() {
|
|||
log.Fatalf("invalid debug value %v", name)
|
||||
}
|
||||
name = name[:i]
|
||||
} else if i := strings.Index(name, ":"); i >= 0 {
|
||||
valstring = name[i+1:]
|
||||
name = name[:i]
|
||||
}
|
||||
for _, t := range debugtab {
|
||||
if t.name == name {
|
||||
|
|
@ -273,7 +277,7 @@ func Main() {
|
|||
flag = phase[i+1:]
|
||||
phase = phase[:i]
|
||||
}
|
||||
err := ssa.PhaseOption(phase, flag, val)
|
||||
err := ssa.PhaseOption(phase, flag, val, valstring)
|
||||
if err != "" {
|
||||
log.Fatalf(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue