mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: separate various from Main
Move various code out of Main itself and into helper functions that can be moved into other packages as package gc splits up. Similarly, move order and instrument inside walk to reduce the amount of API surface needed from the eventual package walk. Change-Id: I7849258038c6e39625a0385af9c0edd6a3b654a1 Reviewed-on: https://go-review.googlesource.com/c/go/+/279304 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
3b12c6dc08
commit
572f168ed2
9 changed files with 211 additions and 179 deletions
|
|
@ -222,24 +222,16 @@ func funccompile(fn *ir.Func) {
|
|||
}
|
||||
|
||||
func compile(fn *ir.Func) {
|
||||
errorsBefore := base.Errors()
|
||||
order(fn)
|
||||
if base.Errors() > errorsBefore {
|
||||
return
|
||||
}
|
||||
|
||||
// Set up the function's LSym early to avoid data races with the assemblers.
|
||||
// Do this before walk, as walk needs the LSym to set attributes/relocations
|
||||
// (e.g. in markTypeUsedInInterface).
|
||||
initLSym(fn, true)
|
||||
|
||||
errorsBefore := base.Errors()
|
||||
walk(fn)
|
||||
if base.Errors() > errorsBefore {
|
||||
return
|
||||
}
|
||||
if instrumenting {
|
||||
instrument(fn)
|
||||
}
|
||||
|
||||
// From this point, there should be no uses of Curfn. Enforce that.
|
||||
Curfn = nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue