Commit e1395498 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

[dev.ssa] cmd/compile: provide better errors for regnum and localOffset failures

Change-Id: I2667b0923e17df7cbf08e34ebec1b69a0f2f02b2
Reviewed-on: https://go-review.googlesource.com/13265Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent e5fe33e5
......@@ -2398,8 +2398,14 @@ func regMoveAMD64(width int64) int {
// regnum returns the register (in cmd/internal/obj numbering) to
// which v has been allocated. Panics if v is not assigned to a
// register.
// TODO: Make this panic again once it stops happening routinely.
func regnum(v *ssa.Value) int16 {
return ssaRegToReg[v.Block.Func.RegAlloc[v.ID].(*ssa.Register).Num]
reg := v.Block.Func.RegAlloc[v.ID]
if reg == nil {
v.Unimplementedf("nil regnum for value: %s\n%s\n", v.LongString(), v.Block.Func)
return 0
}
return ssaRegToReg[reg.(*ssa.Register).Num]
}
// localOffset returns the offset below the frame pointer where
......@@ -2410,7 +2416,7 @@ func localOffset(v *ssa.Value) int64 {
reg := v.Block.Func.RegAlloc[v.ID]
slot, ok := reg.(*ssa.LocalSlot)
if !ok {
v.Unimplementedf("localOffset of non-LocalSlot value: %s", v.LongString())
v.Unimplementedf("localOffset of non-LocalSlot value: %s\n%s\n", v.LongString(), v.Block.Func)
return 0
}
return slot.Idx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment