From: Matthew Dempsky Date: Fri, 16 Sep 2016 02:00:05 +0000 (-0700) Subject: cmd/internal/obj: remove Addr.Etype and Addr.Width X-Git-Tag: go1.8beta1~1284 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1bd91d4ccc57d3dbb2e5452c16ff6281d53e9763;p=gostls13.git cmd/internal/obj: remove Addr.Etype and Addr.Width Since the legacy backends were removed, these fields are write-only. Change-Id: I4816c39267b7c10a4da2a6d22cd367dc475e564d Reviewed-on: https://go-review.googlesource.com/29246 Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot Reviewed-by: Michael Hudson-Doyle Reviewed-by: Dave Cheney --- diff --git a/src/cmd/compile/internal/gc/gsubr.go b/src/cmd/compile/internal/gc/gsubr.go index 4bf5b7a7b3..201698e700 100644 --- a/src/cmd/compile/internal/gc/gsubr.go +++ b/src/cmd/compile/internal/gc/gsubr.go @@ -32,7 +32,6 @@ package gc import ( "cmd/internal/obj" - "cmd/internal/sys" "fmt" ) @@ -246,8 +245,6 @@ func Naddr(a *obj.Addr, n *Node) { // hopes innocuous) type mismatches. // The type mismatches should be fixed and the clearing below removed. dowidth(n.Type) - - a.Width = n.Type.Width } switch n.Op { @@ -261,9 +258,6 @@ func Naddr(a *obj.Addr, n *Node) { a.Type = obj.TYPE_REG a.Reg = n.Reg a.Sym = nil - if Thearch.LinkArch.Family == sys.I386 { // TODO(rsc): Never clear a->width. - a.Width = 0 - } case OINDREG: a.Type = obj.TYPE_MEM @@ -273,9 +267,6 @@ func Naddr(a *obj.Addr, n *Node) { if a.Offset != int64(int32(a.Offset)) { yyerror("offset %d too large for OINDREG", a.Offset) } - if Thearch.LinkArch.Family == sys.I386 { // TODO(rsc): Never clear a->width. - a.Width = 0 - } case OCLOSUREVAR: if !Curfn.Func.Needctxt { @@ -291,10 +282,6 @@ func Naddr(a *obj.Addr, n *Node) { a.Sym = Linksym(n.Left.Sym) case ONAME: - a.Etype = 0 - if n.Type != nil { - a.Etype = uint8(simtype[n.Type.Etype]) - } a.Offset = n.Xoffset s := n.Sym a.Node = n.Orig @@ -325,7 +312,6 @@ func Naddr(a *obj.Addr, n *Node) { case PFUNC: a.Name = obj.NAME_EXTERN a.Type = obj.TYPE_ADDR - a.Width = int64(Widthptr) s = funcsym(s) } @@ -343,9 +329,6 @@ func Naddr(a *obj.Addr, n *Node) { Naddr(a, n.Left) case OLITERAL: - if Thearch.LinkArch.Family == sys.I386 { - a.Width = 0 - } switch u := n.Val().U.(type) { default: Fatalf("naddr: const %L", n.Type) @@ -375,10 +358,6 @@ func Naddr(a *obj.Addr, n *Node) { case OADDR: Naddr(a, n.Left) - a.Etype = uint8(Tptr) - if !Thearch.LinkArch.InFamily(sys.MIPS64, sys.ARM, sys.ARM64, sys.PPC64, sys.S390X) { // TODO(rsc): Do this even for these architectures. - a.Width = int64(Widthptr) - } if a.Type != obj.TYPE_MEM { a := a // copy to let escape into Ctxt.Dconv Fatalf("naddr: OADDR %v (from %v)", Ctxt.Dconv(a), n.Left.Op) @@ -391,8 +370,6 @@ func Naddr(a *obj.Addr, n *Node) { if a.Type == obj.TYPE_CONST && a.Offset == 0 { break // itab(nil) } - a.Etype = uint8(Tptr) - a.Width = int64(Widthptr) case OIDATA: // idata of interface value @@ -400,13 +377,7 @@ func Naddr(a *obj.Addr, n *Node) { if a.Type == obj.TYPE_CONST && a.Offset == 0 { break // idata(nil) } - if isdirectiface(n.Type) { - a.Etype = uint8(simtype[n.Type.Etype]) - } else { - a.Etype = uint8(Tptr) - } a.Offset += int64(Widthptr) - a.Width = int64(Widthptr) // pointer in a string or slice case OSPTR: @@ -415,9 +386,7 @@ func Naddr(a *obj.Addr, n *Node) { if a.Type == obj.TYPE_CONST && a.Offset == 0 { break // ptr(nil) } - a.Etype = uint8(simtype[Tptr]) a.Offset += int64(array_array) - a.Width = int64(Widthptr) // len of string or slice case OLEN: @@ -426,11 +395,7 @@ func Naddr(a *obj.Addr, n *Node) { if a.Type == obj.TYPE_CONST && a.Offset == 0 { break // len(nil) } - a.Etype = uint8(simtype[TUINT]) a.Offset += int64(array_nel) - if Thearch.LinkArch.Family != sys.ARM { // TODO(rsc): Do this even on arm. - a.Width = int64(Widthint) - } // cap of string or slice case OCAP: @@ -439,11 +404,7 @@ func Naddr(a *obj.Addr, n *Node) { if a.Type == obj.TYPE_CONST && a.Offset == 0 { break // cap(nil) } - a.Etype = uint8(simtype[TUINT]) a.Offset += int64(array_cap) - if Thearch.LinkArch.Family != sys.ARM { // TODO(rsc): Do this even on arm. - a.Width = int64(Widthint) - } } } diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go index 64f8a91f54..93ca2f8563 100644 --- a/src/cmd/compile/internal/gc/obj.go +++ b/src/cmd/compile/internal/gc/obj.go @@ -355,7 +355,6 @@ func datagostring(sval string, a *obj.Addr) { a.Name = obj.NAME_EXTERN a.Sym = symhdr a.Offset = 0 - a.Etype = uint8(TSTRING) } func dsname(s *Sym, off int, t string) int { diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go index 614be6f74f..5d77d69df3 100644 --- a/src/cmd/internal/obj/link.go +++ b/src/cmd/internal/obj/link.go @@ -158,9 +158,7 @@ type Addr struct { Type AddrType Name int8 Class int8 - Etype uint8 Offset int64 - Width int64 Sym *LSym Gotype *LSym diff --git a/src/cmd/internal/obj/sizeof_test.go b/src/cmd/internal/obj/sizeof_test.go index f7173d3c4c..6fe99739c9 100644 --- a/src/cmd/internal/obj/sizeof_test.go +++ b/src/cmd/internal/obj/sizeof_test.go @@ -22,9 +22,9 @@ func TestSizeof(t *testing.T) { _32bit uintptr // size on 32bit platforms _64bit uintptr // size on 64bit platforms }{ - {Addr{}, 52, 80}, + {Addr{}, 44, 72}, {LSym{}, 80, 136}, - {Prog{}, 196, 288}, + {Prog{}, 180, 272}, } for _, tt := range tests {