mirror of https://github.com/golang/go.git
[dev.regabi] cmd/compile: change AddrExpr.Alloc to AddrExpr.Prealloc
For being consistent with other Prealloc fields. [git-generate] cd src/cmd/compile/internal/ir rf ' mv AddrExpr.Alloc AddrExpr.Prealloc ' go generate Change-Id: Id1b05119092036e3f8208b73b63bd0ca6ceb7b15 Reviewed-on: https://go-review.googlesource.com/c/go/+/279450 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
850aa7c60c
commit
f5816624cd
|
|
@ -107,7 +107,7 @@ func NewAddStringExpr(pos src.XPos, list []Node) *AddStringExpr {
|
||||||
type AddrExpr struct {
|
type AddrExpr struct {
|
||||||
miniExpr
|
miniExpr
|
||||||
X Node
|
X Node
|
||||||
Alloc *Name // preallocated storage if any
|
Prealloc *Name // preallocated storage if any
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAddrExpr(pos src.XPos, x Node) *AddrExpr {
|
func NewAddrExpr(pos src.XPos, x Node) *AddrExpr {
|
||||||
|
|
|
||||||
|
|
@ -38,16 +38,16 @@ func (n *AddrExpr) doChildren(do func(Node) error) error {
|
||||||
var err error
|
var err error
|
||||||
err = maybeDoList(n.init, err, do)
|
err = maybeDoList(n.init, err, do)
|
||||||
err = maybeDo(n.X, err, do)
|
err = maybeDo(n.X, err, do)
|
||||||
if n.Alloc != nil {
|
if n.Prealloc != nil {
|
||||||
err = maybeDo(n.Alloc, err, do)
|
err = maybeDo(n.Prealloc, err, do)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
func (n *AddrExpr) editChildren(edit func(Node) Node) {
|
func (n *AddrExpr) editChildren(edit func(Node) Node) {
|
||||||
editList(n.init, edit)
|
editList(n.init, edit)
|
||||||
n.X = maybeEdit(n.X, edit)
|
n.X = maybeEdit(n.X, edit)
|
||||||
if n.Alloc != nil {
|
if n.Prealloc != nil {
|
||||||
n.Alloc = edit(n.Alloc).(*Name)
|
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ func walkClosure(clo *ir.ClosureExpr, init *ir.Nodes) ir.Node {
|
||||||
if !types.Identical(typ, x.Type()) {
|
if !types.Identical(typ, x.Type()) {
|
||||||
panic("closure type does not match order's assigned type")
|
panic("closure type does not match order's assigned type")
|
||||||
}
|
}
|
||||||
addr.Alloc = x
|
addr.Prealloc = x
|
||||||
clo.Prealloc = nil
|
clo.Prealloc = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,7 +189,7 @@ func walkCallPart(n *ir.SelectorExpr, init *ir.Nodes) ir.Node {
|
||||||
if !types.Identical(typ, x.Type()) {
|
if !types.Identical(typ, x.Type()) {
|
||||||
panic("partial call type does not match order's assigned type")
|
panic("partial call type does not match order's assigned type")
|
||||||
}
|
}
|
||||||
addr.Alloc = x
|
addr.Prealloc = x
|
||||||
n.Prealloc = nil
|
n.Prealloc = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -549,10 +549,10 @@ func anylit(n ir.Node, var_ ir.Node, init *ir.Nodes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var r ir.Node
|
var r ir.Node
|
||||||
if n.Alloc != nil {
|
if n.Prealloc != nil {
|
||||||
// n.Right is stack temporary used as backing store.
|
// n.Right is stack temporary used as backing store.
|
||||||
appendWalkStmt(init, ir.NewAssignStmt(base.Pos, n.Alloc, nil)) // zero backing store, just in case (#18410)
|
appendWalkStmt(init, ir.NewAssignStmt(base.Pos, n.Prealloc, nil)) // zero backing store, just in case (#18410)
|
||||||
r = typecheck.NodAddr(n.Alloc)
|
r = typecheck.NodAddr(n.Prealloc)
|
||||||
} else {
|
} else {
|
||||||
r = ir.NewUnaryExpr(base.Pos, ir.ONEW, ir.TypeNode(n.X.Type()))
|
r = ir.NewUnaryExpr(base.Pos, ir.ONEW, ir.TypeNode(n.X.Type()))
|
||||||
r.SetEsc(n.Esc())
|
r.SetEsc(n.Esc())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue