]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/ssa: Mark ADD[Q|L]const as rematerializeable
authorIlya Tocar <ilya.tocar@intel.com>
Wed, 9 Aug 2017 18:43:34 +0000 (13:43 -0500)
committerIlya Tocar <ilya.tocar@intel.com>
Mon, 28 Aug 2017 17:30:40 +0000 (17:30 +0000)
We can rematerialize only ops that have SP or SB as their only argument.
There are some ADDQconst(SP) that can be rematerialized, but are spilled/filled instead,
so mark addconst as rematerializeable. This shaves ~1kb from go tool.

Change-Id: Ib4cf4fe5f2ec9d3d7e5f0f77f1193eba66ca2f08
Reviewed-on: https://go-review.googlesource.com/54393
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/gen/AMD64Ops.go
src/cmd/compile/internal/ssa/opGen.go

index 7a70819a3937bff2e89f3dcaa3b3f63632bcb539..c5a81fcb406ccaf5e8a2184d86254e2faa803d01 100644 (file)
@@ -189,8 +189,8 @@ func init() {
                // binary ops
                {name: "ADDQ", argLength: 2, reg: gp21sp, asm: "ADDQ", commutative: true, clobberFlags: true},                                                           // arg0 + arg1
                {name: "ADDL", argLength: 2, reg: gp21sp, asm: "ADDL", commutative: true, clobberFlags: true},                                                           // arg0 + arg1
-               {name: "ADDQconst", argLength: 1, reg: gp11sp, asm: "ADDQ", aux: "Int64", typ: "UInt64", clobberFlags: true},                                            // arg0 + auxint
-               {name: "ADDLconst", argLength: 1, reg: gp11sp, asm: "ADDL", aux: "Int32", clobberFlags: true},                                                           // arg0 + auxint
+               {name: "ADDQconst", argLength: 1, reg: gp11sp, asm: "ADDQ", aux: "Int64", typ: "UInt64", clobberFlags: true, rematerializeable: true},                   // arg0 + auxint
+               {name: "ADDLconst", argLength: 1, reg: gp11sp, asm: "ADDL", aux: "Int32", clobberFlags: true, rematerializeable: true},                                  // arg0 + auxint
                {name: "ADDQconstmem", argLength: 2, reg: gpstoreconst, asm: "ADDQ", aux: "SymValAndOff", clobberFlags: true, faultOnNilArg0: true, symEffect: "Write"}, // add ValAndOff(AuxInt).Val() to arg0+ValAndOff(AuxInt).Off()+aux, arg1=mem
                {name: "ADDLconstmem", argLength: 2, reg: gpstoreconst, asm: "ADDL", aux: "SymValAndOff", clobberFlags: true, faultOnNilArg0: true, symEffect: "Write"}, // add ValAndOff(AuxInt).Val() to arg0+ValAndOff(AuxInt).Off()+aux, arg1=mem
 
index bf6149591d3aa3549c8780228711bf3efda47dcc..a4dc4b61181a1ff64a21cbaf620712de594c330a 100644 (file)
@@ -4849,11 +4849,12 @@ var opcodeTable = [...]opInfo{
                },
        },
        {
-               name:         "ADDQconst",
-               auxType:      auxInt64,
-               argLen:       1,
-               clobberFlags: true,
-               asm:          x86.AADDQ,
+               name:              "ADDQconst",
+               auxType:           auxInt64,
+               argLen:            1,
+               rematerializeable: true,
+               clobberFlags:      true,
+               asm:               x86.AADDQ,
                reg: regInfo{
                        inputs: []inputInfo{
                                {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
@@ -4864,11 +4865,12 @@ var opcodeTable = [...]opInfo{
                },
        },
        {
-               name:         "ADDLconst",
-               auxType:      auxInt32,
-               argLen:       1,
-               clobberFlags: true,
-               asm:          x86.AADDL,
+               name:              "ADDLconst",
+               auxType:           auxInt32,
+               argLen:            1,
+               rematerializeable: true,
+               clobberFlags:      true,
+               asm:               x86.AADDL,
                reg: regInfo{
                        inputs: []inputInfo{
                                {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15