aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-06-11 03:54:25 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-06-15 22:29:54 +0000
commitcf1ae5fc364eb7f2ee5203e4c5e30411c3cfe01f (patch)
tree455a662e7e6c2fe4db559d7d3201a21167369429
parent79cd1687e6abf8c565281d310b4c2b44a8d4bb84 (diff)
downloadgo-cf1ae5fc364eb7f2ee5203e4c5e30411c3cfe01f.tar.gz
go-cf1ae5fc364eb7f2ee5203e4c5e30411c3cfe01f.zip
[dev.typeparams] cmd/compile: add -d=unified flag to enable unified IR
This CL adds a new -d=unified debug flag, which controls whether unified IR mode is used. Change-Id: Iaa5f3cc0a24b9881aeec5317cd6b462b4a7b6fc9 Reviewed-on: https://go-review.googlesource.com/c/go/+/327054 Trust: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Robert Griesemer <gri@golang.org>
-rw-r--r--src/cmd/compile/internal/base/debug.go1
-rw-r--r--src/cmd/compile/internal/noder/noder.go5
-rw-r--r--src/cmd/compile/internal/reflectdata/reflect.go4
3 files changed, 10 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/base/debug.go b/src/cmd/compile/internal/base/debug.go
index 71712ab1a5..824a8baa83 100644
--- a/src/cmd/compile/internal/base/debug.go
+++ b/src/cmd/compile/internal/base/debug.go
@@ -46,6 +46,7 @@ type DebugFlags struct {
SoftFloat int `help:"force compiler to emit soft-float code"`
TypeAssert int `help:"print information about type assertion inlining"`
TypecheckInl int `help:"eager typechecking of inline function bodies"`
+ Unified int `help:"enable unified IR construction"`
WB int `help:"print information about write barriers"`
ABIWrap int `help:"print information about ABI wrapper generation"`
diff --git a/src/cmd/compile/internal/noder/noder.go b/src/cmd/compile/internal/noder/noder.go
index d417edcbd5..c7970396f8 100644
--- a/src/cmd/compile/internal/noder/noder.go
+++ b/src/cmd/compile/internal/noder/noder.go
@@ -76,6 +76,11 @@ func LoadPackage(filenames []string) {
}
base.Timer.AddEvent(int64(lines), "lines")
+ if base.Debug.Unified != 0 {
+ useUnifiedIR(noders)
+ return
+ }
+
if base.Flag.G != 0 {
// Use types2 to type-check and possibly generate IR.
check2(noders)
diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go
index f16034ea70..5516f707fa 100644
--- a/src/cmd/compile/internal/reflectdata/reflect.go
+++ b/src/cmd/compile/internal/reflectdata/reflect.go
@@ -1780,6 +1780,10 @@ func methodWrapper(rcvr *types.Type, method *types.Field, forItab bool) *obj.LSy
// TODO: check that we do the right thing when rcvr.IsInterface().
generic = true
}
+ if base.Debug.Unified != 0 {
+ // TODO(mdempsky): Support dictionaries for unified IR.
+ generic = false
+ }
newnam := ir.MethodSym(rcvr, method.Sym)
lsym := newnam.Linksym()
if newnam.Siggen() {