]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj: remove Addr.Etype and Addr.Width
authorMatthew Dempsky <mdempsky@google.com>
Fri, 16 Sep 2016 02:00:05 +0000 (19:00 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 16 Sep 2016 02:47:34 +0000 (02:47 +0000)
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 <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
src/cmd/compile/internal/gc/gsubr.go
src/cmd/compile/internal/gc/obj.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/sizeof_test.go

index 4bf5b7a7b3813ede67fb5932c01e1fe67a4e327e..201698e7001812bcec749aabdb76e9fd55a0e16e 100644 (file)
@@ -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)
-               }
        }
 }
 
index 64f8a91f5475a061160f4313645346c3aca39d2d..93ca2f856369acb5d64cfccddff87870f54b3ceb 100644 (file)
@@ -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 {
index 614be6f74f80df2c17c156ea803fde4b5d430c13..5d77d69df3ab93bc43c67addaf380d00ac7f0a90 100644 (file)
@@ -158,9 +158,7 @@ type Addr struct {
        Type   AddrType
        Name   int8
        Class  int8
-       Etype  uint8
        Offset int64
-       Width  int64
        Sym    *LSym
        Gotype *LSym
 
index f7173d3c4c01cfe7dbe5fcf1fe68f8fcc4faf638..6fe99739c9bc03d5dfbe67ca3674ec9eb3d55e41 100644 (file)
@@ -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 {