Commit 4f753e77 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/all: stop generating ADATA Progs

The only remaining place that generated ADATA
Prog was the assembler. Stop, and delete some
now-dead code.

Passes toolstash -cmp.

Change-Id: I26578ff1b4868e98562b44f69d909c083e96f8d5
Reviewed-on: https://go-review.googlesource.com/20646Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 7c18f8cd
...@@ -219,18 +219,23 @@ func (p *Parser) asmData(word string, operands [][]lex.Token) { ...@@ -219,18 +219,23 @@ func (p *Parser) asmData(word string, operands [][]lex.Token) {
} }
p.dataAddr[name] = nameAddr.Offset + int64(scale) p.dataAddr[name] = nameAddr.Offset + int64(scale)
prog := &obj.Prog{ switch valueAddr.Type {
Ctxt: p.ctxt, case obj.TYPE_CONST:
As: obj.ADATA, nameAddr.Sym.WriteInt(p.ctxt, nameAddr.Offset, int64(scale), valueAddr.Offset)
Lineno: p.histLineNum, case obj.TYPE_FCONST:
From: nameAddr, switch scale {
From3: &obj.Addr{ case 4:
Offset: int64(scale), nameAddr.Sym.WriteFloat32(p.ctxt, nameAddr.Offset, float32(valueAddr.Val.(float64)))
}, case 8:
To: valueAddr, nameAddr.Sym.WriteFloat64(p.ctxt, nameAddr.Offset, valueAddr.Val.(float64))
default:
panic("bad float scale")
}
case obj.TYPE_SCONST:
nameAddr.Sym.WriteString(p.ctxt, nameAddr.Offset, int64(scale), valueAddr.Val.(string))
case obj.TYPE_ADDR:
nameAddr.Sym.WriteAddr(p.ctxt, nameAddr.Offset, int64(scale), valueAddr.Sym, valueAddr.Offset)
} }
p.append(prog, "", false)
} }
// asmGlobl assembles a GLOBL pseudo-op. // asmGlobl assembles a GLOBL pseudo-op.
......
...@@ -1547,7 +1547,6 @@ func predicable(p *obj.Prog) bool { ...@@ -1547,7 +1547,6 @@ func predicable(p *obj.Prog) bool {
switch p.As { switch p.As {
case obj.ANOP, case obj.ANOP,
obj.AXXX, obj.AXXX,
obj.ADATA,
obj.AGLOBL, obj.AGLOBL,
obj.ATEXT, obj.ATEXT,
arm.AWORD: arm.AWORD:
......
...@@ -100,7 +100,7 @@ func Gbranch(as obj.As, t *Type, likely int) *obj.Prog { ...@@ -100,7 +100,7 @@ func Gbranch(as obj.As, t *Type, likely int) *obj.Prog {
func Prog(as obj.As) *obj.Prog { func Prog(as obj.As) *obj.Prog {
var p *obj.Prog var p *obj.Prog
if as == obj.ADATA || as == obj.AGLOBL { if as == obj.AGLOBL {
if ddumped { if ddumped {
Fatalf("already dumped data") Fatalf("already dumped data")
} }
......
...@@ -864,7 +864,7 @@ func checkptxt(fn *Node, firstp *obj.Prog) { ...@@ -864,7 +864,7 @@ func checkptxt(fn *Node, firstp *obj.Prog) {
if false { if false {
fmt.Printf("analyzing '%v'\n", p) fmt.Printf("analyzing '%v'\n", p)
} }
if p.As != obj.ADATA && p.As != obj.AGLOBL && p.As != obj.ATYPE { if p.As != obj.AGLOBL && p.As != obj.ATYPE {
checkprog(fn, p) checkprog(fn, p)
} }
} }
......
...@@ -110,65 +110,6 @@ func (s *LSym) WriteString(ctxt *Link, off, siz int64, str string) { ...@@ -110,65 +110,6 @@ func (s *LSym) WriteString(ctxt *Link, off, siz int64, str string) {
copy(s.P[off:off+siz], str) copy(s.P[off:off+siz], str)
} }
func savedata(ctxt *Link, p *Prog) {
s := p.From.Sym
off := int32(p.From.Offset)
siz := int32(p.From3.Offset)
if off < 0 || siz < 0 || off >= 1<<30 || siz >= 100 {
log.Fatalf("savedata: bad off=%d siz=%d", off, siz)
}
if s.Type == SBSS || s.Type == STLSBSS {
ctxt.Diag("cannot supply data for BSS var")
}
Symgrow(ctxt, s, int64(off+siz))
switch p.To.Type {
default:
ctxt.Diag("bad data: %v", p)
case TYPE_FCONST:
switch siz {
default:
ctxt.Diag("unexpected %d-byte floating point constant", siz)
case 4:
flt := math.Float32bits(float32(p.To.Val.(float64)))
ctxt.Arch.ByteOrder.PutUint32(s.P[off:], flt)
case 8:
flt := math.Float64bits(p.To.Val.(float64))
ctxt.Arch.ByteOrder.PutUint64(s.P[off:], flt)
}
case TYPE_SCONST:
copy(s.P[off:off+siz], p.To.Val.(string))
case TYPE_CONST, TYPE_ADDR:
if p.To.Sym != nil || p.To.Type == TYPE_ADDR {
r := Addrel(s)
r.Off = off
r.Siz = uint8(siz)
r.Sym = p.To.Sym
r.Type = R_ADDR
r.Add = p.To.Offset
break
}
o := p.To.Offset
switch siz {
default:
ctxt.Diag("unexpected %d-byte integer constant", siz)
case 1:
s.P[off] = byte(o)
case 2:
ctxt.Arch.ByteOrder.PutUint16(s.P[off:], uint16(o))
case 4:
ctxt.Arch.ByteOrder.PutUint32(s.P[off:], uint32(o))
case 8:
ctxt.Arch.ByteOrder.PutUint64(s.P[off:], uint64(o))
}
}
}
func Addrel(s *LSym) *Reloc { func Addrel(s *LSym) *Reloc {
s.R = append(s.R, Reloc{}) s.R = append(s.R, Reloc{})
return &s.R[len(s.R)-1] return &s.R[len(s.R)-1]
......
...@@ -198,7 +198,7 @@ const ( ...@@ -198,7 +198,7 @@ const (
) )
// TODO(rsc): Describe prog. // TODO(rsc): Describe prog.
// TODO(rsc): Describe TEXT/GLOBL flag in from3, DATA width in from3. // TODO(rsc): Describe TEXT/GLOBL flag in from3
type Prog struct { type Prog struct {
Ctxt *Link Ctxt *Link
Link *Prog Link *Prog
...@@ -266,7 +266,7 @@ const ( ...@@ -266,7 +266,7 @@ const (
AXXX As = iota AXXX As = iota
ACALL ACALL
ACHECKNIL ACHECKNIL
ADATA ADATA // used only by the assembler for parsing
ADUFFCOPY ADUFFCOPY
ADUFFZERO ADUFFZERO
AEND AEND
......
...@@ -200,10 +200,6 @@ func flushplist(ctxt *Link, freeProgs bool) { ...@@ -200,10 +200,6 @@ func flushplist(ctxt *Link, freeProgs bool) {
ctxt.Edata = s ctxt.Edata = s
continue continue
case ADATA:
savedata(ctxt, p)
continue
case ATEXT: case ATEXT:
s := p.From.Sym s := p.From.Sym
if s == nil { if s == nil {
......
...@@ -288,7 +288,7 @@ func (p *Prog) String() string { ...@@ -288,7 +288,7 @@ func (p *Prog) String() string {
sep = ", " sep = ", "
} }
if p.From3Type() != TYPE_NONE { if p.From3Type() != TYPE_NONE {
if p.From3.Type == TYPE_CONST && (p.As == ADATA || p.As == ATEXT || p.As == AGLOBL) { if p.From3.Type == TYPE_CONST && (p.As == ATEXT || p.As == AGLOBL) {
// Special case - omit $. // Special case - omit $.
fmt.Fprintf(&buf, "%s%d", sep, p.From3.Offset) fmt.Fprintf(&buf, "%s%d", sep, p.From3.Offset)
} else { } else {
......
...@@ -1100,7 +1100,6 @@ var optab = ...@@ -1100,7 +1100,6 @@ var optab =
{ACQO, ynone, Pw, [23]uint8{0x99}}, {ACQO, ynone, Pw, [23]uint8{0x99}},
{ADAA, ynone, P32, [23]uint8{0x27}}, {ADAA, ynone, P32, [23]uint8{0x27}},
{ADAS, ynone, P32, [23]uint8{0x2f}}, {ADAS, ynone, P32, [23]uint8{0x2f}},
{obj.ADATA, nil, 0, [23]uint8{}},
{ADECB, yincb, Pb, [23]uint8{0xfe, 01}}, {ADECB, yincb, Pb, [23]uint8{0xfe, 01}},
{ADECL, yincl, Px1, [23]uint8{0x48, 0xff, 01}}, {ADECL, yincl, Px1, [23]uint8{0x48, 0xff, 01}},
{ADECQ, yincq, Pw, [23]uint8{0xff, 01}}, {ADECQ, yincq, Pw, [23]uint8{0xff, 01}},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment