An *ir.Func is always ODCLFUNC, so no need to double-check this
anymore. The type system statically ensures we have the right Op.
Also, pkginit.initRequiredForCoverage appears to be unused, so we can
get rid of it completely.
Change-Id: If1abb35672b40f705f23c365ad2a828c2661e9c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/520603
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
// Batch performs escape analysis on a minimal batch of
// functions.
func Batch(fns []*ir.Func, recursive bool) {
- for _, fn := range fns {
- if fn.Op() != ir.ODCLFUNC {
- base.Fatalf("unexpected node: %v", fn)
- }
- }
-
var b batch
b.heapLoc.attrs = attrEscapes | attrPersists | attrMutates | attrCalls
b.mutatorLoc.attrs = attrMutates
// It's not quite read only, the state field must be modifiable.
objw.Global(lsym, int32(ot), obj.NOPTR)
}
-
-// initRequiredForCoverage returns TRUE if we need to force creation
-// of an init function for the package so as to insert a coverage
-// runtime registration call.
-func initRequiredForCoverage(l []ir.Node) bool {
- if base.Flag.Cfg.CoverageInfo == nil {
- return false
- }
- for _, n := range l {
- if n.Op() == ir.ODCLFUNC {
- return true
- }
- }
- return false
-}
default:
base.Fatalf("expected ONAME or OCLOSURE node, got %+v", arg)
}
- if callee.Op() != ir.ODCLFUNC {
- base.Fatalf("expected ODCLFUNC node, got %+v", callee)
- }
c.extraCalls[c.curfn] = append(c.extraCalls[c.curfn], nowritebarrierrecCall{callee, n.Pos()})
}