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:
@@ -1,8 +1,9 @@
|
||||
//! System V ABI unwind information.
|
||||
|
||||
use crate::binemit::CodeOffset;
|
||||
use crate::isa::unwind::UnwindInst;
|
||||
use crate::result::{CodegenError, CodegenResult};
|
||||
use crate::machinst::Reg;
|
||||
use crate::result::CodegenResult;
|
||||
use crate::{binemit::CodeOffset, CodegenError};
|
||||
use alloc::vec::Vec;
|
||||
use gimli::write::{Address, FrameDescriptionEntry};
|
||||
|
||||
@@ -160,7 +161,7 @@ pub struct UnwindInfo {
|
||||
len: u32,
|
||||
}
|
||||
|
||||
pub(crate) fn create_unwind_info_from_insts<MR: RegisterMapper<regalloc::Reg>>(
|
||||
pub(crate) fn create_unwind_info_from_insts<MR: RegisterMapper<Reg>>(
|
||||
insts: &[(CodeOffset, UnwindInst)],
|
||||
code_len: usize,
|
||||
mr: &MR,
|
||||
@@ -237,7 +238,7 @@ pub(crate) fn create_unwind_info_from_insts<MR: RegisterMapper<regalloc::Reg>>(
|
||||
reg,
|
||||
} => {
|
||||
let reg = mr
|
||||
.map(reg.to_reg())
|
||||
.map(reg.into())
|
||||
.map_err(|e| CodegenError::RegisterMappingError(e))?;
|
||||
let off = (clobber_offset as i32) - (clobber_offset_to_cfa as i32);
|
||||
instructions.push((instruction_offset, CallFrameInstruction::Offset(reg, off)));
|
||||
|
||||
@@ -262,7 +262,7 @@ impl UnwindInfo {
|
||||
|
||||
const UNWIND_RBP_REG: u8 = 5;
|
||||
|
||||
pub(crate) fn create_unwind_info_from_insts<MR: RegisterMapper<regalloc::Reg>>(
|
||||
pub(crate) fn create_unwind_info_from_insts<MR: RegisterMapper<crate::machinst::Reg>>(
|
||||
insts: &[(CodeOffset, UnwindInst)],
|
||||
) -> CodegenResult<UnwindInfo> {
|
||||
let mut unwind_codes = vec![];
|
||||
@@ -293,7 +293,7 @@ pub(crate) fn create_unwind_info_from_insts<MR: RegisterMapper<regalloc::Reg>>(
|
||||
&UnwindInst::SaveReg {
|
||||
clobber_offset,
|
||||
reg,
|
||||
} => match MR::map(reg.to_reg()) {
|
||||
} => match MR::map(reg.into()) {
|
||||
MappedRegister::Int(reg) => {
|
||||
unwind_codes.push(UnwindCode::SaveReg {
|
||||
instruction_offset,
|
||||
|
||||
Reference in New Issue
Block a user