x64: clean up regalloc-related semantics on several instructions. (#4811)
* x64: clean up regalloc-related semantics on several instructions. This PR removes all uses of "modify" operands on instructions in the x64 backend, and also removes all uses of "pinned vregs", or vregs that are explicitly tied to particular physical registers. In place of both of these mechanisms, which are legacies of the old regalloc design and supported via compatibility code, the backend now uses operand constraints. This is more flexible as it allows the regalloc to see the liveranges and constraints without "reverse-engineering" move instructions. Eventually, after removing all such uses (including in other backends and by the ABI code), we can remove the compatibility code in regalloc2, significantly simplifying its liverange-construction frontend and thus allowing for higher confidence in correctness as well as possibly a bit more compilation speed. Curiously, there are a few extra move instructions now; they are likely poor splitting decisions and I can try to chase these down later. * Fix cranelift-codegen tests. * Review feedback.
This commit is contained in:
@@ -427,37 +427,34 @@ mod test {
|
||||
|
||||
// 00000000 55 push rbp
|
||||
// 00000001 4889E5 mov rbp,rsp
|
||||
// 00000004 41B900000000 mov r9d,0x0
|
||||
// 0000000A 83FF02 cmp edi,byte +0x2
|
||||
// 0000000D 0F8320000000 jnc near 0x33
|
||||
// 00000013 8BF7 mov esi,edi
|
||||
// 00000015 490F43F1 cmovnc rsi,r9
|
||||
// 00000019 4C8D0D0B000000 lea r9,[rel 0x2b]
|
||||
// 00000020 496374B100 movsxd rsi,dword [r9+rsi*4+0x0]
|
||||
// 00000025 4901F1 add r9,rsi
|
||||
// 00000028 41FFE1 jmp r9
|
||||
// 0000002B 1200 adc al,[rax]
|
||||
// 0000002D 0000 add [rax],al
|
||||
// 0000002F 1C00 sbb al,0x0
|
||||
// 00000031 0000 add [rax],al
|
||||
// 00000033 B803000000 mov eax,0x3
|
||||
// 00000038 4889EC mov rsp,rbp
|
||||
// 0000003B 5D pop rbp
|
||||
// 0000003C C3 ret
|
||||
// 0000003D B801000000 mov eax,0x1
|
||||
// 00000042 4889EC mov rsp,rbp
|
||||
// 00000045 5D pop rbp
|
||||
// 00000046 C3 ret
|
||||
// 00000047 B802000000 mov eax,0x2
|
||||
// 0000004C 4889EC mov rsp,rbp
|
||||
// 0000004F 5D pop rbp
|
||||
// 00000050 C3 ret
|
||||
// 00000004 83FF02 cmp edi,byte +0x2
|
||||
// 00000007 0F8327000000 jnc near 0x34
|
||||
// 0000000D 448BDF mov r11d,edi
|
||||
// 00000010 41BA00000000 mov r10d,0x0
|
||||
// 00000016 4D0F43DA cmovnc r11,r10
|
||||
// 0000001A 4C8D150B000000 lea r10,[rel 0x2c]
|
||||
// 00000021 4F635C9A00 movsxd r11,dword [r10+r11*4+0x0]
|
||||
// 00000026 4D01DA add r10,r11
|
||||
// 00000029 41FFE2 jmp r10
|
||||
// 0000002C 120000001C000000 (jumptable data)
|
||||
// 00000034 B803000000 mov eax,0x3
|
||||
// 00000039 4889EC mov rsp,rbp
|
||||
// 0000003C 5D pop rbp
|
||||
// 0000003D C3 ret
|
||||
// 0000003E B801000000 mov eax,0x1
|
||||
// 00000043 4889EC mov rsp,rbp
|
||||
// 00000046 5D pop rbp
|
||||
// 00000047 C3 ret
|
||||
// 00000048 B802000000 mov eax,0x2
|
||||
// 0000004D 4889EC mov rsp,rbp
|
||||
// 00000050 5D pop rbp
|
||||
// 00000051 C3 ret
|
||||
|
||||
let golden = vec![
|
||||
85, 72, 137, 229, 65, 185, 0, 0, 0, 0, 131, 255, 2, 15, 131, 32, 0, 0, 0, 139, 247, 73,
|
||||
15, 67, 241, 76, 141, 13, 11, 0, 0, 0, 73, 99, 116, 177, 0, 73, 1, 241, 65, 255, 225,
|
||||
18, 0, 0, 0, 28, 0, 0, 0, 184, 3, 0, 0, 0, 72, 137, 236, 93, 195, 184, 1, 0, 0, 0, 72,
|
||||
137, 236, 93, 195, 184, 2, 0, 0, 0, 72, 137, 236, 93, 195,
|
||||
85, 72, 137, 229, 131, 255, 2, 15, 131, 39, 0, 0, 0, 68, 139, 223, 65, 186, 0, 0, 0, 0,
|
||||
77, 15, 67, 218, 76, 141, 21, 11, 0, 0, 0, 79, 99, 92, 154, 0, 77, 1, 218, 65, 255,
|
||||
226, 18, 0, 0, 0, 28, 0, 0, 0, 184, 3, 0, 0, 0, 72, 137, 236, 93, 195, 184, 1, 0, 0, 0,
|
||||
72, 137, 236, 93, 195, 184, 2, 0, 0, 0, 72, 137, 236, 93, 195,
|
||||
];
|
||||
|
||||
assert_eq!(code, &golden[..]);
|
||||
|
||||
Reference in New Issue
Block a user