Implement SystemV struct argument passing

This commit is contained in:
bjorn3
2020-04-20 12:01:53 +02:00
committed by Benjamin Bouvier
parent 2f368ed5d6
commit 4431ac1108
15 changed files with 298 additions and 50 deletions

View File

@@ -2152,6 +2152,8 @@ pub(crate) fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
panic!("x86-specific opcode in supposedly arch-neutral IR!");
}
Opcode::DummySarg => unreachable!(),
Opcode::AvgRound => unimplemented!(),
Opcode::Iabs => unimplemented!(),
Opcode::Snarrow

View File

@@ -108,6 +108,19 @@ impl Args {
impl ArgAssigner for Args {
fn assign(&mut self, arg: &AbiParam) -> ArgAction {
if let ArgumentPurpose::StructArgument(size) = arg.purpose {
if self.call_conv != CallConv::SystemV {
panic!(
"The sarg argument purpose is not yet implemented for non-systemv call conv {:?}",
self.call_conv,
);
}
let loc = ArgumentLoc::Stack(self.offset as i32);
self.offset += size;
debug_assert!(self.offset <= i32::MAX as u32);
return ArgAction::AssignAndChangeType(loc, types::SARG__);
}
let ty = arg.value_type;
if ty.bits() > u16::from(self.pointer_bits) {