1
Fork 0

Change FnAbi::fixed_count to a u32.

This commit is contained in:
Nicholas Nethercote 2022-08-25 19:02:22 +10:00
parent e4bf113027
commit 4df7bffa95
5 changed files with 7 additions and 6 deletions

View file

@ -325,7 +325,8 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
fn llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type {
// Ignore "extra" args from the call site for C variadic functions.
// Only the "fixed" args are part of the LLVM function signature.
let args = if self.c_variadic { &self.args[..self.fixed_count] } else { &self.args };
let args =
if self.c_variadic { &self.args[..self.fixed_count as usize] } else { &self.args };
let args_capacity: usize = args.iter().map(|arg|
if arg.pad.is_some() { 1 } else { 0 } +

View file

@ -3262,7 +3262,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
.map(|(i, ty)| arg_of(ty, Some(i)))
.collect::<Result<_, _>>()?,
c_variadic: sig.c_variadic,
fixed_count: inputs.len(),
fixed_count: inputs.len() as u32,
conv,
can_unwind: fn_can_unwind(self.tcx(), fn_def_id, sig.abi),
};

View file

@ -888,7 +888,7 @@ pub fn typeid_for_fnabi<'tcx>(
typeid.push('v');
}
} else {
for n in 0..fn_abi.fixed_count {
for n in 0..fn_abi.fixed_count as usize {
let ty = transform_ty(tcx, fn_abi.args[n].layout.ty, transform_ty_options);
typeid.push_str(&encode_ty(tcx, ty, &mut dict, encode_ty_options));
}

View file

@ -625,7 +625,7 @@ pub struct FnAbi<'a, Ty> {
///
/// Should only be different from args.len() when c_variadic is true.
/// This can be used to know whether an argument is variadic or not.
pub fixed_count: usize,
pub fixed_count: u32,
pub conv: Conv,
@ -738,5 +738,5 @@ mod size_asserts {
use rustc_data_structures::static_assert_size;
// These are in alphabetical order, which is easy to maintain.
static_assert_size!(ArgAbi<'_, usize>, 72);
static_assert_size!(FnAbi<'_, usize>, 112);
static_assert_size!(FnAbi<'_, usize>, 104);
}

View file

@ -340,7 +340,7 @@ where
arg,
xlen,
flen,
i >= fn_abi.fixed_count,
i >= fn_abi.fixed_count as usize,
&mut avail_gprs,
&mut avail_fprs,
);