1
Fork 0

Fix c_variadic flag and add opaque info to PassMode

We should expand the information in PassMode later.
This commit is contained in:
Celina G. Val 2023-12-19 11:04:34 -08:00
parent 1a83c5b55b
commit 76b3e6de55
3 changed files with 53 additions and 17 deletions

View file

@ -21,12 +21,9 @@ pub struct FnAbi {
/// The ABI convention.
pub conv: CallConvention,
}
impl FnAbi {
pub fn is_c_variadic(&self) -> bool {
self.args.len() > self.fixed_count as usize
}
/// Whether this is a variadic C function,
pub c_variadic: bool,
}
/// Information about the ABI of a function's argument, or return value.
@ -47,15 +44,15 @@ pub enum PassMode {
/// Pass the argument directly.
///
/// The argument has a layout abi of `Scalar` or `Vector`.
Direct,
Direct(Opaque),
/// Pass a pair's elements directly in two arguments.
///
/// The argument has a layout abi of `ScalarPair`.
Pair,
Pair(Opaque, Opaque),
/// Pass the argument after casting it.
Cast,
Cast { pad_i32: bool, cast: Opaque },
/// Pass the argument indirectly via a hidden pointer.
Indirect,
Indirect { attrs: Opaque, meta_attrs: Opaque, on_stack: bool },
}
/// The layout of a type, alongside the type itself.