s390x: use constraints for call arguments and return values (#5092)

Use the regalloc constraint-based CallArgList / CallRetList
mechanism instead of directly using physregs in instructions.
This commit is contained in:
Ulrich Weigand
2022-10-21 20:01:22 +02:00
committed by GitHub
parent 86e77953f8
commit 9dadba60a0
10 changed files with 317 additions and 240 deletions

View File

@@ -39,8 +39,8 @@ pub use crate::isa::s390x::lower::isle::generated_code::{
#[derive(Clone, Debug)]
pub struct CallInfo {
pub dest: ExternalName,
pub uses: SmallVec<[Reg; 8]>,
pub defs: SmallVec<[Writable<Reg>; 8]>,
pub uses: CallArgList,
pub defs: CallRetList,
pub clobbers: PRegSet,
pub opcode: Opcode,
pub caller_callconv: CallConv,
@@ -53,8 +53,8 @@ pub struct CallInfo {
#[derive(Clone, Debug)]
pub struct CallIndInfo {
pub rn: Reg,
pub uses: SmallVec<[Reg; 8]>,
pub defs: SmallVec<[Writable<Reg>; 8]>,
pub uses: CallArgList,
pub defs: CallRetList,
pub clobbers: PRegSet,
pub opcode: Opcode,
pub caller_callconv: CallConv,
@@ -1004,15 +1004,23 @@ fn s390x_get_operands<F: Fn(VReg) -> VReg>(inst: &Inst, collector: &mut OperandC
}
&Inst::Call { link, ref info } => {
collector.reg_def(link);
collector.reg_uses(&*info.uses);
collector.reg_defs(&*info.defs);
for u in &info.uses {
collector.reg_fixed_use(u.vreg, u.preg);
}
for d in &info.defs {
collector.reg_fixed_def(d.vreg, d.preg);
}
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);
for u in &info.uses {
collector.reg_fixed_use(u.vreg, u.preg);
}
for d in &info.defs {
collector.reg_fixed_def(d.vreg, d.preg);
}
collector.reg_clobbers(info.clobbers);
}
&Inst::Args { ref args } => {