]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj: make Dconv a portable top-level function
authorRob Pike <r@golang.org>
Wed, 25 Feb 2015 17:07:02 +0000 (09:07 -0800)
committerRob Pike <r@golang.org>
Wed, 25 Feb 2015 20:59:50 +0000 (20:59 +0000)
commit29421cbb5bc892124c965ead9e4d2e14d963254c
tree7fa67663ecfe9c2843dd90b0b944d08b340092c6
parent77d7771a829411b36461487b90a1e3034843b8dd
cmd/internal/obj: make Dconv a portable top-level function

Each architecture had its own Dconv (operand printer) but the syntax is
close to uniform and the code overlap was considerable. Consolidate these
into a single top-level function. A similar but smaller unification is done
for Mconv ("Name" formatter) as well.

The signature is changed. The flag was unused so drop it. Add a
function argument, Rconv, that must be supplied by the caller.
TODO: A future change will unify Rconv as well and this argument
will go away.

Some formats changed, because of the automatic consistency
created by unification. For instance, 0(R1) always prints as (R1)
now, and foo+0(SB) is just foo(SB). Before, some made these
simplifications and some didn't; now they all do.

Update the asm tests that depend on the format.

Change-Id: I6e3310bc19814c0c784ff0b960a154521acd9532
Reviewed-on: https://go-review.googlesource.com/5920
Reviewed-by: Russ Cox <rsc@golang.org>
21 files changed:
src/cmd/asm/internal/arch/arch.go
src/cmd/asm/internal/asm/asm.go
src/cmd/asm/internal/asm/operand_test.go
src/cmd/asm/internal/asm/parse.go
src/cmd/asm/internal/asm/testdata/386.out
src/cmd/asm/internal/asm/testdata/amd64.out
src/cmd/asm/internal/asm/testdata/arm.out
src/cmd/asm/internal/asm/testdata/ppc64.out
src/cmd/internal/obj/arm/list5.go
src/cmd/internal/obj/arm/obj5.go
src/cmd/internal/obj/data.go
src/cmd/internal/obj/i386/asm8.go
src/cmd/internal/obj/i386/list8.go
src/cmd/internal/obj/i386/obj8.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/ppc64/list9.go
src/cmd/internal/obj/ppc64/obj9.go
src/cmd/internal/obj/util.go
src/cmd/internal/obj/x86/asm6.go
src/cmd/internal/obj/x86/list6.go
src/cmd/internal/obj/x86/obj6.go