No immediate reduction in the size of Addr.
Passes toolstash -cmp.
Change-Id: I78ea4c6e181b6e571ce70a5f1ae8158844eb197d
Reviewed-on: https://go-review.googlesource.com/20276
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
return p
}
-func appendpp(p *obj.Prog, as int, ftype int, freg int, foffset int64, ttype int, treg int, toffset int64) *obj.Prog {
+func appendpp(p *obj.Prog, as int, ftype obj.AddrType, freg int, foffset int64, ttype obj.AddrType, treg int, toffset int64) *obj.Prog {
q := gc.Ctxt.NewProg()
gc.Clearp(q)
q.As = int16(as)
q.Lineno = p.Lineno
- q.From.Type = int16(ftype)
+ q.From.Type = ftype
q.From.Reg = int16(freg)
q.From.Offset = foffset
- q.To.Type = int16(ttype)
+ q.To.Type = ttype
q.To.Reg = int16(treg)
q.To.Offset = toffset
q.Link = p.Link
}
a.Type = obj.TYPE_NONE
- a.Index = obj.TYPE_NONE
+ a.Index = x86.REG_NONE
gc.Fixlargeoffset(&n1)
gc.Naddr(a, &n1)
return true
return p
}
-func appendpp(p *obj.Prog, as int, ftype int, freg int, foffset int32, ttype int, treg int, toffset int32) *obj.Prog {
+func appendpp(p *obj.Prog, as int, ftype obj.AddrType, freg int, foffset int32, ttype obj.AddrType, treg int, toffset int32) *obj.Prog {
q := gc.Ctxt.NewProg()
gc.Clearp(q)
q.As = int16(as)
q.Lineno = p.Lineno
- q.From.Type = int16(ftype)
+ q.From.Type = ftype
q.From.Reg = int16(freg)
q.From.Offset = int64(foffset)
- q.To.Type = int16(ttype)
+ q.To.Type = ttype
q.To.Reg = int16(treg)
q.To.Offset = int64(toffset)
q.Link = p.Link
return p
}
-func appendpp(p *obj.Prog, as int, ftype int, freg int, foffset int64, ttype int, treg int, toffset int64) *obj.Prog {
+func appendpp(p *obj.Prog, as int, ftype obj.AddrType, freg int, foffset int64, ttype obj.AddrType, treg int, toffset int64) *obj.Prog {
q := gc.Ctxt.NewProg()
gc.Clearp(q)
q.As = int16(as)
q.Lineno = p.Lineno
- q.From.Type = int16(ftype)
+ q.From.Type = ftype
q.From.Reg = int16(freg)
q.From.Offset = foffset
- q.To.Type = int16(ttype)
+ q.To.Type = ttype
q.To.Reg = int16(treg)
q.To.Offset = toffset
q.Link = p.Link
return p
}
-func appendpp(p *obj.Prog, as int, ftype int, freg int, foffset int64, ttype int, treg int, toffset int64) *obj.Prog {
+func appendpp(p *obj.Prog, as int, ftype obj.AddrType, freg int, foffset int64, ttype obj.AddrType, treg int, toffset int64) *obj.Prog {
q := gc.Ctxt.NewProg()
gc.Clearp(q)
q.As = int16(as)
q.Lineno = p.Lineno
- q.From.Type = int16(ftype)
+ q.From.Type = ftype
q.From.Reg = int16(freg)
q.From.Offset = foffset
- q.To.Type = int16(ttype)
+ q.To.Type = ttype
q.To.Reg = int16(treg)
q.To.Offset = toffset
q.Link = p.Link
return p
}
-func appendpp(p *obj.Prog, as int, ftype int, freg int, foffset int64, ttype int, treg int, toffset int64) *obj.Prog {
+func appendpp(p *obj.Prog, as int, ftype obj.AddrType, freg int, foffset int64, ttype obj.AddrType, treg int, toffset int64) *obj.Prog {
q := gc.Ctxt.NewProg()
gc.Clearp(q)
q.As = int16(as)
q.Lineno = p.Lineno
- q.From.Type = int16(ftype)
+ q.From.Type = ftype
q.From.Reg = int16(freg)
q.From.Offset = foffset
- q.To.Type = int16(ttype)
+ q.To.Type = ttype
q.To.Reg = int16(treg)
q.To.Offset = toffset
q.Link = p.Link
return p
}
-func appendpp(p *obj.Prog, as int, ftype int, freg int, foffset int64, ttype int, treg int, toffset int64) *obj.Prog {
+func appendpp(p *obj.Prog, as int, ftype obj.AddrType, freg int, foffset int64, ttype obj.AddrType, treg int, toffset int64) *obj.Prog {
q := gc.Ctxt.NewProg()
gc.Clearp(q)
q.As = int16(as)
q.Lineno = p.Lineno
- q.From.Type = int16(ftype)
+ q.From.Type = ftype
q.From.Reg = int16(freg)
q.From.Offset = foffset
- q.To.Type = int16(ttype)
+ q.To.Type = ttype
q.To.Reg = int16(treg)
q.To.Offset = toffset
q.Link = p.Link
if regtyp(v) {
reg := int(v.Reg)
if (a.Type == obj.TYPE_MEM || a.Type == obj.TYPE_ADDR) && int(a.Reg) == reg {
- if (s.Reg == x86.REG_BP) && a.Index != obj.TYPE_NONE {
+ if (s.Reg == x86.REG_BP) && a.Index != x86.REG_NONE {
return 1 /* can't use BP-base with index */
}
if f != 0 {
return C_LAUTO
- case obj.TYPE_NONE:
+ case obj.NAME_NONE:
ctxt.Instoffset = a.Offset
t := int(immaddr(int32(ctxt.Instoffset)))
if t != 0 {
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)
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
}
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)
}
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
}
return C_VCON
- case obj.NAME_EXTERN,
- obj.NAME_STATIC:
+ case obj.NAME_EXTERN, obj.NAME_STATIC:
if a.Sym == nil {
break
}
}
Symgrow(ctxt, s, int64(off+siz))
- switch int(p.To.Type) {
+ switch p.To.Type {
default:
ctxt.Diag("bad data: %v", p)
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)
// 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
Node interface{} // for use by compiler
}
+type AddrType uint8
+
const (
NAME_NONE = 0 + iota
NAME_EXTERN
)
const (
- TYPE_NONE = 0
-)
+ TYPE_NONE AddrType = 0
-const (
- TYPE_BRANCH = 5 + iota
+ TYPE_BRANCH AddrType = 5 + iota
TYPE_TEXTSIZE
TYPE_MEM
TYPE_CONST
}
// 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
}
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 {
}
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)))
}
}
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))
}
}