From: Austin Clements Date: Thu, 8 Feb 2018 15:31:07 +0000 (-0500) Subject: cmd/compile: calls can clobber g on s390x X-Git-Tag: go1.11beta1~1710 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=de186c63ce058b2ab43f324fe582dc2ab1369614;p=gostls13.git cmd/compile: calls can clobber g on s390x Because a call may ultimately invoke runtime.setg, we have to assume that g may be clobbered by any call. All of the other architectures that use a g register already do this, but it was missing from the s390x caller save clobber set. Change-Id: Ia931638d42c44979839f20d71097acf31475f423 Reviewed-on: https://go-review.googlesource.com/92835 Run-TryBot: Austin Clements TryBot-Result: Gobot Gobot Reviewed-by: Cherry Zhang --- diff --git a/src/cmd/compile/internal/ssa/gen/S390XOps.go b/src/cmd/compile/internal/ssa/gen/S390XOps.go index ab781cee90..ec4c9b2a3e 100644 --- a/src/cmd/compile/internal/ssa/gen/S390XOps.go +++ b/src/cmd/compile/internal/ssa/gen/S390XOps.go @@ -124,7 +124,7 @@ func init() { ptrspsb = ptrsp | sb fp = buildReg("F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15") - callerSave = gp | fp + callerSave = gp | fp | buildReg("g") // runtime.setg (and anything calling it) may clobber g ) // Common slices of register masks var ( diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go index 0beabb0b84..7569545357 100644 --- a/src/cmd/compile/internal/ssa/opGen.go +++ b/src/cmd/compile/internal/ssa/opGen.go @@ -21883,7 +21883,7 @@ var opcodeTable = [...]opInfo{ call: true, symEffect: SymNone, reg: regInfo{ - clobbers: 4294923263, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R12 R14 F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 + clobbers: 4294931455, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R12 g R14 F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 }, }, { @@ -21897,7 +21897,7 @@ var opcodeTable = [...]opInfo{ {1, 4096}, // R12 {0, 54270}, // R1 R2 R3 R4 R5 R6 R7 R8 R9 R12 R14 SP }, - clobbers: 4294923263, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R12 R14 F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 + clobbers: 4294931455, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R12 g R14 F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 }, }, { @@ -21910,7 +21910,7 @@ var opcodeTable = [...]opInfo{ inputs: []inputInfo{ {0, 21502}, // R1 R2 R3 R4 R5 R6 R7 R8 R9 R12 R14 }, - clobbers: 4294923263, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R12 R14 F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 + clobbers: 4294931455, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R12 g R14 F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 }, }, {