aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ir/node.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-01-16 16:59:19 -0800
committerMatthew Dempsky <mdempsky@google.com>2021-01-17 05:07:59 +0000
commit78e5aabcdb8aeae58a6437a3051fde3555ee0bf2 (patch)
treecf53ecab78c8b906a36969655d1bde33bcdb4d4e /src/cmd/compile/internal/ir/node.go
parent6de9423445840351a4cc7b17d732f0b5e922ef1a (diff)
downloadgo-78e5aabcdb8aeae58a6437a3051fde3555ee0bf2.tar.gz
go-78e5aabcdb8aeae58a6437a3051fde3555ee0bf2.zip
[dev.regabi] cmd/compile: replace Node.HasCall with walk.mayCall
After CL 284220, we now only need to detect expressions that contain function calls in the arguments list of further function calls. So we can simplify Node.HasCall/fncall/etc a lot. Instead of incrementally tracking whether an expression contains function calls all throughout walk, simply check once at the point of using an expression as a function call argument. Since any expression checked here will itself become a function call argument, it won't be checked again because we'll short circuit at the enclosing function call. Also, restructure the recursive walk code to use mayCall, and trim down the list of acceptable expressions. It should be okay to be stricter, since we'll now only see function call arguments and after they've already been walked. It's possible I was overly aggressive removing Ops here. But if so, we'll get an ICE, and it'll be easy to re-add them. I think this is better than the alternative of accidentally allowing expressions through that risk silently clobbering the stack. Passes toolstash -cmp. Change-Id: I585ef35dcccd9f4018e4bf2c3f9ccb1514a826f3 Reviewed-on: https://go-review.googlesource.com/c/go/+/284223 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/ir/node.go')
-rw-r--r--src/cmd/compile/internal/ir/node.go3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/ir/node.go b/src/cmd/compile/internal/ir/node.go
index de03800da24..a44bf42e781 100644
--- a/src/cmd/compile/internal/ir/node.go
+++ b/src/cmd/compile/internal/ir/node.go
@@ -52,8 +52,6 @@ type Node interface {
SetTypecheck(x uint8)
NonNil() bool
MarkNonNil()
- HasCall() bool
- SetHasCall(x bool)
}
// Line returns n's position as a string. If n has been inlined,
@@ -544,7 +542,6 @@ func InitExpr(init []Node, expr Node) Node {
}
n.PtrInit().Prepend(init...)
- n.SetHasCall(true)
return n
}