Commit e14e67ff authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: clean up one Node.Etype usage

Whoever Marvin is, we're one step closer to realizing his dream.

Change-Id: I8dece4417d0f9ec234be158d0ee7bc6735342d93
Reviewed-on: https://go-review.googlesource.com/27465
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent 874ea6a4
......@@ -365,8 +365,7 @@ func inlnode(n *Node) *Node {
case ODEFER, OPROC:
switch n.Left.Op {
case OCALLFUNC, OCALLMETH:
// TODO(marvin): Fix Node.EType type union.
n.Left.Etype = EType(n.Op)
n.Left.setNoInline(true)
}
fallthrough
......@@ -468,8 +467,7 @@ func inlnode(n *Node) *Node {
// switch at the top of this function.
switch n.Op {
case OCALLFUNC, OCALLMETH:
// TODO(marvin): Fix Node.EType type union.
if n.Etype == EType(OPROC) || n.Etype == EType(ODEFER) {
if n.noInline() {
return n
}
}
......
......@@ -80,6 +80,7 @@ const (
notLiveAtEnd
isClosureVar
isOutputParamHeapAddr
noInline // used internally by inliner to indicate that a function call should not be inlined; set for OCALLFUNC and OCALLMETH only
)
func (n *Node) HasBreak() bool {
......@@ -112,6 +113,16 @@ func (n *Node) setIsClosureVar(b bool) {
n.flags &^= isClosureVar
}
}
func (n *Node) noInline() bool {
return n.flags&noInline != 0
}
func (n *Node) setNoInline(b bool) {
if b {
n.flags |= noInline
} else {
n.flags &^= noInline
}
}
func (n *Node) IsOutputParamHeapAddr() bool {
return n.flags&isOutputParamHeapAddr != 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment