// findRegFor finds a register we can use to make a temp copy of type typ.
func (e *edgeState) findRegFor(typ *types.Type) Location {
// Which registers are possibilities.
- types := &e.s.f.Config.Types
m := e.s.compatRegs(typ)
// Pick a register. In priority order:
if !c.rematerializeable() {
x := e.p.NewValue1(c.Pos, OpStoreReg, c.Type, c)
// Allocate a temp location to spill a register to.
- // The type of the slot is immaterial - it will not be live across
- // any safepoint. Just use a type big enough to hold any register.
- t := LocalSlot{N: e.s.f.NewLocal(c.Pos, types.Int64), Type: types.Int64}
+ t := LocalSlot{N: e.s.f.NewLocal(c.Pos, c.Type), Type: c.Type}
// TODO: reuse these slots. They'll need to be erased first.
e.set(t, vid, x, false, c.Pos)
if e.s.f.pass.debug > regDebug {
func AutoVar(v *Value) (*ir.Name, int64) {
if loc, ok := v.Block.Func.RegAlloc[v.ID].(LocalSlot); ok {
if v.Type.Size() > loc.Type.Size() {
- v.Fatalf("spill/restore type %s doesn't fit in slot type %s", v.Type, loc.Type)
+ v.Fatalf("v%d: spill/restore type %v doesn't fit in slot type %v", v.ID, v.Type, loc.Type)
}
return loc.N, loc.Off
}