From a800d1cf3782aef779ed1a87add9da8b9b6f2b86 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Mon, 16 Sep 2024 13:04:24 -0700 Subject: [PATCH] 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. --- compiler/rustc_target/src/abi/call/m68k.rs | 2 +- compiler/rustc_target/src/abi/call/mod.rs | 7 +++---- compiler/rustc_target/src/abi/call/x86.rs | 2 +- compiler/rustc_target/src/abi/call/x86_64.rs | 2 +- compiler/rustc_target/src/abi/call/xtensa.rs | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_target/src/abi/call/m68k.rs b/compiler/rustc_target/src/abi/call/m68k.rs index b6bd68b66fc..82fe81f8c52 100644 --- a/compiler/rustc_target/src/abi/call/m68k.rs +++ b/compiler/rustc_target/src/abi/call/m68k.rs @@ -14,7 +14,7 @@ fn classify_arg(arg: &mut ArgAbi<'_, Ty>) { return; } if arg.layout.is_aggregate() { - arg.make_indirect_byval(None); + arg.pass_by_stack_offset(None); } else { arg.extend_integer_width_to(32); } diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs index c2826b55dc5..060ee4a1bc2 100644 --- a/compiler/rustc_target/src/abi/call/mod.rs +++ b/compiler/rustc_target/src/abi/call/mod.rs @@ -64,7 +64,7 @@ pub enum PassMode { /// (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 /// 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`. Indirect { attrs: ArgAttributes, meta_attrs: Option, 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) /// 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. - pub fn make_indirect_byval(&mut self, byval_align: Option) { + pub fn pass_by_stack_offset(&mut self, byval_align: Option) { assert!(!self.layout.is_unsized(), "used byval ABI for unsized layout"); self.make_indirect(); match self.mode { @@ -879,8 +879,7 @@ impl<'a, Ty> FnAbi<'a, Ty> { { if abi == spec::abi::Abi::X86Interrupt { if let Some(arg) = self.args.first_mut() { - // FIXME(pcwalton): This probably should use the x86 `byval` ABI... - arg.make_indirect_byval(None); + arg.pass_by_stack_offset(None); } return Ok(()); } diff --git a/compiler/rustc_target/src/abi/call/x86.rs b/compiler/rustc_target/src/abi/call/x86.rs index bdb14350ded..d9af83d3205 100644 --- a/compiler/rustc_target/src/abi/call/x86.rs +++ b/compiler/rustc_target/src/abi/call/x86.rs @@ -122,7 +122,7 @@ where align_4 }; - arg.make_indirect_byval(Some(byval_align)); + arg.pass_by_stack_offset(Some(byval_align)); } else { arg.extend_integer_width_to(32); } diff --git a/compiler/rustc_target/src/abi/call/x86_64.rs b/compiler/rustc_target/src/abi/call/x86_64.rs index 1209204debf..9910e623ac9 100644 --- a/compiler/rustc_target/src/abi/call/x86_64.rs +++ b/compiler/rustc_target/src/abi/call/x86_64.rs @@ -219,7 +219,7 @@ where if is_arg { // The x86_64 ABI doesn't have any special requirements for `byval` alignment, // the type's alignment is always used. - arg.make_indirect_byval(None); + arg.pass_by_stack_offset(None); } else { // `sret` parameter thus one less integer register available arg.make_indirect(); diff --git a/compiler/rustc_target/src/abi/call/xtensa.rs b/compiler/rustc_target/src/abi/call/xtensa.rs index d7b5fe9d4cc..e1728b08a39 100644 --- a/compiler/rustc_target/src/abi/call/xtensa.rs +++ b/compiler/rustc_target/src/abi/call/xtensa.rs @@ -68,7 +68,7 @@ where *arg_gprs_left -= needed_arg_gprs; if must_use_stack { - arg.make_indirect_byval(None); + arg.pass_by_stack_offset(None); } else if is_xtensa_aggregate(arg) { // Aggregates which are <= max_size will be passed in // registers if possible, so coerce to integers.