Commit 5c5f2a73 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

[dev.ssa] cmd/compile: convert localOffset panic to unimplemented

This prevents panics while attempting to generate code
for the runtime package. Now:

<unknown line number>: internal compiler error: localOffset of non-LocalSlot value: v10 = ADDQconst <*m> [256] v22

Change-Id: I20ed6ec6aae2c91183b8c826b8ebcc98e8ceebff
Reviewed-on: https://go-review.googlesource.com/12655Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent 8d31df18
...@@ -1911,8 +1911,15 @@ func regnum(v *ssa.Value) int16 { ...@@ -1911,8 +1911,15 @@ func regnum(v *ssa.Value) int16 {
// localOffset returns the offset below the frame pointer where // localOffset returns the offset below the frame pointer where
// a stack-allocated local has been allocated. Panics if v // a stack-allocated local has been allocated. Panics if v
// is not assigned to a local slot. // is not assigned to a local slot.
// TODO: Make this panic again once it stops happening routinely.
func localOffset(v *ssa.Value) int64 { func localOffset(v *ssa.Value) int64 {
return v.Block.Func.RegAlloc[v.ID].(*ssa.LocalSlot).Idx reg := v.Block.Func.RegAlloc[v.ID]
slot, ok := reg.(*ssa.LocalSlot)
if !ok {
v.Unimplementedf("localOffset of non-LocalSlot value: %s", v.LongString())
return 0
}
return slot.Idx
} }
// ssaExport exports a bunch of compiler services for the ssa backend. // ssaExport exports a bunch of compiler services for the ssa backend.
......
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