diff options
author | Russ Cox <rsc@golang.org> | 2020-12-21 01:29:02 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2020-12-21 19:23:28 +0000 |
commit | 1a3b036b836d5b41871515ec350b203377e087a6 (patch) | |
tree | 52f0c6be36f2607486df1970c7824d273a8c8e5e /src/cmd/compile/internal/gc/export.go | |
parent | 2153a99914c3c24b98cd4cfccd1d2f670273a4ac (diff) | |
download | go-1a3b036b836d5b41871515ec350b203377e087a6.tar.gz go-1a3b036b836d5b41871515ec350b203377e087a6.zip |
[dev.regabi] cmd/compile: collect global compilation state
There are various global variables tracking the state of the
compilation. Collect them in a single global struct instead.
The struct definition is in package ir, but the struct itself is
still in package gc. It may eventually be threaded through the
code, but in the short term will end up in package typecheck.
Change-Id: I019db07aaedaed2c9b67dd45a4e138dc6028e54c
Reviewed-on: https://go-review.googlesource.com/c/go/+/279297
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/gc/export.go')
-rw-r--r-- | src/cmd/compile/internal/gc/export.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/gc/export.go b/src/cmd/compile/internal/gc/export.go index 16d45a00aa..42e0db2b20 100644 --- a/src/cmd/compile/internal/gc/export.go +++ b/src/cmd/compile/internal/gc/export.go @@ -21,8 +21,6 @@ func exportf(bout *bio.Writer, format string, args ...interface{}) { } } -var asmlist []ir.Node - // exportsym marks n for export (or reexport). func exportsym(n *ir.Name) { if n.Sym().OnExportList() { @@ -34,7 +32,7 @@ func exportsym(n *ir.Name) { fmt.Printf("export symbol %v\n", n.Sym()) } - exportlist = append(exportlist, n) + Target.Exports = append(Target.Exports, n) } func initname(s string) bool { @@ -57,7 +55,7 @@ func autoexport(n *ir.Name, ctxt ir.Class) { } if base.Flag.AsmHdr != "" && !n.Sym().Asm() { n.Sym().SetAsm(true) - asmlist = append(asmlist, n) + Target.Asms = append(Target.Asms, n) } } @@ -202,7 +200,7 @@ func dumpasmhdr() { base.Fatalf("%v", err) } fmt.Fprintf(b, "// generated by compile -asmhdr from package %s\n\n", types.LocalPkg.Name) - for _, n := range asmlist { + for _, n := range Target.Asms { if n.Sym().IsBlank() { continue } |