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:
Trevor Elliott
2022-10-21 09:22:16 -07:00
committed by GitHub
parent 204d4c332c
commit d9753fac2b
19 changed files with 1215 additions and 758 deletions

View File

@@ -8,7 +8,8 @@ use crate::ir::ExternalName;
use crate::isa::s390x::abi::{S390xMachineDeps, REG_SAVE_AREA_SIZE};
use crate::isa::s390x::inst::{
gpr, stack_reg, writable_gpr, zero_reg, CallIndInfo, CallInfo, Cond, Inst as MInst, LaneOrder,
MemArg, MemArgPair, SymbolReloc, UImm12, UImm16Shifted, UImm32Shifted,
MemArg, MemArgPair, RegPair, SymbolReloc, UImm12, UImm16Shifted, UImm32Shifted,
WritableRegPair,
};
use crate::isa::s390x::settings::Flags as IsaFlags;
use crate::machinst::isle::*;
@@ -842,6 +843,36 @@ impl generated_code::Context for IsleContext<'_, '_, MInst, Flags, IsaFlags, 6>
fn preg_stack(&mut self) -> PReg {
stack_reg().to_real_reg().unwrap().into()
}
#[inline]
fn writable_regpair(&mut self, hi: WritableReg, lo: WritableReg) -> WritableRegPair {
WritableRegPair { hi, lo }
}
#[inline]
fn writable_regpair_hi(&mut self, w: WritableRegPair) -> WritableReg {
w.hi
}
#[inline]
fn writable_regpair_lo(&mut self, w: WritableRegPair) -> WritableReg {
w.lo
}
#[inline]
fn regpair(&mut self, hi: Reg, lo: Reg) -> RegPair {
RegPair { hi, lo }
}
#[inline]
fn regpair_hi(&mut self, w: RegPair) -> Reg {
w.hi
}
#[inline]
fn regpair_lo(&mut self, w: RegPair) -> Reg {
w.lo
}
}
/// Lane order to be used for a given calling convention.