"cmd/internal/obj"
"fmt"
"sort"
+ "strings"
)
const (
bb := newblock(firstp)
cfg = append(cfg, bb)
- for p := firstp; p != nil; p = p.Link {
+ for p := firstp; p != nil && p.As != obj.AEND; p = p.Link {
Thearch.Proginfo(p)
if p.To.Type == obj.TYPE_BRANCH {
if p.To.Val == nil {
// contained instructions until a label is reached. Add edges
// for branches and fall-through instructions.
for _, bb := range cfg {
- for p := bb.last; p != nil; p = p.Link {
+ for p := bb.last; p != nil && p.As != obj.AEND; p = p.Link {
if p.Opt != nil && p != bb.last {
break
}
// Stop before an unreachable RET, to avoid creating
// unreachable control flow nodes.
if p.Link != nil && p.Link.As == obj.ARET && p.Link.Mode == 1 {
+ // TODO: remove after SSA is done. SSA does not
+ // generate any unreachable RET instructions.
break
}
}
n = lv.vars[j]
if n.Class != PPARAM {
- yyerrorl(int(p.Lineno), "internal error: %v %v recorded as live on entry", Curfn.Func.Nname, Nconv(n, obj.FmtLong))
+ yyerrorl(int(p.Lineno), "internal error: %v %v recorded as live on entry, p.Pc=%v", Curfn.Func.Nname, Nconv(n, obj.FmtLong), p.Pc)
}
}
}
if msg != nil {
fmt_ = ""
fmt_ += fmt.Sprintf("%v: live at ", p.Line())
- if p.As == obj.ACALL && p.To.Node != nil {
- fmt_ += fmt.Sprintf("call to %s:", ((p.To.Node).(*Node)).Sym.Name)
+ if p.As == obj.ACALL && p.To.Sym != nil {
+ name := p.To.Sym.Name
+ i := strings.Index(name, ".")
+ if i >= 0 {
+ name = name[i+1:]
+ }
+ fmt_ += fmt.Sprintf("call to %s:", name)
} else if p.As == obj.ACALL {
fmt_ += "indirect call:"
} else {