aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/gen
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2021-04-27 17:19:42 -0400
committerCherry Zhang <cherryyz@google.com>2021-04-28 14:01:59 +0000
commit4a7effa418b4644abc5142e35228e26c6a52a50a (patch)
tree16421c069036d36664d5c99a54183bc5b39904fb /src/cmd/compile/internal/ssa/gen
parent4fe324dd0f3497f6bf4f46ba39921d7855dbc29b (diff)
downloadgo-4a7effa418b4644abc5142e35228e26c6a52a50a.tar.gz
go-4a7effa418b4644abc5142e35228e26c6a52a50a.zip
cmd/compile: mark R12 clobbered for special calls
In external linking mode the external linker may insert trampolines, which use R12 as a scratch register. So a call could potentially clobber R12 if the target is laid out too far. Mark R12 clobbered. Also, we will use R12 for trampolines in the Go linker as well. CL 310731 updated the generated rewrite files so imports are grouped, but the generator was not updated to do so. Grouped imports are nice. But as those are generated files, for simplicity and my laziness, just regenerate with the current generator (which makes imports not grouped). Change-Id: Iddb741ff7314a291ade5fbffc7d315f555808409 Reviewed-on: https://go-review.googlesource.com/c/go/+/314453 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/gen')
-rw-r--r--src/cmd/compile/internal/ssa/gen/ARMOps.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/ssa/gen/ARMOps.go b/src/cmd/compile/internal/ssa/gen/ARMOps.go
index 253ff573ec..d1f86039a3 100644
--- a/src/cmd/compile/internal/ssa/gen/ARMOps.go
+++ b/src/cmd/compile/internal/ssa/gen/ARMOps.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
@@ -156,7 +157,7 @@ func init() {
reg: regInfo{
inputs: []regMask{buildReg("R1"), buildReg("R0")},
outputs: []regMask{buildReg("R0"), buildReg("R1")},
- clobbers: buildReg("R2 R3 R14"),
+ clobbers: buildReg("R2 R3 R12 R14"), // R14 is LR, R12 is linker trampoline scratch register
},
clobberFlags: true,
typ: "(UInt32,UInt32)",
@@ -459,7 +460,7 @@ func init() {
argLength: 3,
reg: regInfo{
inputs: []regMask{buildReg("R1"), buildReg("R0")},
- clobbers: buildReg("R1 R14"),
+ clobbers: buildReg("R1 R12 R14"), // R14 is LR, R12 is linker trampoline scratch register
},
faultOnNilArg0: true,
},
@@ -476,7 +477,7 @@ func init() {
argLength: 3,
reg: regInfo{
inputs: []regMask{buildReg("R2"), buildReg("R1")},
- clobbers: buildReg("R0 R1 R2 R14"),
+ clobbers: buildReg("R0 R1 R2 R12 R14"), // R14 is LR, R12 is linker trampoline scratch register
},
faultOnNilArg0: true,
faultOnNilArg1: true,
@@ -564,8 +565,8 @@ func init() {
// LoweredWB invokes runtime.gcWriteBarrier. arg0=destptr, arg1=srcptr, arg2=mem, aux=runtime.gcWriteBarrier
// It saves all GP registers if necessary,
- // but clobbers R14 (LR) because it's a call.
- {name: "LoweredWB", argLength: 3, reg: regInfo{inputs: []regMask{buildReg("R2"), buildReg("R3")}, clobbers: (callerSave &^ gpg) | buildReg("R14")}, clobberFlags: true, aux: "Sym", symEffect: "None"},
+ // but clobbers R14 (LR) because it's a call, and R12 which is linker trampoline scratch register.
+ {name: "LoweredWB", argLength: 3, reg: regInfo{inputs: []regMask{buildReg("R2"), buildReg("R3")}, clobbers: (callerSave &^ gpg) | buildReg("R12 R14")}, clobberFlags: true, aux: "Sym", symEffect: "None"},
}
blocks := []blockData{