1
0
mirror of https://github.com/golang/go synced 2024-10-05 16:41:21 -06:00

[dev.ssa] cmd/compile: fix registers for in-place instructions

Some of these were right; others weren't.

Fixes 'GOGC=off GOSSAPKG=mime go test -a mime'.

The right long term fix is probably to teach the
register allocator about in-place instructions.
In the meantime, all the tests that we can run
now pass.

Change-Id: I8e37b00a5f5e14f241b427d45d5f5cc1064883a2
Reviewed-on: https://go-review.googlesource.com/12664
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2015-07-24 20:09:39 -07:00
parent 0bb2a50a55
commit b61f8c8df3
2 changed files with 3 additions and 7 deletions

View File

@ -1492,7 +1492,7 @@ func genValue(v *ssa.Value) {
p.From.Reg = regnum(v.Args[1]) // should be CX
p.To.Type = obj.TYPE_REG
p.To.Reg = r
case ssa.OpAMD64SHLQconst, ssa.OpAMD64SHRQconst, ssa.OpAMD64SARQconst:
case ssa.OpAMD64SHLQconst, ssa.OpAMD64SHRQconst, ssa.OpAMD64SARQconst, ssa.OpAMD64XORQconst:
x := regnum(v.Args[0])
r := regnum(v)
if x != r {
@ -1686,12 +1686,6 @@ func genValue(v *ssa.Value) {
p := Prog(obj.ACALL)
p.To.Type = obj.TYPE_REG
p.To.Reg = regnum(v.Args[0])
case ssa.OpAMD64XORQconst:
p := Prog(x86.AXORQ)
p.From.Type = obj.TYPE_CONST
p.From.Offset = v.AuxInt
p.To.Type = obj.TYPE_REG
p.To.Reg = regnum(v.Args[0])
case ssa.OpAMD64NEGQ, ssa.OpAMD64NEGL, ssa.OpAMD64NEGW, ssa.OpAMD64NEGB:
p := Prog(v.Op.Asm())
p.To.Type = obj.TYPE_REG

View File

@ -28,6 +28,8 @@ Regalloc
- Floating point registers
- Make calls clobber all registers
- Make liveness analysis non-quadratic.
- Handle in-place instructions (like XORQconst) directly:
Use XORQ AX, 1 rather than MOVQ AX, BX; XORQ BX, 1.
StackAlloc:
- Sort variables so all ptr-containing ones are first (so stack