Remove uses of reg_mod from s390x (#5073)
Remove uses of reg_mod from the s390x backend. This required moving away from using r0/r1 as the result registers from a few different pseudo instructions, standardizing instead on r2/r3. That change was necessary as regalloc2 will not correctly allocate registers that aren't listed in the allocatable set, which r0/r1 are not. Co-authored-by: Ulrich Weigand <ulrich.weigand@de.ibm.com> Co-authored-by: Chris Fallin <chris@cfallin.org>
This commit is contained in:
@@ -5,6 +5,7 @@ use regalloc2::MachineEnv;
|
||||
use regalloc2::PReg;
|
||||
use regalloc2::VReg;
|
||||
|
||||
use crate::isa::s390x::inst::{RegPair, WritableRegPair};
|
||||
use crate::machinst::*;
|
||||
use crate::settings;
|
||||
|
||||
@@ -178,6 +179,24 @@ pub fn pretty_print_reg(reg: Reg, allocs: &mut AllocationConsumer<'_>) -> String
|
||||
show_reg(reg)
|
||||
}
|
||||
|
||||
pub fn pretty_print_regpair(pair: RegPair, allocs: &mut AllocationConsumer<'_>) -> String {
|
||||
let hi = allocs.next(pair.hi);
|
||||
let lo = allocs.next(pair.lo);
|
||||
if let Some(hi_reg) = hi.to_real_reg() {
|
||||
if let Some(lo_reg) = lo.to_real_reg() {
|
||||
assert!(
|
||||
hi_reg.hw_enc() + 1 == lo_reg.hw_enc(),
|
||||
"Invalid regpair: {} {}",
|
||||
show_reg(hi),
|
||||
show_reg(lo)
|
||||
);
|
||||
return show_reg(hi);
|
||||
}
|
||||
}
|
||||
|
||||
format!("{}/{}", show_reg(hi), show_reg(lo))
|
||||
}
|
||||
|
||||
pub fn pretty_print_reg_mod(
|
||||
rd: Writable<Reg>,
|
||||
ri: Reg,
|
||||
@@ -192,6 +211,48 @@ pub fn pretty_print_reg_mod(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pretty_print_regpair_mod(
|
||||
rd: WritableRegPair,
|
||||
ri: RegPair,
|
||||
allocs: &mut AllocationConsumer<'_>,
|
||||
) -> String {
|
||||
let rd_hi = allocs.next(rd.hi.to_reg());
|
||||
let rd_lo = allocs.next(rd.lo.to_reg());
|
||||
let ri_hi = allocs.next(ri.hi);
|
||||
let ri_lo = allocs.next(ri.lo);
|
||||
if rd_hi == ri_hi {
|
||||
show_reg(rd_hi)
|
||||
} else {
|
||||
format!(
|
||||
"{}/{}<-{}/{}",
|
||||
show_reg(rd_hi),
|
||||
show_reg(rd_lo),
|
||||
show_reg(ri_hi),
|
||||
show_reg(ri_lo)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pretty_print_regpair_mod_lo(
|
||||
rd: WritableRegPair,
|
||||
ri: Reg,
|
||||
allocs: &mut AllocationConsumer<'_>,
|
||||
) -> String {
|
||||
let rd_hi = allocs.next(rd.hi.to_reg());
|
||||
let rd_lo = allocs.next(rd.lo.to_reg());
|
||||
let ri = allocs.next(ri);
|
||||
if rd_lo == ri {
|
||||
show_reg(rd_hi)
|
||||
} else {
|
||||
format!(
|
||||
"{}/{}<-_/{}",
|
||||
show_reg(rd_hi),
|
||||
show_reg(rd_lo),
|
||||
show_reg(ri),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pretty_print_fpr(reg: Reg, allocs: &mut AllocationConsumer<'_>) -> (String, Option<String>) {
|
||||
let reg = allocs.next(reg);
|
||||
(show_reg(reg), maybe_show_fpr(reg))
|
||||
|
||||
Reference in New Issue
Block a user