aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/gc/main.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-01-12 11:38:32 -0800
committerMatthew Dempsky <mdempsky@google.com>2021-01-12 23:22:04 +0000
commitcc90e7a51e15659ea1a1eb53ca08361b6a77696a (patch)
tree2103231742aab67a2be2351ee0f4d8189ada3abe /src/cmd/compile/internal/gc/main.go
parentcd5b74d2dfe6009d55c86e90f6c204e58c229c16 (diff)
downloadgo-cc90e7a51e15659ea1a1eb53ca08361b6a77696a.tar.gz
go-cc90e7a51e15659ea1a1eb53ca08361b6a77696a.zip
[dev.regabi] cmd/compile: always use the compile queue
The compiler currently has two modes for compilation: one where it compiles each function as it sees them, and another where it enqueues them all into a work queue. A subsequent CL is going to reorder function compilation to ensure that functions are always compiled before any non-trivial function literals they enclose, and this will be easier if we always use the compile work queue. Also, fewer compilation modes makes things simpler to reason about. Change-Id: Ie090e81f7476c49486296f2b90911fa0a466a5dd Reviewed-on: https://go-review.googlesource.com/c/go/+/283313 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/gc/main.go')
-rw-r--r--src/cmd/compile/internal/gc/main.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go
index 1541bc4285..2903d64ff8 100644
--- a/src/cmd/compile/internal/gc/main.go
+++ b/src/cmd/compile/internal/gc/main.go
@@ -300,9 +300,8 @@ func Main(archInit func(*ssagen.ArchInfo)) {
base.Timer.Start("be", "compilefuncs")
fcount := int64(0)
for i := 0; i < len(typecheck.Target.Decls); i++ {
- n := typecheck.Target.Decls[i]
- if n.Op() == ir.ODCLFUNC {
- funccompile(n.(*ir.Func))
+ if fn, ok := typecheck.Target.Decls[i].(*ir.Func); ok {
+ enqueueFunc(fn)
fcount++
}
}