Skip to content

Commit

Permalink
Update to regalloc2-0.10.0 (#9197)
Browse files Browse the repository at this point in the history
* Reapply "Upgrade regalloc2 to 0.9.4 (#9191)" (#9193)

This reverts commit 7081b8f.

* Upgrade to regalloc-0.10.0
  • Loading branch information
elliottt authored Sep 3, 2024
1 parent 7081b8f commit 1854929
Show file tree
Hide file tree
Showing 52 changed files with 1,278 additions and 1,450 deletions.
15 changes: 3 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ byte-array-literals = { path = "crates/wasi-preview1-component-adapter/byte-arra

# Bytecode Alliance maintained dependencies:
# ---------------------------
regalloc2 = "0.9.3"
regalloc2 = "0.10.0"

# cap-std family:
target-lexicon = "0.12.16"
Expand Down
30 changes: 1 addition & 29 deletions cranelift/codegen/src/machinst/vcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,30 +884,6 @@ impl<I: VCodeInst> VCode<I> {
// If this is a safepoint, compute a stack map
// and pass it to the emit state.
let stack_map_disasm = if self.insts[iix.index()].is_safepoint() {
let mut safepoint_slots: SmallVec<[SpillSlot; 8]> = smallvec![];
// Find the contiguous range of
// (progpoint, allocation) safepoint slot
// records in `regalloc.safepoint_slots`
// for this instruction index.
let safepoint_slots_start = regalloc
.safepoint_slots
.binary_search_by(|(progpoint, _alloc)| {
if progpoint.inst() >= iix {
std::cmp::Ordering::Greater
} else {
std::cmp::Ordering::Less
}
})
.unwrap_err();

for (_, alloc) in regalloc.safepoint_slots[safepoint_slots_start..]
.iter()
.take_while(|(progpoint, _)| progpoint.inst() == iix)
{
let slot = alloc.as_stack().unwrap();
safepoint_slots.push(slot);
}

let (user_stack_map, user_stack_map_disasm) = {
// The `user_stack_maps` is keyed by reverse
// instruction index, so we must flip the
Expand Down Expand Up @@ -1297,7 +1273,7 @@ impl<I: VCodeInst> RegallocFunction for VCode<I> {

fn block_insns(&self, block: BlockIndex) -> InstRange {
let range = self.block_ranges.get(block.index());
InstRange::forward(InsnIndex::new(range.start), InsnIndex::new(range.end))
InstRange::new(InsnIndex::new(range.start), InsnIndex::new(range.end))
}

fn block_succs(&self, block: BlockIndex) -> &[BlockIndex] {
Expand Down Expand Up @@ -1344,10 +1320,6 @@ impl<I: VCodeInst> RegallocFunction for VCode<I> {
}
}

fn requires_refs_on_stack(&self, _insn: InsnIndex) -> bool {
false
}

fn inst_operands(&self, insn: InsnIndex) -> &[Operand] {
let range = self.operand_ranges.get(insn.index());
&self.operands[range]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ block0(v0: i64):
; stp fp, lr, [sp, #-16]!
; mov fp, sp
; block0:
; mov x0, x2
; load_ext_name x3, TestCase(%g)+0
; mov x0, x2
; blr x3
; mov x2, x0
; ldp fp, lr, [sp], #16
Expand All @@ -76,11 +76,11 @@ block0(v0: i64):
; stp x29, x30, [sp, #-0x10]!
; mov x29, sp
; block1: ; offset 0xc
; mov x0, x2
; ldr x3, #0x18
; b #0x20
; ldr x3, #0x14
; b #0x1c
; .byte 0x00, 0x00, 0x00, 0x00 ; reloc_external Abs8 %g 0
; .byte 0x00, 0x00, 0x00, 0x00
; mov x0, x2
; blr x3
; mov x2, x0
; ldp x29, x30, [sp], #0x10
Expand Down
8 changes: 4 additions & 4 deletions cranelift/filetests/filetests/isa/aarch64/call-pauth.clif
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ block0(v0: i64):
; stp fp, lr, [sp, #-16]!
; mov fp, sp
; block0:
; mov x0, x2
; load_ext_name x3, TestCase(%g)+0
; mov x0, x2
; blr x3
; mov x2, x0
; ldp fp, lr, [sp], #16
Expand All @@ -77,11 +77,11 @@ block0(v0: i64):
; stp x29, x30, [sp, #-0x10]!
; mov x29, sp
; block1: ; offset 0xc
; mov x0, x2
; ldr x3, #0x18
; b #0x20
; ldr x3, #0x14
; b #0x1c
; .byte 0x00, 0x00, 0x00, 0x00 ; reloc_external Abs8 %g 0
; .byte 0x00, 0x00, 0x00, 0x00
; mov x0, x2
; blr x3
; mov x2, x0
; ldp x29, x30, [sp], #0x10
Expand Down
80 changes: 40 additions & 40 deletions cranelift/filetests/filetests/isa/aarch64/call.clif
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,9 @@ block0(v0: i64):
; stp fp, lr, [sp, #-16]!
; mov fp, sp
; block0:
; mov x1, x0
; movz x2, #42
; load_ext_name x4, TestCase(%f11)+0
; mov x1, x0
; mov x0, x2
; blr x4
; ldp fp, lr, [sp], #16
Expand All @@ -542,12 +542,12 @@ block0(v0: i64):
; stp x29, x30, [sp, #-0x10]!
; mov x29, sp
; block1: ; offset 0x8
; mov x1, x0
; mov x2, #0x2a
; ldr x4, #0x18
; b #0x20
; ldr x4, #0x14
; b #0x1c
; .byte 0x00, 0x00, 0x00, 0x00 ; reloc_external Abs8 %f11 0
; .byte 0x00, 0x00, 0x00, 0x00
; mov x1, x0
; mov x0, x2
; blr x4
; ldp x29, x30, [sp], #0x10
Expand Down Expand Up @@ -583,9 +583,9 @@ block0(v0: i64):
; stp fp, lr, [sp, #-16]!
; mov fp, sp
; block0:
; mov x2, x0
; movz x3, #42
; load_ext_name x4, TestCase(%f12)+0
; mov x2, x0
; mov x0, x3
; blr x4
; ldp fp, lr, [sp], #16
Expand All @@ -596,12 +596,12 @@ block0(v0: i64):
; stp x29, x30, [sp, #-0x10]!
; mov x29, sp
; block1: ; offset 0x8
; mov x2, x0
; mov x3, #0x2a
; ldr x4, #0x18
; b #0x20
; ldr x4, #0x14
; b #0x1c
; .byte 0x00, 0x00, 0x00, 0x00 ; reloc_external Abs8 %f12 0
; .byte 0x00, 0x00, 0x00, 0x00
; mov x2, x0
; mov x0, x3
; blr x4
; ldp x29, x30, [sp], #0x10
Expand Down Expand Up @@ -637,9 +637,9 @@ block0(v0: i64):
; stp fp, lr, [sp, #-16]!
; mov fp, sp
; block0:
; mov x1, x0
; movz x2, #42
; load_ext_name x4, TestCase(%f13)+0
; mov x1, x0
; mov x0, x2
; blr x4
; ldp fp, lr, [sp], #16
Expand All @@ -650,12 +650,12 @@ block0(v0: i64):
; stp x29, x30, [sp, #-0x10]!
; mov x29, sp
; block1: ; offset 0x8
; mov x1, x0
; mov x2, #0x2a
; ldr x4, #0x18
; b #0x20
; ldr x4, #0x14
; b #0x1c
; .byte 0x00, 0x00, 0x00, 0x00 ; reloc_external Abs8 %f13 0
; .byte 0x00, 0x00, 0x00, 0x00
; mov x1, x0
; mov x0, x2
; blr x4
; ldp x29, x30, [sp], #0x10
Expand Down Expand Up @@ -698,12 +698,12 @@ block0(v0: i128, v1: i64):
; mov fp, sp
; sub sp, sp, #16
; block0:
; mov x6, x2
; str x0, [sp]
; mov x4, x0
; str x1, [sp, #8]
; mov x5, x1
; load_ext_name x8, TestCase(%f14)+0
; mov x4, x0
; mov x5, x1
; mov x6, x2
; mov x2, x4
; mov x3, x5
; blr x8
Expand All @@ -717,15 +717,15 @@ block0(v0: i128, v1: i64):
; mov x29, sp
; sub sp, sp, #0x10
; block1: ; offset 0xc
; mov x6, x2
; stur x0, [sp]
; mov x4, x0
; stur x1, [sp, #8]
; mov x5, x1
; ldr x8, #0x28
; b #0x30
; ldr x8, #0x1c
; b #0x24
; .byte 0x00, 0x00, 0x00, 0x00 ; reloc_external Abs8 %f14 0
; .byte 0x00, 0x00, 0x00, 0x00
; mov x4, x0
; mov x5, x1
; mov x6, x2
; mov x2, x4
; mov x3, x5
; blr x8
Expand Down Expand Up @@ -770,12 +770,12 @@ block0(v0: i128, v1: i64):
; mov fp, sp
; sub sp, sp, #16
; block0:
; mov x6, x2
; str x0, [sp]
; mov x4, x0
; str x1, [sp, #8]
; mov x5, x1
; load_ext_name x8, TestCase(%f15)+0
; mov x4, x0
; mov x5, x1
; mov x6, x2
; mov x2, x4
; mov x3, x5
; blr x8
Expand All @@ -789,15 +789,15 @@ block0(v0: i128, v1: i64):
; mov x29, sp
; sub sp, sp, #0x10
; block1: ; offset 0xc
; mov x6, x2
; stur x0, [sp]
; mov x4, x0
; stur x1, [sp, #8]
; mov x5, x1
; ldr x8, #0x28
; b #0x30
; ldr x8, #0x1c
; b #0x24
; .byte 0x00, 0x00, 0x00, 0x00 ; reloc_external Abs8 %f15 0
; .byte 0x00, 0x00, 0x00, 0x00
; mov x4, x0
; mov x5, x1
; mov x6, x2
; mov x2, x4
; mov x3, x5
; blr x8
Expand Down Expand Up @@ -836,8 +836,8 @@ block0(v0: i64):
; stp fp, lr, [sp, #-16]!
; mov fp, sp
; block0:
; mov x8, x0
; load_ext_name x3, TestCase(%g)+0
; mov x8, x0
; blr x3
; ldp fp, lr, [sp], #16
; ret
Expand All @@ -847,11 +847,11 @@ block0(v0: i64):
; stp x29, x30, [sp, #-0x10]!
; mov x29, sp
; block1: ; offset 0x8
; mov x8, x0
; ldr x3, #0x14
; b #0x1c
; ldr x3, #0x10
; b #0x18
; .byte 0x00, 0x00, 0x00, 0x00 ; reloc_external Abs8 %g 0
; .byte 0x00, 0x00, 0x00, 0x00
; mov x8, x0
; blr x3
; ldp x29, x30, [sp], #0x10
; ret
Expand All @@ -867,30 +867,30 @@ block0(v0: i64):
; VCode:
; stp fp, lr, [sp, #-16]!
; mov fp, sp
; str x23, [sp, #-16]!
; str x24, [sp, #-16]!
; block0:
; mov x23, x8
; mov x24, x8
; load_ext_name x2, TestCase(%g)+0
; blr x2
; mov x8, x23
; ldr x23, [sp], #16
; mov x8, x24
; ldr x24, [sp], #16
; ldp fp, lr, [sp], #16
; ret
;
; Disassembled:
; block0: ; offset 0x0
; stp x29, x30, [sp, #-0x10]!
; mov x29, sp
; str x23, [sp, #-0x10]!
; str x24, [sp, #-0x10]!
; block1: ; offset 0xc
; mov x23, x8
; mov x24, x8
; ldr x2, #0x18
; b #0x20
; .byte 0x00, 0x00, 0x00, 0x00 ; reloc_external Abs8 %g 0
; .byte 0x00, 0x00, 0x00, 0x00
; blr x2
; mov x8, x23
; ldr x23, [sp], #0x10
; mov x8, x24
; ldr x24, [sp], #0x10
; ldp x29, x30, [sp], #0x10
; ret

Expand Down
12 changes: 6 additions & 6 deletions cranelift/filetests/filetests/isa/aarch64/fma.clif
Original file line number Diff line number Diff line change
Expand Up @@ -358,28 +358,28 @@ block0(v0: f32x4, v1: f32x4, v2: f32x4):

; VCode:
; block0:
; mov v31.16b, v1.16b
; movz w6, #7452
; movk w6, w6, #7966, LSL #16
; dup v17.4s, w6
; mov v31.16b, v1.16b
; mov v30.16b, v31.16b
; tbl v19.16b, { v30.16b, v31.16b }, v17.16b
; mov v23.16b, v0.16b
; mov v22.16b, v0.16b
; mov v0.16b, v2.16b
; fmla v0.4s, v0.4s, v23.4s, v19.4s
; fmla v0.4s, v0.4s, v22.4s, v19.4s
; ret
;
; Disassembled:
; block0: ; offset 0x0
; mov v31.16b, v1.16b
; mov w6, #0x1d1c
; movk w6, #0x1f1e, lsl #16
; dup v17.4s, w6
; mov v31.16b, v1.16b
; mov v30.16b, v31.16b
; tbl v19.16b, {v30.16b, v31.16b}, v17.16b
; mov v23.16b, v0.16b
; mov v22.16b, v0.16b
; mov v0.16b, v2.16b
; fmla v0.4s, v23.4s, v19.4s
; fmla v0.4s, v22.4s, v19.4s
; ret

function %f64x2_splat0(f64x2, f64x2, f64x2) -> f64x2 {
Expand Down
Loading

0 comments on commit 1854929

Please sign in to comment.