diff options
author | Russ Cox <rsc@golang.org> | 2020-12-21 01:20:20 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2020-12-22 19:32:16 +0000 |
commit | 51ba53f5c2d58dd0c02b5ee1f4ef1db2577c4d3a (patch) | |
tree | a705a366936b16316557632c23c9a6434a2499fc /src/cmd/compile/internal/gc/main.go | |
parent | 572f168ed26bb32e83562cffb336f2df3a651d9c (diff) | |
download | go-51ba53f5c2d58dd0c02b5ee1f4ef1db2577c4d3a.tar.gz go-51ba53f5c2d58dd0c02b5ee1f4ef1db2577c4d3a.zip |
[dev.regabi] cmd/compile: separate misc for gc split
Misc cleanup for splitting package gc: API tweaks
and boundary adjustments.
The change in ir.NewBlockStmt makes it a drop-in
replacement for liststmt.
Change-Id: I9455fe8ccae7d71fe8ccf390ac96672389bf4f3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/279305
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/gc/main.go')
-rw-r--r-- | src/cmd/compile/internal/gc/main.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 4aa2a2ca47..80b17ebbf8 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -54,9 +54,6 @@ func hidePanic() { // Target is the package being compiled. var Target *ir.Package -// timing data for compiler phases -var timings Timings - // Main parses flags and Go source files specified in the command-line // arguments, type-checks the parsed Go package, compiles functions to machine // code, and finally writes the compiled package definition to disk. @@ -189,6 +186,7 @@ func Main(archInit func(*Arch)) { logopt.LogJsonOption(base.Flag.JSON) } + ir.EscFmt = escFmt IsIntrinsicCall = isIntrinsicCall SSADumpInline = ssaDumpInline initSSAEnv() @@ -962,9 +960,11 @@ type lang struct { // any language version is supported. var langWant lang -// langSupported reports whether language version major.minor is -// supported in a particular package. -func langSupported(major, minor int, pkg *types.Pkg) bool { +// AllowsGoVersion reports whether a particular package +// is allowed to use Go version major.minor. +// We assume the imported packages have all been checked, +// so we only have to check the local package against the -lang flag. +func AllowsGoVersion(pkg *types.Pkg, major, minor int) bool { if pkg == nil { // TODO(mdempsky): Set Pkg for local types earlier. pkg = types.LocalPkg @@ -973,13 +973,16 @@ func langSupported(major, minor int, pkg *types.Pkg) bool { // Assume imported packages passed type-checking. return true } - if langWant.major == 0 && langWant.minor == 0 { return true } return langWant.major > major || (langWant.major == major && langWant.minor >= minor) } +func langSupported(major, minor int, pkg *types.Pkg) bool { + return AllowsGoVersion(pkg, major, minor) +} + // checkLang verifies that the -lang flag holds a valid value, and // exits if not. It initializes data used by langSupported. func checkLang() { |