about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
AgeCommit message (Collapse)AuthorLines
2025-06-03Only borrow EncodedMetadata in codegen_cratebjorn3-28/+35
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-06-02Auto merge of #141750 - Noratrieb:gold-rush, r=bjorn3bors-1/+58
Warn when gold was used as the linker gold has been deprecated recently and is known to behave incorrectly around Rust programs, including miscompiling `#[used(linker)]`. Tell people to switch to a different linker instead. closes rust-lang/rust#141748 r? bjorn3
2025-06-02Auto merge of #141760 - bjorn3:intrinsic_rework_part2, r=fee1-deadbors-29/+23
Improve intrinsic handling in cg_ssa (part 2) * Avoid computing function type and signature for intrinsics where possible * Nicer handling of bool returning intrinsics Follow up to https://github.com/rust-lang/rust/pull/141404
2025-05-31Warn when gold was used as the linkerNoratrieb-1/+58
gold has been deprecated recently and is known to behave incorrectly around Rust programs, including miscompiling `#[used(linker)]`. Tell people to switch to a different linker instead. Co-Authored-By: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2025-05-30Rollup merge of #141749 - ↵Matthias Krüger-52/+2
Noratrieb:RUSTC_ACTUALLY_DO_NOT_RETRY_LINKER_ON_SEGFAULT, r=petrochenkov Remove RUSTC_RETRY_LINKER_ON_SEGFAULT hack It looks like this was added in rust-lang/rust#40422 6 years ago because of issues with the MacOS linker. MacOS got a new linker in the meantime, so that should probably be resolved now. Hopefully. r? petrochenkov
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-30Rollup merge of #141507 - RalfJung:atomic-intrinsics, r=bjorn3Matthias Krüger-50/+56
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-29Remove RUSTC_RETRY_LINKER_ON_SEGFAULT hackNoratrieb-52/+2
It looks like this was added 6 years ago because of issues with the MacOS linker. MacOS got a new linker in the meantime, so that should probably be resolved now. Hopefully.
2025-05-29Rollup merge of #141448 - bjorn3:codegen_refactors, r=WaffleLapkinGuillaume Gomez-83/+44
A variety of improvements to the codegen backends Some are just general improvements to cg_ssa or cg_llvm, while others will make it slightly easier to use cg_ssa in cg_clif in the future.
2025-05-29Rollup merge of #138139 - xizheyin:issue-137384, r=ChrisDentonJacob Pratt-0/+19
Emit warning while outputs is not exe and prints linkage info cc #137384 ```bash $ rustc +stage1 /dev/null --print native-static-libs --crate-type staticlib --emit metadata warning: skipping link step due to conflict: cannot output linkage information without emitting executable note: consider emitting executable to print link information warning: 1 warning emitted ```
2025-05-28get rid of rustc_codegen_ssa::common::AtomicOrderingRalf Jung-26/+7
2025-05-28atomic_load intrinsic: use const generic parameter for orderingRalf Jung-34/+59
2025-05-28Remove unused arg_memory_ty methodbjorn3-1/+0
2025-05-28Mark all optimize methods and the codegen method as safebjorn3-22/+13
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-4/+4
2025-05-28Move supports_parallel from CodegenBackend to ExtraBackendMethodsbjorn3-8/+8
It is only relevant when using cg_ssa for driving compilation.
2025-05-28Remove a couple of uses of interior mutability around staticsbjorn3-3/+3
2025-05-28Reduce amount of types that need to be PartialEqbjorn3-3/+3
2025-05-28The personality function is a Function, not a Valuebjorn3-4/+4
2025-05-28Remove codegen_unit from MiscCodegenMethodsbjorn3-28/+11
2025-05-28Rollup merge of #141404 - bjorn3:refactor_cg_ssa_call_codegen, r=davidtwcoTrevor Gross-185/+185
Improve intrinsic handling in cg_ssa * Move all intrinsic handling code to the start of `codegen_call_terminator`. * Push some intrinsic handling code into `codegen_intrinsic_call`. * Don't depend on FnAbi for intrinsics.
2025-05-27Rename unpack to kindMichael Goulet-1/+1
2025-05-26Reduce indentation in codegen_panic_intrinsicbjorn3-49/+47
2025-05-26Don't depend on FnAbi for intrinsicsbjorn3-32/+42
Intrinsics are not real functions and as such don't have any calling convention. Trying to compute a calling convention for an intrinsic anyway is a nonsensical operation.
2025-05-26Remove usage of FnAbi in codegen_intrinsic_callbjorn3-22/+10
2025-05-26Pass PlaceRef rather than Bx::Value to codegen_intrinsic_callbjorn3-5/+7
2025-05-26Move caller_location handling into codegen_intrinsic_callbjorn3-18/+20
2025-05-26Always use fn_span in codegen_call_terminatorbjorn3-15/+11
2025-05-26Move some code around in codegen_call_terminatorbjorn3-99/+103
2025-05-26Auto merge of #138489 - tmiasko:call-tmps-lifetime, r=workingjubileebors-13/+35
Describe lifetime of call argument temporaries passed indirectly Fixes #132014.
2025-05-24Auto merge of #141518 - GuillaumeGomez:rollup-ivjep2j, r=GuillaumeGomezbors-3/+3
Rollup of 6 pull requests Successful merges: - rust-lang/rust#140066 (Stabilize `<[T; N]>::as_mut_slice` as `const`) - rust-lang/rust#141105 (additional edge cases tests for `path.rs` 🧪 ) - rust-lang/rust#141487 (Update askama to `0.14.0`) - rust-lang/rust#141498 (Use C-string literals to reduce boilerplate) - rust-lang/rust#141505 (rename internal panicking::try to catch_unwind) - rust-lang/rust#141511 (Cleanup CodegenFnAttrFlags) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-24Cleanup CodegenFnAttrFlagsNoratrieb-3/+3
- Rename `USED` to `USED_COMPILER` to better reflect its behavior. - Reorder some items to group the used and allocator flags together - Renumber them without gaps
2025-05-24Auto merge of #141372 - khuey:ir_call_dbg_loc, r=jieyouxubors-0/+1
Use the fn_span when emitting function calls for better debug info. This especially improves the developer experience for long chains of function calls that span multiple lines, which is common with builder patterns, chains of iterator/future combinators, etc. try-job: armhf-gnu try-job: test-various try-job: x86_64-msvc-1 try-job: arm-android r? `@jieyouxu`
2025-05-23Rollup merge of #141376 - nnethercote:rename-kw-Empty, r=petrochenkovMatthias Krüger-3/+3
Rename `kw::Empty` as `sym::empty`. Because the empty string is not a keyword. r? `@petrochenkov`
2025-05-22Use the fn_span when emitting function calls for better debug info.Kyle Huey-0/+1
This especially improves the developer experience for long chains of function calls that span multiple lines, which is common with builder patterns, chains of iterator/future combinators, etc.
2025-05-22make enabling the neon target feature a FCWRalf Jung-5/+23
2025-05-22Rename `kw::Empty` as `sym::empty`.Nicholas Nethercote-3/+3
Because the empty string is not a keyword.
2025-05-19Rollup merge of #140874 - mejrs:rads, r=WaffleLapkinStuart Cook-6/+6
make `rustc_attr_parsing` less dominant in the rustc crate graph It has/had a glob re-export of `rustc_attr_data_structures`, which is a crate much lower in the graph, and a lot of crates were using it *just* (or *mostly*) for that re-export, while they can rely on `rustc_attr_data_structures` directly. Previous graph: ![graph_1](https://github.com/user-attachments/assets/f4a5f13c-4222-4903-b56d-28c83511fcbd) Graph with this PR: ![graph_2](https://github.com/user-attachments/assets/1e053d9c-75cc-402b-84df-86229c98277a) The first commit keeps the re-export, and just changes the dependency if possible. The second commit is the "breaking change" which removes the re-export, and "explicitly" adds the `rustc_attr_data_structures` dependency where needed. It also switches over some src/tools/*. The second commit is actually a lot more involved than I expected. Please let me know if it's a better idea to back it out and just keep the first commit.
2025-05-18Remove rustc_attr_data_structures re-export from rustc_attr_parsingmejrs-6/+6
2025-05-17Rollup merge of #141035 - lqd:lld-warn, r=Mark-SimulacrumMatthias Krüger-1/+1
turn lld warning on old gccs into info log As discussed in #140964 and IRL, this PR switches the spammy warning shown unconditionally when an old gcc doesn't support `-fuse-ld=lld` and we retry linking without it, to an info debug log so we don't lose it. r? `@Mark-Simulacrum` Fixes #140964
2025-05-17Describe lifetime of call argument temporaries passed indirectlyTomasz Miąsko-13/+35
2025-05-15Revert "Fix linking statics on Arm64EC #140176"Jieyou Xu-130/+50
Unfortunately, multiple people are reporting linker warnings related to `__rust_no_alloc_shim_is_unstable` after this change. The solution isn't quite clear yet, let's revert to green for now, and try a reland with a determined solution for `__rust_no_alloc_shim_is_unstable`. This reverts commit c8b7f32434c0306db5c1b974ee43443746098a92, reversing changes made to 667247db71ea18c4130dd018d060e7f09d589490.
2025-05-15silence unexpected lld warning on old gccsRémy Rakic-1/+1
2025-05-13Auto merge of #140887 - pietroalbini:pa-bootstrap-update, r=compiler-errorsbors-1/+0
Stage0 bootstrap update This PR [follows the release process](https://forge.rust-lang.org/release/process.html#master-bootstrap-update-tuesday) to update the stage0 compiler. The only thing of note is https://github.com/rust-lang/rust/commit/58651d1b316e268fac2100c3ae37bb502a36b8ba, which was flagged by clippy as a correctness fix. I think allowing that lint in our case makes sense, but it's worth to have a second pair of eyes on it. r? `@Mark-Simulacrum`
2025-05-12Fix typosomahs-2/+2