Imports #
"cmd/compile/internal/base"
"cmd/compile/internal/devirtualize"
"cmd/compile/internal/inline"
"cmd/compile/internal/inline/inlheur"
"cmd/compile/internal/ir"
"cmd/compile/internal/pgoir"
"cmd/compile/internal/typecheck"
"fmt"
"cmd/compile/internal/base"
"cmd/compile/internal/devirtualize"
"cmd/compile/internal/inline"
"cmd/compile/internal/inline/inlheur"
"cmd/compile/internal/ir"
"cmd/compile/internal/pgoir"
"cmd/compile/internal/typecheck"
"fmt"
type callSite struct {
fn *ir.Func
whichParen int
}
type inlClosureState struct {
fn *ir.Func
profile *pgoir.Profile
callSites map[*ir.ParenExpr]bool
resolved []*ir.Func
useCounts map[*ir.Func]int
parens []*ir.ParenExpr
bigCaller bool
}
DevirtualizeAndInlineFunc interleaves devirtualization and inlining on a single function.
func DevirtualizeAndInlineFunc(fn *ir.Func, profile *pgoir.Profile)
DevirtualizeAndInlinePackage interleaves devirtualization and inlining on all functions within pkg.
func DevirtualizeAndInlinePackage(pkg *ir.Package, profile *pgoir.Profile)
func (s *inlClosureState) edit(i int) ir.Node
fixpoint repeatedly edits a function until it stabilizes, returning whether anything changed in any of the fixpoint iterations. It applies s.edit(n) to each node n within the parentheses in s.parens. If s.edit(n) returns nil, no change is made. Otherwise, the result replaces n in fn's body, and fixpoint iterates at least once more. After an iteration where all edit calls return nil, fixpoint returns.
func (s *inlClosureState) fixpoint() bool
isTestingBLoop returns true if it matches the node as a testing.(*B).Loop. See issue #61515.
func isTestingBLoop(t ir.Node) bool
Mark inserts parentheses, and is called repeatedly. These inserted parentheses mark the call sites where inlining will be attempted.
func (s *inlClosureState) mark(n ir.Node) ir.Node
func match(n ir.Node) bool
parenthesize applies s.mark to all the nodes within s.fn to mark calls and simplify rewriting them in place.
func (s *inlClosureState) parenthesize()
resolve attempts to resolve a call to a potentially inlineable callee and updates use counts on the callees. Returns the call site count for that callee.
func (s *inlClosureState) resolve(i int) (*ir.Func, int)
func (s *inlClosureState) unparenthesize()
Generated with Arrow