]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: remove "short" node header mode
authorRuss Cox <rsc@golang.org>
Fri, 4 Dec 2020 23:40:24 +0000 (18:40 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 7 Dec 2020 20:40:28 +0000 (20:40 +0000)
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 <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/escape.go
src/cmd/compile/internal/ir/fmt.go

index 32bc7b297b0c41da6f18d9aec89e7f66f95a48a0..a7458ab733fb27cc4db29ec89fc2f01e72600deb 100644 (file)
@@ -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())
index bc5536241ea1d39d23393ab6971aa20c3f4c4ae6..593e77880d959679b01e9a720579ed6690abd805 100644 (file)
@@ -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")
        }
 }