Commit 8dc0444a authored by Cherry Zhang's avatar Cherry Zhang Committed by Minux Ma

cmd/asm, cmd/internal/obj/mips: add an alias of RSB on mips64x

Change-Id: I724ce0a48c1aeed14267c049fa415a6fa2fffbcf
Reviewed-on: https://go-review.googlesource.com/19864Reviewed-by: default avatarMinux Ma <minux@golang.org>
parent a409fb80
...@@ -393,6 +393,9 @@ func archMips64() *Arch { ...@@ -393,6 +393,9 @@ func archMips64() *Arch {
// Avoid unintentionally clobbering g using R30. // Avoid unintentionally clobbering g using R30.
delete(register, "R30") delete(register, "R30")
register["g"] = mips.REG_R30 register["g"] = mips.REG_R30
// Avoid unintentionally clobbering RSB using R28.
delete(register, "R28")
register["RSB"] = mips.REG_R28
registerPrefix := map[string]bool{ registerPrefix := map[string]bool{
"F": true, "F": true,
"FCR": true, "FCR": true,
......
...@@ -512,7 +512,6 @@ var mips64OperandTests = []operandTest{ ...@@ -512,7 +512,6 @@ var mips64OperandTests = []operandTest{
{"R25", "R25"}, {"R25", "R25"},
{"R26", "R26"}, {"R26", "R26"},
{"R27", "R27"}, {"R27", "R27"},
{"R28", "R28"},
{"R29", "R29"}, {"R29", "R29"},
{"R3", "R3"}, {"R3", "R3"},
{"R31", "R31"}, {"R31", "R31"},
...@@ -525,6 +524,7 @@ var mips64OperandTests = []operandTest{ ...@@ -525,6 +524,7 @@ var mips64OperandTests = []operandTest{
{"LO", "LO"}, {"LO", "LO"},
{"a(FP)", "a(FP)"}, {"a(FP)", "a(FP)"},
{"g", "g"}, {"g", "g"},
{"RSB", "RSB"},
{"ret+8(FP)", "ret+8(FP)"}, {"ret+8(FP)", "ret+8(FP)"},
{"runtime·abort(SB)", "runtime.abort(SB)"}, {"runtime·abort(SB)", "runtime.abort(SB)"},
{"·AddUint32(SB)", "\"\".AddUint32(SB)"}, {"·AddUint32(SB)", "\"\".AddUint32(SB)"},
......
...@@ -187,7 +187,7 @@ const ( ...@@ -187,7 +187,7 @@ const (
REGZERO = REG_R0 /* set to zero */ REGZERO = REG_R0 /* set to zero */
REGSP = REG_R29 REGSP = REG_R29
REGSB = REG_R30 REGSB = REG_R28
REGLINK = REG_R31 REGLINK = REG_R31
REGRET = REG_R1 REGRET = REG_R1
REGARG = -1 /* -1 disables passing the first argument in register */ REGARG = -1 /* -1 disables passing the first argument in register */
......
...@@ -47,6 +47,10 @@ func Rconv(r int) string { ...@@ -47,6 +47,10 @@ func Rconv(r int) string {
// Special case. // Special case.
return "g" return "g"
} }
if r == REGSB {
// Special case.
return "RSB"
}
if REG_R0 <= r && r <= REG_R31 { if REG_R0 <= r && r <= REG_R31 {
return fmt.Sprintf("R%d", r-REG_R0) return fmt.Sprintf("R%d", r-REG_R0)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment