package abi
import (
+ "cmd/compile/internal/base"
"cmd/compile/internal/ir"
"cmd/compile/internal/types"
"cmd/internal/src"
// This will panic if "a" describes a register-allocated parameter.
func (a *ABIParamAssignment) Offset() int32 {
if len(a.Registers) > 0 {
- panic("Register allocated parameters have no offset")
+ base.Fatalf("register allocated parameters have no offset")
}
return a.offset
}
// spill area to help reduce stack sizes.)
func (a *ABIParamAssignment) FrameOffset(i *ABIParamResultInfo) int64 {
if a.offset == -1 {
- panic("Function parameter has no ABI-defined frame-pointer offset")
+ base.Fatalf("function parameter has no ABI-defined frame-pointer offset")
}
if len(a.Registers) == 0 { // passed on stack
return int64(a.offset) - i.config.LocalsOffset()
func (config *ABIConfig) ABIAnalyze(t *types.Type, setNname bool) *ABIParamResultInfo {
ft := t.FuncType()
result := config.ABIAnalyzeFuncType(ft)
+
// Fill in the frame offsets for receiver, inputs, results
k := 0
if t.NumRecvs() != 0 {
f.Nname.(*ir.Name).SetIsOutputParamInRegisters(false)
}
} else if fOffset != off {
- panic(fmt.Errorf("Offset changed from %d to %d", fOffset, off))
+ base.Fatalf("offset for %s at %s changed from %d to %d", f.Sym.Name, base.FmtPos(f.Pos), fOffset, off)
}
} else {
if setNname && f.Nname != nil {
return state.allocateRegs(regs, synthIface)
}
}
- panic(fmt.Errorf("Was not expecting type %s", t))
+ base.Fatalf("was not expecting type %s", t)
+ panic("unreachable")
}
// regAllocate creates a register ABIParamAssignment object for a param
case types.TINTER:
return state.regassignStruct(synthIface)
default:
- panic("not expected")
+ base.Fatalf("not expected")
+ panic("unreachable")
}
}
func (state *assignState) assignParamOrReturn(pt *types.Type, n types.Object, isReturn bool) ABIParamAssignment {
state.pUsed = RegAmounts{}
if pt.Width == types.BADWIDTH {
- panic("should never happen")
+ base.Fatalf("should never happen")
+ panic("unreachable")
} else if pt.Width == 0 {
return state.stackAllocate(pt, n)
} else if state.regassign(pt) {
if len(fn.Body) == 0 {
// Initialize ABI wrappers if necessary.
ssagen.InitLSym(fn, false)
- types.CalcSize(fn.Type()) // TODO register args; remove this once all is done by abiutils
+ types.CalcSize(fn.Type())
a := ssagen.AbiForBodylessFuncStackMap(fn)
- abiInfo := a.ABIAnalyze(fn.Type(), true) // will set parameter spill/home locations correctly
+ abiInfo := a.ABIAnalyzeFuncType(fn.Type().FuncType()) // abiInfo has spill/home locations for wrapper
liveness.WriteFuncMap(fn, abiInfo)
return
}