mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj/mips: use LR as temporary register in RET
On mips/mips64, for non-leaf function, RET is assembled as MOV (SP), R4 // load saved LR ADD $framesize, SP JMP (R4) This clobbers R4 unnecessarily. Use the link register as temporary instead. Probably for Go 1.11. Change-Id: I2209db7be11074ed2e0e0829cace95ebfb709e9f Reviewed-on: https://go-review.googlesource.com/79016 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
36951a9f63
commit
1e0ef6601d
1 changed files with 2 additions and 5 deletions
|
|
@ -495,10 +495,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
|
||||||
p.From.Offset = 0
|
p.From.Offset = 0
|
||||||
p.From.Reg = REGSP
|
p.From.Reg = REGSP
|
||||||
p.To.Type = obj.TYPE_REG
|
p.To.Type = obj.TYPE_REG
|
||||||
p.To.Reg = REG_R4
|
|
||||||
if retSym != nil { // retjmp from non-leaf, need to restore LINK register
|
|
||||||
p.To.Reg = REGLINK
|
p.To.Reg = REGLINK
|
||||||
}
|
|
||||||
|
|
||||||
if autosize != 0 {
|
if autosize != 0 {
|
||||||
q = c.newprog()
|
q = c.newprog()
|
||||||
|
|
@ -524,7 +521,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
|
||||||
} else {
|
} else {
|
||||||
q1.To.Type = obj.TYPE_MEM
|
q1.To.Type = obj.TYPE_MEM
|
||||||
q1.To.Offset = 0
|
q1.To.Offset = 0
|
||||||
q1.To.Reg = REG_R4
|
q1.To.Reg = REGLINK
|
||||||
}
|
}
|
||||||
q1.Mark |= BRANCH
|
q1.Mark |= BRANCH
|
||||||
q1.Spadj = +autosize
|
q1.Spadj = +autosize
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue