diff options
| author | Nikita Popov <npopov@redhat.com> | 2024-03-21 16:10:23 +0100 |
|---|---|---|
| committer | Nikita Popov <npopov@redhat.com> | 2024-04-08 11:31:43 +0900 |
| commit | 1b7342b4117e321012cbe49df5ae859d52031f2b (patch) | |
| tree | 8d0b021578c5f5566e15c92cf6dad191a2c56172 /compiler/rustc_codegen_llvm/src | |
| parent | 009280c5e312bdf11cd0e0e1b336bf374eed7b00 (diff) | |
| download | rust-1b7342b4117e321012cbe49df5ae859d52031f2b.tar.gz rust-1b7342b4117e321012cbe49df5ae859d52031f2b.zip | |
force_array -> is_consecutive
The actual ABI implication here is that in some cases the values are required to be "consecutive", i.e. must either all be passed in registers or all on stack (without padding). Adjust the code to either use Uniform::new() or Uniform::consecutive() depending on which behavior is needed. Then, when lowering this in LLVM, skip the [1 x i128] to i128 simplification if is_consecutive is set. i128 is the only case I'm aware of where this is problematic right now. If we find other cases, we can extend this (either based on target information or possibly just by not simplifying for is_consecutive entirely).
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/abi.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 8b2330471f7..f918facc86d 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -150,7 +150,10 @@ impl LlvmType for CastTarget { // Simplify to a single unit or an array if there's no prefix. // This produces the same layout, but using a simpler type. if self.prefix.iter().all(|x| x.is_none()) { - if rest_count == 1 && !self.rest.force_array { + // We can't do this if is_consecutive is set and the unit would get + // split on the target. Currently, this is only relevant for i128 + // registers. + if rest_count == 1 && (!self.rest.is_consecutive || self.rest.unit != Reg::i128()) { return rest_ll_unit; } |
