mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
073d248bf5
commit
1bd91d4ccc
4 changed files with 2 additions and 44 deletions
|
|
@ -32,7 +32,6 @@ package gc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cmd/internal/obj"
|
"cmd/internal/obj"
|
||||||
"cmd/internal/sys"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -246,8 +245,6 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||||
// hopes innocuous) type mismatches.
|
// hopes innocuous) type mismatches.
|
||||||
// The type mismatches should be fixed and the clearing below removed.
|
// The type mismatches should be fixed and the clearing below removed.
|
||||||
dowidth(n.Type)
|
dowidth(n.Type)
|
||||||
|
|
||||||
a.Width = n.Type.Width
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch n.Op {
|
switch n.Op {
|
||||||
|
|
@ -261,9 +258,6 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||||
a.Type = obj.TYPE_REG
|
a.Type = obj.TYPE_REG
|
||||||
a.Reg = n.Reg
|
a.Reg = n.Reg
|
||||||
a.Sym = nil
|
a.Sym = nil
|
||||||
if Thearch.LinkArch.Family == sys.I386 { // TODO(rsc): Never clear a->width.
|
|
||||||
a.Width = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
case OINDREG:
|
case OINDREG:
|
||||||
a.Type = obj.TYPE_MEM
|
a.Type = obj.TYPE_MEM
|
||||||
|
|
@ -273,9 +267,6 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||||
if a.Offset != int64(int32(a.Offset)) {
|
if a.Offset != int64(int32(a.Offset)) {
|
||||||
yyerror("offset %d too large for OINDREG", 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:
|
case OCLOSUREVAR:
|
||||||
if !Curfn.Func.Needctxt {
|
if !Curfn.Func.Needctxt {
|
||||||
|
|
@ -291,10 +282,6 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||||
a.Sym = Linksym(n.Left.Sym)
|
a.Sym = Linksym(n.Left.Sym)
|
||||||
|
|
||||||
case ONAME:
|
case ONAME:
|
||||||
a.Etype = 0
|
|
||||||
if n.Type != nil {
|
|
||||||
a.Etype = uint8(simtype[n.Type.Etype])
|
|
||||||
}
|
|
||||||
a.Offset = n.Xoffset
|
a.Offset = n.Xoffset
|
||||||
s := n.Sym
|
s := n.Sym
|
||||||
a.Node = n.Orig
|
a.Node = n.Orig
|
||||||
|
|
@ -325,7 +312,6 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||||
case PFUNC:
|
case PFUNC:
|
||||||
a.Name = obj.NAME_EXTERN
|
a.Name = obj.NAME_EXTERN
|
||||||
a.Type = obj.TYPE_ADDR
|
a.Type = obj.TYPE_ADDR
|
||||||
a.Width = int64(Widthptr)
|
|
||||||
s = funcsym(s)
|
s = funcsym(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -343,9 +329,6 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||||
Naddr(a, n.Left)
|
Naddr(a, n.Left)
|
||||||
|
|
||||||
case OLITERAL:
|
case OLITERAL:
|
||||||
if Thearch.LinkArch.Family == sys.I386 {
|
|
||||||
a.Width = 0
|
|
||||||
}
|
|
||||||
switch u := n.Val().U.(type) {
|
switch u := n.Val().U.(type) {
|
||||||
default:
|
default:
|
||||||
Fatalf("naddr: const %L", n.Type)
|
Fatalf("naddr: const %L", n.Type)
|
||||||
|
|
@ -375,10 +358,6 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||||
|
|
||||||
case OADDR:
|
case OADDR:
|
||||||
Naddr(a, n.Left)
|
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 {
|
if a.Type != obj.TYPE_MEM {
|
||||||
a := a // copy to let escape into Ctxt.Dconv
|
a := a // copy to let escape into Ctxt.Dconv
|
||||||
Fatalf("naddr: OADDR %v (from %v)", Ctxt.Dconv(a), n.Left.Op)
|
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 {
|
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
|
||||||
break // itab(nil)
|
break // itab(nil)
|
||||||
}
|
}
|
||||||
a.Etype = uint8(Tptr)
|
|
||||||
a.Width = int64(Widthptr)
|
|
||||||
|
|
||||||
case OIDATA:
|
case OIDATA:
|
||||||
// idata of interface value
|
// idata of interface value
|
||||||
|
|
@ -400,13 +377,7 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||||
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
|
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
|
||||||
break // idata(nil)
|
break // idata(nil)
|
||||||
}
|
}
|
||||||
if isdirectiface(n.Type) {
|
|
||||||
a.Etype = uint8(simtype[n.Type.Etype])
|
|
||||||
} else {
|
|
||||||
a.Etype = uint8(Tptr)
|
|
||||||
}
|
|
||||||
a.Offset += int64(Widthptr)
|
a.Offset += int64(Widthptr)
|
||||||
a.Width = int64(Widthptr)
|
|
||||||
|
|
||||||
// pointer in a string or slice
|
// pointer in a string or slice
|
||||||
case OSPTR:
|
case OSPTR:
|
||||||
|
|
@ -415,9 +386,7 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||||
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
|
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
|
||||||
break // ptr(nil)
|
break // ptr(nil)
|
||||||
}
|
}
|
||||||
a.Etype = uint8(simtype[Tptr])
|
|
||||||
a.Offset += int64(array_array)
|
a.Offset += int64(array_array)
|
||||||
a.Width = int64(Widthptr)
|
|
||||||
|
|
||||||
// len of string or slice
|
// len of string or slice
|
||||||
case OLEN:
|
case OLEN:
|
||||||
|
|
@ -426,11 +395,7 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||||
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
|
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
|
||||||
break // len(nil)
|
break // len(nil)
|
||||||
}
|
}
|
||||||
a.Etype = uint8(simtype[TUINT])
|
|
||||||
a.Offset += int64(array_nel)
|
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
|
// cap of string or slice
|
||||||
case OCAP:
|
case OCAP:
|
||||||
|
|
@ -439,11 +404,7 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||||
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
|
if a.Type == obj.TYPE_CONST && a.Offset == 0 {
|
||||||
break // cap(nil)
|
break // cap(nil)
|
||||||
}
|
}
|
||||||
a.Etype = uint8(simtype[TUINT])
|
|
||||||
a.Offset += int64(array_cap)
|
a.Offset += int64(array_cap)
|
||||||
if Thearch.LinkArch.Family != sys.ARM { // TODO(rsc): Do this even on arm.
|
|
||||||
a.Width = int64(Widthint)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,6 @@ func datagostring(sval string, a *obj.Addr) {
|
||||||
a.Name = obj.NAME_EXTERN
|
a.Name = obj.NAME_EXTERN
|
||||||
a.Sym = symhdr
|
a.Sym = symhdr
|
||||||
a.Offset = 0
|
a.Offset = 0
|
||||||
a.Etype = uint8(TSTRING)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func dsname(s *Sym, off int, t string) int {
|
func dsname(s *Sym, off int, t string) int {
|
||||||
|
|
|
||||||
|
|
@ -158,9 +158,7 @@ type Addr struct {
|
||||||
Type AddrType
|
Type AddrType
|
||||||
Name int8
|
Name int8
|
||||||
Class int8
|
Class int8
|
||||||
Etype uint8
|
|
||||||
Offset int64
|
Offset int64
|
||||||
Width int64
|
|
||||||
Sym *LSym
|
Sym *LSym
|
||||||
Gotype *LSym
|
Gotype *LSym
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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{}, 52, 80},
|
{Addr{}, 44, 72},
|
||||||
{LSym{}, 80, 136},
|
{LSym{}, 80, 136},
|
||||||
{Prog{}, 196, 288},
|
{Prog{}, 180, 272},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue