aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/internal/obj')
-rw-r--r--src/cmd/internal/obj/arm/asm5.go4
-rw-r--r--src/cmd/internal/obj/arm64/asm7.go13
-rw-r--r--src/cmd/internal/obj/data.go4
-rw-r--r--src/cmd/internal/obj/link.go12
-rw-r--r--src/cmd/internal/obj/ppc64/asm9.go2
-rw-r--r--src/cmd/internal/obj/util.go2
-rw-r--r--src/cmd/internal/obj/x86/asm6.go4
7 files changed, 19 insertions, 22 deletions
diff --git a/src/cmd/internal/obj/arm/asm5.go b/src/cmd/internal/obj/arm/asm5.go
index 9da33bc854..8536e7628b 100644
--- a/src/cmd/internal/obj/arm/asm5.go
+++ b/src/cmd/internal/obj/arm/asm5.go
@@ -1067,7 +1067,7 @@ func aclass(ctxt *obj.Link, a *obj.Addr) int {
return C_LAUTO
- case obj.TYPE_NONE:
+ case obj.NAME_NONE:
ctxt.Instoffset = a.Offset
t := int(immaddr(int32(ctxt.Instoffset)))
if t != 0 {
@@ -1115,7 +1115,7 @@ func aclass(ctxt *obj.Link, a *obj.Addr) int {
case obj.TYPE_CONST,
obj.TYPE_ADDR:
switch a.Name {
- case obj.TYPE_NONE:
+ case obj.NAME_NONE:
ctxt.Instoffset = a.Offset
if a.Reg != 0 {
return aconsize(ctxt)
diff --git a/src/cmd/internal/obj/arm64/asm7.go b/src/cmd/internal/obj/arm64/asm7.go
index 2b0a9cc287..bc0096d624 100644
--- a/src/cmd/internal/obj/arm64/asm7.go
+++ b/src/cmd/internal/obj/arm64/asm7.go
@@ -970,8 +970,7 @@ func aclass(ctxt *obj.Link, a *obj.Addr) int {
case obj.TYPE_MEM:
switch a.Name {
- case obj.NAME_EXTERN,
- obj.NAME_STATIC:
+ case obj.NAME_EXTERN, obj.NAME_STATIC:
if a.Sym == nil {
break
}
@@ -999,7 +998,7 @@ func aclass(ctxt *obj.Link, a *obj.Addr) int {
ctxt.Instoffset = int64(ctxt.Autosize) + a.Offset + 8
return autoclass(ctxt.Instoffset)
- case obj.TYPE_NONE:
+ case obj.NAME_NONE:
ctxt.Instoffset = a.Offset
return oregclass(ctxt.Instoffset)
}
@@ -1011,10 +1010,9 @@ func aclass(ctxt *obj.Link, a *obj.Addr) int {
case obj.TYPE_TEXTSIZE:
return C_TEXTSIZE
- case obj.TYPE_CONST,
- obj.TYPE_ADDR:
+ case obj.TYPE_CONST, obj.TYPE_ADDR:
switch a.Name {
- case obj.TYPE_NONE:
+ case obj.NAME_NONE:
ctxt.Instoffset = a.Offset
if a.Reg != 0 && a.Reg != REGZERO {
goto aconsize
@@ -1058,8 +1056,7 @@ func aclass(ctxt *obj.Link, a *obj.Addr) int {
}
return C_VCON
- case obj.NAME_EXTERN,
- obj.NAME_STATIC:
+ case obj.NAME_EXTERN, obj.NAME_STATIC:
if a.Sym == nil {
break
}
diff --git a/src/cmd/internal/obj/data.go b/src/cmd/internal/obj/data.go
index 96129fd954..438435fd58 100644
--- a/src/cmd/internal/obj/data.go
+++ b/src/cmd/internal/obj/data.go
@@ -66,7 +66,7 @@ func savedata(ctxt *Link, s *LSym, p *Prog, file string) {
}
Symgrow(ctxt, s, int64(off+siz))
- switch int(p.To.Type) {
+ switch p.To.Type {
default:
ctxt.Diag("bad data: %v", p)
@@ -88,7 +88,7 @@ func savedata(ctxt *Link, s *LSym, p *Prog, file string) {
copy(s.P[off:off+siz], p.To.Val.(string))
case TYPE_CONST, TYPE_ADDR:
- if p.To.Sym != nil || int(p.To.Type) == TYPE_ADDR {
+ if p.To.Sym != nil || p.To.Type == TYPE_ADDR {
r := Addrel(s)
r.Off = off
r.Siz = uint8(siz)
diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go
index 53a8fa3334..b7683ebaa2 100644
--- a/src/cmd/internal/obj/link.go
+++ b/src/cmd/internal/obj/link.go
@@ -144,10 +144,10 @@ import "encoding/binary"
// scale = 1
//
type Addr struct {
- Type int16
Reg int16
Index int16
Scale int16 // Sometimes holds a register.
+ Type AddrType
Name int8
Class int8
Etype uint8
@@ -166,6 +166,8 @@ type Addr struct {
Node interface{} // for use by compiler
}
+type AddrType uint8
+
const (
NAME_NONE = 0 + iota
NAME_EXTERN
@@ -178,11 +180,9 @@ const (
)
const (
- TYPE_NONE = 0
-)
+ TYPE_NONE AddrType = 0
-const (
- TYPE_BRANCH = 5 + iota
+ TYPE_BRANCH AddrType = 5 + iota
TYPE_TEXTSIZE
TYPE_MEM
TYPE_CONST
@@ -228,7 +228,7 @@ type Prog struct {
}
// From3Type returns From3.Type, or TYPE_NONE when From3 is nil.
-func (p *Prog) From3Type() int16 {
+func (p *Prog) From3Type() AddrType {
if p.From3 == nil {
return TYPE_NONE
}
diff --git a/src/cmd/internal/obj/ppc64/asm9.go b/src/cmd/internal/obj/ppc64/asm9.go
index c4e8fdc21d..cf2a6e82b0 100644
--- a/src/cmd/internal/obj/ppc64/asm9.go
+++ b/src/cmd/internal/obj/ppc64/asm9.go
@@ -636,7 +636,7 @@ func aclass(ctxt *obj.Link, a *obj.Addr) int {
case obj.TYPE_CONST,
obj.TYPE_ADDR:
switch a.Name {
- case obj.TYPE_NONE:
+ case obj.NAME_NONE:
ctxt.Instoffset = a.Offset
if a.Reg != 0 {
if -BIG <= ctxt.Instoffset && ctxt.Instoffset <= BIG {
diff --git a/src/cmd/internal/obj/util.go b/src/cmd/internal/obj/util.go
index a1c1cca895..7689d22d7f 100644
--- a/src/cmd/internal/obj/util.go
+++ b/src/cmd/internal/obj/util.go
@@ -383,7 +383,7 @@ func Dconv(p *Prog, a *Addr) string {
}
str = Rconv(int(a.Reg))
- if a.Name != TYPE_NONE || a.Sym != nil {
+ if a.Name != NAME_NONE || a.Sym != nil {
str = fmt.Sprintf("%v(%v)(REG)", Mconv(a), Rconv(int(a.Reg)))
}
diff --git a/src/cmd/internal/obj/x86/asm6.go b/src/cmd/internal/obj/x86/asm6.go
index c4f2140e9c..0f81bbb74f 100644
--- a/src/cmd/internal/obj/x86/asm6.go
+++ b/src/cmd/internal/obj/x86/asm6.go
@@ -4621,10 +4621,10 @@ func asmins(ctxt *obj.Link, p *obj.Prog) {
}
if p.As != ALEAQ && p.As != ALEAL {
- if p.From.Index != obj.TYPE_NONE && p.From.Scale > 0 {
+ if p.From.Index != REG_NONE && p.From.Scale > 0 {
nacltrunc(ctxt, int(p.From.Index))
}
- if p.To.Index != obj.TYPE_NONE && p.To.Scale > 0 {
+ if p.To.Index != REG_NONE && p.To.Scale > 0 {
nacltrunc(ctxt, int(p.To.Index))
}
}