Commit 98b88de5 authored by Todd Neal's avatar Todd Neal

cmd/compile: change the type of ssa Warnl line number

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: 's avatarKeith Randall <khr@golang.org>
parent 2dcbbbd1
......@@ -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 {
......
......@@ -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
......
......@@ -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 }
......
......@@ -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.
......
......@@ -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])
}
}
......
......@@ -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 {
......
......@@ -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)
......
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment