]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/inline/inlheur/callsite.go
cmd/compile/internal/inline: rework call scoring for non-inlinable funcs
[gostls13.git] / src / cmd / compile / internal / inline / inlheur / callsite.go
index 5b75a672437f236ff6a3ca2c843435c351f4cef2..d62215cb37cf7cbb9fd04a61e7bd249430d6c5b6 100644 (file)
@@ -41,17 +41,6 @@ type CallSite struct {
 // with many calls that share the same auto-generated pos.
 type CallSiteTab map[*ir.CallExpr]*CallSite
 
-// Package-level table of callsites.
-var cstab = CallSiteTab{}
-
-func GetCallSiteScore(ce *ir.CallExpr) (bool, int) {
-       cs, ok := cstab[ce]
-       if !ok {
-               return false, 0
-       }
-       return true, cs.Score
-}
-
 type CSPropBits uint32
 
 const (
@@ -98,7 +87,7 @@ func fmtFullPos(p src.XPos) string {
        return sb.String()
 }
 
-func encodeCallSiteKey(cs *CallSite) string {
+func EncodeCallSiteKey(cs *CallSite) string {
        var sb strings.Builder
        // FIXME: maybe rewrite line offsets relative to function start?
        sb.WriteString(fmtFullPos(cs.Call.Pos()))
@@ -109,7 +98,7 @@ func encodeCallSiteKey(cs *CallSite) string {
 func buildEncodedCallSiteTab(tab CallSiteTab) encodedCallSiteTab {
        r := make(encodedCallSiteTab)
        for _, cs := range tab {
-               k := encodeCallSiteKey(cs)
+               k := EncodeCallSiteKey(cs)
                r[k] = propsAndScore{
                        props: cs.Flags,
                        score: cs.Score,