type edge … type Allocator … // NewAllocator builds an allocator for the given physical registers. func NewAllocator(rs []reg.Physical) (*Allocator, error) { … } // NewAllocatorForKind builds an allocator for the given kind of registers. func NewAllocatorForKind(k reg.Kind) (*Allocator, error) { … } // SetPriority sets the priority of the given regiser to p. Higher priority // registers are preferred in allocations. By default all registers have 0 // priority. Priority will only apply to subsequent Add() calls, therefore // typically all SetPriority calls should happen at allocator initialization. func (a *Allocator) SetPriority(id reg.ID, p int) { … } // sortregisters sorts the list of available registers: higher priority first, // falling back to sorting by ID. func (a *Allocator) sortregisters() { … } // AddInterferenceSet records that r interferes with every register in s. Convenience wrapper around AddInterference. func (a *Allocator) AddInterferenceSet(r reg.Register, s reg.MaskSet) { … } // AddInterference records that x and y must be assigned to non-conflicting physical registers. func (a *Allocator) AddInterference(x, y reg.ID) { … } // Add adds a register to be allocated. Does nothing if the register has already been added. func (a *Allocator) Add(v reg.ID) { … } // Allocate allocates physical registers. func (a *Allocator) Allocate() (reg.Allocation, error) { … } // update possible allocations based on edges. func (a *Allocator) update() error { … } // mostrestricted returns the virtual register with the least possibilities. func (a *Allocator) mostrestricted() reg.ID { … } // discardconflicting removes registers from vs possible list that conflict with p. func (a *Allocator) discardconflicting(v, p reg.ID) { … } // alloc attempts to allocate a register to v. func (a *Allocator) alloc(v reg.ID) error { … } // remaining returns the number of unallocated registers. func (a *Allocator) remaining() int { … } // possibleregisters returns all allocate-able registers for the given virtual. func (a *Allocator) possibleregisters(v reg.ID) []reg.ID { … } func filterregisters(in []reg.ID, predicate func(reg.ID) bool) []reg.ID { … }