diff options
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 |