go/ssa: add position info to all Load/Store instructions
Was originally https://codereview.appspot.com/92880043/ by Richard Musiol.
Change-Id: If0b22cf962b94ef44edbac28a5e5af4acb950991
Reviewed-on: https://go-review.googlesource.com/2174
Reviewed-by: Robert Griesemer <gri@golang.org>
diff --git a/go/ssa/lvalue.go b/go/ssa/lvalue.go
index e58bc24..8342645 100644
--- a/go/ssa/lvalue.go
+++ b/go/ssa/lvalue.go
@@ -27,20 +27,19 @@
// An address is an lvalue represented by a true pointer.
type address struct {
- addr Value
- starPos token.Pos // source position, if from explicit *addr
- expr ast.Expr // source syntax [debug mode]
+ addr Value
+ pos token.Pos // source position
+ expr ast.Expr // source syntax [debug mode]
}
func (a *address) load(fn *Function) Value {
load := emitLoad(fn, a.addr)
- load.pos = a.starPos
+ load.pos = a.pos
return load
}
func (a *address) store(fn *Function, v Value) {
- store := emitStore(fn, a.addr, v)
- store.pos = a.starPos
+ store := emitStore(fn, a.addr, v, a.pos)
if a.expr != nil {
// store.Val is v, converted for assignability.
emitDebugRef(fn, a.expr, store.Val, false)