[dev.ssa] cmd/compile: disable xor clearing when flags must be preserved

The x86 backend automatically rewrites MOV $0, AX to
XOR AX, AX.  That rewrite isn't ok when the flags register
is live across the MOV.  Keep track of which moves care
about preserving flags, then disable this rewrite for them.

On x86, Prog.Mark was being used to hold the length of the
instruction.  We already store that in Prog.Isize, so no
need to store it in Prog.Mark also.  This frees up Prog.Mark
to hold a bitmask on x86 just like all the other architectures.

Update #12405

Change-Id: Ibad8a8f41fc6222bec1e4904221887d3cc3ca029
Reviewed-on: https://go-review.googlesource.com/18861
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Keith Randall 2016-01-22 13:44:58 -08:00
parent 733bf6ef67
commit 7b773946c0
11 changed files with 66 additions and 37 deletions

View file

@ -214,14 +214,14 @@ type Prog struct {
Spadj int32
As int16
Reg int16
RegTo2 int16 // 2nd register output operand
Mark uint16
RegTo2 int16 // 2nd register output operand
Mark uint16 // bitmask of arch-specific items
Optab uint16
Scond uint8
Back uint8
Ft uint8
Tt uint8
Isize uint8
Isize uint8 // size of the instruction in bytes (x86 only)
Mode int8
Info ProgInfo