[dev.ssa] cmd/compile: preallocate small-numbered values and blocks
Speeds up the compiler ~5%.
Change-Id: Ia5cf0bcd58701fd14018ec77d01f03d5c7d6385b
Reviewed-on: https://go-review.googlesource.com/19060
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go
index 203de64..ae74732 100644
--- a/src/cmd/compile/internal/gc/ssa.go
+++ b/src/cmd/compile/internal/gc/ssa.go
@@ -21,6 +21,9 @@
// Smallest possible faulting page at address zero.
const minZeroPage = 4096
+var ssaConfig *ssa.Config
+var ssaExp ssaExport
+
func shouldssa(fn *Node) bool {
if Thearch.Thestring != "amd64" {
return false
@@ -119,9 +122,13 @@
// TODO(khr): build config just once at the start of the compiler binary
- var e ssaExport
- e.log = printssa
- s.config = ssa.NewConfig(Thearch.Thestring, &e, Ctxt, Debug['N'] == 0)
+ ssaExp.log = printssa
+ ssaExp.unimplemented = false
+ ssaExp.mustImplement = true
+ if ssaConfig == nil {
+ ssaConfig = ssa.NewConfig(Thearch.Thestring, &ssaExp, Ctxt, Debug['N'] == 0)
+ }
+ s.config = ssaConfig
s.f = s.config.NewFunc()
s.f.Name = name
s.exitCode = fn.Func.Exit