cmd/internal/obj: switch to one global Aconv

Aconv is the pretty-printer for instruction opcodes like AMOVQ.
There was one for each architecture.
Make the space of A names have a different region for each architecture,
much as we did for the registers, so a single global Aconv function can
do the work. Each architecture registers its region as a slice of names
at a given offset.

The global names like CALL and JMP are now defined only once.

The A values are used for indexing tables, so make it easy to do the
indexing by making the offset maskable.

Remove a bunch of now-duplicated architecture-specific code.

Change-Id: Ib15647b7145a1c089e21e36543691a19e146b60e
Reviewed-on: https://go-review.googlesource.com/6620
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Rob Pike 2015-03-02 20:17:20 -08:00
parent 91e7ca588d
commit 74e88dfdee
24 changed files with 560 additions and 625 deletions

View file

@ -424,6 +424,10 @@ const (
// These are the portable opcodes, common to all architectures.
// Each architecture defines many more arch-specific opcodes,
// with values starting at A_ARCHSPECIFIC.
// Each architecture adds an offset to this so each machine has
// distinct space for its instructions. The offset is a power of
// two so it can be masked to return to origin zero.
// See the definitions of ABase386 etc.
const (
AXXX = 0 + iota
ACALL
@ -570,30 +574,4 @@ const (
LinkExternal
)
// asm5.c
// asm6.c
// asm8.c
// asm9.c
// data.c
// go.c
// ld.c
// list[5689].c
// obj.c
// objfile.c
// pass.c
// pcln.c
// sym.c
var linkbasepointer int