1
2
3
4
5
6
7 package ssacompile
8
9 import (
10 "fmt"
11
12 "cmd/compile/internal/ssa"
13 )
14
15
16
17
18 func stackalloc(f *ssa.Func, spillLive [][]ssa.ID) [][]ssa.ID {
19 if f.Pass.Debug > ssa.StackDebug {
20 fmt.Println("before stackalloc")
21 fmt.Println(f.String())
22 }
23 s := ssa.NewStackAllocState(f)
24 s.Init(f, spillLive)
25 defer ssa.PutStackAllocState(s)
26
27 s.Stackalloc()
28 if f.Pass.Stats > 0 {
29 f.LogStat("stack_alloc_stats",
30 s.NArgSlot, "arg_slots", s.NNotNeed, "slot_not_needed",
31 s.NNamedSlot, "named_slots", s.NAuto, "auto_slots",
32 s.NReuse, "reused_slots", s.NSelfInterfere, "self_interfering")
33 }
34
35 return s.Live
36 }
37
View as plain text