]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: calls can clobber g on s390x
authorAustin Clements <austin@google.com>
Thu, 8 Feb 2018 15:31:07 +0000 (10:31 -0500)
committerAustin Clements <austin@google.com>
Tue, 13 Feb 2018 16:34:14 +0000 (16:34 +0000)
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 <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssa/gen/S390XOps.go
src/cmd/compile/internal/ssa/opGen.go

index ab781cee90c82712e4b3592a76b6f8adc0bd5c7a..ec4c9b2a3e3ec13b77ca43d09648e914b6a7deed 100644 (file)
@@ -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 (
index 0beabb0b842339de94f4ccbd06062009370bee21..756954535749f1d451ff750b2760b3c205b155ed 100644 (file)
@@ -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
                },
        },
        {