cmd/internal/obj: make Rconv a global function

Clean up the obj API by making Rconv (register pretty printer) a top-level
function. This means that Dconv (operand pretty printer) doesn't need
an Rconv argument.

To do this, we make the register numbers, which are arbitrary inside an
operand (obj.Addr), disjoint sets for each architecture. Each architecture
registers (ha) a piece of the space and then the global Rconv knows which
architecture-specific printer to use.

Clean up all the code that uses Dconv.

Now register numbers are large, so a couple of fields in Addr need to go
from int8 to int16 because they sometimes hold register numbers. Clean
up their uses, which meant regenerating the yacc grammars for the
assemblers. There are changes in this CL triggered by earlier changes
to yacc, which had not been run in this directory.

There is still cleanup to do in Addr, but we're getting closer to that being
easy to do.

Change-Id: I9290ebee013b62f7d24e886743ea5a6b232990ab
Reviewed-on: https://go-review.googlesource.com/6220
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Rob Pike 2015-02-26 17:09:16 -08:00
parent 95bf77bc68
commit daddeb2686
36 changed files with 1177 additions and 756 deletions

View file

@ -35,8 +35,9 @@ import "encoding/binary"
type Addr struct {
Type int16
Reg int16
Reg2 int16 // RHS of register pair. AX:DX (386)
Index int16
Scale int8
Scale int16 // Sometimes holds a register.
Name int8
Offset int64
Sym *LSym