]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/mips: fix use of R28 on 32-bit MIPS
authorCherry Zhang <cherryyz@google.com>
Thu, 8 Feb 2018 16:39:50 +0000 (11:39 -0500)
committerCherry Zhang <cherryyz@google.com>
Tue, 13 Feb 2018 16:00:30 +0000 (16:00 +0000)
R28 is used as the SB register on MIPS64, and it was printed as
"RSB" on both 32-bit and 64-bit MIPS. This is confusing on MIPS32
as there R28 is just a general purpose register. Further, this
string representation is used in the assembler's frontend to parse
register symbols, and this leads to failure in parsing R28 in
MIPS32 assembly code. Change rconv to always print the register
as R28. This fixes the parsing problem on MIPS32, and this is
a reasonable representation on both MIPS32 and MIPS64.

Change-Id: I30d6c0a442fbb08ea615f32f1763b5baadcee1da
Reviewed-on: https://go-review.googlesource.com/92915
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/cmd/asm/internal/asm/operand_test.go
src/cmd/internal/obj/mips/list0.go

index ca692bf828ca48c8f9bd6fd41ad92dc6a338af52..f4ce4fe11472aea9f1434f124d7795b412e1c5f4 100644 (file)
@@ -626,7 +626,7 @@ var mips64OperandTests = []operandTest{
        {"LO", "LO"},
        {"a(FP)", "a(FP)"},
        {"g", "g"},
-       {"RSB", "RSB"},
+       {"RSB", "R28"},
        {"ret+8(FP)", "ret+8(FP)"},
        {"runtime·abort(SB)", "runtime.abort(SB)"},
        {"·AddUint32(SB)", "\"\".AddUint32(SB)"},
@@ -697,6 +697,7 @@ var mipsOperandTests = []operandTest{
        {"R25", "R25"},
        {"R26", "R26"},
        {"R27", "R27"},
+       {"R28", "R28"},
        {"R29", "R29"},
        {"R3", "R3"},
        {"R31", "R31"},
index bdd9df974a099796e8d7968fa6432e004d897564..addf9f70d8a22400ae1c555d8b0a05544bcf3b23 100644 (file)
@@ -47,10 +47,6 @@ func rconv(r int) string {
                // Special case.
                return "g"
        }
-       if r == REGSB {
-               // Special case.
-               return "RSB"
-       }
        if REG_R0 <= r && r <= REG_R31 {
                return fmt.Sprintf("R%d", r-REG_R0)
        }