cmd/compile: eliminate PPARAMREF

As in the elimination of PHEAP|PPARAM in CL 23393,
this is something the front end can trivially take care of
and then not bother the back ends with.
It also eliminates some suspect (and only lightly exercised)
code paths in the back ends.

I don't have a smoking gun for this one but it seems
more clearly correct.

Change-Id: I3b3f5e669b3b81d091ff1e2fb13226a6f14c69d5
Reviewed-on: https://go-review.googlesource.com/23431
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
This commit is contained in:
Russ Cox 2016-05-25 10:29:50 -04:00
parent b6dc3e6f66
commit 20803b845f
16 changed files with 39 additions and 71 deletions

View file

@ -78,6 +78,7 @@ type Node struct {
const (
hasBreak = 1 << iota
notLiveAtEnd
isClosureParam
)
func (n *Node) HasBreak() bool {
@ -100,6 +101,16 @@ func (n *Node) SetNotLiveAtEnd(b bool) {
n.flags &^= notLiveAtEnd
}
}
func (n *Node) isClosureParam() bool {
return n.flags&isClosureParam != 0
}
func (n *Node) setIsClosureParam(b bool) {
if b {
n.flags |= isClosureParam
} else {
n.flags &^= isClosureParam
}
}
// Val returns the Val for the node.
func (n *Node) Val() Val {
@ -174,9 +185,9 @@ type Param struct {
// ONAME PPARAM
Field *Field // TFIELD in arg struct
// ONAME closure param with PPARAMREF
Outer *Node // outer PPARAMREF in nested closure
Closure *Node // ONAME/PAUTOHEAP <-> ONAME/PPARAMREF
// ONAME closure linkage
Outer *Node
Closure *Node
}
// Func holds Node fields used only with function-like nodes.