1
0
mirror of https://github.com/golang/go synced 2024-09-30 13:18:34 -06:00

cmd/internal/obj: remove unneeded Addr.Node and Prog.Opt fields

Change-Id: I218b241c32a5948b66ad0d95ecc368648cf4ddf5
Reviewed-on: https://go-review.googlesource.com/38130
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Matthew Dempsky 2017-03-11 17:17:15 -08:00
parent cce4c319d6
commit 7bb5b2d33a
4 changed files with 24 additions and 32 deletions

View File

@ -124,7 +124,6 @@ func Naddr(a *obj.Addr, n *Node) {
a.Offset = n.Xoffset a.Offset = n.Xoffset
s := n.Sym s := n.Sym
a.Node = n.Orig
if s == nil { if s == nil {
Fatalf("naddr: nil sym %v", n) Fatalf("naddr: nil sym %v", n)

View File

@ -4472,13 +4472,11 @@ func AddAux2(a *obj.Addr, v *ssa.Value, offset int64) {
case *ssa.ArgSymbol: case *ssa.ArgSymbol:
n := sym.Node.(*Node) n := sym.Node.(*Node)
a.Name = obj.NAME_PARAM a.Name = obj.NAME_PARAM
a.Node = n
a.Sym = Linksym(n.Orig.Sym) a.Sym = Linksym(n.Orig.Sym)
a.Offset += n.Xoffset a.Offset += n.Xoffset
case *ssa.AutoSymbol: case *ssa.AutoSymbol:
n := sym.Node.(*Node) n := sym.Node.(*Node)
a.Name = obj.NAME_AUTO a.Name = obj.NAME_AUTO
a.Node = n
a.Sym = Linksym(n.Sym) a.Sym = Linksym(n.Sym)
a.Offset += n.Xoffset a.Offset += n.Xoffset
default: default:
@ -4581,7 +4579,6 @@ func AutoVar(v *ssa.Value) (*Node, int64) {
func AddrAuto(a *obj.Addr, v *ssa.Value) { func AddrAuto(a *obj.Addr, v *ssa.Value) {
n, off := AutoVar(v) n, off := AutoVar(v)
a.Type = obj.TYPE_MEM a.Type = obj.TYPE_MEM
a.Node = n
a.Sym = Linksym(n.Sym) a.Sym = Linksym(n.Sym)
a.Reg = int16(thearch.REGSP) a.Reg = int16(thearch.REGSP)
a.Offset = n.Xoffset + off a.Offset = n.Xoffset + off
@ -4598,7 +4595,6 @@ func (s *SSAGenState) AddrScratch(a *obj.Addr) {
} }
a.Type = obj.TYPE_MEM a.Type = obj.TYPE_MEM
a.Name = obj.NAME_AUTO a.Name = obj.NAME_AUTO
a.Node = s.ScratchFpMem
a.Sym = Linksym(s.ScratchFpMem.Sym) a.Sym = Linksym(s.ScratchFpMem.Sym)
a.Reg = int16(thearch.REGSP) a.Reg = int16(thearch.REGSP)
a.Offset = s.ScratchFpMem.Xoffset a.Offset = s.ScratchFpMem.Xoffset

View File

@ -169,8 +169,6 @@ type Addr struct {
// for TYPE_BRANCH, a *Prog (optional) // for TYPE_BRANCH, a *Prog (optional)
// for TYPE_TEXTSIZE, an int32 (optional) // for TYPE_TEXTSIZE, an int32 (optional)
Val interface{} Val interface{}
Node interface{} // for use by compiler
} }
type AddrName int8 type AddrName int8
@ -237,7 +235,6 @@ type Prog struct {
From3 *Addr // third source operand (second is Reg below) From3 *Addr // third source operand (second is Reg below)
To Addr // destination operand (second is RegTo2 below) To Addr // destination operand (second is RegTo2 below)
Pcond *Prog // target of conditional jump Pcond *Prog // target of conditional jump
Opt interface{} // available to optimization passes to hold per-Prog state
Forwd *Prog // for x86 back end Forwd *Prog // for x86 back end
Rel *Prog // for x86, arm back ends Rel *Prog // for x86, arm back ends
Pc int64 // for back ends or assembler: virtual or actual program counter, depending on phase Pc int64 // for back ends or assembler: virtual or actual program counter, depending on phase

View File

@ -22,9 +22,9 @@ func TestSizeof(t *testing.T) {
_32bit uintptr // size on 32bit platforms _32bit uintptr // size on 32bit platforms
_64bit uintptr // size on 64bit platforms _64bit uintptr // size on 64bit platforms
}{ }{
{Addr{}, 40, 64}, {Addr{}, 32, 48},
{LSym{}, 60, 104}, {LSym{}, 60, 104},
{Prog{}, 148, 232}, {Prog{}, 124, 184},
} }
for _, tt := range tests { for _, tt := range tests {