Cranelift: update to latest regalloc2: (#4324)
- Handle call instructions' clobbers with the clobbers API, using RA2's clobbers bitmask (bytecodealliance/regalloc2#58) rather than clobbers list; - Pull in changes from bytecodealliance/regalloc2#59 for much more sane edge-case behavior w.r.t. liverange splitting.
This commit is contained in:
@@ -6804,8 +6804,9 @@ fn test_s390x_binemit() {
|
||||
link: writable_gpr(14),
|
||||
info: Box::new(CallInfo {
|
||||
dest: ExternalName::testcase("test0"),
|
||||
uses: Vec::new(),
|
||||
defs: Vec::new(),
|
||||
uses: smallvec![],
|
||||
defs: smallvec![],
|
||||
clobbers: PRegSet::empty(),
|
||||
opcode: Opcode::Call,
|
||||
}),
|
||||
},
|
||||
@@ -6818,8 +6819,9 @@ fn test_s390x_binemit() {
|
||||
link: writable_gpr(14),
|
||||
info: Box::new(CallIndInfo {
|
||||
rn: gpr(1),
|
||||
uses: Vec::new(),
|
||||
defs: Vec::new(),
|
||||
uses: smallvec![],
|
||||
defs: smallvec![],
|
||||
clobbers: PRegSet::empty(),
|
||||
opcode: Opcode::CallIndirect,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::{settings, CodegenError, CodegenResult};
|
||||
use alloc::boxed::Box;
|
||||
use alloc::vec::Vec;
|
||||
use core::convert::TryFrom;
|
||||
use regalloc2::VReg;
|
||||
use regalloc2::{PRegSet, VReg};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use std::string::{String, ToString};
|
||||
pub mod regs;
|
||||
@@ -36,8 +36,9 @@ pub use crate::isa::s390x::lower::isle::generated_code::{
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CallInfo {
|
||||
pub dest: ExternalName,
|
||||
pub uses: Vec<Reg>,
|
||||
pub defs: Vec<Writable<Reg>>,
|
||||
pub uses: SmallVec<[Reg; 8]>,
|
||||
pub defs: SmallVec<[Writable<Reg>; 8]>,
|
||||
pub clobbers: PRegSet,
|
||||
pub opcode: Opcode,
|
||||
}
|
||||
|
||||
@@ -46,8 +47,9 @@ pub struct CallInfo {
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CallIndInfo {
|
||||
pub rn: Reg,
|
||||
pub uses: Vec<Reg>,
|
||||
pub defs: Vec<Writable<Reg>>,
|
||||
pub uses: SmallVec<[Reg; 8]>,
|
||||
pub defs: SmallVec<[Writable<Reg>; 8]>,
|
||||
pub clobbers: PRegSet,
|
||||
pub opcode: Opcode,
|
||||
}
|
||||
|
||||
@@ -660,12 +662,14 @@ fn s390x_get_operands<F: Fn(VReg) -> VReg>(inst: &Inst, collector: &mut OperandC
|
||||
collector.reg_def(link);
|
||||
collector.reg_uses(&*info.uses);
|
||||
collector.reg_defs(&*info.defs);
|
||||
collector.reg_clobbers(info.clobbers);
|
||||
}
|
||||
&Inst::CallInd { link, ref info } => {
|
||||
collector.reg_def(link);
|
||||
collector.reg_use(info.rn);
|
||||
collector.reg_uses(&*info.uses);
|
||||
collector.reg_defs(&*info.defs);
|
||||
collector.reg_clobbers(info.clobbers);
|
||||
}
|
||||
&Inst::Ret { link, ref rets } => {
|
||||
collector.reg_use(link);
|
||||
|
||||
@@ -13,11 +13,15 @@ use crate::settings;
|
||||
|
||||
/// Get a reference to a GPR (integer register).
|
||||
pub fn gpr(num: u8) -> Reg {
|
||||
assert!(num < 16);
|
||||
let preg = PReg::new(num as usize, RegClass::Int);
|
||||
let preg = gpr_preg(num);
|
||||
Reg::from(VReg::new(preg.index(), RegClass::Int))
|
||||
}
|
||||
|
||||
pub(crate) const fn gpr_preg(num: u8) -> PReg {
|
||||
assert!(num < 16);
|
||||
PReg::new(num as usize, RegClass::Int)
|
||||
}
|
||||
|
||||
/// Get a writable reference to a GPR.
|
||||
pub fn writable_gpr(num: u8) -> Writable<Reg> {
|
||||
Writable::from_reg(gpr(num))
|
||||
@@ -25,12 +29,17 @@ pub fn writable_gpr(num: u8) -> Writable<Reg> {
|
||||
|
||||
/// Get a reference to a FPR (floating-point register).
|
||||
pub fn fpr(num: u8) -> Reg {
|
||||
assert!(num < 16);
|
||||
let preg = PReg::new(num as usize, RegClass::Float);
|
||||
let preg = fpr_preg(num);
|
||||
Reg::from(VReg::new(preg.index(), RegClass::Float))
|
||||
}
|
||||
|
||||
/// Get a writable reference to a V-register.
|
||||
pub(crate) const fn fpr_preg(num: u8) -> PReg {
|
||||
assert!(num < 16);
|
||||
PReg::new(num as usize, RegClass::Float)
|
||||
}
|
||||
|
||||
/// Get a writable reference to a FPR.
|
||||
#[allow(dead_code)] // used by tests.
|
||||
pub fn writable_fpr(num: u8) -> Writable<Reg> {
|
||||
Writable::from_reg(fpr(num))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user