diff options
author | Keith Randall <khr@golang.org> | 2022-07-19 09:07:38 -0700 |
---|---|---|
committer | Keith Randall <khr@google.com> | 2022-07-19 19:51:06 +0000 |
commit | 8e1e64c16a4d53c06ed4f2287fc11eeb5029ca1a (patch) | |
tree | 8f64c388bbd543d7711bb69f13dc77c345b66098 | |
parent | 28be440d3434a440d0c144ba2128b30ce9771ecf (diff) | |
download | go-8e1e64c16a4d53c06ed4f2287fc11eeb5029ca1a.tar.gz go-8e1e64c16a4d53c06ed4f2287fc11eeb5029ca1a.zip |
cmd/compile: fix mknode script
It's not currently working. Somehow a field of type []constant.Value
causes it to barf. (That field was added with jump table statements.)
Also added some instructions about how to run it correctly (which took
me a suprisingly long time to figure out).
Larger improvements coming, but this gets us to a working state
and is safe for 1.19.
Change-Id: I3027356fde1294942e87d075ca28bb40d2c0d6c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/418234
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
-rw-r--r-- | src/cmd/compile/internal/ir/mini.go | 1 | ||||
-rw-r--r-- | src/cmd/compile/internal/ir/mknode.go | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ir/mini.go b/src/cmd/compile/internal/ir/mini.go index 98c0ffa5b0..48f5eccf34 100644 --- a/src/cmd/compile/internal/ir/mini.go +++ b/src/cmd/compile/internal/ir/mini.go @@ -3,6 +3,7 @@ // license that can be found in the LICENSE file. //go:generate go run -mod=mod mknode.go +// Note: see comment at top of mknode.go package ir diff --git a/src/cmd/compile/internal/ir/mknode.go b/src/cmd/compile/internal/ir/mknode.go index 5a0aaadf16..af8869d122 100644 --- a/src/cmd/compile/internal/ir/mknode.go +++ b/src/cmd/compile/internal/ir/mknode.go @@ -5,6 +5,12 @@ //go:build ignore // +build ignore +// Note: this program must be run with the GOROOT +// environment variable set to the root of this tree. +// GOROOT=... +// cd $GOROOT/src/cmd/compile/internal/ir +// ../../../../../bin/go run -mod=mod mknode.go + package main import ( @@ -154,6 +160,9 @@ func forNodeFields(named *types.Named, prologue, singleTmpl, sliceTmpl, epilogue } tmpl, what := singleTmpl, types.TypeString(typ, types.RelativeTo(irPkg)) + if what == "go/constant.Value" { + return false + } if implementsNode(typ) { if slice != nil { helper := strings.TrimPrefix(what, "*") + "s" |