Commit cfd17f51 authored by Robert Griesemer's avatar Robert Griesemer

[dev.inline] cmd/compile/internal/ssa: rename various fields from Line to Pos

This is a mostly mechanical rename followed by manual fixes where necessary.

Change-Id: Ie5c670b133db978f15dc03e50dc2da0c80fc8842
Reviewed-on: https://go-review.googlesource.com/34137Reviewed-by: default avatarDavid Lazar <lazard@golang.org>
parent eab3707d
......@@ -147,7 +147,7 @@ func duff(size int64) (int64, int64) {
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
s.SetPos(v.Line)
s.SetPos(v.Pos)
switch v.Op {
case ssa.OpAMD64ADDQ, ssa.OpAMD64ADDL:
r := v.Reg()
......@@ -875,8 +875,8 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p.To.Type = obj.TYPE_MEM
p.To.Reg = v.Args[0].Reg()
gc.AddAux(&p.To, v)
if gc.Debug_checknil != 0 && v.Line.Line() > 1 { // v.Line.Line()==1 in generated wrappers
gc.Warnl(v.Line, "generated nil check")
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
gc.Warnl(v.Pos, "generated nil check")
}
case ssa.OpAMD64MOVLatomicload, ssa.OpAMD64MOVQatomicload:
p := gc.Prog(v.Op.Asm())
......@@ -962,7 +962,7 @@ var nefJumps = [2][2]gc.FloatingEQNEJump{
}
func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
s.SetPos(b.Line)
s.SetPos(b.Pos)
switch b.Kind {
case ssa.BlockPlain:
......
......@@ -118,7 +118,7 @@ func genregshift(as obj.As, r0, r1, r2, r int16, typ int64) *obj.Prog {
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
s.SetPos(v.Line)
s.SetPos(v.Pos)
switch v.Op {
case ssa.OpInitMem:
// memory arg needs no code
......@@ -705,8 +705,8 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
gc.AddAux(&p.From, v)
p.To.Type = obj.TYPE_REG
p.To.Reg = arm.REGTMP
if gc.Debug_checknil != 0 && v.Line.Line() > 1 { // v.Line.Line()==1 in generated wrappers
gc.Warnl(v.Line, "generated nil check")
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
gc.Warnl(v.Pos, "generated nil check")
}
case ssa.OpARMLoweredZero:
// MOVW.P Rarg2, 4(R1)
......@@ -861,7 +861,7 @@ var blockJump = map[ssa.BlockKind]struct {
}
func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
s.SetPos(b.Line)
s.SetPos(b.Pos)
switch b.Kind {
case ssa.BlockPlain:
......
......@@ -92,7 +92,7 @@ func genshift(as obj.As, r0, r1, r int16, typ int64, s int64) *obj.Prog {
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
s.SetPos(v.Line)
s.SetPos(v.Pos)
switch v.Op {
case ssa.OpInitMem:
// memory arg needs no code
......@@ -690,8 +690,8 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
gc.AddAux(&p.From, v)
p.To.Type = obj.TYPE_REG
p.To.Reg = arm64.REGTMP
if gc.Debug_checknil != 0 && v.Line.Line() > 1 { // v.Line==1 in generated wrappers
gc.Warnl(v.Line, "generated nil check")
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Line==1 in generated wrappers
gc.Warnl(v.Pos, "generated nil check")
}
case ssa.OpVarDef:
gc.Gvardef(v.Aux.(*gc.Node))
......@@ -768,7 +768,7 @@ var blockJump = map[ssa.BlockKind]struct {
}
func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
s.SetPos(b.Line)
s.SetPos(b.Pos)
switch b.Kind {
case ssa.BlockPlain:
......
......@@ -234,7 +234,7 @@ func (s *phiState) insertVarPhis(n int, var_ *Node, defs []*ssa.Block, typ ssa.T
if !hasPhi.contains(c.ID) {
// Add a phi to block c for variable n.
hasPhi.add(c.ID)
v := c.NewValue0I(currentRoot.Line, ssa.OpPhi, typ, int64(n)) // TODO: line number right?
v := c.NewValue0I(currentRoot.Pos, ssa.OpPhi, typ, int64(n)) // TODO: line number right?
// Note: we store the variable number in the phi's AuxInt field. Used temporarily by phi building.
s.s.addNamedValue(var_, v)
for i := 0; i < len(c.Preds); i++ {
......@@ -467,7 +467,7 @@ loop:
// Find variable value on each predecessor.
args = args[:0]
for _, e := range b.Preds {
args = append(args, s.lookupVarOutgoing(e.Block(), v.Type, var_, v.Line))
args = append(args, s.lookupVarOutgoing(e.Block(), v.Type, var_, v.Pos))
}
// Decide if we need a phi or not. We need a phi if there
......
......@@ -281,7 +281,7 @@ func (s *state) label(sym *Sym) *ssaLabel {
func (s *state) Logf(msg string, args ...interface{}) { s.config.Logf(msg, args...) }
func (s *state) Log() bool { return s.config.Log() }
func (s *state) Fatalf(msg string, args ...interface{}) { s.config.Fatalf(s.peekLine(), msg, args...) }
func (s *state) Fatalf(msg string, args ...interface{}) { s.config.Fatalf(s.peekPos(), msg, args...) }
func (s *state) Warnl(line src.Pos, msg string, args ...interface{}) {
s.config.Warnl(line, msg, args...)
}
......@@ -326,7 +326,7 @@ func (s *state) endBlock() *ssa.Block {
s.defvars[b.ID] = s.vars
s.curBlock = nil
s.vars = nil
b.Line = s.peekLine()
b.Pos = s.peekPos()
return b
}
......@@ -335,7 +335,7 @@ func (s *state) pushLine(line src.Pos) {
if !line.IsKnown() {
// the frontend may emit node with line number missing,
// use the parent line number in this case.
line = s.peekLine()
line = s.peekPos()
if Debug['K'] != 0 {
Warn("buildssa: unknown position (line 0)")
}
......@@ -348,130 +348,130 @@ func (s *state) popLine() {
s.line = s.line[:len(s.line)-1]
}
// peekLine peek the top of the line number stack.
func (s *state) peekLine() src.Pos {
// peekPos peeks the top of the line number stack.
func (s *state) peekPos() src.Pos {
return s.line[len(s.line)-1]
}
func (s *state) Error(msg string, args ...interface{}) {
yyerrorl(s.peekLine(), msg, args...)
yyerrorl(s.peekPos(), msg, args...)
}
// newValue0 adds a new value with no arguments to the current block.
func (s *state) newValue0(op ssa.Op, t ssa.Type) *ssa.Value {
return s.curBlock.NewValue0(s.peekLine(), op, t)
return s.curBlock.NewValue0(s.peekPos(), op, t)
}
// newValue0A adds a new value with no arguments and an aux value to the current block.
func (s *state) newValue0A(op ssa.Op, t ssa.Type, aux interface{}) *ssa.Value {
return s.curBlock.NewValue0A(s.peekLine(), op, t, aux)
return s.curBlock.NewValue0A(s.peekPos(), op, t, aux)
}
// newValue0I adds a new value with no arguments and an auxint value to the current block.
func (s *state) newValue0I(op ssa.Op, t ssa.Type, auxint int64) *ssa.Value {
return s.curBlock.NewValue0I(s.peekLine(), op, t, auxint)
return s.curBlock.NewValue0I(s.peekPos(), op, t, auxint)
}
// newValue1 adds a new value with one argument to the current block.
func (s *state) newValue1(op ssa.Op, t ssa.Type, arg *ssa.Value) *ssa.Value {
return s.curBlock.NewValue1(s.peekLine(), op, t, arg)
return s.curBlock.NewValue1(s.peekPos(), op, t, arg)
}
// newValue1A adds a new value with one argument and an aux value to the current block.
func (s *state) newValue1A(op ssa.Op, t ssa.Type, aux interface{}, arg *ssa.Value) *ssa.Value {
return s.curBlock.NewValue1A(s.peekLine(), op, t, aux, arg)
return s.curBlock.NewValue1A(s.peekPos(), op, t, aux, arg)
}
// newValue1I adds a new value with one argument and an auxint value to the current block.
func (s *state) newValue1I(op ssa.Op, t ssa.Type, aux int64, arg *ssa.Value) *ssa.Value {
return s.curBlock.NewValue1I(s.peekLine(), op, t, aux, arg)
return s.curBlock.NewValue1I(s.peekPos(), op, t, aux, arg)
}
// newValue2 adds a new value with two arguments to the current block.
func (s *state) newValue2(op ssa.Op, t ssa.Type, arg0, arg1 *ssa.Value) *ssa.Value {
return s.curBlock.NewValue2(s.peekLine(), op, t, arg0, arg1)
return s.curBlock.NewValue2(s.peekPos(), op, t, arg0, arg1)
}
// newValue2I adds a new value with two arguments and an auxint value to the current block.
func (s *state) newValue2I(op ssa.Op, t ssa.Type, aux int64, arg0, arg1 *ssa.Value) *ssa.Value {
return s.curBlock.NewValue2I(s.peekLine(), op, t, aux, arg0, arg1)
return s.curBlock.NewValue2I(s.peekPos(), op, t, aux, arg0, arg1)
}
// newValue3 adds a new value with three arguments to the current block.
func (s *state) newValue3(op ssa.Op, t ssa.Type, arg0, arg1, arg2 *ssa.Value) *ssa.Value {
return s.curBlock.NewValue3(s.peekLine(), op, t, arg0, arg1, arg2)
return s.curBlock.NewValue3(s.peekPos(), op, t, arg0, arg1, arg2)
}
// newValue3I adds a new value with three arguments and an auxint value to the current block.
func (s *state) newValue3I(op ssa.Op, t ssa.Type, aux int64, arg0, arg1, arg2 *ssa.Value) *ssa.Value {
return s.curBlock.NewValue3I(s.peekLine(), op, t, aux, arg0, arg1, arg2)
return s.curBlock.NewValue3I(s.peekPos(), op, t, aux, arg0, arg1, arg2)
}
// newValue4 adds a new value with four arguments to the current block.
func (s *state) newValue4(op ssa.Op, t ssa.Type, arg0, arg1, arg2, arg3 *ssa.Value) *ssa.Value {
return s.curBlock.NewValue4(s.peekLine(), op, t, arg0, arg1, arg2, arg3)
return s.curBlock.NewValue4(s.peekPos(), op, t, arg0, arg1, arg2, arg3)
}
// entryNewValue0 adds a new value with no arguments to the entry block.
func (s *state) entryNewValue0(op ssa.Op, t ssa.Type) *ssa.Value {
return s.f.Entry.NewValue0(s.peekLine(), op, t)
return s.f.Entry.NewValue0(s.peekPos(), op, t)
}
// entryNewValue0A adds a new value with no arguments and an aux value to the entry block.
func (s *state) entryNewValue0A(op ssa.Op, t ssa.Type, aux interface{}) *ssa.Value {
return s.f.Entry.NewValue0A(s.peekLine(), op, t, aux)
return s.f.Entry.NewValue0A(s.peekPos(), op, t, aux)
}
// entryNewValue0I adds a new value with no arguments and an auxint value to the entry block.
func (s *state) entryNewValue0I(op ssa.Op, t ssa.Type, auxint int64) *ssa.Value {
return s.f.Entry.NewValue0I(s.peekLine(), op, t, auxint)
return s.f.Entry.NewValue0I(s.peekPos(), op, t, auxint)
}
// entryNewValue1 adds a new value with one argument to the entry block.
func (s *state) entryNewValue1(op ssa.Op, t ssa.Type, arg *ssa.Value) *ssa.Value {
return s.f.Entry.NewValue1(s.peekLine(), op, t, arg)
return s.f.Entry.NewValue1(s.peekPos(), op, t, arg)
}
// entryNewValue1 adds a new value with one argument and an auxint value to the entry block.
func (s *state) entryNewValue1I(op ssa.Op, t ssa.Type, auxint int64, arg *ssa.Value) *ssa.Value {
return s.f.Entry.NewValue1I(s.peekLine(), op, t, auxint, arg)
return s.f.Entry.NewValue1I(s.peekPos(), op, t, auxint, arg)
}
// entryNewValue1A adds a new value with one argument and an aux value to the entry block.
func (s *state) entryNewValue1A(op ssa.Op, t ssa.Type, aux interface{}, arg *ssa.Value) *ssa.Value {
return s.f.Entry.NewValue1A(s.peekLine(), op, t, aux, arg)
return s.f.Entry.NewValue1A(s.peekPos(), op, t, aux, arg)
}
// entryNewValue2 adds a new value with two arguments to the entry block.
func (s *state) entryNewValue2(op ssa.Op, t ssa.Type, arg0, arg1 *ssa.Value) *ssa.Value {
return s.f.Entry.NewValue2(s.peekLine(), op, t, arg0, arg1)
return s.f.Entry.NewValue2(s.peekPos(), op, t, arg0, arg1)
}
// const* routines add a new const value to the entry block.
func (s *state) constSlice(t ssa.Type) *ssa.Value { return s.f.ConstSlice(s.peekLine(), t) }
func (s *state) constInterface(t ssa.Type) *ssa.Value { return s.f.ConstInterface(s.peekLine(), t) }
func (s *state) constNil(t ssa.Type) *ssa.Value { return s.f.ConstNil(s.peekLine(), t) }
func (s *state) constEmptyString(t ssa.Type) *ssa.Value { return s.f.ConstEmptyString(s.peekLine(), t) }
func (s *state) constSlice(t ssa.Type) *ssa.Value { return s.f.ConstSlice(s.peekPos(), t) }
func (s *state) constInterface(t ssa.Type) *ssa.Value { return s.f.ConstInterface(s.peekPos(), t) }
func (s *state) constNil(t ssa.Type) *ssa.Value { return s.f.ConstNil(s.peekPos(), t) }
func (s *state) constEmptyString(t ssa.Type) *ssa.Value { return s.f.ConstEmptyString(s.peekPos(), t) }
func (s *state) constBool(c bool) *ssa.Value {
return s.f.ConstBool(s.peekLine(), Types[TBOOL], c)
return s.f.ConstBool(s.peekPos(), Types[TBOOL], c)
}
func (s *state) constInt8(t ssa.Type, c int8) *ssa.Value {
return s.f.ConstInt8(s.peekLine(), t, c)
return s.f.ConstInt8(s.peekPos(), t, c)
}
func (s *state) constInt16(t ssa.Type, c int16) *ssa.Value {
return s.f.ConstInt16(s.peekLine(), t, c)
return s.f.ConstInt16(s.peekPos(), t, c)
}
func (s *state) constInt32(t ssa.Type, c int32) *ssa.Value {
return s.f.ConstInt32(s.peekLine(), t, c)
return s.f.ConstInt32(s.peekPos(), t, c)
}
func (s *state) constInt64(t ssa.Type, c int64) *ssa.Value {
return s.f.ConstInt64(s.peekLine(), t, c)
return s.f.ConstInt64(s.peekPos(), t, c)
}
func (s *state) constFloat32(t ssa.Type, c float64) *ssa.Value {
return s.f.ConstFloat32(s.peekLine(), t, c)
return s.f.ConstFloat32(s.peekPos(), t, c)
}
func (s *state) constFloat64(t ssa.Type, c float64) *ssa.Value {
return s.f.ConstFloat64(s.peekLine(), t, c)
return s.f.ConstFloat64(s.peekPos(), t, c)
}
func (s *state) constInt(t ssa.Type, c int64) *ssa.Value {
if s.config.IntSize == 8 {
......@@ -3315,7 +3315,7 @@ func (s *state) check(cmp *ssa.Value, fn *Node) {
b.SetControl(cmp)
b.Likely = ssa.BranchLikely
bNext := s.f.NewBlock(ssa.BlockPlain)
line := s.peekLine()
line := s.peekPos()
bPanic := s.panics[funcLine{fn, line}]
if bPanic == nil {
bPanic = s.f.NewBlock(ssa.BlockPlain)
......@@ -3427,7 +3427,7 @@ func (s *state) insertWBmove(t *Type, left, right *ssa.Value, line src.Pos, righ
s.Error("write barrier prohibited")
}
if !s.WBPos.IsKnown() {
s.WBPos = left.Line
s.WBPos = left.Pos
}
var val *ssa.Value
......@@ -3468,7 +3468,7 @@ func (s *state) insertWBstore(t *Type, left, right *ssa.Value, line src.Pos, ski
s.Error("write barrier prohibited")
}
if !s.WBPos.IsKnown() {
s.WBPos = left.Line
s.WBPos = left.Pos
}
s.storeTypeScalars(t, left, right, skip)
s.storeTypePtrsWB(t, left, right)
......
......@@ -74,7 +74,7 @@ func storeByType(t ssa.Type, r int16) obj.As {
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
s.SetPos(v.Line)
s.SetPos(v.Pos)
switch v.Op {
case ssa.OpInitMem:
// memory arg needs no code
......@@ -796,8 +796,8 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
gc.AddAux(&p.From, v)
p.To.Type = obj.TYPE_REG
p.To.Reg = mips.REGTMP
if gc.Debug_checknil != 0 && v.Line.Line() > 1 { // v.Line==1 in generated wrappers
gc.Warnl(v.Line, "generated nil check")
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
gc.Warnl(v.Pos, "generated nil check")
}
case ssa.OpMIPSFPFlagTrue,
ssa.OpMIPSFPFlagFalse:
......@@ -841,7 +841,7 @@ var blockJump = map[ssa.BlockKind]struct {
}
func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
s.SetPos(b.Line)
s.SetPos(b.Pos)
switch b.Kind {
case ssa.BlockPlain:
......
......@@ -82,7 +82,7 @@ func storeByType(t ssa.Type, r int16) obj.As {
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
s.SetPos(v.Line)
s.SetPos(v.Pos)
switch v.Op {
case ssa.OpInitMem:
// memory arg needs no code
......@@ -548,8 +548,8 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
gc.AddAux(&p.From, v)
p.To.Type = obj.TYPE_REG
p.To.Reg = mips.REGTMP
if gc.Debug_checknil != 0 && v.Line.Line() > 1 { // v.Line==1 in generated wrappers
gc.Warnl(v.Line, "generated nil check")
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
gc.Warnl(v.Pos, "generated nil check")
}
case ssa.OpVarDef:
gc.Gvardef(v.Aux.(*gc.Node))
......@@ -606,7 +606,7 @@ var blockJump = map[ssa.BlockKind]struct {
}
func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
s.SetPos(b.Line)
s.SetPos(b.Pos)
switch b.Kind {
case ssa.BlockPlain:
......
......@@ -143,7 +143,7 @@ func ssaGenISEL(v *ssa.Value, cr int64, r1, r2 int16) {
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
s.SetPos(v.Line)
s.SetPos(v.Pos)
switch v.Op {
case ssa.OpInitMem:
// memory arg needs no code
......@@ -803,8 +803,8 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
gc.AddAux(&p.From, v)
p.To.Type = obj.TYPE_REG
p.To.Reg = ppc64.REGTMP
if gc.Debug_checknil != 0 && v.Line.Line() > 1 { // v.Line==1 in generated wrappers
gc.Warnl(v.Line, "generated nil check")
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
gc.Warnl(v.Pos, "generated nil check")
}
case ssa.OpPPC64InvertFlags:
......@@ -837,7 +837,7 @@ var blockJump = [...]struct {
}
func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
s.SetPos(b.Line)
s.SetPos(b.Pos)
switch b.Kind {
......
......@@ -156,7 +156,7 @@ func opregregimm(op obj.As, dest, src int16, off int64) *obj.Prog {
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
s.SetPos(v.Line)
s.SetPos(v.Pos)
switch v.Op {
case ssa.OpS390XSLD, ssa.OpS390XSLW,
ssa.OpS390XSRD, ssa.OpS390XSRW,
......@@ -570,8 +570,8 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
gc.AddAux(&p.From, v)
p.To.Type = obj.TYPE_REG
p.To.Reg = s390x.REGTMP
if gc.Debug_checknil != 0 && v.Line.Line() > 1 { // v.Line==1 in generated wrappers
gc.Warnl(v.Line, "generated nil check")
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
gc.Warnl(v.Pos, "generated nil check")
}
case ssa.OpS390XMVC:
vo := v.AuxValAndOff()
......@@ -796,7 +796,7 @@ var blockJump = [...]struct {
}
func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
s.SetPos(b.Line)
s.SetPos(b.Pos)
switch b.Kind {
case ssa.BlockPlain:
......
......@@ -15,8 +15,8 @@ type Block struct {
// these IDs densely, but no guarantees.
ID ID
// Line number for block's control operation
Line src.Pos
// Source position for block's control operation
Pos src.Pos
// The kind of block this is.
Kind BlockKind
......
......@@ -16,7 +16,7 @@ func checkbce(f *Func) {
for _, b := range f.Blocks {
for _, v := range b.Values {
if v.Op == OpIsInBounds || v.Op == OpIsSliceInBounds {
f.Config.Warnl(v.Line, "Found %v", v.Op)
f.Config.Warnl(v.Pos, "Found %v", v.Op)
}
}
}
......
......@@ -60,10 +60,10 @@ func critical(f *Func) {
// since we're iterating over len(f.Blocks) above, this forces
// the new blocks to be re-examined.
d = f.NewBlock(BlockPlain)
d.Line = p.Line
d.Pos = p.Pos
blocks[argID] = d
if f.pass.debug > 0 {
f.Config.Warnl(p.Line, "split critical edge")
f.Config.Warnl(p.Pos, "split critical edge")
}
} else {
reusedBlock = true
......@@ -72,9 +72,9 @@ func critical(f *Func) {
// no existing block, so allocate a new block
// to place on the edge
d = f.NewBlock(BlockPlain)
d.Line = p.Line
d.Pos = p.Pos
if f.pass.debug > 0 {
f.Config.Warnl(p.Line, "split critical edge")
f.Config.Warnl(p.Pos, "split critical edge")
}
}
......
......@@ -35,8 +35,8 @@ func decomposeBuiltIn(f *Func) {
hiName, loName := f.Config.fe.SplitInt64(name)
newNames = append(newNames, hiName, loName)
for _, v := range f.NamedValues[name] {
hi := v.Block.NewValue1(v.Line, OpInt64Hi, elemType, v)
lo := v.Block.NewValue1(v.Line, OpInt64Lo, f.Config.fe.TypeUInt32(), v)
hi := v.Block.NewValue1(v.Pos, OpInt64Hi, elemType, v)
lo := v.Block.NewValue1(v.Pos, OpInt64Lo, f.Config.fe.TypeUInt32(), v)
f.NamedValues[hiName] = append(f.NamedValues[hiName], hi)
f.NamedValues[loName] = append(f.NamedValues[loName], lo)
}
......@@ -51,8 +51,8 @@ func decomposeBuiltIn(f *Func) {
rName, iName := f.Config.fe.SplitComplex(name)
newNames = append(newNames, rName, iName)
for _, v := range f.NamedValues[name] {
r := v.Block.NewValue1(v.Line, OpComplexReal, elemType, v)
i := v.Block.NewValue1(v.Line, OpComplexImag, elemType, v)
r := v.Block.NewValue1(v.Pos, OpComplexReal, elemType, v)
i := v.Block.NewValue1(v.Pos, OpComplexImag, elemType, v)
f.NamedValues[rName] = append(f.NamedValues[rName], r)
f.NamedValues[iName] = append(f.NamedValues[iName], i)
}
......@@ -63,8 +63,8 @@ func decomposeBuiltIn(f *Func) {
ptrName, lenName := f.Config.fe.SplitString(name)
newNames = append(newNames, ptrName, lenName)
for _, v := range f.NamedValues[name] {
ptr := v.Block.NewValue1(v.Line, OpStringPtr, ptrType, v)
len := v.Block.NewValue1(v.Line, OpStringLen, lenType, v)
ptr := v.Block.NewValue1(v.Pos, OpStringPtr, ptrType, v)
len := v.Block.NewValue1(v.Pos, OpStringLen, lenType, v)
f.NamedValues[ptrName] = append(f.NamedValues[ptrName], ptr)
f.NamedValues[lenName] = append(f.NamedValues[lenName], len)
}
......@@ -75,9 +75,9 @@ func decomposeBuiltIn(f *Func) {
ptrName, lenName, capName := f.Config.fe.SplitSlice(name)
newNames = append(newNames, ptrName, lenName, capName)
for _, v := range f.NamedValues[name] {
ptr := v.Block.NewValue1(v.Line, OpSlicePtr, ptrType, v)
len := v.Block.NewValue1(v.Line, OpSliceLen, lenType, v)
cap := v.Block.NewValue1(v.Line, OpSliceCap, lenType, v)
ptr := v.Block.NewValue1(v.Pos, OpSlicePtr, ptrType, v)
len := v.Block.NewValue1(v.Pos, OpSliceLen, lenType, v)
cap := v.Block.NewValue1(v.Pos, OpSliceCap, lenType, v)
f.NamedValues[ptrName] = append(f.NamedValues[ptrName], ptr)
f.NamedValues[lenName] = append(f.NamedValues[lenName], len)
f.NamedValues[capName] = append(f.NamedValues[capName], cap)
......@@ -88,8 +88,8 @@ func decomposeBuiltIn(f *Func) {
typeName, dataName := f.Config.fe.SplitInterface(name)
newNames = append(newNames, typeName, dataName)
for _, v := range f.NamedValues[name] {
typ := v.Block.NewValue1(v.Line, OpITab, ptrType, v)
data := v.Block.NewValue1(v.Line, OpIData, ptrType, v)
typ := v.Block.NewValue1(v.Pos, OpITab, ptrType, v)
data := v.Block.NewValue1(v.Pos, OpIData, ptrType, v)
f.NamedValues[typeName] = append(f.NamedValues[typeName], typ)
f.NamedValues[dataName] = append(f.NamedValues[dataName], data)
}
......@@ -133,11 +133,11 @@ func decomposeStringPhi(v *Value) {
ptrType := fe.TypeBytePtr()
lenType := fe.TypeInt()
ptr := v.Block.NewValue0(v.Line, OpPhi, ptrType)
len := v.Block.NewValue0(v.Line, OpPhi, lenType)
ptr := v.Block.NewValue0(v.Pos, OpPhi, ptrType)
len := v.Block.NewValue0(v.Pos, OpPhi, lenType)
for _, a := range v.Args {
ptr.AddArg(a.Block.NewValue1(v.Line, OpStringPtr, ptrType, a))
len.AddArg(a.Block.NewValue1(v.Line, OpStringLen, lenType, a))
ptr.AddArg(a.Block.NewValue1(v.Pos, OpStringPtr, ptrType, a))
len.AddArg(a.Block.NewValue1(v.Pos, OpStringLen, lenType, a))
}
v.reset(OpStringMake)
v.AddArg(ptr)
......@@ -149,13 +149,13 @@ func decomposeSlicePhi(v *Value) {
ptrType := fe.TypeBytePtr()
lenType := fe.TypeInt()
ptr := v.Block.NewValue0(v.Line, OpPhi, ptrType)
len := v.Block.NewValue0(v.Line, OpPhi, lenType)
cap := v.Block.NewValue0(v.Line, OpPhi, lenType)
ptr := v.Block.NewValue0(v.Pos, OpPhi, ptrType)
len := v.Block.NewValue0(v.Pos, OpPhi, lenType)
cap := v.Block.NewValue0(v.Pos, OpPhi, lenType)
for _, a := range v.Args {
ptr.AddArg(a.Block.NewValue1(v.Line, OpSlicePtr, ptrType, a))
len.AddArg(a.Block.NewValue1(v.Line, OpSliceLen, lenType, a))
cap.AddArg(a.Block.NewValue1(v.Line, OpSliceCap, lenType, a))
ptr.AddArg(a.Block.NewValue1(v.Pos, OpSlicePtr, ptrType, a))
len.AddArg(a.Block.NewValue1(v.Pos, OpSliceLen, lenType, a))
cap.AddArg(a.Block.NewValue1(v.Pos, OpSliceCap, lenType, a))
}
v.reset(OpSliceMake)
v.AddArg(ptr)
......@@ -172,11 +172,11 @@ func decomposeInt64Phi(v *Value) {
partType = fe.TypeUInt32()
}
hi := v.Block.NewValue0(v.Line, OpPhi, partType)
lo := v.Block.NewValue0(v.Line, OpPhi, fe.TypeUInt32())
hi := v.Block.NewValue0(v.Pos, OpPhi, partType)
lo := v.Block.NewValue0(v.Pos, OpPhi, fe.TypeUInt32())
for _, a := range v.Args {
hi.AddArg(a.Block.NewValue1(v.Line, OpInt64Hi, partType, a))
lo.AddArg(a.Block.NewValue1(v.Line, OpInt64Lo, fe.TypeUInt32(), a))
hi.AddArg(a.Block.NewValue1(v.Pos, OpInt64Hi, partType, a))
lo.AddArg(a.Block.NewValue1(v.Pos, OpInt64Lo, fe.TypeUInt32(), a))
}
v.reset(OpInt64Make)
v.AddArg(hi)
......@@ -195,11 +195,11 @@ func decomposeComplexPhi(v *Value) {
v.Fatalf("decomposeComplexPhi: bad complex size %d", z)
}
real := v.Block.NewValue0(v.Line, OpPhi, partType)
imag := v.Block.NewValue0(v.Line, OpPhi, partType)
real := v.Block.NewValue0(v.Pos, OpPhi, partType)
imag := v.Block.NewValue0(v.Pos, OpPhi, partType)
for _, a := range v.Args {
real.AddArg(a.Block.NewValue1(v.Line, OpComplexReal, partType, a))
imag.AddArg(a.Block.NewValue1(v.Line, OpComplexImag, partType, a))
real.AddArg(a.Block.NewValue1(v.Pos, OpComplexReal, partType, a))
imag.AddArg(a.Block.NewValue1(v.Pos, OpComplexImag, partType, a))
}
v.reset(OpComplexMake)
v.AddArg(real)
......@@ -209,11 +209,11 @@ func decomposeComplexPhi(v *Value) {
func decomposeInterfacePhi(v *Value) {
ptrType := v.Block.Func.Config.fe.TypeBytePtr()
itab := v.Block.NewValue0(v.Line, OpPhi, ptrType)
data := v.Block.NewValue0(v.Line, OpPhi, ptrType)
itab := v.Block.NewValue0(v.Pos, OpPhi, ptrType)
data := v.Block.NewValue0(v.Pos, OpPhi, ptrType)
for _, a := range v.Args {
itab.AddArg(a.Block.NewValue1(v.Line, OpITab, ptrType, a))
data.AddArg(a.Block.NewValue1(v.Line, OpIData, ptrType, a))
itab.AddArg(a.Block.NewValue1(v.Pos, OpITab, ptrType, a))
data.AddArg(a.Block.NewValue1(v.Pos, OpIData, ptrType, a))
}
v.reset(OpIMake)
v.AddArg(itab)
......@@ -247,7 +247,7 @@ func decomposeUser(f *Func) {
}
for _, v := range f.NamedValues[name] {
for i := 0; i < n; i++ {
x := v.Block.NewValue1I(v.Line, OpStructSelect, t.FieldType(i), int64(i), v)
x := v.Block.NewValue1I(v.Pos, OpStructSelect, t.FieldType(i), int64(i), v)
f.NamedValues[fnames[i]] = append(f.NamedValues[fnames[i]], x)
}
}
......@@ -264,7 +264,7 @@ func decomposeUser(f *Func) {
}
elemName := f.Config.fe.SplitArray(name)
for _, v := range f.NamedValues[name] {
e := v.Block.NewValue1I(v.Line, OpArraySelect, t.ElemType(), 0, v)
e := v.Block.NewValue1I(v.Pos, OpArraySelect, t.ElemType(), 0, v)
f.NamedValues[elemName] = append(f.NamedValues[elemName], e)
}
......@@ -293,11 +293,11 @@ func decomposeStructPhi(v *Value) {
n := t.NumFields()
var fields [MaxStruct]*Value
for i := 0; i < n; i++ {
fields[i] = v.Block.NewValue0(v.Line, OpPhi, t.FieldType(i))
fields[i] = v.Block.NewValue0(v.Pos, OpPhi, t.FieldType(i))
}
for _, a := range v.Args {
for i := 0; i < n; i++ {
fields[i].AddArg(a.Block.NewValue1I(v.Line, OpStructSelect, t.FieldType(i), int64(i), a))
fields[i].AddArg(a.Block.NewValue1I(v.Pos, OpStructSelect, t.FieldType(i), int64(i), a))
}
}
v.reset(StructMakeOp(n))
......@@ -320,9 +320,9 @@ func decomposeArrayPhi(v *Value) {
if t.NumElem() != 1 {
v.Fatalf("SSAable array must have no more than 1 element")
}
elem := v.Block.NewValue0(v.Line, OpPhi, t.ElemType())
elem := v.Block.NewValue0(v.Pos, OpPhi, t.ElemType())
for _, a := range v.Args {
elem.AddArg(a.Block.NewValue1I(v.Line, OpArraySelect, t.ElemType(), 0, a))
elem.AddArg(a.Block.NewValue1I(v.Pos, OpArraySelect, t.ElemType(), 0, a))
}
v.reset(OpArrayMake1)
v.AddArg(elem)
......
......@@ -80,7 +80,7 @@ func (f *Func) retSparseSet(ss *sparseSet) {
}
// newValue allocates a new Value with the given fields and places it at the end of b.Values.
func (f *Func) newValue(op Op, t Type, b *Block, line src.Pos) *Value {
func (f *Func) newValue(op Op, t Type, b *Block, pos src.Pos) *Value {
var v *Value
if f.freeValues != nil {
v = f.freeValues
......@@ -97,7 +97,7 @@ func (f *Func) newValue(op Op, t Type, b *Block, line src.Pos) *Value {
v.Op = op
v.Type = t
v.Block = b
v.Line = line
v.Pos = pos
b.Values = append(b.Values, v)
return v
}
......@@ -117,7 +117,7 @@ func (f *Func) LogStat(key string, args ...interface{}) {
if f.pass != nil {
n = strings.Replace(f.pass.name, " ", "_", -1)
}
f.Config.Warnl(f.Entry.Line, "\t%s\t%s%s\t%s", n, key, value, f.Name)
f.Config.Warnl(f.Entry.Pos, "\t%s\t%s%s\t%s", n, key, value, f.Name)
}
// freeValue frees a value. It must no longer be referenced.
......@@ -411,7 +411,7 @@ func (f *Func) ConstEmptyString(line src.Pos, t Type) *Value {
func (f *Func) Logf(msg string, args ...interface{}) { f.Config.Logf(msg, args...) }
func (f *Func) Log() bool { return f.Config.Log() }
func (f *Func) Fatalf(msg string, args ...interface{}) { f.Config.Fatalf(f.Entry.Line, msg, args...) }
func (f *Func) Fatalf(msg string, args ...interface{}) { f.Config.Fatalf(f.Entry.Pos, msg, args...) }
func (f *Func) Free() {
// Clear cached CFG info.
......
......@@ -1009,11 +1009,11 @@
&& mem.Op == OpStaticCall
&& isSameSym(mem.Aux, "runtime.newobject")
&& c == config.ctxt.FixedFrameSize() + config.RegSize // offset of return value
&& warnRule(config.Debug_checknil() && int(v.Line) > 1, v, "removed nil check")
&& warnRule(config.Debug_checknil() && int(v.Pos) > 1, v, "removed nil check")
-> (Invalid)
(NilCheck (OffPtr (Load (OffPtr [c] (SP)) mem)) mem)
&& mem.Op == OpStaticCall
&& isSameSym(mem.Aux, "runtime.newobject")
&& c == config.ctxt.FixedFrameSize() + config.RegSize // offset of return value
&& warnRule(config.Debug_checknil() && int(v.Line) > 1, v, "removed nil check")
&& warnRule(config.Debug_checknil() && int(v.Pos) > 1, v, "removed nil check")
-> (Invalid)
......@@ -491,7 +491,7 @@ func genResult0(w io.Writer, arch arch, result string, alloc *int, top, move boo
}
v = fmt.Sprintf("v%d", *alloc)
*alloc++
fmt.Fprintf(w, "%s := b.NewValue0(v.Line, Op%s%s, %s)\n", v, oparch, op.name, typ)
fmt.Fprintf(w, "%s := b.NewValue0(v.Pos, Op%s%s, %s)\n", v, oparch, op.name, typ)
if move && top {
// Rewrite original into a copy
fmt.Fprintf(w, "v.reset(OpCopy)\n")
......
......@@ -108,7 +108,7 @@ func describePredictionAgrees(b *Block, prediction BranchPrediction) string {
}
func describeBranchPrediction(f *Func, b *Block, likely, not int8, prediction BranchPrediction) {
f.Config.Warnl(b.Line, "Branch prediction rule %s < %s%s",
f.Config.Warnl(b.Pos, "Branch prediction rule %s < %s%s",
bllikelies[likely-blMin], bllikelies[not-blMin], describePredictionAgrees(b, prediction))
}
......@@ -183,7 +183,7 @@ func likelyadjust(f *Func) {
noprediction = true
}
if f.pass.debug > 0 && !noprediction {
f.Config.Warnl(b.Line, "Branch prediction rule stay in loop%s",
f.Config.Warnl(b.Pos, "Branch prediction rule stay in loop%s",
describePredictionAgrees(b, prediction))
}
......@@ -226,7 +226,7 @@ func likelyadjust(f *Func) {
}
}
if f.pass.debug > 2 {
f.Config.Warnl(b.Line, "BP: Block %s, local=%s, certain=%s", b, bllikelies[local[b.ID]-blMin], bllikelies[certain[b.ID]-blMin])
f.Config.Warnl(b.Pos, "BP: Block %s, local=%s, certain=%s", b, bllikelies[local[b.ID]-blMin], bllikelies[certain[b.ID]-blMin])
}
}
......
......@@ -139,9 +139,9 @@ nextb:
if f.pass.debug > 1 {
if min.Op == OpConst64 {
b.Func.Config.Warnl(b.Line, "Induction variable with minimum %d and increment %d", min.AuxInt, inc.AuxInt)
b.Func.Config.Warnl(b.Pos, "Induction variable with minimum %d and increment %d", min.AuxInt, inc.AuxInt)
} else {
b.Func.Config.Warnl(b.Line, "Induction variable with non-const minimum and increment %d", inc.AuxInt)
b.Func.Config.Warnl(b.Pos, "Induction variable with non-const minimum and increment %d", inc.AuxInt)
}
}
......@@ -205,7 +205,7 @@ func removeBoundsChecks(f *Func, m map[*Value]indVar) {
if iv, has := m[ind]; has && sdom.isAncestorEq(iv.entry, b) && isNonNegative(iv.min) {
if v.Args[1] == iv.max {
if f.pass.debug > 0 {
f.Config.Warnl(b.Line, "Found redundant %s", v.Op)
f.Config.Warnl(b.Pos, "Found redundant %s", v.Op)
}
goto simplify
}
......@@ -232,7 +232,7 @@ func removeBoundsChecks(f *Func, m map[*Value]indVar) {
if iv, has := m[ind]; has && sdom.isAncestorEq(iv.entry, b) && isNonNegative(iv.min) {
if v.Args[1].Op == OpSliceCap && iv.max.Op == OpSliceLen && v.Args[1].Args[0] == iv.max.Args[0] {
if f.pass.debug > 0 {
f.Config.Warnl(b.Line, "Found redundant %s (len promoted to cap)", v.Op)
f.Config.Warnl(b.Pos, "Found redundant %s (len promoted to cap)", v.Op)
}
goto simplify
}
......@@ -263,7 +263,7 @@ func removeBoundsChecks(f *Func, m map[*Value]indVar) {
if max := iv.max.AuxInt + add; 0 <= max && max <= limit { // handle overflow
if f.pass.debug > 0 {
f.Config.Warnl(b.Line, "Found redundant (%s ind %d), ind < %d", v.Op, v.Args[1].AuxInt, iv.max.AuxInt+add)
f.Config.Warnl(b.Pos, "Found redundant (%s ind %d), ind < %d", v.Op, v.Args[1].AuxInt, iv.max.AuxInt+add)
}
goto simplify
}
......
......@@ -101,8 +101,8 @@ func nilcheckelim(f *Func) {
// This is a redundant implicit nil check.
// Logging in the style of the former compiler -- and omit line 1,
// which is usually in generated code.
if f.Config.Debug_checknil() && v.Line.Line() > 1 {
f.Config.Warnl(v.Line, "removed nil check")
if f.Config.Debug_checknil() && v.Pos.Line() > 1 {
f.Config.Warnl(v.Pos, "removed nil check")
}
v.reset(OpUnknown)
i--
......@@ -147,8 +147,8 @@ func nilcheckelim2(f *Func) {
for i := len(b.Values) - 1; i >= 0; i-- {
v := b.Values[i]
if opcodeTable[v.Op].nilCheck && unnecessary.contains(v.Args[0].ID) {
if f.Config.Debug_checknil() && v.Line.Line() > 1 {
f.Config.Warnl(v.Line, "removed nil check")
if f.Config.Debug_checknil() && v.Pos.Line() > 1 {
f.Config.Warnl(v.Pos, "removed nil check")
}
v.reset(OpUnknown)
continue
......
......@@ -63,7 +63,7 @@ func phielimValue(v *Value) bool {
v.SetArgs1(w)
f := v.Block.Func
if f.pass.debug > 0 {
f.Config.Warnl(v.Line, "eliminated phi")
f.Config.Warnl(v.Pos, "eliminated phi")
}
return true
}
......@@ -81,7 +81,7 @@ func phiopt(f *Func) {
v.reset(ops[v.Args[reverse].AuxInt])
v.AddArg(b0.Control)
if f.pass.debug > 0 {
f.Config.Warnl(b.Line, "converted OpPhi to %v", v.Op)
f.Config.Warnl(b.Pos, "converted OpPhi to %v", v.Op)
}
continue
}
......@@ -97,7 +97,7 @@ func phiopt(f *Func) {
v.reset(OpOrB)
v.SetArgs2(b0.Control, tmp)
if f.pass.debug > 0 {
f.Config.Warnl(b.Line, "converted OpPhi to %v", v.Op)
f.Config.Warnl(b.Pos, "converted OpPhi to %v", v.Op)
}
continue
}
......@@ -113,7 +113,7 @@ func phiopt(f *Func) {
v.reset(OpAndB)
v.SetArgs2(b0.Control, tmp)
if f.pass.debug > 0 {
f.Config.Warnl(b.Line, "converted OpPhi to %v", v.Op)
f.Config.Warnl(b.Pos, "converted OpPhi to %v", v.Op)
}
continue
}
......@@ -163,12 +163,12 @@ func phioptint(v *Value, b0 *Block, reverse int) {
a := b0.Control
if negate {
a = v.Block.NewValue1(v.Line, OpNot, a.Type, a)
a = v.Block.NewValue1(v.Pos, OpNot, a.Type, a)
}
v.AddArg(a)
f := b0.Func
if f.pass.debug > 0 {
f.Config.Warnl(v.Block.Line, "converted OpPhi bool -> int%d", v.Type.Size()*8)
f.Config.Warnl(v.Block.Pos, "converted OpPhi bool -> int%d", v.Type.Size()*8)
}
}
......@@ -62,7 +62,7 @@ func (p stringFuncPrinter) endBlock(b *Block) {
func (p stringFuncPrinter) value(v *Value, live bool) {
fmt.Fprint(p.w, " ")
//fmt.Fprint(p.w, v.Block.Func.Config.fe.Line(v.Line))
//fmt.Fprint(p.w, v.Block.Func.Config.fe.Pos(v.Pos))
//fmt.Fprint(p.w, ": ")
fmt.Fprint(p.w, v.LongString())
if !live {
......
......@@ -301,7 +301,7 @@ func (ft *factsTable) update(parent *Block, v, w *Value, d domain, r relation) {
ft.limitStack = append(ft.limitStack, limitFact{v.ID, old})
ft.limits[v.ID] = lim
if v.Block.Func.pass.debug > 2 {
v.Block.Func.Config.Warnl(parent.Line, "parent=%s, new limits %s %s %s", parent, v, w, lim.String())
v.Block.Func.Config.Warnl(parent.Pos, "parent=%s, new limits %s %s %s", parent, v, w, lim.String())
}
}
}
......@@ -600,7 +600,7 @@ func simplifyBlock(ft *factsTable, b *Block) branch {
v.reset(OpConst32)
}
if b.Func.pass.debug > 0 {
b.Func.Config.Warnl(v.Line, "Proved slicemask not needed")
b.Func.Config.Warnl(v.Pos, "Proved slicemask not needed")
}
v.AuxInt = -1
}
......@@ -615,9 +615,9 @@ func simplifyBlock(ft *factsTable, b *Block) branch {
if m == lt|gt {
if b.Func.pass.debug > 0 {
if b.Func.pass.debug > 1 {
b.Func.Config.Warnl(b.Line, "Proved boolean %s (%s)", b.Control.Op, b.Control)
b.Func.Config.Warnl(b.Pos, "Proved boolean %s (%s)", b.Control.Op, b.Control)
} else {
b.Func.Config.Warnl(b.Line, "Proved boolean %s", b.Control.Op)
b.Func.Config.Warnl(b.Pos, "Proved boolean %s", b.Control.Op)
}
}
return positive
......@@ -625,9 +625,9 @@ func simplifyBlock(ft *factsTable, b *Block) branch {
if m == eq {
if b.Func.pass.debug > 0 {
if b.Func.pass.debug > 1 {
b.Func.Config.Warnl(b.Line, "Disproved boolean %s (%s)", b.Control.Op, b.Control)
b.Func.Config.Warnl(b.Pos, "Disproved boolean %s (%s)", b.Control.Op, b.Control)
} else {
b.Func.Config.Warnl(b.Line, "Disproved boolean %s", b.Control.Op)
b.Func.Config.Warnl(b.Pos, "Disproved boolean %s", b.Control.Op)
}
}
return negative
......@@ -656,9 +656,9 @@ func simplifyBlock(ft *factsTable, b *Block) branch {
if m != 0 && tr.r&m == m {
if b.Func.pass.debug > 0 {
if b.Func.pass.debug > 1 {
b.Func.Config.Warnl(b.Line, "Proved %s (%s)", c.Op, c)
b.Func.Config.Warnl(b.Pos, "Proved %s (%s)", c.Op, c)
} else {
b.Func.Config.Warnl(b.Line, "Proved %s", c.Op)
b.Func.Config.Warnl(b.Pos, "Proved %s", c.Op)
}
}
return positive
......@@ -666,9 +666,9 @@ func simplifyBlock(ft *factsTable, b *Block) branch {
if m != 0 && ((lt|eq|gt)^tr.r)&m == m {
if b.Func.pass.debug > 0 {
if b.Func.pass.debug > 1 {
b.Func.Config.Warnl(b.Line, "Disproved %s (%s)", c.Op, c)
b.Func.Config.Warnl(b.Pos, "Disproved %s (%s)", c.Op, c)
} else {
b.Func.Config.Warnl(b.Line, "Disproved %s", c.Op)
b.Func.Config.Warnl(b.Pos, "Disproved %s", c.Op)
}
}
return negative
......@@ -685,9 +685,9 @@ func simplifyBlock(ft *factsTable, b *Block) branch {
if m != 0 && tr.r&m == m {
if b.Func.pass.debug > 0 {
if b.Func.pass.debug > 1 {
b.Func.Config.Warnl(b.Line, "Proved non-negative bounds %s (%s)", c.Op, c)
b.Func.Config.Warnl(b.Pos, "Proved non-negative bounds %s (%s)", c.Op, c)
} else {
b.Func.Config.Warnl(b.Line, "Proved non-negative bounds %s", c.Op)
b.Func.Config.Warnl(b.Pos, "Proved non-negative bounds %s", c.Op)
}
}
return positive
......
......@@ -393,7 +393,7 @@ func (s *regAllocState) allocReg(mask regMask, v *Value) register {
m := s.compatRegs(v2.Type) &^ s.used &^ s.tmpused &^ (regMask(1) << r)
if m != 0 && !s.values[v2.ID].rematerializeable && countRegs(s.values[v2.ID].regs) == 1 {
r2 := pickReg(m)
c := s.curBlock.NewValue1(v2.Line, OpCopy, v2.Type, s.regs[r].c)
c := s.curBlock.NewValue1(v2.Pos, OpCopy, v2.Type, s.regs[r].c)
s.copies[c] = false
if s.f.pass.debug > regDebug {
fmt.Printf("copy %s to %s : %s\n", v2, c, s.registers[r2].Name())
......@@ -446,7 +446,7 @@ func (s *regAllocState) allocValToReg(v *Value, mask regMask, nospill bool, line
// Load v from its spill location.
case vi.spill != nil:
if s.f.pass.debug > logSpills {
s.f.Config.Warnl(vi.spill.Line, "load spill for %v from %v", v, vi.spill)
s.f.Config.Warnl(vi.spill.Pos, "load spill for %v from %v", v, vi.spill)
}
c = s.curBlock.NewValue1(line, OpLoadReg, v.Type, vi.spill)
vi.spillUsed = true
......@@ -760,7 +760,7 @@ func (s *regAllocState) regalloc(f *Func) {
liveSet.add(e.ID)
}
if v := b.Control; v != nil && s.values[v.ID].needReg {
s.addUse(v.ID, int32(len(b.Values)), b.Line) // psuedo-use by control value
s.addUse(v.ID, int32(len(b.Values)), b.Pos) // psuedo-use by control value
liveSet.add(v.ID)
}
for i := len(b.Values) - 1; i >= 0; i-- {
......@@ -776,7 +776,7 @@ func (s *regAllocState) regalloc(f *Func) {
if !s.values[a.ID].needReg {
continue
}
s.addUse(a.ID, int32(i), v.Line)
s.addUse(a.ID, int32(i), v.Pos)
liveSet.add(a.ID)
}
}
......@@ -902,7 +902,7 @@ func (s *regAllocState) regalloc(f *Func) {
m := s.compatRegs(a.Type) &^ s.used &^ phiUsed
if m != 0 && !s.values[a.ID].rematerializeable && countRegs(s.values[a.ID].regs) == 1 {
r2 := pickReg(m)
c := p.NewValue1(a.Line, OpCopy, a.Type, s.regs[r].c)
c := p.NewValue1(a.Pos, OpCopy, a.Type, s.regs[r].c)
s.copies[c] = false
if s.f.pass.debug > regDebug {
fmt.Printf("copy %s to %s : %s\n", a, c, s.registers[r2].Name())
......@@ -951,7 +951,7 @@ func (s *regAllocState) regalloc(f *Func) {
// register-based phi
s.assignReg(r, v, v)
// Spill the phi in case we need to restore it later.
spill := b.NewValue1(v.Line, OpStoreReg, v.Type, v)
spill := b.NewValue1(v.Pos, OpStoreReg, v.Type, v)
s.setOrig(spill, v)
s.values[v.ID].spill = spill
s.values[v.ID].spillUsed = false
......@@ -1184,7 +1184,7 @@ func (s *regAllocState) regalloc(f *Func) {
mask &^= desired.avoid
}
}
args[i.idx] = s.allocValToReg(args[i.idx], mask, true, v.Line)
args[i.idx] = s.allocValToReg(args[i.idx], mask, true, v.Pos)
}
// If the output clobbers the input register, make sure we have
......@@ -1236,7 +1236,7 @@ func (s *regAllocState) regalloc(f *Func) {
for _, r := range dinfo[idx].out {
if r != noRegister && m>>r&1 != 0 {
m = regMask(1) << r
args[0] = s.allocValToReg(v.Args[0], m, true, v.Line)
args[0] = s.allocValToReg(v.Args[0], m, true, v.Pos)
// Note: we update args[0] so the instruction will
// use the register copy we just made.
goto ok
......@@ -1247,7 +1247,7 @@ func (s *regAllocState) regalloc(f *Func) {
for _, r := range dinfo[idx].in[0] {
if r != noRegister && m>>r&1 != 0 {
m = regMask(1) << r
c := s.allocValToReg(v.Args[0], m, true, v.Line)
c := s.allocValToReg(v.Args[0], m, true, v.Pos)
s.copies[c] = false
// Note: no update to args[0] so the instruction will
// use the original copy.
......@@ -1258,7 +1258,7 @@ func (s *regAllocState) regalloc(f *Func) {
for _, r := range dinfo[idx].in[1] {
if r != noRegister && m>>r&1 != 0 {
m = regMask(1) << r
c := s.allocValToReg(v.Args[1], m, true, v.Line)
c := s.allocValToReg(v.Args[1], m, true, v.Pos)
s.copies[c] = false
args[0], args[1] = args[1], args[0]
goto ok
......@@ -1270,7 +1270,7 @@ func (s *regAllocState) regalloc(f *Func) {
m &^= desired.avoid
}
// Save input 0 to a new register so we can clobber it.
c := s.allocValToReg(v.Args[0], m, true, v.Line)
c := s.allocValToReg(v.Args[0], m, true, v.Pos)
s.copies[c] = false
}
......@@ -1384,7 +1384,7 @@ func (s *regAllocState) regalloc(f *Func) {
// It would be good to have both spill and restore inside the IF.
issueSpill:
if s.values[v.ID].needReg {
spill := b.NewValue1(v.Line, OpStoreReg, v.Type, v)
spill := b.NewValue1(v.Pos, OpStoreReg, v.Type, v)
s.setOrig(spill, v)
s.values[v.ID].spill = spill
s.values[v.ID].spillUsed = false
......@@ -1404,7 +1404,7 @@ func (s *regAllocState) regalloc(f *Func) {
// We assume that a control input can be passed in any
// type-compatible register. If this turns out not to be true,
// we'll need to introduce a regspec for a block's control value.
b.Control = s.allocValToReg(v, s.compatRegs(v.Type), false, b.Line)
b.Control = s.allocValToReg(v, s.compatRegs(v.Type), false, b.Pos)
if b.Control != v {
v.Uses--
b.Control.Uses++
......@@ -1459,7 +1459,7 @@ func (s *regAllocState) regalloc(f *Func) {
m &^= desired.avoid
}
if m != 0 {
s.allocValToReg(v, m, false, b.Line)
s.allocValToReg(v, m, false, b.Pos)
}
}
}
......@@ -1610,7 +1610,7 @@ func (s *regAllocState) regalloc(f *Func) {
vi := s.values[i]
if vi.spillUsed {
if s.f.pass.debug > logSpills && vi.spill.Op != OpArg {
s.f.Config.Warnl(vi.spill.Line, "spilled value at %v remains", vi.spill)
s.f.Config.Warnl(vi.spill.Pos, "spilled value at %v remains", vi.spill)
}
continue
}
......@@ -1708,7 +1708,7 @@ sinking:
}
// If here, the register assignment was lost down at least one exit and it can't be sunk
if s.f.pass.debug > moveSpills {
s.f.Config.Warnl(e.Line, "lost register assignment for spill %v in %v at exit %v to %v",
s.f.Config.Warnl(e.Pos, "lost register assignment for spill %v in %v at exit %v to %v",
vsp, b, p, d)
}
nSpillsChanged++
......@@ -1744,10 +1744,10 @@ sinking:
d := loop.exits[i]
vspnew := vsp // reuse original for first sunk spill, saves tracking down and renaming uses
if !first { // any sunk spills after first must make a copy
vspnew = d.NewValue1(e.Line, OpStoreReg, e.Type, e)
vspnew = d.NewValue1(e.Pos, OpStoreReg, e.Type, e)
f.setHome(vspnew, f.getHome(vsp.ID)) // copy stack home
if s.f.pass.debug > moveSpills {
s.f.Config.Warnl(e.Line, "copied spill %v in %v for %v to %v in %v",
s.f.Config.Warnl(e.Pos, "copied spill %v in %v for %v to %v in %v",
vsp, b, e, vspnew, d)
}
} else {
......@@ -1755,7 +1755,7 @@ sinking:
vspnew.Block = d
d.Values = append(d.Values, vspnew)
if s.f.pass.debug > moveSpills {
s.f.Config.Warnl(e.Line, "moved spill %v in %v for %v to %v in %v",
s.f.Config.Warnl(e.Pos, "moved spill %v in %v for %v to %v in %v",
vsp, b, e, vspnew, d)
}
}
......@@ -1935,7 +1935,7 @@ func (e *edgeState) setup(idx int, srcReg []endReg, dstReg []startReg, stacklive
if loc == nil {
continue
}
dsts = append(dsts, dstRecord{loc, v.Args[idx].ID, &v.Args[idx], v.Line})
dsts = append(dsts, dstRecord{loc, v.Args[idx].ID, &v.Args[idx], v.Pos})
}
e.destinations = dsts
......@@ -2251,8 +2251,8 @@ func (e *edgeState) findRegFor(typ Type) Location {
a := e.cache[vid]
for _, c := range a {
if r, ok := e.s.f.getHome(c.ID).(*Register); ok && m>>uint(r.num)&1 != 0 {
x := e.p.NewValue1(c.Line, OpStoreReg, c.Type, c)
e.set(t, vid, x, false, c.Line)
x := e.p.NewValue1(c.Pos, OpStoreReg, c.Type, c)
e.set(t, vid, x, false, c.Pos)
if e.s.f.pass.debug > regDebug {
fmt.Printf(" SPILL %s->%s %s\n", r.Name(), t.Name(), x.LongString())
}
......@@ -2347,7 +2347,7 @@ func (s *regAllocState) computeLive() {
// Mark control value as live
if b.Control != nil && s.values[b.Control.ID].needReg {
live.set(b.Control.ID, int32(len(b.Values)), b.Line)
live.set(b.Control.ID, int32(len(b.Values)), b.Pos)
}
// Propagate backwards to the start of the block
......@@ -2369,7 +2369,7 @@ func (s *regAllocState) computeLive() {
}
for _, a := range v.Args {
if s.values[a.ID].needReg {
live.set(a.ID, int32(i), v.Line)
live.set(a.ID, int32(i), v.Pos)
}
}
}
......@@ -2447,7 +2447,7 @@ func (s *regAllocState) computeLive() {
id := v.Args[i].ID
if s.values[id].needReg && (!t.contains(id) || delta < t.get(id)) {
update = true
t.set(id, delta, v.Line)
t.set(id, delta, v.Pos)
}
}
......
......@@ -489,7 +489,7 @@ func noteRule(s string) bool {
// cond is true and the rule is fired.
func warnRule(cond bool, v *Value, s string) bool {
if cond {
v.Block.Func.Config.Warnl(v.Line, s)
v.Block.Func.Config.Warnl(v.Pos, s)
}
return true
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -46,8 +46,8 @@ func (h ValHeap) Less(i, j int) bool {
if c := sx - sy; c != 0 {
return c > 0 // higher score comes later.
}
if x.Line != y.Line { // Favor in-order line stepping
return x.Line.After(y.Line)
if x.Pos != y.Pos { // Favor in-order line stepping
return x.Pos.After(y.Pos)
}
if x.Op != OpPhi {
if c := len(x.Args) - len(y.Args); c != 0 {
......
......@@ -17,8 +17,8 @@ func shortcircuit(f *Func) {
// x = phi(a, ...)
//
// We can replace the "a" in the phi with the constant true.
ct := f.ConstBool(f.Entry.Line, f.Config.fe.TypeBool(), true)
cf := f.ConstBool(f.Entry.Line, f.Config.fe.TypeBool(), false)
ct := f.ConstBool(f.Entry.Pos, f.Config.fe.TypeBool(), true)
cf := f.ConstBool(f.Entry.Pos, f.Config.fe.TypeBool(), false)
for _, b := range f.Blocks {
for _, v := range b.Values {
if v.Op != OpPhi {
......
......@@ -37,8 +37,8 @@ type Value struct {
// Containing basic block
Block *Block
// Source line number
Line src.Pos
// Source position
Pos src.Pos
// Use count. Each appearance in Value.Args and Block.Control counts once.
Uses int32
......@@ -218,7 +218,7 @@ func (v *Value) reset(op Op) {
// copyInto makes a new value identical to v and adds it to the end of b.
func (v *Value) copyInto(b *Block) *Value {
c := b.NewValue0(v.Line, v.Op, v.Type)
c := b.NewValue0(v.Pos, v.Op, v.Type)
c.Aux = v.Aux
c.AuxInt = v.AuxInt
c.AddArgs(v.Args...)
......@@ -233,7 +233,7 @@ func (v *Value) copyInto(b *Block) *Value {
func (v *Value) Logf(msg string, args ...interface{}) { v.Block.Logf(msg, args...) }
func (v *Value) Log() bool { return v.Block.Log() }
func (v *Value) Fatalf(msg string, args ...interface{}) {
v.Block.Func.Config.Fatalf(v.Line, msg, args...)
v.Block.Func.Config.Fatalf(v.Pos, msg, args...)
}
// isGenericIntConst returns whether v is a generic integer constant.
......
......@@ -56,7 +56,7 @@ func writebarrier(f *Func) {
if wbaddr == nil {
// initalize global values for write barrier test and calls
// find SB and SP values in entry block
initln := f.Entry.Line
initln := f.Entry.Pos
for _, v := range f.Entry.Values {
if v.Op == OpSB {
sb = v
......@@ -81,7 +81,7 @@ func writebarrier(f *Func) {
defer f.retSparseSet(wbs)
}
line := v.Line
line := v.Pos
// there may be a sequence of WB stores in the current block. find them.
storeWBs = storeWBs[:0]
......@@ -127,9 +127,9 @@ func writebarrier(f *Func) {
bThen := f.NewBlock(BlockPlain)
bElse := f.NewBlock(BlockPlain)
bEnd := f.NewBlock(b.Kind)
bThen.Line = line
bElse.Line = line
bEnd.Line = line
bThen.Pos = line
bElse.Pos = line
bEnd.Pos = line
// set up control flow for end block
bEnd.SetControl(b.Control)
......
......@@ -114,7 +114,7 @@ func opregreg(op obj.As, dest, src int16) *obj.Prog {
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
s.SetPos(v.Line)
s.SetPos(v.Pos)
if gc.Thearch.Use387 {
if ssaGenValue387(s, v) {
......@@ -788,8 +788,8 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p.To.Type = obj.TYPE_MEM
p.To.Reg = v.Args[0].Reg()
gc.AddAux(&p.To, v)
if gc.Debug_checknil != 0 && v.Line.Line() > 1 { // v.Line==1 in generated wrappers
gc.Warnl(v.Line, "generated nil check")
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
gc.Warnl(v.Pos, "generated nil check")
}
case ssa.Op386FCHS:
v.Fatalf("FCHS in non-387 mode")
......@@ -825,7 +825,7 @@ var nefJumps = [2][2]gc.FloatingEQNEJump{
}
func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
s.SetPos(b.Line)
s.SetPos(b.Pos)
if gc.Thearch.Use387 {
// Empty the 387's FP stack before the block ends.
......
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