From: Russ Cox Date: Fri, 4 Dec 2020 23:40:24 +0000 (-0500) Subject: [dev.regabi] cmd/compile: remove "short" node header mode X-Git-Tag: go1.17beta1~1539^2~357 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a79742f39a;p=gostls13.git [dev.regabi] cmd/compile: remove "short" node header mode This is unreachable code - the only way short can be true is if verb == 'S', but jconv is only called when verb == 'j'. Simplify by removing. Passes buildall w/ toolstash -cmp. Change-Id: I27bd38319f72215069e940b320b5c82608e2651a Reviewed-on: https://go-review.googlesource.com/c/go/+/275772 Trust: Russ Cox Reviewed-by: Matthew Dempsky --- diff --git a/src/cmd/compile/internal/gc/escape.go b/src/cmd/compile/internal/gc/escape.go index 32bc7b297b..a7458ab733 100644 --- a/src/cmd/compile/internal/gc/escape.go +++ b/src/cmd/compile/internal/gc/escape.go @@ -148,7 +148,7 @@ func init() { } // escFmt is called from node printing to print information about escape analysis results. -func escFmt(n ir.Node, short bool) string { +func escFmt(n ir.Node) string { text := "" switch n.Esc() { case EscUnknown: @@ -161,9 +161,7 @@ func escFmt(n ir.Node, short bool) string { text = "esc(no)" case EscNever: - if !short { - text = "esc(N)" - } + text = "esc(N)" default: text = fmt.Sprintf("esc(%d)", n.Esc()) diff --git a/src/cmd/compile/internal/ir/fmt.go b/src/cmd/compile/internal/ir/fmt.go index bc5536241e..593e77880d 100644 --- a/src/cmd/compile/internal/ir/fmt.go +++ b/src/cmd/compile/internal/ir/fmt.go @@ -339,21 +339,19 @@ func nodeFormat(n Node, s fmt.State, verb rune, mode FmtMode) { } // EscFmt is set by the escape analysis code to add escape analysis details to the node print. -var EscFmt func(n Node, short bool) string +var EscFmt func(n Node) string // *Node details func jconvFmt(n Node, s fmt.State, flag FmtFlag) { - short := flag&FmtShort != 0 - // Useful to see which nodes in an AST printout are actually identical if base.Debug.DumpPtrs != 0 { fmt.Fprintf(s, " p(%p)", n) } - if !short && n.Name() != nil && n.Name().Vargen != 0 { + if n.Name() != nil && n.Name().Vargen != 0 { fmt.Fprintf(s, " g(%d)", n.Name().Vargen) } - if base.Debug.DumpPtrs != 0 && !short && n.Name() != nil && n.Name().Defn != nil { + if base.Debug.DumpPtrs != 0 && n.Name() != nil && n.Name().Defn != nil { // Useful to see where Defn is set and what node it points to fmt.Fprintf(s, " defn(%p)", n.Name().Defn) } @@ -369,7 +367,7 @@ func jconvFmt(n Node, s fmt.State, flag FmtFlag) { fmt.Fprintf(s, " l(%s%d)", pfx, n.Pos().Line()) } - if !short && n.Offset() != types.BADWIDTH { + if n.Offset() != types.BADWIDTH { fmt.Fprintf(s, " x(%d)", n.Offset()) } @@ -382,12 +380,12 @@ func jconvFmt(n Node, s fmt.State, flag FmtFlag) { } if EscFmt != nil { - if esc := EscFmt(n, short); esc != "" { + if esc := EscFmt(n); esc != "" { fmt.Fprintf(s, " %s", esc) } } - if !short && n.Typecheck() != 0 { + if n.Typecheck() != 0 { fmt.Fprintf(s, " tc(%d)", n.Typecheck()) } @@ -423,11 +421,11 @@ func jconvFmt(n Node, s fmt.State, flag FmtFlag) { fmt.Fprint(s, " nonnil") } - if !short && n.HasCall() { + if n.HasCall() { fmt.Fprint(s, " hascall") } - if !short && n.Name() != nil && n.Name().Used() { + if n.Name() != nil && n.Name().Used() { fmt.Fprint(s, " used") } }