mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: make ir.Func the ODCLFUNC Node implementation
Before this CL, an ODCLFUNC Node was represented by both a node struct and a Func struct (and a Name for the ONAME, which isn't changing here). Now Func can be repurposed as the ODCLFUNC implementation, replacing the two structs totaling 280+144 = 424 bytes (64-bit) with a single 320-byte struct. Using the *Func as the node also gives us a clear, typed answer to “which node should we use to represent functions?” The next CL will clean up uses. This CL is just the trivial change in representation. Passes buildall w/ toolstash -cmp. Change-Id: Ie6d670da91d6eb8d67a85f8f83630b9586dc7443 Reviewed-on: https://go-review.googlesource.com/c/go/+/274096 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
65ae15ac5d
commit
c4bd0b7474
4 changed files with 43 additions and 9 deletions
|
|
@ -1106,13 +1106,7 @@ func NodAt(pos src.XPos, op Op, nleft, nright Node) Node {
|
|||
var n *node
|
||||
switch op {
|
||||
case ODCLFUNC:
|
||||
var x struct {
|
||||
n node
|
||||
f Func
|
||||
}
|
||||
n = &x.n
|
||||
n.SetFunc(&x.f)
|
||||
n.Func().Decl = n
|
||||
return NewFunc(pos)
|
||||
case OPACK:
|
||||
return NewPkgName(pos, nil, nil)
|
||||
case OEMPTY:
|
||||
|
|
@ -1179,7 +1173,6 @@ var okForNod = [OEND]bool{
|
|||
ODCL: true,
|
||||
ODCLCONST: true,
|
||||
ODCLFIELD: true,
|
||||
ODCLFUNC: true,
|
||||
ODCLTYPE: true,
|
||||
ODDD: true,
|
||||
ODEFER: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue