github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/inline/inlheur/analyze.go (about)

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package inlheur
     6  
     7  import (
     8  	"github.com/shogo82148/std/cmd/compile/internal/ir"
     9  )
    10  
    11  // AnalyzeFunc computes function properties for fn and its contained
    12  // closures, updating the global 'fpmap' table. It is assumed that
    13  // "CanInline" has been run on fn and on the closures that feed
    14  // directly into calls; other closures not directly called will also
    15  // be checked inlinability for inlinability here in case they are
    16  // returned as a result.
    17  func AnalyzeFunc(fn *ir.Func, canInline func(*ir.Func), budgetForFunc func(*ir.Func) int32, inlineMaxBudget int)
    18  
    19  // TearDown is invoked at the end of the main inlining pass; doing
    20  // function analysis and call site scoring is unlikely to help a lot
    21  // after this point, so nil out fpmap and other globals to reclaim
    22  // storage.
    23  func TearDown()
    24  
    25  func Enabled() bool
    26  
    27  func UnitTesting() bool
    28  
    29  // DumpFuncProps computes and caches function properties for the func
    30  // 'fn', writing out a description of the previously computed set of
    31  // properties to the file given in 'dumpfile'. Used for the
    32  // "-d=dumpinlfuncprops=..." command line flag, intended for use
    33  // primarily in unit testing.
    34  func DumpFuncProps(fn *ir.Func, dumpfile string)