From 8a0bd5dc01f21888525e58d42efdc9dd246748d6 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Thu, 15 Sep 2016 00:21:28 -0700 Subject: [PATCH] cmd/compile: eliminate differences in appendpp functions Consistently use int16 for [ft]reg and int64 for [ft]offset. Change-Id: I7d279bb6e4fb735105429234a949074bf1cefb29 Reviewed-on: https://go-review.googlesource.com/29215 Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot Reviewed-by: Michael Hudson-Doyle --- src/cmd/compile/internal/amd64/ggen.go | 6 +++--- src/cmd/compile/internal/arm/ggen.go | 18 +++++++++--------- src/cmd/compile/internal/arm64/ggen.go | 6 +++--- src/cmd/compile/internal/mips64/ggen.go | 6 +++--- src/cmd/compile/internal/ppc64/ggen.go | 6 +++--- src/cmd/compile/internal/x86/ggen.go | 6 +++--- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/cmd/compile/internal/amd64/ggen.go b/src/cmd/compile/internal/amd64/ggen.go index 4145ff2f37..775c0d6e9f 100644 --- a/src/cmd/compile/internal/amd64/ggen.go +++ b/src/cmd/compile/internal/amd64/ggen.go @@ -166,16 +166,16 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64, ax *uint32, x0 *uin return p } -func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int, foffset int64, ttype obj.AddrType, treg int, toffset int64) *obj.Prog { +func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int16, foffset int64, ttype obj.AddrType, treg int16, toffset int64) *obj.Prog { q := gc.Ctxt.NewProg() gc.Clearp(q) q.As = as q.Lineno = p.Lineno q.From.Type = ftype - q.From.Reg = int16(freg) + q.From.Reg = freg q.From.Offset = foffset q.To.Type = ttype - q.To.Reg = int16(treg) + q.To.Reg = treg q.To.Offset = toffset q.Link = p.Link p.Link = q diff --git a/src/cmd/compile/internal/arm/ggen.go b/src/cmd/compile/internal/arm/ggen.go index 24b63b4252..c971f986a5 100644 --- a/src/cmd/compile/internal/arm/ggen.go +++ b/src/cmd/compile/internal/arm/ggen.go @@ -68,10 +68,10 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64, r0 *uint32) *obj.Pr if cnt < int64(4*gc.Widthptr) { for i := int64(0); i < cnt; i += int64(gc.Widthptr) { - p = appendpp(p, arm.AMOVW, obj.TYPE_REG, arm.REG_R0, 0, obj.TYPE_MEM, arm.REGSP, int32(4+frame+lo+i)) + p = appendpp(p, arm.AMOVW, obj.TYPE_REG, arm.REG_R0, 0, obj.TYPE_MEM, arm.REGSP, 4+frame+lo+i) } } else if !gc.Nacl && (cnt <= int64(128*gc.Widthptr)) { - p = appendpp(p, arm.AADD, obj.TYPE_CONST, 0, int32(4+frame+lo), obj.TYPE_REG, arm.REG_R1, 0) + p = appendpp(p, arm.AADD, obj.TYPE_CONST, 0, 4+frame+lo, obj.TYPE_REG, arm.REG_R1, 0) p.Reg = arm.REGSP p = appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_MEM, 0, 0) f := gc.Sysfunc("duffzero") @@ -79,9 +79,9 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64, r0 *uint32) *obj.Pr gc.Afunclit(&p.To, f) p.To.Offset = 4 * (128 - cnt/int64(gc.Widthptr)) } else { - p = appendpp(p, arm.AADD, obj.TYPE_CONST, 0, int32(4+frame+lo), obj.TYPE_REG, arm.REG_R1, 0) + p = appendpp(p, arm.AADD, obj.TYPE_CONST, 0, 4+frame+lo, obj.TYPE_REG, arm.REG_R1, 0) p.Reg = arm.REGSP - p = appendpp(p, arm.AADD, obj.TYPE_CONST, 0, int32(cnt), obj.TYPE_REG, arm.REG_R2, 0) + p = appendpp(p, arm.AADD, obj.TYPE_CONST, 0, cnt, obj.TYPE_REG, arm.REG_R2, 0) p.Reg = arm.REG_R1 p = appendpp(p, arm.AMOVW, obj.TYPE_REG, arm.REG_R0, 0, obj.TYPE_MEM, arm.REG_R1, 4) p1 := p @@ -95,17 +95,17 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64, r0 *uint32) *obj.Pr return p } -func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int, foffset int32, ttype obj.AddrType, treg int, toffset int32) *obj.Prog { +func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int16, foffset int64, ttype obj.AddrType, treg int16, toffset int64) *obj.Prog { q := gc.Ctxt.NewProg() gc.Clearp(q) q.As = as q.Lineno = p.Lineno q.From.Type = ftype - q.From.Reg = int16(freg) - q.From.Offset = int64(foffset) + q.From.Reg = freg + q.From.Offset = foffset q.To.Type = ttype - q.To.Reg = int16(treg) - q.To.Offset = int64(toffset) + q.To.Reg = treg + q.To.Offset = toffset q.Link = p.Link p.Link = q return q diff --git a/src/cmd/compile/internal/arm64/ggen.go b/src/cmd/compile/internal/arm64/ggen.go index 48a6a4c82d..9efb95c3dc 100644 --- a/src/cmd/compile/internal/arm64/ggen.go +++ b/src/cmd/compile/internal/arm64/ggen.go @@ -105,16 +105,16 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64) *obj.Prog { return p } -func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int, foffset int64, ttype obj.AddrType, treg int, toffset int64) *obj.Prog { +func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int16, foffset int64, ttype obj.AddrType, treg int16, toffset int64) *obj.Prog { q := gc.Ctxt.NewProg() gc.Clearp(q) q.As = as q.Lineno = p.Lineno q.From.Type = ftype - q.From.Reg = int16(freg) + q.From.Reg = freg q.From.Offset = foffset q.To.Type = ttype - q.To.Reg = int16(treg) + q.To.Reg = treg q.To.Offset = toffset q.Link = p.Link p.Link = q diff --git a/src/cmd/compile/internal/mips64/ggen.go b/src/cmd/compile/internal/mips64/ggen.go index 49ec8da8bf..4490420f60 100644 --- a/src/cmd/compile/internal/mips64/ggen.go +++ b/src/cmd/compile/internal/mips64/ggen.go @@ -100,16 +100,16 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64) *obj.Prog { return p } -func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int, foffset int64, ttype obj.AddrType, treg int, toffset int64) *obj.Prog { +func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int16, foffset int64, ttype obj.AddrType, treg int16, toffset int64) *obj.Prog { q := gc.Ctxt.NewProg() gc.Clearp(q) q.As = as q.Lineno = p.Lineno q.From.Type = ftype - q.From.Reg = int16(freg) + q.From.Reg = freg q.From.Offset = foffset q.To.Type = ttype - q.To.Reg = int16(treg) + q.To.Reg = treg q.To.Offset = toffset q.Link = p.Link p.Link = q diff --git a/src/cmd/compile/internal/ppc64/ggen.go b/src/cmd/compile/internal/ppc64/ggen.go index f36eedc553..b21a4a4170 100644 --- a/src/cmd/compile/internal/ppc64/ggen.go +++ b/src/cmd/compile/internal/ppc64/ggen.go @@ -92,16 +92,16 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64) *obj.Prog { return p } -func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int, foffset int64, ttype obj.AddrType, treg int, toffset int64) *obj.Prog { +func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int16, foffset int64, ttype obj.AddrType, treg int16, toffset int64) *obj.Prog { q := gc.Ctxt.NewProg() gc.Clearp(q) q.As = as q.Lineno = p.Lineno q.From.Type = ftype - q.From.Reg = int16(freg) + q.From.Reg = freg q.From.Offset = foffset q.To.Type = ttype - q.To.Reg = int16(treg) + q.To.Reg = treg q.To.Offset = toffset q.Link = p.Link p.Link = q diff --git a/src/cmd/compile/internal/x86/ggen.go b/src/cmd/compile/internal/x86/ggen.go index f7012661db..a6d0588d4d 100644 --- a/src/cmd/compile/internal/x86/ggen.go +++ b/src/cmd/compile/internal/x86/ggen.go @@ -84,16 +84,16 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64, ax *uint32) *obj.Pr return p } -func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int, foffset int64, ttype obj.AddrType, treg int, toffset int64) *obj.Prog { +func appendpp(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int16, foffset int64, ttype obj.AddrType, treg int16, toffset int64) *obj.Prog { q := gc.Ctxt.NewProg() gc.Clearp(q) q.As = as q.Lineno = p.Lineno q.From.Type = ftype - q.From.Reg = int16(freg) + q.From.Reg = freg q.From.Offset = foffset q.To.Type = ttype - q.To.Reg = int16(treg) + q.To.Reg = treg q.To.Offset = toffset q.Link = p.Link p.Link = q