1
2
3
4
5 package ssa
6
7 import (
8 "sort"
9
10 "cmd/internal/obj"
11 )
12
13
14
15 type Cache struct {
16
17 values [2000]Value
18 blocks [200]Block
19 Locs [2000]Location
20
21
22
23 stackAllocState *StackAllocState
24
25 scrPoset []*Poset
26
27
28 RegallocValues []ValState
29
30 ValueToProgAfter []*obj.Prog
31 DebugState DebugState
32
33 Liveness any
34
35
36
37 hdrValueSlice []*[]*Value
38 hdrLimitSlice []*[]Limit
39 }
40
41 func (c *Cache) Reset() {
42 nv := sort.Search(len(c.values), func(i int) bool { return c.values[i].ID == 0 })
43 clear(c.values[:nv])
44 nb := sort.Search(len(c.blocks), func(i int) bool { return c.blocks[i].ID == 0 })
45 clear(c.blocks[:nb])
46 nl := sort.Search(len(c.Locs), func(i int) bool { return c.Locs[i] == nil })
47 clear(c.Locs[:nl])
48
49
50
51 clear(c.RegallocValues)
52 }
53
View as plain text