From ead4957892bc1975d9cc9c32777733c67e5a885e Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 23 Dec 2020 00:05:23 -0500 Subject: [dev.regabi] cmd/compile: move helpers into package base [generated] [git-generate] cd src/cmd/compile/internal/gc rf ' # Move EnableTrace constant into base, with the other flags. mv enableTrace EnableTrace mv EnableTrace base.go # Move compilation checks to base. mv instrumenting Instrumenting mv ispkgin Compiling mv omit_pkgs NoInstrumentPkgs mv norace_inst_pkgs NoRacePkgs mv Instrumenting Compiling NoInstrumentPkgs NoRacePkgs base.go # Move AutogeneratedPos to package base, next to Pos. mv autogeneratedPos AutogeneratedPos mv AutogeneratedPos print.go mv timings Timer mv base.go print.go timings.go cmd/compile/internal/base ' cd ../base rf ' mv Instrumenting Flag.Cfg.Instrumenting ' Change-Id: I534437fa75857d31531fc499d833c9930c0a06d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/279420 Trust: Russ Cox Run-TryBot: Russ Cox TryBot-Result: Go Bot Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/gc/main.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/cmd/compile/internal/gc/main.go') diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index c1cc7ed377..feded3f9b2 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -58,7 +58,7 @@ var Target *ir.Package // arguments, type-checks the parsed Go package, compiles functions to machine // code, and finally writes the compiled package definition to disk. func Main(archInit func(*Arch)) { - timings.Start("fe", "init") + base.Timer.Start("fe", "init") defer hidePanic() @@ -123,7 +123,7 @@ func Main(archInit func(*Arch)) { // changes in the binary.) recordFlags("B", "N", "l", "msan", "race", "shared", "dynlink", "dwarflocationlists", "dwarfbasentries", "smallframes", "spectre") - if !enableTrace && base.Flag.LowerT { + if !base.EnableTrace && base.Flag.LowerT { log.Fatalf("compiler not built with support for -t") } @@ -159,7 +159,7 @@ func Main(archInit func(*Arch)) { readSymABIs(base.Flag.SymABIs, base.Ctxt.Pkgpath) } - if ispkgin(omit_pkgs) { + if base.Compiling(base.NoInstrumentPkgs) { base.Flag.Race = false base.Flag.MSan = false } @@ -173,7 +173,7 @@ func Main(archInit func(*Arch)) { msanpkg = types.NewPkg("runtime/msan", "") } if base.Flag.Race || base.Flag.MSan { - instrumenting = true + base.Flag.Cfg.Instrumenting = true } if base.Flag.Dwarf { dwarf.EnableLogging(base.Debug.DwarfInl != 0) @@ -205,7 +205,7 @@ func Main(archInit func(*Arch)) { NeedITab = func(t, iface *types.Type) { itabname(t, iface) } NeedRuntimeType = addsignat // TODO(rsc): typenamesym for lock? - autogeneratedPos = makePos(src.NewFileBase("", ""), 1, 0) + base.AutogeneratedPos = makePos(src.NewFileBase("", ""), 1, 0) types.TypeLinkSym = func(t *types.Type) *obj.LSym { return typenamesym(t).Linksym() @@ -213,11 +213,11 @@ func Main(archInit func(*Arch)) { TypecheckInit() // Parse input. - timings.Start("fe", "parse") + base.Timer.Start("fe", "parse") lines := parseFiles(flag.Args()) cgoSymABIs() - timings.Stop() - timings.AddEvent(int64(lines), "lines") + base.Timer.Stop() + base.Timer.AddEvent(int64(lines), "lines") recordPackageName() // Typecheck. @@ -233,7 +233,7 @@ func Main(archInit func(*Arch)) { } // Inlining - timings.Start("fe", "inlining") + base.Timer.Start("fe", "inlining") if base.Flag.LowerL != 0 { InlinePackage() } @@ -254,7 +254,7 @@ func Main(archInit func(*Arch)) { // or else the stack copier will not update it. // Large values are also moved off stack in escape analysis; // because large values may contain pointers, it must happen early. - timings.Start("fe", "escapes") + base.Timer.Start("fe", "escapes") escapes(Target.Decls) // Collect information for go:nowritebarrierrec @@ -268,7 +268,7 @@ func Main(archInit func(*Arch)) { // Transform closure bodies to properly reference captured variables. // This needs to happen before walk, because closures must be transformed // before walk reaches a call of a closure. - timings.Start("fe", "xclosures") + base.Timer.Start("fe", "xclosures") for _, n := range Target.Decls { if n.Op() == ir.ODCLFUNC { n := n.(*ir.Func) @@ -292,7 +292,7 @@ func Main(archInit func(*Arch)) { // Compile top level functions. // Don't use range--walk can add functions to Target.Decls. - timings.Start("be", "compilefuncs") + base.Timer.Start("be", "compilefuncs") fcount := int64(0) for i := 0; i < len(Target.Decls); i++ { n := Target.Decls[i] @@ -301,7 +301,7 @@ func Main(archInit func(*Arch)) { fcount++ } } - timings.AddEvent(fcount, "funcs") + base.Timer.AddEvent(fcount, "funcs") compileFunctions() @@ -320,7 +320,7 @@ func Main(archInit func(*Arch)) { } // Write object data to disk. - timings.Start("be", "dumpobj") + base.Timer.Start("be", "dumpobj") dumpdata() base.Ctxt.NumberSyms() dumpobj() @@ -339,7 +339,7 @@ func Main(archInit func(*Arch)) { base.ExitIfErrors() base.FlushErrors() - timings.Stop() + base.Timer.Stop() if base.Flag.Bench != "" { if err := writebench(base.Flag.Bench); err != nil { @@ -397,7 +397,7 @@ func writebench(filename string) error { fmt.Fprintln(&buf, "commit:", objabi.Version) fmt.Fprintln(&buf, "goos:", runtime.GOOS) fmt.Fprintln(&buf, "goarch:", runtime.GOARCH) - timings.Write(&buf, "BenchmarkCompile:"+base.Ctxt.Pkgpath+":") + base.Timer.Write(&buf, "BenchmarkCompile:"+base.Ctxt.Pkgpath+":") n, err := f.Write(buf.Bytes()) if err != nil { -- cgit v1.2.3-54-g00ecf