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: default avatarMatthew Dempsky <mdempsky@google.com>
parent 874ea6a4
...@@ -365,8 +365,7 @@ func inlnode(n *Node) *Node { ...@@ -365,8 +365,7 @@ func inlnode(n *Node) *Node {
case ODEFER, OPROC: case ODEFER, OPROC:
switch n.Left.Op { switch n.Left.Op {
case OCALLFUNC, OCALLMETH: case OCALLFUNC, OCALLMETH:
// TODO(marvin): Fix Node.EType type union. n.Left.setNoInline(true)
n.Left.Etype = EType(n.Op)
} }
fallthrough fallthrough
...@@ -468,8 +467,7 @@ func inlnode(n *Node) *Node { ...@@ -468,8 +467,7 @@ func inlnode(n *Node) *Node {
// switch at the top of this function. // switch at the top of this function.
switch n.Op { switch n.Op {
case OCALLFUNC, OCALLMETH: case OCALLFUNC, OCALLMETH:
// TODO(marvin): Fix Node.EType type union. if n.noInline() {
if n.Etype == EType(OPROC) || n.Etype == EType(ODEFER) {
return n return n
} }
} }
......
...@@ -80,6 +80,7 @@ const ( ...@@ -80,6 +80,7 @@ const (
notLiveAtEnd notLiveAtEnd
isClosureVar isClosureVar
isOutputParamHeapAddr 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 { func (n *Node) HasBreak() bool {
...@@ -112,6 +113,16 @@ func (n *Node) setIsClosureVar(b bool) { ...@@ -112,6 +113,16 @@ func (n *Node) setIsClosureVar(b bool) {
n.flags &^= isClosureVar 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 { func (n *Node) IsOutputParamHeapAddr() bool {
return n.flags&isOutputParamHeapAddr != 0 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