9
9
"cmd/compile/internal/inline"
10
10
"cmd/compile/internal/ir"
11
11
"cmd/compile/internal/logopt"
12
- "cmd/compile/internal/pgo "
12
+ "cmd/compile/internal/pgoir "
13
13
"cmd/compile/internal/typecheck"
14
14
"cmd/compile/internal/types"
15
15
"cmd/internal/obj"
@@ -102,7 +102,7 @@ type CallStat struct {
102
102
//
103
103
// The primary benefit of this transformation is enabling inlining of the
104
104
// direct call.
105
- func ProfileGuided (fn * ir.Func , p * pgo .Profile ) {
105
+ func ProfileGuided (fn * ir.Func , p * pgoir .Profile ) {
106
106
ir .CurFunc = fn
107
107
108
108
name := ir .LinkFuncName (fn )
@@ -184,7 +184,7 @@ func ProfileGuided(fn *ir.Func, p *pgo.Profile) {
184
184
// Devirtualize interface call if possible and eligible. Returns the new
185
185
// ir.Node if call was devirtualized, and if so also the callee and weight of
186
186
// the devirtualized edge.
187
- func maybeDevirtualizeInterfaceCall (p * pgo .Profile , fn * ir.Func , call * ir.CallExpr ) (ir.Node , * ir.Func , int64 ) {
187
+ func maybeDevirtualizeInterfaceCall (p * pgoir .Profile , fn * ir.Func , call * ir.CallExpr ) (ir.Node , * ir.Func , int64 ) {
188
188
if base .Debug .PGODevirtualize < 1 {
189
189
return nil , nil , 0
190
190
}
@@ -214,13 +214,13 @@ func maybeDevirtualizeInterfaceCall(p *pgo.Profile, fn *ir.Func, call *ir.CallEx
214
214
// Devirtualize an indirect function call if possible and eligible. Returns the new
215
215
// ir.Node if call was devirtualized, and if so also the callee and weight of
216
216
// the devirtualized edge.
217
- func maybeDevirtualizeFunctionCall (p * pgo .Profile , fn * ir.Func , call * ir.CallExpr ) (ir.Node , * ir.Func , int64 ) {
217
+ func maybeDevirtualizeFunctionCall (p * pgoir .Profile , fn * ir.Func , call * ir.CallExpr ) (ir.Node , * ir.Func , int64 ) {
218
218
if base .Debug .PGODevirtualize < 2 {
219
219
return nil , nil , 0
220
220
}
221
221
222
222
// Bail if this is a direct call; no devirtualization necessary.
223
- callee := pgo .DirectCallee (call .Fun )
223
+ callee := pgoir .DirectCallee (call .Fun )
224
224
if callee != nil {
225
225
return nil , nil , 0
226
226
}
@@ -309,7 +309,7 @@ func shouldPGODevirt(fn *ir.Func) bool {
309
309
fmt .Printf ("%v: should not PGO devirtualize %v: %s\n " , ir .Line (fn ), ir .FuncName (fn ), reason )
310
310
}
311
311
if logopt .Enabled () {
312
- logopt .LogOpt (fn .Pos (), ": should not PGO devirtualize function" , "pgo -devirtualize" , ir .FuncName (fn ), reason )
312
+ logopt .LogOpt (fn .Pos (), ": should not PGO devirtualize function" , "pgoir -devirtualize" , ir .FuncName (fn ), reason )
313
313
}
314
314
}
315
315
}()
@@ -336,7 +336,7 @@ func shouldPGODevirt(fn *ir.Func) bool {
336
336
// constructCallStat builds an initial CallStat describing this call, for
337
337
// logging. If the call is devirtualized, the devirtualization fields should be
338
338
// updated.
339
- func constructCallStat (p * pgo .Profile , fn * ir.Func , name string , call * ir.CallExpr ) * CallStat {
339
+ func constructCallStat (p * pgoir .Profile , fn * ir.Func , name string , call * ir.CallExpr ) * CallStat {
340
340
switch call .Op () {
341
341
case ir .OCALLFUNC , ir .OCALLINTER , ir .OCALLMETH :
342
342
default :
@@ -350,9 +350,9 @@ func constructCallStat(p *pgo.Profile, fn *ir.Func, name string, call *ir.CallEx
350
350
Caller : name ,
351
351
}
352
352
353
- offset := pgo .NodeLineOffset (call , fn )
353
+ offset := pgoir .NodeLineOffset (call , fn )
354
354
355
- hotter := func (e * pgo .IREdge ) bool {
355
+ hotter := func (e * pgoir .IREdge ) bool {
356
356
if stat .Hottest == "" {
357
357
return true
358
358
}
@@ -384,7 +384,7 @@ func constructCallStat(p *pgo.Profile, fn *ir.Func, name string, call *ir.CallEx
384
384
case ir .OCALLFUNC :
385
385
stat .Interface = false
386
386
387
- callee := pgo .DirectCallee (call .Fun )
387
+ callee := pgoir .DirectCallee (call .Fun )
388
388
if callee != nil {
389
389
stat .Direct = true
390
390
if stat .Hottest == "" {
@@ -651,20 +651,20 @@ func interfaceCallRecvTypeAndMethod(call *ir.CallExpr) (*types.Type, *types.Sym)
651
651
// if available, and its edge weight. extraFn can perform additional
652
652
// applicability checks on each candidate edge. If extraFn returns false,
653
653
// candidate will not be considered a valid callee candidate.
654
- func findHotConcreteCallee (p * pgo .Profile , caller * ir.Func , call * ir.CallExpr , extraFn func (callerName string , callOffset int , candidate * pgo .IREdge ) bool ) (* ir.Func , int64 ) {
654
+ func findHotConcreteCallee (p * pgoir .Profile , caller * ir.Func , call * ir.CallExpr , extraFn func (callerName string , callOffset int , candidate * pgoir .IREdge ) bool ) (* ir.Func , int64 ) {
655
655
callerName := ir .LinkFuncName (caller )
656
656
callerNode := p .WeightedCG .IRNodes [callerName ]
657
- callOffset := pgo .NodeLineOffset (call , caller )
657
+ callOffset := pgoir .NodeLineOffset (call , caller )
658
658
659
- var hottest * pgo .IREdge
659
+ var hottest * pgoir .IREdge
660
660
661
661
// Returns true if e is hotter than hottest.
662
662
//
663
663
// Naively this is just e.Weight > hottest.Weight, but because OutEdges
664
664
// has arbitrary iteration order, we need to apply additional sort
665
665
// criteria when e.Weight == hottest.Weight to ensure we have stable
666
666
// selection.
667
- hotter := func (e * pgo .IREdge ) bool {
667
+ hotter := func (e * pgoir .IREdge ) bool {
668
668
if hottest == nil {
669
669
return true
670
670
}
@@ -747,10 +747,10 @@ func findHotConcreteCallee(p *pgo.Profile, caller *ir.Func, call *ir.CallExpr, e
747
747
748
748
// findHotConcreteInterfaceCallee returns the *ir.Func of the hottest callee of an
749
749
// interface call, if available, and its edge weight.
750
- func findHotConcreteInterfaceCallee (p * pgo .Profile , caller * ir.Func , call * ir.CallExpr ) (* ir.Func , int64 ) {
750
+ func findHotConcreteInterfaceCallee (p * pgoir .Profile , caller * ir.Func , call * ir.CallExpr ) (* ir.Func , int64 ) {
751
751
inter , method := interfaceCallRecvTypeAndMethod (call )
752
752
753
- return findHotConcreteCallee (p , caller , call , func (callerName string , callOffset int , e * pgo .IREdge ) bool {
753
+ return findHotConcreteCallee (p , caller , call , func (callerName string , callOffset int , e * pgoir .IREdge ) bool {
754
754
ctyp := methodRecvType (e .Dst .AST )
755
755
if ctyp == nil {
756
756
// Not a method.
@@ -795,10 +795,10 @@ func findHotConcreteInterfaceCallee(p *pgo.Profile, caller *ir.Func, call *ir.Ca
795
795
796
796
// findHotConcreteFunctionCallee returns the *ir.Func of the hottest callee of an
797
797
// indirect function call, if available, and its edge weight.
798
- func findHotConcreteFunctionCallee (p * pgo .Profile , caller * ir.Func , call * ir.CallExpr ) (* ir.Func , int64 ) {
798
+ func findHotConcreteFunctionCallee (p * pgoir .Profile , caller * ir.Func , call * ir.CallExpr ) (* ir.Func , int64 ) {
799
799
typ := call .Fun .Type ().Underlying ()
800
800
801
- return findHotConcreteCallee (p , caller , call , func (callerName string , callOffset int , e * pgo .IREdge ) bool {
801
+ return findHotConcreteCallee (p , caller , call , func (callerName string , callOffset int , e * pgoir .IREdge ) bool {
802
802
ctyp := e .Dst .AST .Type ().Underlying ()
803
803
804
804
// If ctyp doesn't match typ it is most likely from a different
0 commit comments