[dev.regabi] cmd/compile: add custom type syntax Node implementations

The type syntax is reused to stand in for the actual type once typechecked,
to avoid updating all the possible references to the original type syntax.
So all these implementations allow changing their Op from the raw syntax
like OTMAP to the finished form OTYPE, even though obviously the
representation does not change.

Passes buildall w/ toolstash -cmp.

Change-Id: I4acca1a5b35fa2f48ee08e8f1e5a330a004c284b
Reviewed-on: https://go-review.googlesource.com/c/go/+/274103
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Russ Cox 2020-11-26 07:02:13 -05:00
parent d40869fced
commit 4e7685ef1a
23 changed files with 790 additions and 430 deletions

View file

@ -176,7 +176,10 @@ func typeinit() {
t := types.New(types.TUNSAFEPTR)
types.Types[types.TUNSAFEPTR] = t
t.Sym = unsafepkg.Lookup("Pointer")
t.Sym.Def = ir.TypeNode(t)
n := ir.NewNameAt(src.NoXPos, t.Sym) // NewNameAt to get a package for use tracking
n.SetOp(ir.OTYPE)
n.SetType(t)
t.Sym.Def = n
dowidth(types.Types[types.TUNSAFEPTR])
for et := types.TINT8; et <= types.TUINT64; et++ {