about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
AgeCommit message (Collapse)AuthorLines
2025-09-19added typetree support for memcpyKaran Janthe-1/+1
2025-07-23atomicrmw on pointers: move integer-pointer cast hacks into backendRalf Jung-16/+66
2025-06-30Require either wrapping nullary intrinsincs in const blocks or explicitly ↵Oli Scherer-1/+22
deciding not to
2025-06-30Stop backends from needing to support nullary intrinsicsOli Scherer-4/+0
2025-06-12intrinsics: rename min_align_of to align_ofRalf Jung-1/+1
2025-06-08Remove rustc's notion of "preferred" alignment AKA `__alignof`Jubilee Young-5/+1
In PR 90877 T-lang decided not to remove `intrinsics::pref_align_of`. However, the intrinsic and its supporting code 1. is a nightly feature, so can be removed at compiler/libs discretion 2. requires considerable effort in the compiler to support, as it necessarily complicates every single site reasoning about alignment 3. has been justified based on relevance to codegen, but it is only a requirement for C++ (not C, not Rust) stack frame layout for AIX, in ways Rust would not consider even with increased C++ interop 4. is only used by rustc to overalign some globals, not correctness 5. can be adequately replaced by other rules for globals, as it mostly affects alignments for a few types under 16 bytes of alignment 6. has only one clear benefactor: automating C -> Rust translation for GNU extensions like `__alignof` 7. such code was likely intended to be `alignof` or `_Alignof`, because the GNU extension is a "false friend" of the C keyword, which makes the choice to support such a mapping very questionable 8. makes it easy to do incorrect codegen in the compiler by its mere presence as usual Rust rules of alignment (e.g. `size == align * N`) do not hold with preferred alignment The implementation is clearly damaging the code quality of the compiler. Thus it is within the compiler team's purview to simply rip it out. If T-lang wishes to have this intrinsic restored for c2rust's benefit, it would have to use a radically different implementation that somehow does not cause internal incorrectness. Until then, remove the intrinsic and its supporting code, as one tool and an ill-considered GCC extension cannot justify risking correctness. Because we touch a fair amount of the compiler to change this at all, and unfortunately the duplication of AbiAndPrefAlign is deep-rooted, we keep an "AbiAlign" type which we can wean code off later.
2025-06-07intrinsics: use const generic to set atomic orderingRalf Jung-178/+144
2025-05-30Directly use from_immediate for handling boolbjorn3-3/+2
2025-05-30Avoid computing function type for intrinsic instancesbjorn3-8/+8
2025-05-30Use layout field of OperandRef and PlaceRef in codegen_intrinsic_callbjorn3-18/+13
This avoids having to get the function signature.
2025-05-28get rid of rustc_codegen_ssa::common::AtomicOrderingRalf Jung-13/+5
2025-05-28atomic_load intrinsic: use const generic parameter for orderingRalf Jung-34/+59
2025-05-26Remove usage of FnAbi in codegen_intrinsic_callbjorn3-11/+7
2025-05-26Pass PlaceRef rather than Bx::Value to codegen_intrinsic_callbjorn3-3/+2
2025-05-26Move caller_location handling into codegen_intrinsic_callbjorn3-2/+11
2025-05-09remove 'unordered' atomic intrinsicsRalf Jung-1/+0
2025-03-14Rollup merge of #138398 - RalfJung:atomic-intrinsics-provenance, r=nnethercoteJacob Pratt-4/+34
atomic intrinsics: clarify which types are supported and (if applicable) what happens with provenance The provenance semantics match what Miri implements and what the `AtomicPtr` API expects.
2025-03-13atomic intrinsics: clarify which types are supported and (if applicable) ↵Ralf Jung-4/+34
what happens with provenance
2025-03-12Don't `alloca` just to look at a discriminantScott McMurray-9/+1
Today we're making LLVM do a bunch of extra work for every enum you match on, even trivial stuff like `Option<bool>`. Let's not.
2025-02-10Rename rustc_middle::Ty::is_unsafe_ptr to is_raw_ptrBastian Kersting-4/+4
The wording unsafe pointer is less common and not mentioned in a lot of places, instead this is usually called a "raw pointer". For the sake of uniformity, we rename this method. This came up during the review of https://github.com/rust-lang/rust/pull/134424.
2025-01-31Override `disjoint_or` in the LLVM backendScott McMurray-0/+5
2024-12-25rename typed_swap → typed_swap_nonoverlappingRalf Jung-1/+1
2024-11-19`InterpCx` store `TypingEnv` instead of a `ParamEnv`lcnr-4/+1
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-2/+2
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-17Likely unlikely fixJiri Bobek-0/+5
2024-11-03compiler: Directly use rustc_abi in codegenJubilee Young-2/+2
2024-09-25Rollup merge of #130734 - Luv-Ray:fix_vfe, r=lcnrMatthias Krüger-1/+1
Fix: ices on virtual-function-elimination about principal trait Extract `load_vtable` function to ensure the `virtual_function_elimination` option is always checked. It's okay not to use `llvm.type.checked.load` to load the vtable if there is no principal trait. Fixes #123955 Fixes #124092
2024-09-23fix ices on vfe about principal traitLuv-Ray-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-4/+4
2024-07-29Reformat `use` declarations.Nicholas Nethercote-13/+8
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-05-10Refactoring after the `PlaceValue` additionScott McMurray-8/+7
I added `PlaceValue` in 123775, but kept that one line-by-line simple because it touched so many places. This goes through to add more helpers & docs, and change some `PlaceRef` to `PlaceValue` where the type didn't need to be included. No behaviour changes.
2024-04-29Remove `extern crate rustc_middle` from numerous crates.Nicholas Nethercote-0/+1
2024-04-11Add load/store helpers that take `PlaceValue`Scott McMurray-3/+3
2024-04-11Make `PlaceRef` hold a `PlaceValue` for the non-layout fields (like ↵Scott McMurray-3/+3
`OperandRef` does)
2024-03-23Auto merge of #122582 - scottmcm:swap-intrinsic-v2, r=oli-obkbors-0/+24
Let codegen decide when to `mem::swap` with immediates Making `libcore` decide this is silly; the backend has so much better information about when it's a good idea. Thus this PR introduces a new `typed_swap` intrinsic with a fallback body, and replaces that fallback implementation when swapping immediates or scalar pairs. r? oli-obk Replaces #111744, and means we'll never need more libs PRs like #111803 or #107140
2024-03-19Make ptr_guaranteed_cmp a rustc_intrinsic and favor its body over backends ↵Oli Scherer-7/+0
implementing it
2024-03-18Avoid various uses of `Option<Span>` in favor of using `DUMMY_SP` in the few ↵Oli Scherer-1/+1
cases that used `None`
2024-03-17Let codegen decide when to `mem::swap` with immediatesScott McMurray-0/+24
Making `libcore` decide this is silly; the backend has so much better information about when it's a good idea. So introduce a new `typed_swap` intrinsic with a fallback body, but replace that implementation for immediates and scalar pairs.
2024-03-09Sink ptrtoint for RMW ops on pointers to cg_llvmBen Kimock-40/+10
2024-02-20Add "algebraic" versions of the fast-math intrinsicsBen Kimock-0/+32
2024-02-12Give const_deallocate a default bodyOli Scherer-5/+0
2024-02-12Teach llvm backend how to fall back to default bodiesOli Scherer-30/+28
2023-12-30Auto merge of #118705 - WaffleLapkin:codegen-atomic-exhange-untuple, r=cjgillotbors-3/+1
Change `rustc_codegen_ssa`'s `atomic_cmpxchg` interface to return a pair of values Doesn't change much, but a little nicer that way.
2023-12-28Change `rustc_codegen_ssa`'s `atomic_cmpxchg` interface to return a pair of ↵Bernd Schmidt-3/+1
values
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-9/+9
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-12codegen: panic when trying to compute size/align of extern typeRalf Jung-13/+9
2023-10-13Format all the let chains in compilerMichael Goulet-13/+56
2023-09-15explain PassMode::CastRalf Jung-1/+1
2023-07-29cg_ssa: remove pointee types and pointercast/bitcast-of-ptrErik Desjardins-17/+7
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-14/+14