aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2016-09-15 19:00:05 -0700
committerMatthew Dempsky <mdempsky@google.com>2016-09-16 02:47:34 +0000
commit1bd91d4ccc57d3dbb2e5452c16ff6281d53e9763 (patch)
tree878a5fc484ec1ba72905956be37bf72bac1e237e /src
parent073d248bf50b1b1029b2a09c575111f38f6bf5eb (diff)
downloadgo-1bd91d4ccc57d3dbb2e5452c16ff6281d53e9763.tar.xz
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 <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>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/gsubr.go39
-rw-r--r--src/cmd/compile/internal/gc/obj.go1
-rw-r--r--src/cmd/internal/obj/link.go2
-rw-r--r--src/cmd/internal/obj/sizeof_test.go4
4 files changed, 2 insertions, 44 deletions
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 {