[dev.inline] cmd/compile/internal/ssa: another round of renames from line -> pos (cleanup)

Mostly mechanical renames. Make variable names consistent with use.

Change-Id: Iaa89d31deab11eca6e784595b58e779ad525c8a3
Reviewed-on: https://go-review.googlesource.com/34146
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Robert Griesemer 2016-12-08 13:49:51 -08:00
parent cfd17f51c8
commit c10499b539
4 changed files with 119 additions and 121 deletions

View file

@ -89,10 +89,10 @@ type Logger interface {
Log() bool
// Fatal reports a compiler error and exits.
Fatalf(line src.Pos, msg string, args ...interface{})
Fatalf(pos src.Pos, msg string, args ...interface{})
// Warnl writes compiler messages in the form expected by "errorcheck" tests
Warnl(line src.Pos, fmt_ string, args ...interface{})
Warnl(pos src.Pos, fmt_ string, args ...interface{})
// Fowards the Debug flags from gc
Debug_checknil() bool
@ -120,7 +120,7 @@ type Frontend interface {
SplitArray(LocalSlot) LocalSlot // array must be length 1
SplitInt64(LocalSlot) (LocalSlot, LocalSlot) // returns (hi, lo)
// Line returns a string describing the given line number.
// Line returns a string describing the given position.
Line(src.Pos) string
// AllocFrame assigns frame offsets to all live auto variables.
@ -341,10 +341,8 @@ func (c *Config) NewFunc() *Func {
func (c *Config) Logf(msg string, args ...interface{}) { c.fe.Logf(msg, args...) }
func (c *Config) Log() bool { return c.fe.Log() }
func (c *Config) Fatalf(line src.Pos, msg string, args ...interface{}) {
c.fe.Fatalf(line, msg, args...)
}
func (c *Config) Warnl(line src.Pos, msg string, args ...interface{}) { c.fe.Warnl(line, msg, args...) }
func (c *Config) Fatalf(pos src.Pos, msg string, args ...interface{}) { c.fe.Fatalf(pos, msg, args...) }
func (c *Config) Warnl(pos src.Pos, msg string, args ...interface{}) { c.fe.Warnl(pos, msg, args...) }
func (c *Config) Debug_checknil() bool { return c.fe.Debug_checknil() }
func (c *Config) Debug_wb() bool { return c.fe.Debug_wb() }

View file

@ -187,30 +187,30 @@ func (f *Func) freeBlock(b *Block) {
}
// NewValue0 returns a new value in the block with no arguments and zero aux values.
func (b *Block) NewValue0(line src.Pos, op Op, t Type) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue0(pos src.Pos, op Op, t Type) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = 0
v.Args = v.argstorage[:0]
return v
}
// NewValue returns a new value in the block with no arguments and an auxint value.
func (b *Block) NewValue0I(line src.Pos, op Op, t Type, auxint int64) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue0I(pos src.Pos, op Op, t Type, auxint int64) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = auxint
v.Args = v.argstorage[:0]
return v
}
// NewValue returns a new value in the block with no arguments and an aux value.
func (b *Block) NewValue0A(line src.Pos, op Op, t Type, aux interface{}) *Value {
func (b *Block) NewValue0A(pos src.Pos, op Op, t Type, aux interface{}) *Value {
if _, ok := aux.(int64); ok {
// Disallow int64 aux values. They should be in the auxint field instead.
// Maybe we want to allow this at some point, but for now we disallow it
// to prevent errors like using NewValue1A instead of NewValue1I.
b.Fatalf("aux field has int64 type op=%s type=%s aux=%v", op, t, aux)
}
v := b.Func.newValue(op, t, b, line)
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = 0
v.Aux = aux
v.Args = v.argstorage[:0]
@ -218,8 +218,8 @@ func (b *Block) NewValue0A(line src.Pos, op Op, t Type, aux interface{}) *Value
}
// NewValue returns a new value in the block with no arguments and both an auxint and aux values.
func (b *Block) NewValue0IA(line src.Pos, op Op, t Type, auxint int64, aux interface{}) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue0IA(pos src.Pos, op Op, t Type, auxint int64, aux interface{}) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = auxint
v.Aux = aux
v.Args = v.argstorage[:0]
@ -227,8 +227,8 @@ func (b *Block) NewValue0IA(line src.Pos, op Op, t Type, auxint int64, aux inter
}
// NewValue1 returns a new value in the block with one argument and zero aux values.
func (b *Block) NewValue1(line src.Pos, op Op, t Type, arg *Value) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue1(pos src.Pos, op Op, t Type, arg *Value) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = 0
v.Args = v.argstorage[:1]
v.argstorage[0] = arg
@ -237,8 +237,8 @@ func (b *Block) NewValue1(line src.Pos, op Op, t Type, arg *Value) *Value {
}
// NewValue1I returns a new value in the block with one argument and an auxint value.
func (b *Block) NewValue1I(line src.Pos, op Op, t Type, auxint int64, arg *Value) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue1I(pos src.Pos, op Op, t Type, auxint int64, arg *Value) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = auxint
v.Args = v.argstorage[:1]
v.argstorage[0] = arg
@ -247,8 +247,8 @@ func (b *Block) NewValue1I(line src.Pos, op Op, t Type, auxint int64, arg *Value
}
// NewValue1A returns a new value in the block with one argument and an aux value.
func (b *Block) NewValue1A(line src.Pos, op Op, t Type, aux interface{}, arg *Value) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue1A(pos src.Pos, op Op, t Type, aux interface{}, arg *Value) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = 0
v.Aux = aux
v.Args = v.argstorage[:1]
@ -258,8 +258,8 @@ func (b *Block) NewValue1A(line src.Pos, op Op, t Type, aux interface{}, arg *Va
}
// NewValue1IA returns a new value in the block with one argument and both an auxint and aux values.
func (b *Block) NewValue1IA(line src.Pos, op Op, t Type, auxint int64, aux interface{}, arg *Value) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue1IA(pos src.Pos, op Op, t Type, auxint int64, aux interface{}, arg *Value) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = auxint
v.Aux = aux
v.Args = v.argstorage[:1]
@ -269,8 +269,8 @@ func (b *Block) NewValue1IA(line src.Pos, op Op, t Type, auxint int64, aux inter
}
// NewValue2 returns a new value in the block with two arguments and zero aux values.
func (b *Block) NewValue2(line src.Pos, op Op, t Type, arg0, arg1 *Value) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue2(pos src.Pos, op Op, t Type, arg0, arg1 *Value) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = 0
v.Args = v.argstorage[:2]
v.argstorage[0] = arg0
@ -281,8 +281,8 @@ func (b *Block) NewValue2(line src.Pos, op Op, t Type, arg0, arg1 *Value) *Value
}
// NewValue2I returns a new value in the block with two arguments and an auxint value.
func (b *Block) NewValue2I(line src.Pos, op Op, t Type, auxint int64, arg0, arg1 *Value) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue2I(pos src.Pos, op Op, t Type, auxint int64, arg0, arg1 *Value) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = auxint
v.Args = v.argstorage[:2]
v.argstorage[0] = arg0
@ -293,8 +293,8 @@ func (b *Block) NewValue2I(line src.Pos, op Op, t Type, auxint int64, arg0, arg1
}
// NewValue3 returns a new value in the block with three arguments and zero aux values.
func (b *Block) NewValue3(line src.Pos, op Op, t Type, arg0, arg1, arg2 *Value) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue3(pos src.Pos, op Op, t Type, arg0, arg1, arg2 *Value) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = 0
v.Args = v.argstorage[:3]
v.argstorage[0] = arg0
@ -307,8 +307,8 @@ func (b *Block) NewValue3(line src.Pos, op Op, t Type, arg0, arg1, arg2 *Value)
}
// NewValue3I returns a new value in the block with three arguments and an auxint value.
func (b *Block) NewValue3I(line src.Pos, op Op, t Type, auxint int64, arg0, arg1, arg2 *Value) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue3I(pos src.Pos, op Op, t Type, auxint int64, arg0, arg1, arg2 *Value) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = auxint
v.Args = v.argstorage[:3]
v.argstorage[0] = arg0
@ -321,8 +321,8 @@ func (b *Block) NewValue3I(line src.Pos, op Op, t Type, auxint int64, arg0, arg1
}
// NewValue4 returns a new value in the block with four arguments and zero aux values.
func (b *Block) NewValue4(line src.Pos, op Op, t Type, arg0, arg1, arg2, arg3 *Value) *Value {
v := b.Func.newValue(op, t, b, line)
func (b *Block) NewValue4(pos src.Pos, op Op, t Type, arg0, arg1, arg2, arg3 *Value) *Value {
v := b.Func.newValue(op, t, b, pos)
v.AuxInt = 0
v.Args = []*Value{arg0, arg1, arg2, arg3}
arg0.Uses++
@ -333,7 +333,7 @@ func (b *Block) NewValue4(line src.Pos, op Op, t Type, arg0, arg1, arg2, arg3 *V
}
// constVal returns a constant value for c.
func (f *Func) constVal(line src.Pos, op Op, t Type, c int64, setAux bool) *Value {
func (f *Func) constVal(pos src.Pos, op Op, t Type, c int64, setAux bool) *Value {
if f.constants == nil {
f.constants = make(map[int64][]*Value)
}
@ -348,9 +348,9 @@ func (f *Func) constVal(line src.Pos, op Op, t Type, c int64, setAux bool) *Valu
}
var v *Value
if setAux {
v = f.Entry.NewValue0I(line, op, t, c)
v = f.Entry.NewValue0I(pos, op, t, c)
} else {
v = f.Entry.NewValue0(line, op, t)
v = f.Entry.NewValue0(pos, op, t)
}
f.constants[c] = append(vv, v)
return v
@ -368,43 +368,43 @@ const (
)
// ConstInt returns an int constant representing its argument.
func (f *Func) ConstBool(line src.Pos, t Type, c bool) *Value {
func (f *Func) ConstBool(pos src.Pos, t Type, c bool) *Value {
i := int64(0)
if c {
i = 1
}
return f.constVal(line, OpConstBool, t, i, true)
return f.constVal(pos, OpConstBool, t, i, true)
}
func (f *Func) ConstInt8(line src.Pos, t Type, c int8) *Value {
return f.constVal(line, OpConst8, t, int64(c), true)
func (f *Func) ConstInt8(pos src.Pos, t Type, c int8) *Value {
return f.constVal(pos, OpConst8, t, int64(c), true)
}
func (f *Func) ConstInt16(line src.Pos, t Type, c int16) *Value {
return f.constVal(line, OpConst16, t, int64(c), true)
func (f *Func) ConstInt16(pos src.Pos, t Type, c int16) *Value {
return f.constVal(pos, OpConst16, t, int64(c), true)
}
func (f *Func) ConstInt32(line src.Pos, t Type, c int32) *Value {
return f.constVal(line, OpConst32, t, int64(c), true)
func (f *Func) ConstInt32(pos src.Pos, t Type, c int32) *Value {
return f.constVal(pos, OpConst32, t, int64(c), true)
}
func (f *Func) ConstInt64(line src.Pos, t Type, c int64) *Value {
return f.constVal(line, OpConst64, t, c, true)
func (f *Func) ConstInt64(pos src.Pos, t Type, c int64) *Value {
return f.constVal(pos, OpConst64, t, c, true)
}
func (f *Func) ConstFloat32(line src.Pos, t Type, c float64) *Value {
return f.constVal(line, OpConst32F, t, int64(math.Float64bits(float64(float32(c)))), true)
func (f *Func) ConstFloat32(pos src.Pos, t Type, c float64) *Value {
return f.constVal(pos, OpConst32F, t, int64(math.Float64bits(float64(float32(c)))), true)
}
func (f *Func) ConstFloat64(line src.Pos, t Type, c float64) *Value {
return f.constVal(line, OpConst64F, t, int64(math.Float64bits(c)), true)
func (f *Func) ConstFloat64(pos src.Pos, t Type, c float64) *Value {
return f.constVal(pos, OpConst64F, t, int64(math.Float64bits(c)), true)
}
func (f *Func) ConstSlice(line src.Pos, t Type) *Value {
return f.constVal(line, OpConstSlice, t, constSliceMagic, false)
func (f *Func) ConstSlice(pos src.Pos, t Type) *Value {
return f.constVal(pos, OpConstSlice, t, constSliceMagic, false)
}
func (f *Func) ConstInterface(line src.Pos, t Type) *Value {
return f.constVal(line, OpConstInterface, t, constInterfaceMagic, false)
func (f *Func) ConstInterface(pos src.Pos, t Type) *Value {
return f.constVal(pos, OpConstInterface, t, constInterfaceMagic, false)
}
func (f *Func) ConstNil(line src.Pos, t Type) *Value {
return f.constVal(line, OpConstNil, t, constNilMagic, false)
func (f *Func) ConstNil(pos src.Pos, t Type) *Value {
return f.constVal(pos, OpConstNil, t, constNilMagic, false)
}
func (f *Func) ConstEmptyString(line src.Pos, t Type) *Value {
v := f.constVal(line, OpConstString, t, constEmptyStringMagic, false)
func (f *Func) ConstEmptyString(pos src.Pos, t Type) *Value {
v := f.constVal(pos, OpConstString, t, constEmptyStringMagic, false)
v.Aux = ""
return v
}

View file

@ -182,7 +182,7 @@ func pickReg(r regMask) register {
type use struct {
dist int32 // distance from start of the block to a use of a value
line src.Pos // line number of the use
pos src.Pos // source position of the use
next *use // linked list of uses of a value in nondecreasing dist order
}
@ -289,7 +289,7 @@ type endReg struct {
type startReg struct {
r register
vid ID // pre-regalloc value needed in this register
line src.Pos // line number of use of this register
pos src.Pos // source position of use of this register
}
// freeReg frees up register r. Any current user of r is kicked out.
@ -411,7 +411,7 @@ func (s *regAllocState) allocReg(mask regMask, v *Value) register {
// allocated register is marked nospill so the assignment cannot be
// undone until the caller allows it by clearing nospill. Returns a
// *Value which is either v or a copy of v allocated to the chosen register.
func (s *regAllocState) allocValToReg(v *Value, mask regMask, nospill bool, line src.Pos) *Value {
func (s *regAllocState) allocValToReg(v *Value, mask regMask, nospill bool, pos src.Pos) *Value {
vi := &s.values[v.ID]
// Check if v is already in a requested register.
@ -437,7 +437,7 @@ func (s *regAllocState) allocValToReg(v *Value, mask regMask, nospill bool, line
if s.regs[r2].v != v {
panic("bad register state")
}
c = s.curBlock.NewValue1(line, OpCopy, v.Type, s.regs[r2].c)
c = s.curBlock.NewValue1(pos, OpCopy, v.Type, s.regs[r2].c)
} else if v.rematerializeable() {
// Rematerialize instead of loading from the spill location.
c = v.copyInto(s.curBlock)
@ -448,7 +448,7 @@ func (s *regAllocState) allocValToReg(v *Value, mask regMask, nospill bool, line
if s.f.pass.debug > logSpills {
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)
c = s.curBlock.NewValue1(pos, OpLoadReg, v.Type, vi.spill)
vi.spillUsed = true
default:
s.f.Fatalf("attempt to load unspilled value %v", v.LongString())
@ -618,7 +618,7 @@ func (s *regAllocState) init(f *Func) {
// Adds a use record for id at distance dist from the start of the block.
// All calls to addUse must happen with nonincreasing dist.
func (s *regAllocState) addUse(id ID, dist int32, line src.Pos) {
func (s *regAllocState) addUse(id ID, dist int32, pos src.Pos) {
r := s.freeUseRecords
if r != nil {
s.freeUseRecords = r.next
@ -626,7 +626,7 @@ func (s *regAllocState) addUse(id ID, dist int32, line src.Pos) {
r = &use{}
}
r.dist = dist
r.line = line
r.pos = pos
r.next = s.values[id].uses
s.values[id].uses = r
if r.next != nil && dist > r.next.dist {
@ -756,7 +756,7 @@ func (s *regAllocState) regalloc(f *Func) {
// Walk backwards through the block doing liveness analysis.
liveSet.clear()
for _, e := range s.live[b.ID] {
s.addUse(e.ID, int32(len(b.Values))+e.dist, e.line) // pseudo-uses from beyond end of block
s.addUse(e.ID, int32(len(b.Values))+e.dist, e.pos) // pseudo-uses from beyond end of block
liveSet.add(e.ID)
}
if v := b.Control; v != nil && s.values[v.ID].needReg {
@ -974,7 +974,7 @@ func (s *regAllocState) regalloc(f *Func) {
// specially during merge edge processing.
continue
}
regList = append(regList, startReg{r, v.ID, s.values[v.ID].uses.line})
regList = append(regList, startReg{r, v.ID, s.values[v.ID].uses.pos})
}
s.startRegs[b.ID] = regList
@ -1882,14 +1882,14 @@ type contentRecord struct {
vid ID // pre-regalloc value
c *Value // cached value
final bool // this is a satisfied destination
line src.Pos // line number of use of the value
pos src.Pos // source position of use of the value
}
type dstRecord struct {
loc Location // register or stack slot
vid ID // pre-regalloc value it should contain
splice **Value // place to store reference to the generating instruction
line src.Pos // line number of use of this location
pos src.Pos // source position of use of this location
}
// setup initializes the edge state for shuffling.
@ -1912,19 +1912,19 @@ func (e *edgeState) setup(idx int, srcReg []endReg, dstReg []startReg, stacklive
// Live registers can be sources.
for _, x := range srcReg {
e.set(&e.s.registers[x.r], x.v.ID, x.c, false, src.Pos{}) // don't care the line number of the source
e.set(&e.s.registers[x.r], x.v.ID, x.c, false, src.Pos{}) // don't care the position of the source
}
// So can all of the spill locations.
for _, spillID := range stacklive {
v := e.s.orig[spillID]
spill := e.s.values[v.ID].spill
e.set(e.s.f.getHome(spillID), v.ID, spill, false, src.Pos{}) // don't care the line number of the source
e.set(e.s.f.getHome(spillID), v.ID, spill, false, src.Pos{}) // don't care the position of the source
}
// Figure out all the destinations we need.
dsts := e.destinations[:0]
for _, x := range dstReg {
dsts = append(dsts, dstRecord{&e.s.registers[x.r], x.vid, nil, x.line})
dsts = append(dsts, dstRecord{&e.s.registers[x.r], x.vid, nil, x.pos})
}
// Phis need their args to end up in a specific location.
for _, v := range e.b.Values {
@ -1960,7 +1960,7 @@ func (e *edgeState) process() {
for len(dsts) > 0 {
i := 0
for _, d := range dsts {
if !e.processDest(d.loc, d.vid, d.splice, d.line) {
if !e.processDest(d.loc, d.vid, d.splice, d.pos) {
// Failed - save for next iteration.
dsts[i] = d
i++
@ -2007,22 +2007,22 @@ func (e *edgeState) process() {
fmt.Printf("breaking cycle with v%d in %s:%s\n", vid, loc.Name(), c)
}
if _, isReg := loc.(*Register); isReg {
c = e.p.NewValue1(d.line, OpCopy, c.Type, c)
c = e.p.NewValue1(d.pos, OpCopy, c.Type, c)
} else {
e.s.lateSpillUse(vid)
c = e.p.NewValue1(d.line, OpLoadReg, c.Type, c)
c = e.p.NewValue1(d.pos, OpLoadReg, c.Type, c)
}
e.set(r, vid, c, false, d.line)
e.set(r, vid, c, false, d.pos)
}
}
// processDest generates code to put value vid into location loc. Returns true
// if progress was made.
func (e *edgeState) processDest(loc Location, vid ID, splice **Value, line src.Pos) bool {
func (e *edgeState) processDest(loc Location, vid ID, splice **Value, pos src.Pos) bool {
occupant := e.contents[loc]
if occupant.vid == vid {
// Value is already in the correct place.
e.contents[loc] = contentRecord{vid, occupant.c, true, line}
e.contents[loc] = contentRecord{vid, occupant.c, true, pos}
if splice != nil {
(*splice).Uses--
*splice = occupant.c
@ -2088,25 +2088,25 @@ func (e *edgeState) processDest(loc Location, vid ID, splice **Value, line src.P
e.erase(loc) // see pre-clobber comment below
r := e.findRegFor(v.Type)
x = v.copyInto(e.p)
e.set(r, vid, x, false, line)
e.set(r, vid, x, false, pos)
// Make sure we spill with the size of the slot, not the
// size of x (which might be wider due to our dropping
// of narrowing conversions).
x = e.p.NewValue1(line, OpStoreReg, loc.(LocalSlot).Type, x)
x = e.p.NewValue1(pos, OpStoreReg, loc.(LocalSlot).Type, x)
}
} else {
// Emit move from src to dst.
_, srcReg := src.(*Register)
if srcReg {
if dstReg {
x = e.p.NewValue1(line, OpCopy, c.Type, c)
x = e.p.NewValue1(pos, OpCopy, c.Type, c)
} else {
x = e.p.NewValue1(line, OpStoreReg, loc.(LocalSlot).Type, c)
x = e.p.NewValue1(pos, OpStoreReg, loc.(LocalSlot).Type, c)
}
} else {
if dstReg {
e.s.lateSpillUse(vid)
x = e.p.NewValue1(line, OpLoadReg, c.Type, c)
x = e.p.NewValue1(pos, OpLoadReg, c.Type, c)
} else {
// mem->mem. Use temp register.
@ -2124,13 +2124,13 @@ func (e *edgeState) processDest(loc Location, vid ID, splice **Value, line src.P
r := e.findRegFor(c.Type)
e.s.lateSpillUse(vid)
t := e.p.NewValue1(line, OpLoadReg, c.Type, c)
e.set(r, vid, t, false, line)
x = e.p.NewValue1(line, OpStoreReg, loc.(LocalSlot).Type, t)
t := e.p.NewValue1(pos, OpLoadReg, c.Type, c)
e.set(r, vid, t, false, pos)
x = e.p.NewValue1(pos, OpStoreReg, loc.(LocalSlot).Type, t)
}
}
}
e.set(loc, vid, x, true, line)
e.set(loc, vid, x, true, pos)
if splice != nil {
(*splice).Uses--
*splice = x
@ -2140,10 +2140,10 @@ func (e *edgeState) processDest(loc Location, vid ID, splice **Value, line src.P
}
// set changes the contents of location loc to hold the given value and its cached representative.
func (e *edgeState) set(loc Location, vid ID, c *Value, final bool, line src.Pos) {
func (e *edgeState) set(loc Location, vid ID, c *Value, final bool, pos src.Pos) {
e.s.f.setHome(c, loc)
e.erase(loc)
e.contents[loc] = contentRecord{vid, c, final, line}
e.contents[loc] = contentRecord{vid, c, final, pos}
a := e.cache[vid]
if len(a) == 0 {
e.cachedVals = append(e.cachedVals, vid)
@ -2182,7 +2182,7 @@ func (e *edgeState) erase(loc Location) {
// Add a destination to move this value back into place.
// Make sure it gets added to the tail of the destination queue
// so we make progress on other moves first.
e.extra = append(e.extra, dstRecord{loc, cr.vid, nil, cr.line})
e.extra = append(e.extra, dstRecord{loc, cr.vid, nil, cr.pos})
}
// Remove c from the list of cached values.
@ -2293,7 +2293,7 @@ func (v *Value) rematerializeable() bool {
type liveInfo struct {
ID ID // ID of value
dist int32 // # of instructions before next use
line src.Pos // line number of next use
pos src.Pos // source position of next use
}
// dblock contains information about desired & avoid registers at the end of a block.
@ -2342,7 +2342,7 @@ func (s *regAllocState) computeLive() {
// to beginning-of-block distance.
live.clear()
for _, e := range s.live[b.ID] {
live.set(e.ID, e.dist+int32(len(b.Values)), e.line)
live.set(e.ID, e.dist+int32(len(b.Values)), e.pos)
}
// Mark control value as live
@ -2428,7 +2428,7 @@ func (s *regAllocState) computeLive() {
// Start t off with the previously known live values at the end of p.
t.clear()
for _, e := range s.live[p.ID] {
t.set(e.ID, e.dist, e.line)
t.set(e.ID, e.dist, e.pos)
}
update := false

View file

@ -81,7 +81,7 @@ func writebarrier(f *Func) {
defer f.retSparseSet(wbs)
}
line := v.Pos
pos := 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.Pos = line
bElse.Pos = line
bEnd.Pos = line
bThen.Pos = pos
bElse.Pos = pos
bEnd.Pos = pos
// set up control flow for end block
bEnd.SetControl(b.Control)
@ -141,9 +141,9 @@ func writebarrier(f *Func) {
// set up control flow for write barrier test
// load word, test word, avoiding partial register write from load byte.
flag := b.NewValue2(line, OpLoad, f.Config.fe.TypeUInt32(), wbaddr, mem)
const0 := f.ConstInt32(line, f.Config.fe.TypeUInt32(), 0)
flag = b.NewValue2(line, OpNeq32, f.Config.fe.TypeBool(), flag, const0)
flag := b.NewValue2(pos, OpLoad, f.Config.fe.TypeUInt32(), wbaddr, mem)
const0 := f.ConstInt32(pos, f.Config.fe.TypeUInt32(), 0)
flag = b.NewValue2(pos, OpNeq32, f.Config.fe.TypeBool(), flag, const0)
b.Kind = BlockIf
b.SetControl(flag)
b.Likely = BranchUnlikely
@ -178,13 +178,13 @@ func writebarrier(f *Func) {
}
// then block: emit write barrier call
memThen = wbcall(line, bThen, fn, typ, ptr, val, memThen, sp, sb, w.Op == OpMoveWBVolatile)
memThen = wbcall(pos, bThen, fn, typ, ptr, val, memThen, sp, sb, w.Op == OpMoveWBVolatile)
// else block: normal store
if op == OpZero {
memElse = bElse.NewValue2I(line, op, TypeMem, siz, ptr, memElse)
memElse = bElse.NewValue2I(pos, op, TypeMem, siz, ptr, memElse)
} else {
memElse = bElse.NewValue3I(line, op, TypeMem, siz, ptr, val, memElse)
memElse = bElse.NewValue3I(pos, op, TypeMem, siz, ptr, val, memElse)
}
}
@ -229,7 +229,7 @@ func writebarrier(f *Func) {
}
if f.Config.fe.Debug_wb() {
f.Config.Warnl(line, "write barrier")
f.Config.Warnl(pos, "write barrier")
}
break valueLoop
@ -240,7 +240,7 @@ func writebarrier(f *Func) {
// wbcall emits write barrier runtime call in b, returns memory.
// if valIsVolatile, it moves val into temp space before making the call.
func wbcall(line src.Pos, b *Block, fn interface{}, typ interface{}, ptr, val, mem, sp, sb *Value, valIsVolatile bool) *Value {
func wbcall(pos src.Pos, b *Block, fn interface{}, typ interface{}, ptr, val, mem, sp, sb *Value, valIsVolatile bool) *Value {
config := b.Func.Config
var tmp GCNode
@ -251,10 +251,10 @@ func wbcall(line src.Pos, b *Block, fn interface{}, typ interface{}, ptr, val, m
t := val.Type.ElemType()
tmp = config.fe.Auto(t)
aux := &AutoSymbol{Typ: t, Node: tmp}
mem = b.NewValue1A(line, OpVarDef, TypeMem, tmp, mem)
tmpaddr := b.NewValue1A(line, OpAddr, t.PtrTo(), aux, sp)
mem = b.NewValue1A(pos, OpVarDef, TypeMem, tmp, mem)
tmpaddr := b.NewValue1A(pos, OpAddr, t.PtrTo(), aux, sp)
siz := MakeSizeAndAlign(t.Size(), t.Alignment()).Int64()
mem = b.NewValue3I(line, OpMove, TypeMem, siz, tmpaddr, val, mem)
mem = b.NewValue3I(pos, OpMove, TypeMem, siz, tmpaddr, val, mem)
val = tmpaddr
}
@ -262,32 +262,32 @@ func wbcall(line src.Pos, b *Block, fn interface{}, typ interface{}, ptr, val, m
off := config.ctxt.FixedFrameSize()
if typ != nil { // for typedmemmove
taddr := b.NewValue1A(line, OpAddr, config.fe.TypeUintptr(), typ, sb)
taddr := b.NewValue1A(pos, OpAddr, config.fe.TypeUintptr(), typ, sb)
off = round(off, taddr.Type.Alignment())
arg := b.NewValue1I(line, OpOffPtr, taddr.Type.PtrTo(), off, sp)
mem = b.NewValue3I(line, OpStore, TypeMem, ptr.Type.Size(), arg, taddr, mem)
arg := b.NewValue1I(pos, OpOffPtr, taddr.Type.PtrTo(), off, sp)
mem = b.NewValue3I(pos, OpStore, TypeMem, ptr.Type.Size(), arg, taddr, mem)
off += taddr.Type.Size()
}
off = round(off, ptr.Type.Alignment())
arg := b.NewValue1I(line, OpOffPtr, ptr.Type.PtrTo(), off, sp)
mem = b.NewValue3I(line, OpStore, TypeMem, ptr.Type.Size(), arg, ptr, mem)
arg := b.NewValue1I(pos, OpOffPtr, ptr.Type.PtrTo(), off, sp)
mem = b.NewValue3I(pos, OpStore, TypeMem, ptr.Type.Size(), arg, ptr, mem)
off += ptr.Type.Size()
if val != nil {
off = round(off, val.Type.Alignment())
arg = b.NewValue1I(line, OpOffPtr, val.Type.PtrTo(), off, sp)
mem = b.NewValue3I(line, OpStore, TypeMem, val.Type.Size(), arg, val, mem)
arg = b.NewValue1I(pos, OpOffPtr, val.Type.PtrTo(), off, sp)
mem = b.NewValue3I(pos, OpStore, TypeMem, val.Type.Size(), arg, val, mem)
off += val.Type.Size()
}
off = round(off, config.PtrSize)
// issue call
mem = b.NewValue1A(line, OpStaticCall, TypeMem, fn, mem)
mem = b.NewValue1A(pos, OpStaticCall, TypeMem, fn, mem)
mem.AuxInt = off - config.ctxt.FixedFrameSize()
if valIsVolatile {
mem = b.NewValue1A(line, OpVarKill, TypeMem, tmp, mem) // mark temp dead
mem = b.NewValue1A(pos, OpVarKill, TypeMem, tmp, mem) // mark temp dead
}
return mem