Commit b61f8c8d authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

[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/12664Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent 0bb2a50a
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment