cmd/compile: enable optimizer logging for inline-related events

Change-Id: I72de8cb5e1df7a73e46a4b7e5b4e7290fcca4bc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/204162
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
David Chase 2019-10-29 17:25:56 -04:00
parent 405a2f2161
commit 4d0ed149ff
3 changed files with 54 additions and 3 deletions

View file

@ -269,6 +269,35 @@ func (n *Node) funcname() string {
return n.Func.Nname.Sym.Name
}
// pkgFuncName returns the name of the function referenced by n, with package prepended.
// This differs from the compiler's internal convention where local functions lack a package
// because the ultimate consumer of this is a human looking at an IDE; package is only empty
// if the compilation package is actually the empty string.
func (n *Node) pkgFuncName() string {
var s *types.Sym
if n == nil {
return "<nil>"
}
if n.Op == ONAME {
s = n.Sym
} else {
if n.Func == nil || n.Func.Nname == nil {
return "<nil>"
}
s = n.Func.Nname.Sym
}
pkg := s.Pkg
p := myimportpath
if pkg != nil && pkg.Path != "" {
p = pkg.Path
}
if p == "" {
return s.Name
}
return p + "." + s.Name
}
// Name holds Node fields used only by named nodes (ONAME, OTYPE, OPACK, OLABEL, some OLITERAL).
type Name struct {
Pack *Node // real package for import . names