mirror of
https://github.com/golang/go
synced 2024-11-23 07:00:05 -07:00
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>
This commit is contained in:
parent
4fe324dd0f
commit
4a7effa418
@ -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{
|
||||
|
@ -13879,7 +13879,7 @@ var opcodeTable = [...]opInfo{
|
||||
{0, 2}, // R1
|
||||
{1, 1}, // R0
|
||||
},
|
||||
clobbers: 16396, // R2 R3 R14
|
||||
clobbers: 20492, // R2 R3 R12 R14
|
||||
outputs: []outputInfo{
|
||||
{0, 1}, // R0
|
||||
{1, 2}, // R1
|
||||
@ -17228,7 +17228,7 @@ var opcodeTable = [...]opInfo{
|
||||
{0, 2}, // R1
|
||||
{1, 1}, // R0
|
||||
},
|
||||
clobbers: 16386, // R1 R14
|
||||
clobbers: 20482, // R1 R12 R14
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -17242,7 +17242,7 @@ var opcodeTable = [...]opInfo{
|
||||
{0, 4}, // R2
|
||||
{1, 2}, // R1
|
||||
},
|
||||
clobbers: 16391, // R0 R1 R2 R14
|
||||
clobbers: 20487, // R0 R1 R2 R12 R14
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -17403,7 +17403,7 @@ var opcodeTable = [...]opInfo{
|
||||
{0, 4}, // R2
|
||||
{1, 8}, // R3
|
||||
},
|
||||
clobbers: 4294918144, // R14 F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
|
||||
clobbers: 4294922240, // R12 R14 F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -3,10 +3,8 @@
|
||||
|
||||
package ssa
|
||||
|
||||
import (
|
||||
"cmd/compile/internal/types"
|
||||
"math"
|
||||
)
|
||||
import "math"
|
||||
import "cmd/compile/internal/types"
|
||||
|
||||
func rewriteValue386(v *Value) bool {
|
||||
switch v.Op {
|
||||
|
@ -3,12 +3,10 @@
|
||||
|
||||
package ssa
|
||||
|
||||
import (
|
||||
"cmd/compile/internal/types"
|
||||
"cmd/internal/obj"
|
||||
"internal/buildcfg"
|
||||
"math"
|
||||
)
|
||||
import "internal/buildcfg"
|
||||
import "math"
|
||||
import "cmd/internal/obj"
|
||||
import "cmd/compile/internal/types"
|
||||
|
||||
func rewriteValueAMD64(v *Value) bool {
|
||||
switch v.Op {
|
||||
|
@ -3,10 +3,8 @@
|
||||
|
||||
package ssa
|
||||
|
||||
import (
|
||||
"cmd/compile/internal/types"
|
||||
"internal/buildcfg"
|
||||
)
|
||||
import "internal/buildcfg"
|
||||
import "cmd/compile/internal/types"
|
||||
|
||||
func rewriteValueARM(v *Value) bool {
|
||||
switch v.Op {
|
||||
|
@ -3,11 +3,9 @@
|
||||
|
||||
package ssa
|
||||
|
||||
import (
|
||||
"cmd/compile/internal/types"
|
||||
"internal/buildcfg"
|
||||
"math"
|
||||
)
|
||||
import "internal/buildcfg"
|
||||
import "math"
|
||||
import "cmd/compile/internal/types"
|
||||
|
||||
func rewriteValuePPC64(v *Value) bool {
|
||||
switch v.Op {
|
||||
|
@ -3,10 +3,8 @@
|
||||
|
||||
package ssa
|
||||
|
||||
import (
|
||||
"cmd/compile/internal/types"
|
||||
"math"
|
||||
)
|
||||
import "math"
|
||||
import "cmd/compile/internal/types"
|
||||
|
||||
func rewriteValueRISCV64(v *Value) bool {
|
||||
switch v.Op {
|
||||
|
@ -3,11 +3,9 @@
|
||||
|
||||
package ssa
|
||||
|
||||
import (
|
||||
"cmd/compile/internal/types"
|
||||
"cmd/internal/obj/s390x"
|
||||
"math"
|
||||
)
|
||||
import "math"
|
||||
import "cmd/compile/internal/types"
|
||||
import "cmd/internal/obj/s390x"
|
||||
|
||||
func rewriteValueS390X(v *Value) bool {
|
||||
switch v.Op {
|
||||
|
@ -3,11 +3,9 @@
|
||||
|
||||
package ssa
|
||||
|
||||
import (
|
||||
"cmd/compile/internal/types"
|
||||
"internal/buildcfg"
|
||||
"math"
|
||||
)
|
||||
import "internal/buildcfg"
|
||||
import "math"
|
||||
import "cmd/compile/internal/types"
|
||||
|
||||
func rewriteValueWasm(v *Value) bool {
|
||||
switch v.Op {
|
||||
|
@ -3,10 +3,8 @@
|
||||
|
||||
package ssa
|
||||
|
||||
import (
|
||||
"cmd/compile/internal/types"
|
||||
"math"
|
||||
)
|
||||
import "math"
|
||||
import "cmd/compile/internal/types"
|
||||
|
||||
func rewriteValuegeneric(v *Value) bool {
|
||||
switch v.Op {
|
||||
|
Loading…
Reference in New Issue
Block a user