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