about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/traits
AgeCommit message (Collapse)AuthorLines
2025-10-02codegen: Generate `dbg_value` for the ref statementdianqk-1/+13
2025-09-29Rollup merge of #147127 - antoyo:fix/gcc-linker-plugin, r=bjorn3Stuart Cook-1/+10
Add a leading dash to linker plugin arguments in the gcc codegen Fix rust-lang/rust#130583 r? ``@bjorn3``
2025-09-28Add a leading dash to linker plugin arguments in the gcc codegenAntoni Boucher-1/+10
2025-09-19added typetree support for memcpyKaran Janthe-1/+2
2025-09-16Update the FIXME comments in the generic three_way_compareJosh Stone-8/+11
2025-09-16Update the minimum external LLVM to 20Josh Stone-7/+31
2025-09-06Remove want_summary argument from prepare_thinbjorn3-4/+1
It is always false nowadays. ThinLTO summary writing is instead done by llvm_optimize.
2025-09-06Remove thin_link_data method from ThinBufferMethodsbjorn3-1/+0
It is only used within cg_llvm.
2025-08-24Directly raise fatal errors inside the codegen backendsbjorn3-6/+6
As opposed to passing it around through Result.
2025-08-14Complete functionality and general cleanupMarcelo Domínguez-2/+0
2025-08-13Port the `#[linkage]` attribute to the new attribute systemSasha Pourcelot-1/+2
2025-08-08Rollup merge of #144192 - RalfJung:atomicrmw-ptr, r=nikicTrevor Gross-0/+3
atomicrmw on pointers: move integer-pointer cast hacks into backend Conceptually, we want to have atomic operations on pointers of the form `fn atomic_add(ptr: *mut T, offset: usize, ...)`. However, LLVM does not directly support such operations (https://github.com/llvm/llvm-project/issues/120837), so we have to cast the `offset` to a pointer somewhere. This PR moves that hack into the LLVM backend, so that the standard library, intrinsic, and Miri all work with the conceptual operation we actually want. Hopefully, one day LLVM will gain a way to represent these operations without integer-pointer casts, and then the hack will disappear entirely. Cc ```@nikic``` -- this is the best we can do right now, right? Fixes https://github.com/rust-lang/rust/issues/134617
2025-08-06coverage: Remove all unstable support for MC/DC instrumentationZalathar-5/+0
2025-07-31Rollup merge of #144232 - xacrimon:explicit-tail-call, r=WaffleLapkinStuart Cook-0/+12
Implement support for `become` and explicit tail call codegen for the LLVM backend This PR implements codegen of explicit tail calls via `become` in `rustc_codegen_ssa` and support within the LLVM backend. Completes a task on (https://github.com/rust-lang/rust/issues/112788). This PR implements all the necessary bits to make explicit tail calls usable, other backends have received stubs for now and will ICE if you use `become` on them. I suspect there is some bikeshedding to be done on how we should go about implementing this for other backends, but it should be relatively straightforward for GCC after this is merged. During development I also put together a POC bytecode VM based on tail call dispatch to test these changes out and analyze the codegen to make sure it generates expected assembly. That is available [here](https://github.com/xacrimon/tcvm).
2025-07-26Remove support for -Zcombine-cgubjorn3-6/+0
Nobody seems to actually use this, while still adding some extra complexity to the already rather complex codegen coordinator code. It is also not supported by any backend other than the LLVM backend.
2025-07-26Implement support for explicit tail calls in the MIR block builders and the ↵Joel Wejdenstål-0/+12
LLVM codegen backend.
2025-07-23atomicrmw on pointers: move integer-pointer cast hacks into backendRalf Jung-0/+3
2025-07-21Remove each_linked_rlib_for_lto from CodegenContextbjorn3-0/+4
2025-07-21Move exported_symbols_for_lto out of CodegenContextbjorn3-0/+2
2025-07-21Merge modules and cached_modules for fat LTObjorn3-1/+0
The modules vec can already contain serialized modules and there is no need to distinguish between cached and non-cached cgus at LTO time.
2025-07-17Rollup merge of #143388 - bjorn3:lto_refactors, r=compiler-errorsLeón Orell Valerian Liehr-17/+7
Various refactors to the LTO handling code In particular reducing the sharing of code paths between fat and thin-LTO and making the fat LTO implementation more self-contained. This also moves some autodiff handling out of cg_ssa into cg_llvm given that Enzyme only works with LLVM anyway and an implementation for another backend may do things entirely differently. This will also make it a bit easier to split LTO handling out of the coordinator thread main loop into a separate loop, which should reduce the complexity of the coordinator thread.
2025-07-14Eliminate all direct uses of LLVMMDStringInContext2Oli Scherer-3/+3
2025-07-12Auto merge of #143810 - matthiaskrgr:rollup-iw7a23z, r=matthiaskrgrbors-2/+29
Rollup of 9 pull requests Successful merges: - rust-lang/rust#143403 (Port several trait/coherence-related attributes the new attribute system) - rust-lang/rust#143633 (fix: correct assertion to check for 'noinline' attribute presence before removal) - rust-lang/rust#143647 (Clarify and expand documentation for std::sys_common dependency structure) - rust-lang/rust#143716 (compiler: doc/comment some codegen-for-functions interfaces) - rust-lang/rust#143747 (Add target maintainer information for aarch64-unknown-linux-musl) - rust-lang/rust#143759 (Fix typos in function names in the `target_feature` test) - rust-lang/rust#143767 (Bump `src/tools/x` to Edition 2024 and some cleanups) - rust-lang/rust#143769 (Remove support for SwitchInt edge effects in backward dataflow) - rust-lang/rust#143770 (build-helper: clippy fixes) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-12Auto merge of #143766 - matthiaskrgr:rollup-0x7t69s, r=matthiaskrgrbors-0/+10
Rollup of 8 pull requests Successful merges: - rust-lang/rust#142391 (rust: library: Add `setsid` method to `CommandExt` trait) - rust-lang/rust#143302 (`tests/ui`: A New Order [27/N]) - rust-lang/rust#143303 (`tests/ui`: A New Order [28/28] FINAL PART) - rust-lang/rust#143568 (std: sys: net: uefi: tcp4: Add timeout support) - rust-lang/rust#143611 (Mention more APIs in `ParseIntError` docs) - rust-lang/rust#143661 (chore: Improve how the other suggestions message gets rendered) - rust-lang/rust#143708 (fix: Include frontmatter in -Zunpretty output ) - rust-lang/rust#143718 (Make UB transmutes really UB in LLVM) r? `@ghost` `@rustbot` modify labels: rollup try-job: i686-gnu-nopt-1 try-job: test-various
2025-07-11Rollup merge of #143716 - ↵Matthias Krüger-2/+29
workingjubilee:document-some-codegen-backend-stuff, r=bjorn3,fee1-dead compiler: doc/comment some codegen-for-functions interfaces An out-of-date comment gets updated and some underdocumented functions get documented.
2025-07-11compiler: comment on some call-related codegen fn in cg_ssaJubilee Young-2/+29
Partially documents the situation due to LLVM CFI.
2025-07-10Add `BuilderMethods::unreachable_nonterminator`Scott McMurray-0/+10
So places that need `unreachable` but in the middle of a basic block can call that instead of figuring out the best way to do it.
2025-07-07Remove support for dynamic allocasmejrs-1/+0
2025-07-03Merge run_fat_lto, optimize_fat and autodiff into run_and_optimize_fat_ltobjorn3-12/+4
2025-07-03Remove unused config param from WriteBackendMethods::autodiffbjorn3-1/+0
2025-07-03Move dcx creation into WriteBackendMethods::codegenbjorn3-1/+0
2025-07-03Remove LtoModuleCodegenbjorn3-3/+3
Most uses of it either contain a fat or thin lto module. Only WorkItem::LTO could contain both, but splitting that enum variant doesn't complicate things much.
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-1/+1
2025-06-22Remove dead instructions in terminate blocksMark Rousskov-1/+1
2025-06-18Rollup merge of #142383 - scottmcm:operandref-builder, r=workingjubileeJakub Beránek-1/+19
CodeGen: rework Aggregate implemention for rvalue_creates_operand cases A non-trivial refactor pulled out from rust-lang/rust#138759 r? workingjubilee The previous implementation I'd written here based on `index_by_increasing_offset` is complicated to follow and difficult to extend to non-structs. This changes the implementation, without actually changing any codegen (thus no test changes either), to be more like the existing `extract_field` (<https://github.com/rust-lang/rust/blob/2b0274c71dba0e24370ebf65593da450e2e91868/compiler/rustc_codegen_ssa/src/mir/operand.rs#L345-L425>) in that it allows setting a particular field directly. Notably I've found this one much easier to get right, in particular because having the `OperandRef<Result<V, Scalar>>` gives a really useful thing to include in ICE messages if something did happen to go wrong.
2025-06-17CodeGen: rework Aggregate implemention for rvalue_creates_operand casesScott McMurray-1/+19
Another refactor pulled out from 138759 The previous implementation I'd written here based on `index_by_increasing_offset` is complicated to follow and difficult to extend to non-structs. This changes the implementation, without actually changing any codegen (thus no test changes either), to be more like the existing `extract_field` (<https://github.com/rust-lang/rust/blob/2b0274c71dba0e24370ebf65593da450e2e91868/compiler/rustc_codegen_ssa/src/mir/operand.rs#L345-L425>) in that it allows setting a particular field directly. Notably I've found this one much easier to get right, in particular because having the `OperandRef<Result<V, Scalar>>` gives a really useful thing to include in ICE messages if something did happen to go wrong.
2025-06-15Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, ↵León Orell Valerian Liehr-8/+9
r=workingjubilee,saethlin Move metadata object generation for dylibs to the linker code This deduplicates some code between codegen backends and may in the future allow adding extra metadata that is only known at link time. Prerequisite of https://github.com/rust-lang/rust/issues/96708.
2025-06-14Auto merge of #142259 - sayantn:simplify-intrinsics, r=workingjubileebors-2/+2
Simplify implementation of Rust intrinsics by using type parameters in the cache The current implementation of intrinsics have a lot of duplication to handle different overloads of overloaded LLVM intrinsic. This PR uses the **base name and the type parameters** in the cache instead of the full, overloaded name. This has the benefit that `call_intrinsic` doesn't need to provide the full name, rather the type parameters (which is most of the time more available). This uses `LLVMIntrinsicCopyOverloadedName2` to get the overloaded name from the base name and the type parameters, and only uses it to declare the function. (originally was part of rust-lang/rust#140763, split off later) `@rustbot` label A-codegen A-LLVM r? codegen
2025-06-12Simplify implementation of Rust intrinsics by using type parameters in the cachesayantn-2/+2
2025-06-11compiler: Change c_int_width to be an integer typeJubilee Young-4/+4
2025-06-03Move metadata object generation for dylibs to the linker codebjorn3-5/+1
This deduplicates some code between codegen backends and may in the future allow adding extra metadata that is only known at link time.
2025-06-03Only borrow EncodedMetadata in codegen_cratebjorn3-4/+9
And move passing it to the linker to the driver code.
2025-06-03Remove type_test from IntrinsicCallBuilderMethodsbjorn3-2/+0
It is only used within cg_llvm.
2025-06-03Remove get_dbg_loc from DebugInfoBuilderMethodsbjorn3-1/+0
It is only used within cg_llvm.
2025-05-30Rollup merge of #141507 - RalfJung:atomic-intrinsics, r=bjorn3Matthias Krüger-4/+2
atomic_load intrinsic: use const generic parameter for ordering We have a gazillion intrinsics for the atomics because we encode the ordering into the intrinsic name rather than making it a parameter. This is particularly bad for those operations that take two orderings. Let's fix that! This PR only converts `load`, to see if there's any feedback that would fundamentally change the strategy we pursue for the const generic intrinsics. The first two commits are preparation and could be a separate PR if you prefer. `@BoxyUwU` -- I hope this is a use of const generics that is unlikely to explode? All we need is a const generic of enum type. We could funnel it through an integer if we had to but an enum is obviously nicer... `@bjorn3` it seems like the cranelift backend entirely ignores the ordering?
2025-05-28get rid of rustc_codegen_ssa::common::AtomicOrderingRalf Jung-4/+2
2025-05-28Remove unused arg_memory_ty methodbjorn3-1/+0
2025-05-28Mark all optimize methods and the codegen method as safebjorn3-4/+4
There is no safety contract and I don't think any of them can actually cause UB in more ways than passing malicious source code to rustc can. While LtoModuleCodegen::optimize says that the returned ModuleCodegen points into the LTO module, the LTO module has already been dropped by the time this function returns, so if the returned ModuleCodegen indeed points into the LTO module, we would have seen crashes on every LTO compilation, which we don't. As such the comment is outdated.
2025-05-28Remove methods from StaticCodegenMethods that are not called in cg_ssa itselfbjorn3-12/+0
2025-05-28Make predefine methods take &mut selfbjorn3-2/+2