mirror of https://github.com/golang/go.git
cmd/compile: cache the value of environment variable GOSSAFUNC
Store the value of GOSSAFUNC in a global variable to avoid multiple calls to os.Getenv from gc.buildssa and gc.mkinlcall1. The latter is implemented in the CL 126606. Updates #25942 Change-Id: I58caaef2fee23694d80dc5a561a2e809bf077fa4 Reviewed-on: https://go-review.googlesource.com/126604 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
d35135b9da
commit
e34f660a52
|
|
@ -427,6 +427,8 @@ func Main(archInit func(*Arch)) {
|
||||||
Debug['l'] = 1 - Debug['l']
|
Debug['l'] = 1 - Debug['l']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssaDump = os.Getenv("GOSSAFUNC")
|
||||||
|
|
||||||
trackScopes = flagDWARF
|
trackScopes = flagDWARF
|
||||||
|
|
||||||
Widthptr = thearch.LinkArch.PtrSize
|
Widthptr = thearch.LinkArch.PtrSize
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ import (
|
||||||
var ssaConfig *ssa.Config
|
var ssaConfig *ssa.Config
|
||||||
var ssaCaches []ssa.Cache
|
var ssaCaches []ssa.Cache
|
||||||
|
|
||||||
|
var ssaDump string // early copy of $GOSSAFUNC; the func name to dump output for
|
||||||
|
const ssaDumpFile = "ssa.html"
|
||||||
|
|
||||||
func initssaconfig() {
|
func initssaconfig() {
|
||||||
types_ := ssa.NewTypes()
|
types_ := ssa.NewTypes()
|
||||||
|
|
||||||
|
|
@ -103,7 +106,7 @@ func initssaconfig() {
|
||||||
// worker indicates which of the backend workers is doing the processing.
|
// worker indicates which of the backend workers is doing the processing.
|
||||||
func buildssa(fn *Node, worker int) *ssa.Func {
|
func buildssa(fn *Node, worker int) *ssa.Func {
|
||||||
name := fn.funcname()
|
name := fn.funcname()
|
||||||
printssa := name == os.Getenv("GOSSAFUNC")
|
printssa := name == ssaDump
|
||||||
if printssa {
|
if printssa {
|
||||||
fmt.Println("generating SSA for", name)
|
fmt.Println("generating SSA for", name)
|
||||||
dumplist("buildssa-enter", fn.Func.Enter)
|
dumplist("buildssa-enter", fn.Func.Enter)
|
||||||
|
|
@ -141,7 +144,7 @@ func buildssa(fn *Node, worker int) *ssa.Func {
|
||||||
s.softFloat = s.config.SoftFloat
|
s.softFloat = s.config.SoftFloat
|
||||||
|
|
||||||
if printssa {
|
if printssa {
|
||||||
s.f.HTMLWriter = ssa.NewHTMLWriter("ssa.html", s.f.Frontend(), name)
|
s.f.HTMLWriter = ssa.NewHTMLWriter(ssaDumpFile, s.f.Frontend(), name)
|
||||||
// TODO: generate and print a mapping from nodes to values and blocks
|
// TODO: generate and print a mapping from nodes to values and blocks
|
||||||
|
|
||||||
// Read sources for a function fn and format into a column.
|
// Read sources for a function fn and format into a column.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue