cmd/internal/obj: eagerly initialize assemblers

CL 38662 changed the x86 assembler to be eagerly
initialized, for a concurrent backend.

This CL puts in place a proper mechanism for doing so,
and switches all architectures to use it.

Passes toolstash-check -all.

Updates #15756

Change-Id: Id2aa527d3a8259c95797d63a2f0d1123e3ca2a1c
Reviewed-on: https://go-review.googlesource.com/39917
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2017-04-06 13:42:31 -07:00
parent 817c1023b0
commit 63c1aff60b
19 changed files with 64 additions and 17 deletions

View file

@ -382,7 +382,7 @@ func span0(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
ctxt.Autosize = int32(p.To.Offset + ctxt.FixedFrameSize())
if oprange[AOR&obj.AMask] == nil {
buildop(ctxt)
ctxt.Diag("mips ops not initialized, call mips.buildop first")
}
c := int64(0)
@ -668,7 +668,7 @@ func prasm(p *obj.Prog) {
func oplook(ctxt *obj.Link, p *obj.Prog) *Optab {
if oprange[AOR&obj.AMask] == nil {
buildop(ctxt)
ctxt.Diag("mips ops not initialized, call mips.buildop first")
}
a1 := int(p.Optab)
@ -833,6 +833,13 @@ func opset(a, b0 obj.As) {
}
func buildop(ctxt *obj.Link) {
if oprange[AOR&obj.AMask] != nil {
// Already initialized; stop now.
// This happens in the cmd/asm tests,
// each of which re-initializes the arch.
return
}
var n int
for i := 0; i < C_NCLASS; i++ {