]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: change the type of ssa Warnl line number
authorTodd Neal <todd@tneal.org>
Mon, 14 Mar 2016 04:04:31 +0000 (23:04 -0500)
committerTodd Neal <todd@tneal.org>
Mon, 14 Mar 2016 11:04:40 +0000 (11:04 +0000)
Line numbers are always int32, so the Warnl function should take the
line number as an int32 as well.  This matches gc.Warnl and removes
a cast every place it's used.

Change-Id: I5d6201e640d52ec390eb7174f8fd8c438d4efe58
Reviewed-on: https://go-review.googlesource.com/20662
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/ssa/config.go
src/cmd/compile/internal/ssa/export_test.go
src/cmd/compile/internal/ssa/func.go
src/cmd/compile/internal/ssa/likelyadjust.go
src/cmd/compile/internal/ssa/nilcheck.go
src/cmd/compile/internal/ssa/phiopt.go
src/cmd/compile/internal/ssa/prove.go

index b6d15c4a7ea17810a20d9c717efac6fbf8dd8061..6a0947feac79b25b571ff2383f847c073841c645 100644 (file)
@@ -317,8 +317,8 @@ func (s *state) Fatalf(msg string, args ...interface{}) { s.config.Fatalf(s.peek
 func (s *state) Unimplementedf(msg string, args ...interface{}) {
        s.config.Unimplementedf(s.peekLine(), msg, args...)
 }
-func (s *state) Warnl(line int, msg string, args ...interface{}) { s.config.Warnl(line, msg, args...) }
-func (s *state) Debug_checknil() bool                            { return s.config.Debug_checknil() }
+func (s *state) Warnl(line int32, msg string, args ...interface{}) { s.config.Warnl(line, msg, args...) }
+func (s *state) Debug_checknil() bool                              { return s.config.Debug_checknil() }
 
 var (
        // dummy node for the memory variable
@@ -5229,8 +5229,8 @@ func (e *ssaExport) Unimplementedf(line int32, msg string, args ...interface{})
 
 // Warnl reports a "warning", which is usually flag-triggered
 // logging output for the benefit of tests.
-func (e *ssaExport) Warnl(line int, fmt_ string, args ...interface{}) {
-       Warnl(int32(line), fmt_, args...)
+func (e *ssaExport) Warnl(line int32, fmt_ string, args ...interface{}) {
+       Warnl(line, fmt_, args...)
 }
 
 func (e *ssaExport) Debug_checknil() bool {
index 5e54f4f96f3ff2945bf1b77ec62b2fa0abcc1ba1..e7f4aece2a5bc82ffa86518d8e09ab521d7e4fb1 100644 (file)
@@ -75,7 +75,7 @@ type Logger interface {
        Unimplementedf(line int32, msg string, args ...interface{})
 
        // Warnl writes compiler messages in the form expected by "errorcheck" tests
-       Warnl(line int, fmt_ string, args ...interface{})
+       Warnl(line int32, fmt_ string, args ...interface{})
 
        // Fowards the Debug_checknil flag from gc
        Debug_checknil() bool
@@ -162,8 +162,8 @@ func (c *Config) Fatalf(line int32, msg string, args ...interface{}) { c.fe.Fata
 func (c *Config) Unimplementedf(line int32, msg string, args ...interface{}) {
        c.fe.Unimplementedf(line, msg, args...)
 }
-func (c *Config) Warnl(line int, msg string, args ...interface{}) { c.fe.Warnl(line, msg, args...) }
-func (c *Config) Debug_checknil() bool                            { return c.fe.Debug_checknil() }
+func (c *Config) Warnl(line int32, msg string, args ...interface{}) { c.fe.Warnl(line, msg, args...) }
+func (c *Config) Debug_checknil() bool                              { return c.fe.Debug_checknil() }
 
 func (c *Config) logDebugHashMatch(evname, name string) {
        var file *os.File
index dae9ed7de0031e0336b95751972585a6c8157035..a1f791039832557615f3ef6da5b89f7cce357a95 100644 (file)
@@ -42,8 +42,8 @@ func (d DummyFrontend) Fatalf(line int32, msg string, args ...interface{}) { d.t
 func (d DummyFrontend) Unimplementedf(line int32, msg string, args ...interface{}) {
        d.t.Fatalf(msg, args...)
 }
-func (d DummyFrontend) Warnl(line int, msg string, args ...interface{}) { d.t.Logf(msg, args...) }
-func (d DummyFrontend) Debug_checknil() bool                            { return false }
+func (d DummyFrontend) Warnl(line int32, msg string, args ...interface{}) { d.t.Logf(msg, args...) }
+func (d DummyFrontend) Debug_checknil() bool                              { return false }
 
 func (d DummyFrontend) TypeBool() Type    { return TypeBool }
 func (d DummyFrontend) TypeInt8() Type    { return TypeInt8 }
index ba8a823c59eb58edd9fe58f42969e27353d79ad9..d7a48feea94a5b71b5314481b82a28d2d02af897 100644 (file)
@@ -106,7 +106,7 @@ func (f *Func) logStat(key string, args ...interface{}) {
        for _, a := range args {
                value += fmt.Sprintf("\t%v", a)
        }
-       f.Config.Warnl(int(f.Entry.Line), "\t%s\t%s%s\t%s", f.pass.name, key, value, f.Name)
+       f.Config.Warnl(f.Entry.Line, "\t%s\t%s%s\t%s", f.pass.name, key, value, f.Name)
 }
 
 // freeValue frees a value. It must no longer be referenced.
index 93f32c72bf0971ffc4aa92deb4be58075388a2d3..4046958c7b9fb5001e215497f042f35858ced162 100644 (file)
@@ -69,7 +69,7 @@ func describePredictionAgrees(b *Block, prediction BranchPrediction) string {
 }
 
 func describeBranchPrediction(f *Func, b *Block, likely, not int8, prediction BranchPrediction) {
-       f.Config.Warnl(int(b.Line), "Branch prediction rule %s < %s%s",
+       f.Config.Warnl(b.Line, "Branch prediction rule %s < %s%s",
                bllikelies[likely-blMin], bllikelies[not-blMin], describePredictionAgrees(b, prediction))
 }
 
@@ -144,7 +144,7 @@ func likelyadjust(f *Func) {
                                                noprediction = true
                                        }
                                        if f.pass.debug > 0 && !noprediction {
-                                               f.Config.Warnl(int(b.Line), "Branch prediction rule stay in loop%s",
+                                               f.Config.Warnl(b.Line, "Branch prediction rule stay in loop%s",
                                                        describePredictionAgrees(b, prediction))
                                        }
 
@@ -180,7 +180,7 @@ func likelyadjust(f *Func) {
                        }
                }
                if f.pass.debug > 2 {
-                       f.Config.Warnl(int(b.Line), "BP: Block %s, local=%s, certain=%s", b, bllikelies[local[b.ID]-blMin], bllikelies[certain[b.ID]-blMin])
+                       f.Config.Warnl(b.Line, "BP: Block %s, local=%s, certain=%s", b, bllikelies[local[b.ID]-blMin], bllikelies[certain[b.ID]-blMin])
                }
 
        }
index ccd443197a3aa82a9351524e92a1ad76afc79da8..4e40c5b88f44ee755ceae97ad2c92a0a7b8d798b 100644 (file)
@@ -91,8 +91,8 @@ func nilcheckelim(f *Func) {
 
                                        // Logging in the style of the former compiler -- and omit line 1,
                                        // which is usually in generated code.
-                                       if f.Config.Debug_checknil() && int(node.block.Control.Line) > 1 {
-                                               f.Config.Warnl(int(node.block.Control.Line), "removed nil check")
+                                       if f.Config.Debug_checknil() && node.block.Control.Line > 1 {
+                                               f.Config.Warnl(node.block.Control.Line, "removed nil check")
                                        }
 
                                        switch node.block.Kind {
index 31870a650a8b747508cf18a6203612393545af50..132366cfc11f5c7995275f30679654c73610c11f 100644 (file)
@@ -66,7 +66,7 @@ func phiopt(f *Func) {
 
                        if ok && isCopy {
                                if f.pass.debug > 0 {
-                                       f.Config.Warnl(int(b.Line), "converted OpPhi to OpCopy")
+                                       f.Config.Warnl(b.Line, "converted OpPhi to OpCopy")
                                }
                                v.reset(OpCopy)
                                v.AddArg(b0.Control)
@@ -74,7 +74,7 @@ func phiopt(f *Func) {
                        }
                        if ok && !isCopy {
                                if f.pass.debug > 0 {
-                                       f.Config.Warnl(int(b.Line), "converted OpPhi to OpNot")
+                                       f.Config.Warnl(b.Line, "converted OpPhi to OpNot")
                                }
                                v.reset(OpNot)
                                v.AddArg(b0.Control)
index 1c5882646890e21c0b25e72ccf4fc2454c85a8f6..bb20f1d5db463d1dcd85310c8f0fd9088791fddb 100644 (file)
@@ -371,13 +371,13 @@ func simplifyBlock(ft *factsTable, b *Block) branch {
        m := ft.get(nil, b.Control, boolean)
        if m == lt|gt {
                if b.Func.pass.debug > 0 {
-                       b.Func.Config.Warnl(int(b.Line), "Proved boolean %s", b.Control.Op)
+                       b.Func.Config.Warnl(b.Line, "Proved boolean %s", b.Control.Op)
                }
                return positive
        }
        if m == eq {
                if b.Func.pass.debug > 0 {
-                       b.Func.Config.Warnl(int(b.Line), "Disproved boolean %s", b.Control.Op)
+                       b.Func.Config.Warnl(b.Line, "Disproved boolean %s", b.Control.Op)
                }
                return negative
        }
@@ -404,13 +404,13 @@ func simplifyBlock(ft *factsTable, b *Block) branch {
                m := ft.get(a0, a1, d)
                if m != 0 && tr.r&m == m {
                        if b.Func.pass.debug > 0 {
-                               b.Func.Config.Warnl(int(b.Line), "Proved %s", c.Op)
+                               b.Func.Config.Warnl(b.Line, "Proved %s", c.Op)
                        }
                        return positive
                }
                if m != 0 && ((lt|eq|gt)^tr.r)&m == m {
                        if b.Func.pass.debug > 0 {
-                               b.Func.Config.Warnl(int(b.Line), "Disproved %s", c.Op)
+                               b.Func.Config.Warnl(b.Line, "Disproved %s", c.Op)
                        }
                        return negative
                }
@@ -425,7 +425,7 @@ func simplifyBlock(ft *factsTable, b *Block) branch {
                m := ft.get(a0, a1, signed)
                if m != 0 && tr.r&m == m {
                        if b.Func.pass.debug > 0 {
-                               b.Func.Config.Warnl(int(b.Line), "Proved non-negative bounds %s", c.Op)
+                               b.Func.Config.Warnl(b.Line, "Proved non-negative bounds %s", c.Op)
                        }
                        return positive
                }