ISLE: Migrate call and return instructions (#3785)
This adds infrastructure to allow implementing call and return instructions in ISLE, and migrates the s390x back-end. To implement ABI details, this patch creates public accessors for `ABISig` and makes them accessible in ISLE. All actual code generation is then done in ISLE rules, following the information provided by that signature. [ Note that the s390x back end never requires multiple slots for a single argument - the infrastructure to handle this should already be present, however. ] To implement loops in ISLE rules, this patch uses regular tail recursion, employing a `Range` data structure holding a range of integers to be looped over.
This commit is contained in:
@@ -6,7 +6,7 @@ pub mod generated_code;
|
||||
// Types that the generated ISLE code uses via `use super::*`.
|
||||
use super::{
|
||||
CallIndInfo, CallInfo, Cond, Inst as MInst, MachLabel, MemArg, MemFlags, Opcode, Reg,
|
||||
UImm16Shifted, UImm32Shifted,
|
||||
S390xMachineDeps, UImm16Shifted, UImm32Shifted,
|
||||
};
|
||||
use crate::isa::s390x::settings::Flags as IsaFlags;
|
||||
use crate::machinst::isle::*;
|
||||
@@ -69,6 +69,40 @@ where
|
||||
{
|
||||
isle_prelude_methods!();
|
||||
|
||||
fn abi_sig(&mut self, sig_ref: SigRef) -> ABISig {
|
||||
let sig = &self.lower_ctx.dfg().signatures[sig_ref];
|
||||
ABISig::from_func_sig::<S390xMachineDeps>(sig, self.flags).unwrap()
|
||||
}
|
||||
|
||||
fn abi_accumulate_outgoing_args_size(&mut self, abi: &ABISig) -> Unit {
|
||||
let off = abi.stack_arg_space() + abi.stack_ret_space();
|
||||
self.lower_ctx
|
||||
.abi()
|
||||
.accumulate_outgoing_args_size(off as u32);
|
||||
}
|
||||
|
||||
fn abi_call_info(&mut self, abi: &ABISig, name: ExternalName, opcode: &Opcode) -> BoxCallInfo {
|
||||
let (uses, defs, clobbers) = abi.call_uses_defs_clobbers::<S390xMachineDeps>();
|
||||
Box::new(CallInfo {
|
||||
dest: name.clone(),
|
||||
uses,
|
||||
defs,
|
||||
clobbers,
|
||||
opcode: *opcode,
|
||||
})
|
||||
}
|
||||
|
||||
fn abi_call_ind_info(&mut self, abi: &ABISig, target: Reg, opcode: &Opcode) -> BoxCallIndInfo {
|
||||
let (uses, defs, clobbers) = abi.call_uses_defs_clobbers::<S390xMachineDeps>();
|
||||
Box::new(CallIndInfo {
|
||||
rn: target,
|
||||
uses,
|
||||
defs,
|
||||
clobbers,
|
||||
opcode: *opcode,
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn allow_div_traps(&mut self, _: Type) -> Option<()> {
|
||||
if !self.flags.avoid_div_traps() {
|
||||
@@ -432,6 +466,11 @@ where
|
||||
MemArg::reg_plus_off(reg, off, flags)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn memarg_stack_off(&mut self, base: i64, off: i64) -> MemArg {
|
||||
MemArg::reg_plus_off(super::stack_reg(), base + off, MemFlags::trusted())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn memarg_symbol(&mut self, name: ExternalName, offset: i32, flags: MemFlags) -> MemArg {
|
||||
MemArg::Symbol {
|
||||
|
||||
Reference in New Issue
Block a user