about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/abi
AgeCommit message (Collapse)AuthorLines
2025-09-28remove explicit deref of AbiAlign for most methodsJubilee Young-2/+2
Much of the compiler calls functions on Align projected from AbiAlign. AbiAlign impls Deref to its inner Align, so we can simplify these away. Also, it will minimize disruption when AbiAlign is removed. For now, preserve usages that might resolve to PartialOrd or PartialEq, as those have odd inference.
2025-09-17Remove `DynKind`León Orell Valerian Liehr-1/+1
2025-07-07compiler: Parse `p-` specs in datalayout string, allow definition of custom ↵Edoardo Marangoni-2/+2
default data address space
2025-07-01Remove support for dyn*Michael Goulet-45/+0
2025-06-16Fix RISC-V C function ABI when passing/returning structs containing floatsbeetrees-24/+42
2025-06-15Rollup merge of #142389 - beetrees:cranelift-arg-ext, r=bjorn3León Orell Valerian Liehr-22/+37
Apply ABI attributes on return types in `rustc_codegen_cranelift` - The [x86-64 System V ABI standard](https://gitlab.com/x86-psABIs/x86-64-ABI/-/jobs/artifacts/master/raw/x86-64-ABI/abi.pdf?job=build) doesn't sign/zero-extend integer arguments or return types. - But the de-facto standard as implemented by Clang and GCC is to sign/zero-extend arguments to 32 bits (but not return types). - Additionally, Apple targets [sign/zero-extend both arguments and return values to 32 bits](https://developer.apple.com/documentation/xcode/writing-64-bit-intel-code-for-apple-platforms#Pass-arguments-to-functions-correctly). - However, the `rustc_target` ABI adjustment code currently [unconditionally extends both arguments and return values to 32 bits](https://github.com/rust-lang/rust/blame/e703dff8fe220b78195c53478e83fb2f68d8499c/compiler/rustc_target/src/callconv/x86_64.rs#L240) on all targets. - This doesn't cause a miscompilation when compiling with LLVM as LLVM will ignore the `signext`/`zeroext` attribute when applied to return types on non-Apple x86-64 targets. - Cranelift, however, does not have a similar special case, requiring `rustc` to set the argument extension attribute correctly. - However, `rustc_codegen_cranelift` doesn't currently apply ABI attributes to return types at all, meaning `rustc_codegen_cranelift` will currently miscompile `i8`/`u8`/`i16`/`u16` returns on x86-64 Apple targets as those targets require sign/zero-extension of return types. This PR fixes the bug(s) by making the `rustc_target` x86-64 System V ABI only mark return types as sign/zero-extended on Apple platforms, while also making `rustc_codegen_cranelift` apply ABI attributes to return types. The RISC-V and s390x C ABIs also require sign/zero extension of return types, so this will fix those targets when building with `rustc_codegen_cranelift` too. r? `````@bjorn3`````
2025-06-12add `extern "custom"` functionsFolkert de Vries-0/+5
2025-06-12Apply ABI attributes on return types in `rustc_codegen_cranelift`beetrees-22/+37
2025-06-03cg_clif: convert to CanonAbiJubilee Young-27/+22
2025-05-25Merge commit '979dcf8e2f213e4f4b645cb62e7fe9f4f2c0c785' into ↵bjorn3-24/+56
sync_cg_clif-2025-05-25
2025-04-28AsyncDrop implementation using shim codegen of ↵Andrew Zhogin-4/+5
async_drop_in_place::{closure}, scoped async drop added.
2025-03-25Rename `is_like_osx` to `is_like_darwin`Mads Marquart-1/+1
2025-02-28rename BackendRepr::Vector → SimdVectorRalf Jung-2/+2
2025-02-24Add a span to `CompilerBuiltinsCannotCall`Trevor Gross-3/+7
Currently, this error emit a diagnostic with no context like: error: `compiler_builtins` cannot call functions through upstream monomorphizations; encountered invalid call from `<math::libm::support::hex_float::Hexf<i32> as core::fmt::LowerHex>::fmt` to `core::fmt::num::<impl core::fmt::LowerHex for i32>::fmt` With this change, it at least usually points to the problematic function: error: `compiler_builtins` cannot call functions through upstream monomorphizations; encountered invalid call from `<math::libm::support::hex_float::Hexf<i32> as core::fmt::LowerHex>::fmt` to `core::fmt::num::<impl core::fmt::LowerHex for i32>::fmt` --> src/../libm/src/math/support/hex_float.rs:270:5 | 270 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
2025-02-18cg_clif: Tweak formatting of global commentsJubilee-2/+2
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2025-02-17cg_clif: use exclusively ABI alignmentJubilee Young-3/+2
2025-02-15Merge commit '557ed8ebb7e981817d03c87352892c394183dd70' into ↵bjorn3-1/+1
sync_cg_clif-2025-02-15
2025-02-09cg_clif: stop worrying about `Conv::PtxKernel`Jubilee Young-5/+1
2025-01-28Auto merge of #134290 - tgross35:windows-i128-callconv, r=bjorn3,wesleywiserbors-9/+13
Windows x86: Change i128 to return via the vector ABI Clang and GCC both return `i128` in xmm0 on windows-msvc and windows-gnu. Currently, Rust returns the type on the stack. Add a calling convention adjustment so we also return scalar `i128`s using the vector ABI, which makes our `i128` compatible with C. In the future, Clang may change to return `i128` on the stack for its `-msvc` targets (more at [1]). If this happens, the change here will need to be adjusted to only affect MinGW. Link: https://github.com/rust-lang/rust/issues/134288 (does not fix) [1] try-job: x86_64-msvc try-job: x86_64-msvc-ext1 try-job: x86_64-mingw-1 try-job: x86_64-mingw-2
2025-01-27Windows x86: Change `i128` to return via the vector ABITrevor Gross-9/+13
Clang and GCC both return `i128` in xmm0 on windows-msvc and windows-gnu. Currently, Rust returns the type on the stack. Add a calling convention adjustment so we also return scalar `i128`s using the vector ABI, which makes our `i128` compatible with C. In the future, Clang may change to return `i128` on the stack for its `-msvc` targets (more at [1]). If this happens, the change here will need to be adjusted to only affect MinGW. Link: https://github.com/rust-lang/rust/issues/134288
2025-01-16Add gpu-kernel calling conventionFlakebi-1/+5
The amdgpu-kernel calling convention was reverted in commit f6b21e90d1ec01081bc2619efb68af6788a63d65 due to inactivity in the amdgpu target. Introduce a `gpu-kernel` calling convention that translates to `ptx_kernel` or `amdgpu_kernel`, depending on the target that rust compiles for.
2024-12-06Remove polymorphizationBen Kimock-3/+2
2024-12-06Merge commit '57845a397ec15e4e6a561ed2c4bfa3dcf49144fb' into ↵bjorn3-16/+30
sync_cg_clif-2024-12-06
2024-11-23remove remaining references to `Reveal`lcnr-9/+9
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-1/+1
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-09Merge commit '1fa693ca4462fc1f790693464cf765ad693616af' into ↵bjorn3-8/+9
sync_cg_clif-2024-11-09
2024-11-02Merge commit '5b1246bb4bed72fd0bb8fa497d8e5ed2c7f3515c' into ↵bjorn3-2/+7
sync_cg_clif-2024-11-02
2024-10-29cg_clif: `rustc_abi::Abi` => `BackendRepr`Jubilee Young-15/+15
2024-10-27cg_clif: Rename LayoutS to LayoutDataJubilee Young-1/+1
2024-09-23Merge commit '6d35b4c9a04580366fd800692a5b5db79d766530' into ↵bjorn3-1/+4
sync_cg_clif-2024-09-22
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-3/+3
2024-09-21add `C-cmse-nonsecure-entry` ABIFolkert de Vries-0/+3
2024-07-20Rollup merge of #127779 - momvart:should_codegen_hook, r=cjgillotMatthias Krüger-1/+1
Add a hook for `should_codegen_locally` This PR lifts the module-local function `should_codegen_locally` to `TyCtxt` as a hook. In addition to monomorphization, this function is used for checking the dependency of `compiler_builtins` on other libraries. Moving this function to the hooks also makes overriding it possible for the tools that use the rustc interface.
2024-07-19Avoid ref when using format! in compilerYuri Astrakhan-1/+1
Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing). Inlining format args prevents accidental `&` misuse.
2024-07-15Move compiler_builtin check to the use caseMohammad Omidvar-1/+1
2024-07-13Merge commit '659243d85c7489412bd0faa1c068d904a6042941' into ↵bjorn3-1/+0
sync_cg_clif-2024-07-13
2024-07-02Fix spansMichael Goulet-1/+1
2024-07-02Give Instance::expect_resolve a spanMichael Goulet-3/+8
2024-06-30Merge commit '49cd5dd454d0115cfbe9e39102a8b3ba4616aa40' into ↵bjorn3-31/+104
sync_cg_clif-2024-06-30
2024-06-16Rename InstanceDef -> InstanceKindMichael Goulet-7/+7
2024-05-27Omit non-needs_drop drop_in_place in vtablesMark Rousskov-0/+16
This replaces the drop_in_place reference with null in vtables. On librustc_driver.so, this drops about ~17k dynamic relocations from the output, since many vtables can now be placed in read-only memory, rather than having a relocated pointer included. This makes a tradeoff by adding a null check at vtable call sites. That's hard to avoid without changing the vtable format (e.g., to use a pc-relative relocation instead of an absolute address, and avoid the dynamic relocation that way). But it seems likely that the check is cheap at runtime.
2024-05-13Merge commit '3270432f4b0583104c8b9b6f695bf97d6bbf3ac2' into ↵bjorn3-2/+4
sync_cg_clif-2024-05-13
2024-04-23Merge commit 'de5d6523738fd44a0521b6abf3e73ae1df210741' into ↵bjorn3-0/+2
sync_cg_clif-2024-04-23
2024-03-28Merge commit '09fae60a86b848a2fc0ad219ecc4e438dc1eef86' into ↵bjorn3-24/+9
sync_cg_clif-2024-03-28
2024-03-22Auto merge of #122852 - compiler-errors:raw-ptr, r=lcnrbors-5/+1
Remove `TypeAndMut` from `ty::RawPtr` variant, make it take `Ty` and `Mutability` Pretty much mechanically converting `ty::RawPtr(ty::TypeAndMut { ty, mutbl })` to `ty::RawPtr(ty, mutbl)` and its fallout. r? lcnr cc rust-lang/types-team#124
2024-03-22Eagerly convert some ctors to use their specialized ctorsMichael Goulet-5/+1
2024-03-16Handle calls to upstream monomorphizations in compiler_builtinsBen Kimock-0/+14
2024-02-12Teach llvm backend how to fall back to default bodiesOli Scherer-3/+1
2024-02-12Add intrinsic body fallback to cranelift and use itOli Scherer-3/+7
2024-01-30Remove the `abi_amdgpu_kernel` featureclubby789-5/+1