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

     1  // Copyright 2020 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 devirtualize implements two "devirtualization" optimization passes:
     6  //
     7  //   - "Static" devirtualization which replaces interface method calls with
     8  //     direct concrete-type method calls where possible.
     9  //   - "Profile-guided" devirtualization which replaces indirect calls with a
    10  //     conditional direct call to the hottest concrete callee from a profile, as
    11  //     well as a fallback using the original indirect call.
    12  package devirtualize
    13  
    14  import (
    15  	"github.com/shogo82148/std/cmd/compile/internal/ir"
    16  )
    17  
    18  // StaticCall devirtualizes the given call if possible when the concrete callee
    19  // is available statically.
    20  func StaticCall(call *ir.CallExpr)