1
0
mirror of https://github.com/golang/go synced 2024-11-22 14:15:05 -07:00

[dev.regabi] cmd/compile: rewrite a few ++/--/+=/-= to prep for getters/setters [generated]

These are trivial rewrites that are only OK because it turns out that n has no side effects.
Separated into a different CL for easy inspection.

[git-generate]
cd src/cmd/compile/internal/gc
rf '
        ex . ../ir ../ssa {
                import "cmd/compile/internal/ir"
                var n *ir.Node
		var i int64

                n.Xoffset++ -> n.Xoffset = n.Xoffset + 1
                n.Xoffset-- -> n.Xoffset = n.Xoffset - 1
                n.Xoffset += i -> n.Xoffset = n.Xoffset + i
                n.Xoffset -= i -> n.Xoffset = n.Xoffset - i
	}
'

Change-Id: If7b4b7f7cbdafeee988e04d03924ef0e1dd867b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/272932
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Russ Cox 2020-11-24 20:47:32 -05:00
parent 048debb224
commit 41ab6689ed
2 changed files with 6 additions and 6 deletions

View File

@ -142,7 +142,7 @@ func (o *InitOrder) processAssign(n *ir.Node) {
if dep.Class() != ir.PEXTERN || defn.Initorder() == InitDone {
continue
}
n.Xoffset++
n.Xoffset = n.Xoffset + 1
o.blocking[defn] = append(o.blocking[defn], n)
}
@ -169,7 +169,7 @@ func (o *InitOrder) flushReady(initialize func(*ir.Node)) {
delete(o.blocking, n)
for _, m := range blocked {
m.Xoffset--
m.Xoffset = m.Xoffset - 1
if m.Xoffset == 0 {
heap.Push(&o.ready, m)
}

View File

@ -157,7 +157,7 @@ func (s *InitSchedule) staticcopy(l *ir.Node, r *ir.Node) bool {
// copying someone else's computation.
rr := ir.SepCopy(orig)
rr.Type = ll.Type
rr.Xoffset += e.Xoffset
rr.Xoffset = rr.Xoffset + e.Xoffset
setlineno(rr)
s.append(ir.Nod(ir.OAS, ll, rr))
}
@ -301,7 +301,7 @@ func (s *InitSchedule) staticassign(l *ir.Node, r *ir.Node) bool {
// Emit itab, advance offset.
addrsym(n, itab.Left) // itab is an OADDR node
n.Xoffset += int64(Widthptr)
n.Xoffset = n.Xoffset + int64(Widthptr)
// Emit data.
if isdirectiface(val.Type) {
@ -1017,7 +1017,7 @@ func stataddr(n *ir.Node) *ir.Node {
if nam == nil {
break
}
nam.Xoffset += n.Xoffset
nam.Xoffset = nam.Xoffset + n.Xoffset
nam.Type = n.Type
return nam
@ -1038,7 +1038,7 @@ func stataddr(n *ir.Node) *ir.Node {
if n.Type.Width != 0 && thearch.MAXWIDTH/n.Type.Width <= int64(l) {
break
}
nam.Xoffset += int64(l) * n.Type.Width
nam.Xoffset = nam.Xoffset + int64(l)*n.Type.Width
nam.Type = n.Type
return nam
}