compiler: s/make_indirect_byval/pass_by_stack_offset/

The previous name is just an LLVMism, which conveys almost nothing about
what is actually meant by the function relative to the ABI.

In doing so, remove an already-addressed FIXME.
This commit is contained in:
Jubilee Young 2024-09-16 13:04:24 -07:00
parent 0cf89b5336
commit a800d1cf37
5 changed files with 7 additions and 8 deletions

View File

@ -14,7 +14,7 @@ fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
return; return;
} }
if arg.layout.is_aggregate() { if arg.layout.is_aggregate() {
arg.make_indirect_byval(None); arg.pass_by_stack_offset(None);
} else { } else {
arg.extend_integer_width_to(32); arg.extend_integer_width_to(32);
} }

View File

@ -64,7 +64,7 @@ pub enum PassMode {
/// (which ensures that padding is preserved and that we do not rely on LLVM's struct layout), /// (which ensures that padding is preserved and that we do not rely on LLVM's struct layout),
/// and will use the alignment specified in `attrs.pointee_align` (if `Some`) or the type's /// and will use the alignment specified in `attrs.pointee_align` (if `Some`) or the type's
/// alignment (if `None`). This means that the alignment will not always /// alignment (if `None`). This means that the alignment will not always
/// match the Rust type's alignment; see documentation of `make_indirect_byval` for more info. /// match the Rust type's alignment; see documentation of `pass_by_stack_offset` for more info.
/// ///
/// `on_stack` cannot be true for unsized arguments, i.e., when `meta_attrs` is `Some`. /// `on_stack` cannot be true for unsized arguments, i.e., when `meta_attrs` is `Some`.
Indirect { attrs: ArgAttributes, meta_attrs: Option<ArgAttributes>, on_stack: bool }, Indirect { attrs: ArgAttributes, meta_attrs: Option<ArgAttributes>, on_stack: bool },
@ -681,7 +681,7 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
/// either in the caller (if the type's alignment is lower than the byval alignment) /// either in the caller (if the type's alignment is lower than the byval alignment)
/// or in the callee (if the type's alignment is higher than the byval alignment), /// or in the callee (if the type's alignment is higher than the byval alignment),
/// to ensure that Rust code never sees an underaligned pointer. /// to ensure that Rust code never sees an underaligned pointer.
pub fn make_indirect_byval(&mut self, byval_align: Option<Align>) { pub fn pass_by_stack_offset(&mut self, byval_align: Option<Align>) {
assert!(!self.layout.is_unsized(), "used byval ABI for unsized layout"); assert!(!self.layout.is_unsized(), "used byval ABI for unsized layout");
self.make_indirect(); self.make_indirect();
match self.mode { match self.mode {
@ -879,8 +879,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
{ {
if abi == spec::abi::Abi::X86Interrupt { if abi == spec::abi::Abi::X86Interrupt {
if let Some(arg) = self.args.first_mut() { if let Some(arg) = self.args.first_mut() {
// FIXME(pcwalton): This probably should use the x86 `byval` ABI... arg.pass_by_stack_offset(None);
arg.make_indirect_byval(None);
} }
return Ok(()); return Ok(());
} }

View File

@ -122,7 +122,7 @@ where
align_4 align_4
}; };
arg.make_indirect_byval(Some(byval_align)); arg.pass_by_stack_offset(Some(byval_align));
} else { } else {
arg.extend_integer_width_to(32); arg.extend_integer_width_to(32);
} }

View File

@ -219,7 +219,7 @@ where
if is_arg { if is_arg {
// The x86_64 ABI doesn't have any special requirements for `byval` alignment, // The x86_64 ABI doesn't have any special requirements for `byval` alignment,
// the type's alignment is always used. // the type's alignment is always used.
arg.make_indirect_byval(None); arg.pass_by_stack_offset(None);
} else { } else {
// `sret` parameter thus one less integer register available // `sret` parameter thus one less integer register available
arg.make_indirect(); arg.make_indirect();

View File

@ -68,7 +68,7 @@ where
*arg_gprs_left -= needed_arg_gprs; *arg_gprs_left -= needed_arg_gprs;
if must_use_stack { if must_use_stack {
arg.make_indirect_byval(None); arg.pass_by_stack_offset(None);
} else if is_xtensa_aggregate(arg) { } else if is_xtensa_aggregate(arg) {
// Aggregates which are <= max_size will be passed in // Aggregates which are <= max_size will be passed in
// registers if possible, so coerce to integers. // registers if possible, so coerce to integers.