diff options
author | Matthew Dempsky <mdempsky@google.com> | 2020-12-31 23:39:15 -0800 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-01-01 10:52:27 +0000 |
commit | 3a4474cdfda0096b5d88c769f81ad81d6f0168c7 (patch) | |
tree | 9001f7614e140a0d3992583802b9a6a57e1198d0 /src/cmd/compile/internal/gc/main.go | |
parent | 0f1d2129c4c294a895480b79eeab8d22c07ac573 (diff) | |
download | go-3a4474cdfda0096b5d88c769f81ad81d6f0168c7.tar.gz go-3a4474cdfda0096b5d88c769f81ad81d6f0168c7.zip |
[dev.regabi] cmd/compile: some more manual shuffling
More minor reshuffling of passes.
Passes toolstash -cmp.
Change-Id: I22633b3741f668fc5ee8579d7d610035ed57df1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/280975
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/gc/main.go')
-rw-r--r-- | src/cmd/compile/internal/gc/main.go | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 603619eb5a..df6a9d8e45 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -200,23 +200,15 @@ func Main(archInit func(*ssagen.ArchInfo)) { base.AutogeneratedPos = makePos(src.NewFileBase("<autogenerated>", "<autogenerated>"), 1, 0) - typecheck.Init() + typecheck.InitUniverse() - // Parse input. - base.Timer.Start("fe", "parse") - lines := noder.ParseFiles(flag.Args()) - ssagen.CgoSymABIs() - base.Timer.Stop() - base.Timer.AddEvent(int64(lines), "lines") - dwarfgen.RecordPackageName() + // Parse and typecheck input. + noder.LoadPackage(flag.Args()) - // Typecheck. - noder.Package() + dwarfgen.RecordPackageName() + ssagen.CgoSymABIs() - // With all user code typechecked, it's now safe to verify unused dot imports. - noder.CheckDotImports() - base.ExitIfErrors() - // Phase 6: Compute Addrtaken for names. + // Compute Addrtaken for names. // We need to wait until typechecking is done so that when we see &x[i] // we know that x has its address taken if x is an array, but not if x is a slice. // We compute Addrtaken in bulk here. @@ -227,7 +219,7 @@ func Main(archInit func(*ssagen.ArchInfo)) { } typecheck.IncrementalAddrtaken = true - // Phase 7: Eliminate some obviously dead code. + // Eliminate some obviously dead code. // Must happen after typechecking. for _, n := range typecheck.Target.Decls { if n.Op() == ir.ODCLFUNC { @@ -235,7 +227,7 @@ func Main(archInit func(*ssagen.ArchInfo)) { } } - // Phase 8: Decide how to capture closed variables. + // Decide how to capture closed variables. // This needs to run before escape analysis, // because variables captured by value do not escape. base.Timer.Start("fe", "capturevars") @@ -256,6 +248,7 @@ func Main(archInit func(*ssagen.ArchInfo)) { // otherwise lazily when used or re-exported. typecheck.AllImportedBodies() } + // Build init task. if initTask := pkginit.Task(); initTask != nil { typecheck.Export(initTask) @@ -311,6 +304,7 @@ func Main(archInit func(*ssagen.ArchInfo)) { // Prepare for SSA compilation. // This must be before peekitabs, because peekitabs // can trigger function compilation. + typecheck.InitRuntime() ssagen.InitConfig() // Just before compilation, compile itabs found on |