Switch Cranelift over to regalloc2. (#3989)

This PR switches Cranelift over to the new register allocator, regalloc2.

See [this document](https://gist.github.com/cfallin/08553421a91f150254fe878f67301801)
for a summary of the design changes. This switchover has implications for
core VCode/MachInst types and the lowering pass.

Overall, this change brings improvements to both compile time and speed of
generated code (runtime), as reported in #3942:

```
Benchmark       Compilation (wallclock)     Execution (wallclock)
blake3-scalar   25% faster                  28% faster
blake3-simd     no diff                     no diff
meshoptimizer   19% faster                  17% faster
pulldown-cmark  17% faster                  no diff
bz2             15% faster                  no diff
SpiderMonkey,   21% faster                  2% faster
  fib(30)
clang.wasm      42% faster                  N/A
```
This commit is contained in:
Chris Fallin
2022-04-14 10:28:21 -07:00
committed by GitHub
parent bfae6384aa
commit a0318f36f0
181 changed files with 16887 additions and 21587 deletions

View File

@@ -7,21 +7,15 @@ block0(v0: b1, v1: i32, v2: i32):
return v3
}
; VCode_ShowWithRRU {{
; Entry block: 0
; Block 0:
; (original IR block: block0)
; (instruction range: 0 .. 9)
; Inst 0: pushq %rbp
; Inst 1: movq %rsp, %rbp
; Inst 2: testb $1, %dil
; Inst 3: movl %edx, %edi
; Inst 4: cmovnzl %esi, %edi
; Inst 5: movq %rdi, %rax
; Inst 6: movq %rbp, %rsp
; Inst 7: popq %rbp
; Inst 8: ret
; }}
; pushq %rbp
; movq %rsp, %rbp
; block0:
; testb $1, %dil
; cmovnzl %esi, %edx, %edx
; movq %rdx, %rax
; movq %rbp, %rsp
; popq %rbp
; ret
function %f1(b1) -> i32 {
block0(v0: b1):
@@ -35,32 +29,21 @@ block2:
return v2
}
; VCode_ShowWithRRU {{
; Entry block: 0
; Block 0:
; (original IR block: block0)
; (successor: Block 1)
; (successor: Block 2)
; (instruction range: 0 .. 4)
; Inst 0: pushq %rbp
; Inst 1: movq %rsp, %rbp
; Inst 2: testb $1, %dil
; Inst 3: jnz label1; j label2
; Block 1:
; (original IR block: block1)
; (instruction range: 4 .. 8)
; Inst 4: movl $1, %eax
; Inst 5: movq %rbp, %rsp
; Inst 6: popq %rbp
; Inst 7: ret
; Block 2:
; (original IR block: block2)
; (instruction range: 8 .. 12)
; Inst 8: movl $2, %eax
; Inst 9: movq %rbp, %rsp
; Inst 10: popq %rbp
; Inst 11: ret
; }}
; pushq %rbp
; movq %rsp, %rbp
; block0:
; testb $1, %dil
; jnz label1; j label2
; block1:
; movl $1, %eax
; movq %rbp, %rsp
; popq %rbp
; ret
; block2:
; movl $2, %eax
; movq %rbp, %rsp
; popq %rbp
; ret
function %f2(b1) -> i32 {
block0(v0: b1):
@@ -74,30 +57,19 @@ block2:
return v2
}
; VCode_ShowWithRRU {{
; Entry block: 0
; Block 0:
; (original IR block: block0)
; (successor: Block 1)
; (successor: Block 2)
; (instruction range: 0 .. 4)
; Inst 0: pushq %rbp
; Inst 1: movq %rsp, %rbp
; Inst 2: testb $1, %dil
; Inst 3: jz label1; j label2
; Block 1:
; (original IR block: block1)
; (instruction range: 4 .. 8)
; Inst 4: movl $1, %eax
; Inst 5: movq %rbp, %rsp
; Inst 6: popq %rbp
; Inst 7: ret
; Block 2:
; (original IR block: block2)
; (instruction range: 8 .. 12)
; Inst 8: movl $2, %eax
; Inst 9: movq %rbp, %rsp
; Inst 10: popq %rbp
; Inst 11: ret
; }}
; pushq %rbp
; movq %rsp, %rbp
; block0:
; testb $1, %dil
; jz label1; j label2
; block1:
; movl $1, %eax
; movq %rbp, %rsp
; popq %rbp
; ret
; block2:
; movl $2, %eax
; movq %rbp, %rsp
; popq %rbp
; ret