github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/ssa/cache.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package ssa 6 7 import ( 8 "github.com/shogo82148/std/cmd/internal/obj" 9 ) 10 11 // A Cache holds reusable compiler state. 12 // It is intended to be re-used for multiple Func compilations. 13 type Cache struct { 14 // Storage for low-numbered values and blocks. 15 values [2000]Value 16 blocks [200]Block 17 locs [2000]Location 18 19 // Reusable stackAllocState. 20 // See stackalloc.go's {new,put}StackAllocState. 21 stackAllocState *stackAllocState 22 23 scrPoset []*poset 24 25 // Reusable regalloc state. 26 regallocValues []valState 27 28 ValueToProgAfter []*obj.Prog 29 debugState debugState 30 31 Liveness interface{} 32 33 // Free "headers" for use by the allocators in allocators.go. 34 // Used to put slices in sync.Pools without allocation. 35 hdrValueSlice []*[]*Value 36 hdrInt64Slice []*[]int64 37 } 38 39 func (c *Cache) Reset()