]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: allow values with aux Sym to fault on nil args
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 24 Jan 2020 06:19:39 +0000 (22:19 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Sat, 22 Feb 2020 15:33:55 +0000 (15:33 +0000)
And use this newfound power to more precisely describe some PPC64 ops.

Change-Id: Idb2b669d74fbab5f3508edf19f7e3347306b0daf
Reviewed-on: https://go-review.googlesource.com/c/go/+/217002
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/gen/PPC64Ops.go
src/cmd/compile/internal/ssa/gen/main.go
src/cmd/compile/internal/ssa/nilcheck.go
src/cmd/compile/internal/ssa/opGen.go

index ab671a2fa626d7bbb3b4d94f5934d32a94145885..6660b921efcdef279987911cee45259ec694f213 100644 (file)
@@ -317,10 +317,10 @@ func init() {
                {name: "FMOVSloadidx", argLength: 3, reg: fploadidx, asm: "FMOVS", aux: "SymOff", typ: "Float32", faultOnNilArg0: true, symEffect: "Read"},
 
                // Store bytes in the reverse endian order of the arch into arg0.
-               // These are indexes stores with no offset field in the instruction so the aux fields are not used.
-               {name: "MOVDBRstore", argLength: 3, reg: gpstore, asm: "MOVDBR", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 8 bytes reverse order
-               {name: "MOVWBRstore", argLength: 3, reg: gpstore, asm: "MOVWBR", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 4 bytes reverse order
-               {name: "MOVHBRstore", argLength: 3, reg: gpstore, asm: "MOVHBR", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 2 bytes reverse order
+               // These are indexed stores with no offset field in the instruction so the auxint fields are not used.
+               {name: "MOVDBRstore", argLength: 3, reg: gpstore, asm: "MOVDBR", aux: "Sym", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 8 bytes reverse order
+               {name: "MOVWBRstore", argLength: 3, reg: gpstore, asm: "MOVWBR", aux: "Sym", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 4 bytes reverse order
+               {name: "MOVHBRstore", argLength: 3, reg: gpstore, asm: "MOVHBR", aux: "Sym", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 2 bytes reverse order
 
                // Floating point loads from arg0+aux+auxint
                {name: "FMOVDload", argLength: 2, reg: fpload, asm: "FMOVD", aux: "SymOff", typ: "Float64", faultOnNilArg0: true, symEffect: "Read"}, // load double float
index 8520c68a5a5a4a5ce2cb72ec22721d4437da3458..f2a0915737bb3a08ea32e4e37455edb3a2eaa60b 100644 (file)
@@ -307,13 +307,13 @@ func genOp() {
                        }
                        if v.faultOnNilArg0 {
                                fmt.Fprintln(w, "faultOnNilArg0: true,")
-                               if v.aux != "SymOff" && v.aux != "SymValAndOff" && v.aux != "Int64" && v.aux != "Int32" && v.aux != "" {
+                               if v.aux != "Sym" && v.aux != "SymOff" && v.aux != "SymValAndOff" && v.aux != "Int64" && v.aux != "Int32" && v.aux != "" {
                                        log.Fatalf("faultOnNilArg0 with aux %s not allowed", v.aux)
                                }
                        }
                        if v.faultOnNilArg1 {
                                fmt.Fprintln(w, "faultOnNilArg1: true,")
-                               if v.aux != "SymOff" && v.aux != "SymValAndOff" && v.aux != "Int64" && v.aux != "Int32" && v.aux != "" {
+                               if v.aux != "Sym" && v.aux != "SymOff" && v.aux != "SymValAndOff" && v.aux != "Int64" && v.aux != "Int32" && v.aux != "" {
                                        log.Fatalf("faultOnNilArg1 with aux %s not allowed", v.aux)
                                }
                        }
index cf6bdbe37b2e5fb0148144dedc9a70bf746bcece..9e1473b3b8101f547949d55523894abb6c43b71e 100644 (file)
@@ -285,6 +285,10 @@ func nilcheckelim2(f *Func) {
                        for _, ptr := range ptrs {
                                // Check to make sure the offset is small.
                                switch opcodeTable[v.Op].auxType {
+                               case auxSym:
+                                       if v.Aux != nil {
+                                               continue
+                                       }
                                case auxSymOff:
                                        if v.Aux != nil || v.AuxInt < 0 || v.AuxInt >= minZeroPage {
                                                continue
index 6e18f1933b1ff605dc424df95f4fb8417854810f..879490babf25fe12f9fa22cfe006a7ca90fea777 100644 (file)
@@ -23950,7 +23950,7 @@ var opcodeTable = [...]opInfo{
        },
        {
                name:           "MOVDBRstore",
-               auxType:        auxSymOff,
+               auxType:        auxSym,
                argLen:         3,
                faultOnNilArg0: true,
                symEffect:      SymWrite,
@@ -23964,7 +23964,7 @@ var opcodeTable = [...]opInfo{
        },
        {
                name:           "MOVWBRstore",
-               auxType:        auxSymOff,
+               auxType:        auxSym,
                argLen:         3,
                faultOnNilArg0: true,
                symEffect:      SymWrite,
@@ -23978,7 +23978,7 @@ var opcodeTable = [...]opInfo{
        },
        {
                name:           "MOVHBRstore",
-               auxType:        auxSymOff,
+               auxType:        auxSym,
                argLen:         3,
                faultOnNilArg0: true,
                symEffect:      SymWrite,