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:
@@ -369,8 +369,8 @@ mod tests {
|
||||
.map(OpcodeMap::_0F38)
|
||||
.w(true)
|
||||
.opcode(0x1F)
|
||||
.reg(dst.get_hw_encoding())
|
||||
.rm(src.get_hw_encoding())
|
||||
.reg(dst.to_real_reg().unwrap().hw_enc())
|
||||
.rm(src.to_real_reg().unwrap().hw_enc())
|
||||
.length(EvexVectorLength::V128)
|
||||
.encode(&mut sink0);
|
||||
|
||||
@@ -393,8 +393,8 @@ mod tests {
|
||||
.map(OpcodeMap::None)
|
||||
.w(false)
|
||||
.opcode(0x00)
|
||||
.reg(regs::rax().get_hw_encoding())
|
||||
.rm(regs::rax().get_hw_encoding())
|
||||
.reg(regs::rax().to_real_reg().unwrap().hw_enc())
|
||||
.rm(regs::rax().to_real_reg().unwrap().hw_enc())
|
||||
.mask(EvexMasking::None)
|
||||
.encode(&mut sink1);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
//! operand ("G" in Intelese), the order is always G first, then E. The term "enc" in the following
|
||||
//! means "hardware register encoding number".
|
||||
|
||||
use crate::machinst::{Reg, RegClass};
|
||||
use crate::{
|
||||
ir::TrapCode,
|
||||
isa::x64::inst::{
|
||||
@@ -16,7 +17,6 @@ use crate::{
|
||||
},
|
||||
machinst::MachBuffer,
|
||||
};
|
||||
use regalloc::{Reg, RegClass};
|
||||
|
||||
pub(crate) fn low8_will_sign_extend_to_64(x: u32) -> bool {
|
||||
let xs = (x as i32) as i64;
|
||||
@@ -50,8 +50,8 @@ pub(crate) fn encode_sib(shift: u8, enc_index: u8, enc_base: u8) -> u8 {
|
||||
pub(crate) fn int_reg_enc(reg: impl Into<Reg>) -> u8 {
|
||||
let reg = reg.into();
|
||||
debug_assert!(reg.is_real());
|
||||
debug_assert_eq!(reg.get_class(), RegClass::I64);
|
||||
reg.get_hw_encoding()
|
||||
debug_assert_eq!(reg.class(), RegClass::Int);
|
||||
reg.to_real_reg().unwrap().hw_enc()
|
||||
}
|
||||
|
||||
/// Get the encoding number of any register.
|
||||
@@ -59,7 +59,7 @@ pub(crate) fn int_reg_enc(reg: impl Into<Reg>) -> u8 {
|
||||
pub(crate) fn reg_enc(reg: impl Into<Reg>) -> u8 {
|
||||
let reg = reg.into();
|
||||
debug_assert!(reg.is_real());
|
||||
reg.get_hw_encoding()
|
||||
reg.to_real_reg().unwrap().hw_enc()
|
||||
}
|
||||
|
||||
/// A small bit field to record a REX prefix specification:
|
||||
|
||||
Reference in New Issue
Block a user