Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa6f9bc

Browse files
committed
ZJIT: Register spill for Opnd::VReg (WIP)
1 parent 599f58f commit fa6f9bc

File tree

5 files changed

+186
-76
lines changed

5 files changed

+186
-76
lines changed

zjit/src/asm/x86_64/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ pub fn lea(cb: &mut CodeBlock, dst: X86Opnd, src: X86Opnd) {
921921
assert!(matches!(src, X86Opnd::Mem(_) | X86Opnd::IPRel(_)));
922922
write_rm(cb, false, true, dst, src, None, &[0x8d]);
923923
} else {
924-
unreachable!();
924+
unreachable!("expected dst to be Reg, but got: {dst:?}");
925925
}
926926
}
927927

@@ -1334,7 +1334,7 @@ pub fn test(cb: &mut CodeBlock, rm_opnd: X86Opnd, test_opnd: X86Opnd) {
13341334
write_rm(cb, rm_num_bits == 16, rm_num_bits == 64, test_opnd, rm_opnd, None, &[0x85]);
13351335
}
13361336
},
1337-
_ => unreachable!()
1337+
_ => unreachable!("expected test_opnd to be Reg, UImm, or Imm, but got: {rm_opnd:?}, {test_opnd:?}")
13381338
};
13391339
}
13401340

zjit/src/backend/arm64/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,13 @@ fn emit_load_value(cb: &mut CodeBlock, rd: A64Opnd, value: u64) -> usize {
184184
/// This has the same number of registers for x86_64 and arm64.
185185
/// SCRATCH0 and SCRATCH1 are excluded.
186186
pub const ALLOC_REGS: &[Reg] = &[
187-
X0_REG,
188187
X1_REG,
189188
X2_REG,
190189
X3_REG,
191190
X4_REG,
192191
X5_REG,
193192
X11_REG,
194-
X12_REG,
193+
X0_REG,
195194
];
196195

197196
impl Assembler
@@ -205,6 +204,7 @@ impl Assembler
205204
const SCRATCH1_REG: Reg = X17_REG;
206205
const SCRATCH0: A64Opnd = A64Opnd::Reg(Self::SCRATCH0_REG);
207206
const SCRATCH1: A64Opnd = A64Opnd::Reg(Self::SCRATCH1_REG);
207+
pub const SPILL_BASE_REG: Reg = X12_REG;
208208

209209
/// Get the list of registers from which we will allocate on this platform
210210
pub fn get_alloc_regs() -> Vec<Reg> {

0 commit comments

Comments
 (0)