]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: print SizeAndAlign AuxInt values correctly
authorKeith Randall <khr@golang.org>
Wed, 31 Aug 2016 19:30:46 +0000 (12:30 -0700)
committerKeith Randall <khr@golang.org>
Wed, 31 Aug 2016 20:34:39 +0000 (20:34 +0000)
Makes the AuxInt arg to Move/Zero print in a readable format.

Change-Id: I12295959b00ff7c1638d35836cc6d64d112c11ca
Reviewed-on: https://go-review.googlesource.com/28271
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/ssa/check.go
src/cmd/compile/internal/ssa/gen/genericOps.go
src/cmd/compile/internal/ssa/gen/rulegen.go
src/cmd/compile/internal/ssa/op.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/value.go

index bfedd477946b5322d254e7f7f4ac5cb80b9c0b7b..e99a485b14d0cbe9d6289df4dfa6d2c51fd365d3 100644 (file)
@@ -165,6 +165,8 @@ func checkFunc(f *Func) {
                                if !isExactFloat32(v) {
                                        f.Fatalf("value %v has an AuxInt value that is not an exact float32", v)
                                }
+                       case auxSizeAndAlign:
+                               canHaveAuxInt = true
                        case auxString, auxSym:
                                canHaveAux = true
                        case auxSymOff, auxSymValAndOff:
index 1bdacb2413762bfcd80d1bd61e1f440d0adf2a31..d3b0305310aa960c8a5150c81afc8bc51c4458e0 100644 (file)
@@ -305,10 +305,10 @@ var genericOps = []opData{
        {name: "Func", aux: "Sym"},   // entry address of a function
 
        // Memory operations
-       {name: "Load", argLength: 2},                            // Load from arg0.  arg1=memory
-       {name: "Store", argLength: 3, typ: "Mem", aux: "Int64"}, // Store arg1 to arg0.  arg2=memory, auxint=size.  Returns memory.
-       {name: "Move", argLength: 3, typ: "Mem", aux: "Int64"},  // arg0=destptr, arg1=srcptr, arg2=mem, auxint=size.  Returns memory.
-       {name: "Zero", argLength: 2, typ: "Mem", aux: "Int64"},  // arg0=destptr, arg1=mem, auxint=size. Returns memory.
+       {name: "Load", argLength: 2},                                  // Load from arg0.  arg1=memory
+       {name: "Store", argLength: 3, typ: "Mem", aux: "Int64"},       // Store arg1 to arg0.  arg2=memory, auxint=size.  Returns memory.
+       {name: "Move", argLength: 3, typ: "Mem", aux: "SizeAndAlign"}, // arg0=destptr, arg1=srcptr, arg2=mem, auxint=size+alignment.  Returns memory.
+       {name: "Zero", argLength: 2, typ: "Mem", aux: "SizeAndAlign"}, // arg0=destptr, arg1=mem, auxint=size+alignment. Returns memory.
 
        // Function calls. Arguments to the call have already been written to the stack.
        // Return values appear on the stack. The method receiver, if any, is treated
index 60187730e2bb43b54b6349190a2c00c322c8a2a1..afe17469ae052e285b91a7a7217a7261640e6ac0 100644 (file)
@@ -657,7 +657,7 @@ func parseValue(val string, arch arch, loc string) (op opData, oparch string, ty
        // Sanity check aux, auxint.
        if auxint != "" {
                switch op.aux {
-               case "Bool", "Int8", "Int16", "Int32", "Int64", "Int128", "Float32", "Float64", "SymOff", "SymValAndOff", "SymInt32":
+               case "Bool", "Int8", "Int16", "Int32", "Int64", "Int128", "Float32", "Float64", "SymOff", "SymValAndOff", "SymInt32", "SizeAndAlign":
                default:
                        log.Fatalf("%s: op %s %s can't have auxint", loc, op.name, op.aux)
                }
index 987cbd7b5634ca72a95a6bbbb7f98e5c955f1d43..887cce1511dde98194a141cb6dbdb4704e6d3e73 100644 (file)
@@ -58,6 +58,7 @@ const (
        auxInt128               // auxInt represents a 128-bit integer.  Always 0.
        auxFloat32              // auxInt is a float32 (encoded with math.Float64bits)
        auxFloat64              // auxInt is a float64 (encoded with math.Float64bits)
+       auxSizeAndAlign         // auxInt is a SizeAndAlign
        auxString               // aux is a string
        auxSym                  // aux is a symbol
        auxSymOff               // aux is a symbol, auxInt is an offset
index 678ba183c3e5c84407dda0b2867f2c745bcf21e8..5e62fab2ff62fd5593b22bee5cc9cbe16f6b5747 100644 (file)
@@ -15873,13 +15873,13 @@ var opcodeTable = [...]opInfo{
        },
        {
                name:    "Move",
-               auxType: auxInt64,
+               auxType: auxSizeAndAlign,
                argLen:  3,
                generic: true,
        },
        {
                name:    "Zero",
-               auxType: auxInt64,
+               auxType: auxSizeAndAlign,
                argLen:  2,
                generic: true,
        },
index d30ef2718217c1c49bdf65ad51502fd09b636132..562037a191960a9690b3524eb5c731e342162404 100644 (file)
@@ -126,6 +126,8 @@ func (v *Value) auxString() string {
                return fmt.Sprintf(" [%d]", v.AuxInt32())
        case auxInt64, auxInt128:
                return fmt.Sprintf(" [%d]", v.AuxInt)
+       case auxSizeAndAlign:
+               return fmt.Sprintf(" [%s]", SizeAndAlign(v.AuxInt))
        case auxFloat32, auxFloat64:
                return fmt.Sprintf(" [%g]", v.AuxFloat())
        case auxString: