about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
AgeCommit message (Collapse)AuthorLines
2025-01-31Auto merge of #136331 - jhpratt:rollup-curo1f4, r=jhprattbors-2/+0
Rollup of 8 pull requests Successful merges: - #135414 (Stabilize `const_black_box`) - #136150 (ci: use windows 2025 for i686-mingw) - #136258 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 11)) - #136270 (Remove `NamedVarMap`.) - #136278 (add constraint graph to polonius MIR dump) - #136287 (LLVM changed the nocapture attribute to captures(none)) - #136291 (some test suite cleanups) - #136296 (float::min/max: mention the non-determinism around signed 0) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-31Rollup merge of #135414 - tgross35:stabilize-const_black_box, r=dtolnayJacob Pratt-2/+0
Stabilize `const_black_box` This has been unstably const since #92226, but a tracking issue was never created. Per [discussion on Zulip][zulip], there should not be any blockers to making this const-stable. The function does not provide any functionality at compile time but does allow code reuse between const- and non-const functions, so stabilize it here. [zulip]: https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/const_black_box
2025-01-30Use ExistentialTraitRef throughout codegenMichael Goulet-5/+5
2025-01-30Do not treat vtable supertraits as distinct when bound with different bound varsMichael Goulet-1/+6
2025-01-28ABI-required target features: warn when they are missing in base CPU (rather ↵Ralf Jung-51/+4
than silently enabling them)
2025-01-27Auto merge of #136024 - GuillaumeGomez:cg_gcc-subtree, r=GuillaumeGomezbors-41/+85
Update rustc_codegen_gcc subtree cc `@antoyo`
2025-01-27Stabilize `const_black_box`Trevor Gross-2/+0
This has been unstably const since [1], but a tracking issue was never created. Per discussion on Zulip [2], there should not be any blockers to making this const-stable. The function does not provide any functionality at compile time but does allow code reuse between const- and non-const functions, so stabilize it here. [1]: https://github.com/rust-lang/rust/pull/92226 [2]: https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/const_black_box
2025-01-24Rollup merge of #135581 - EnzymeAD:refactor-codgencx, r=oli-obkMatthias Krüger-1/+0
Separate Builder methods from tcx As part of the autodiff upstreaming we noticed, that it would be nice to have various builder methods available without the TypeContext, which prevents the normal CodegenCx to be passed around between threads. We introduce a SimpleCx which just owns the llvm module and llvm context, to encapsulate them. The previous CodegenCx now implements deref and forwards access to the llvm module or context to it's SimpleCx sub-struct. This gives us a bit more flexibility, because now we can pass (or construct) the SimpleCx in locations where we don't have enough information to construct a CodegenCx, or are not able to pass it around due to the tcx lifetimes (and it not implementing send/sync). This also introduces an SBuilder, similar to the SimpleCx. The SBuilder uses a SimpleCx, whereas the existing Builder uses the larger CodegenCx. I will push updates to make implementations generic (where possible) to be implemented once and work for either of the two. I'll also clean up the leftover code. `call` is a bit tricky, because it requires a tcx, I probably need to duplicate it after all. Tracking: - https://github.com/rust-lang/rust/issues/124509
2025-01-24Merge commit '9f33f846ddc06afd7ffd839ee4f18babac3f3204'Guillaume Gomez-41/+85
2025-01-24Make CodegenCx and Builder genericManuel Drehwald-1/+0
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2025-01-21Auto merge of #134299 - RalfJung:remove-start, r=compiler-errorsbors-121/+77
remove support for the (unstable) #[start] attribute As explained by `@Noratrieb:` `#[start]` should be deleted. It's nothing but an accidentally leaked implementation detail that's a not very useful mix between "portable" entrypoint logic and bad abstraction. I think the way the stable user-facing entrypoint should work (and works today on stable) is pretty simple: - `std`-using cross-platform programs should use `fn main()`. the compiler, together with `std`, will then ensure that code ends up at `main` (by having a platform-specific entrypoint that gets directed through `lang_start` in `std` to `main` - but that's just an implementation detail) - `no_std` platform-specific programs should use `#![no_main]` and define their own platform-specific entrypoint symbol with `#[no_mangle]`, like `main`, `_start`, `WinMain` or `my_embedded_platform_wants_to_start_here`. most of them only support a single platform anyways, and need cfg for the different platform's ways of passing arguments or other things *anyways* `#[start]` is in a super weird position of being neither of those two. It tries to pretend that it's cross-platform, but its signature is a total lie. Those arguments are just stubbed out to zero on ~~Windows~~ wasm, for example. It also only handles the platform-specific entrypoints for a few platforms that are supported by `std`, like Windows or Unix-likes. `my_embedded_platform_wants_to_start_here` can't use it, and neither could a libc-less Linux program. So we have an attribute that only works in some cases anyways, that has a signature that's a total lie (and a signature that, as I might want to add, has changed recently, and that I definitely would not be comfortable giving *any* stability guarantees on), and where there's a pretty easy way to get things working without it in the first place. Note that this feature has **not** been RFCed in the first place. *This comment was posted [in May](https://github.com/rust-lang/rust/issues/29633#issuecomment-2088596042) and so far nobody spoke up in that issue with a usecase that would require keeping the attribute.* Closes https://github.com/rust-lang/rust/issues/29633 try-job: x86_64-gnu-nopt try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: test-various
2025-01-21remove support for the #[start] attributeRalf Jung-121/+77
2025-01-21Treat undef bytes as equal to any other byteOli Scherer-0/+5
2025-01-19When LLVM's location discriminator value limit is exceeded, emit locations ↵Kyle Huey-9/+9
with dummy spans instead of dropping them entirely Revert most of #133194 (except the test and the comment fixes). Then refix not emitting locations at all when the correct location discriminator value exceeds LLVM's capacity.
2025-01-15Rollup merge of #134338 - tgross35:overflowing-c-safe-ret, r=bjorn3,antoyoJacob Pratt-65/+64
Use a C-safe return type for `__rust_[ui]128_*` overflowing intrinsics Combined with [1], this will change the overflowing multiplication operations to return an `extern "C"`-safe type. Link: https://github.com/rust-lang/compiler-builtins/pull/735 [1]
2025-01-15Rollup merge of #132397 - m-ou-se:warn-missing-abi, r=NadrierilJacob Pratt-5/+5
Make missing_abi lint warn-by-default. This makes the missing_abi lint warn-by-default, as suggested here: https://github.com/rust-lang/rfcs/pull/3722#issuecomment-2447719047 This needs a lang FCP.
2025-01-15Use a C-safe return type for `__rust_[ui]128_*` overflowing intrinsicsTrevor Gross-65/+64
Combined with [1], this will change the overflowing multiplication operations to return an `extern "C"`-safe type. Link: https://github.com/rust-lang/compiler-builtins/pull/735 [1]
2025-01-13Fix formattingAntoni Boucher-8/+8
2025-01-13Merge commit '59a81c2ca1edc88ad3ac4b27a8e03977ffb8e73a' into ↵Antoni Boucher-1522/+828
subtree-update_cg_gcc_2025_01_12
2025-01-11migrate `rustc_codegen_gcc` to the `DenseBitSet` nameRémy Rakic-5/+5
2025-01-10mir_transform: implement forced inliningDavid Wood-1/+1
Adds `#[rustc_force_inline]` which is similar to always inlining but reports an error if the inlining was not possible, and which always attempts to inline annotated items, regardless of optimisation levels. It can only be applied to free functions to guarantee that the MIR inliner will be able to resolve calls.
2025-01-07Update tests.Mara Bos-5/+5
2025-01-07llvm: Ignore error value that is always falseMatthew Maurer-3/+1
See llvm/llvm-project#121851 For LLVM 20+, this function (`renameModuleForThinLTO`) has no return value. For prior versions of LLVM, this never failed, but had a signature which allowed an error value people were handling.
2025-01-05Auto merge of #134794 - RalfJung:abi-required-target-features, r=workingjubileebors-81/+125
Add a notion of "some ABIs require certain target features" I think I finally found the right shape for the data and checks that I recently added in https://github.com/rust-lang/rust/pull/133099, https://github.com/rust-lang/rust/pull/133417, https://github.com/rust-lang/rust/pull/134337: we have a notion of "this ABI requires the following list of target features, and it is incompatible with the following list of target features". Both `-Ctarget-feature` and `#[target_feature]` are updated to ensure we follow the rules of the ABI. This removes all the "toggleability" stuff introduced before, though we do keep the notion of a fully "forbidden" target feature -- this is needed to deal with target features that are actual ABI switches, and hence are needed to even compute the list of required target features. We always explicitly (un)set all required and in-conflict features, just to avoid potential trouble caused by the default features of whatever the base CPU is. We do this *before* applying `-Ctarget-feature` to maintain backward compatibility; this poses a slight risk of missing some implicit feature dependencies in LLVM but has the advantage of not breaking users that deliberately toggle ABI-relevant target features. They get a warning but the feature does get toggled the way they requested. For now, our logic supports x86, ARM, and RISC-V (just like the previous logic did). Unsurprisingly, RISC-V is the nicest. ;) As a side-effect this also (unstably) allows *enabling* `x87` when that is harmless. I used the opportunity to mark SSE2 as required on x86-64, to better match the actual logic in LLVM and because all x86-64 chips do have SSE2. This infrastructure also prepares us for requiring SSE on x86-32 when we want to use that for our ABI (and for float semantics sanity), see https://github.com/rust-lang/rust/issues/133611, but no such change is happening in this PR. r? `@workingjubilee`
2025-01-05add dedicated type for ABI target feature constraintsRalf Jung-8/+11
2025-01-01upstream rustc_codegen_llvm changes for enzyme/autodiffManuel Drehwald-0/+10
2024-12-31add ABI target features *before* -Ctarget-featuresRalf Jung-6/+6
2024-12-31x86-64 hardfloat actually requires sse2Ralf Jung-6/+12
2024-12-31adjust GCC backendRalf Jung-81/+116
2024-12-18chore: fix some typosacceptacross-1/+1
Signed-off-by: acceptacross <csqcqs@gmail.com>
2024-12-16rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structuresJonathan Dönszelmann-3/+3
2024-12-14target_features: control separately whether enabling and disabling a target ↵Ralf Jung-3/+3
feature is allowed
2024-12-13Auto merge of #133099 - RalfJung:forbidden-hardfloat-features, r=workingjubileebors-14/+20
forbid toggling x87 and fpregs on hard-float targets Part of https://github.com/rust-lang/rust/issues/116344, follow-up to https://github.com/rust-lang/rust/pull/129884: The `x87` target feature on x86 and the `fpregs` target feature on ARM must not be disabled on a hardfloat target, as that would change the float ABI. However, *enabling* `fpregs` on ARM is [explicitly requested](https://github.com/rust-lang/rust/issues/130988) as it seems to be useful. Therefore, we need to refine the distinction of "forbidden" target features and "allowed" target features: all (un)stable target features can determine on a per-target basis whether they should be allowed to be toggled or not. `fpregs` then checks whether the current target has the `soft-float` feature, and if yes, `fpregs` is permitted -- otherwise, it is not. (Same for `x87` on x86). Also fixes https://github.com/rust-lang/rust/issues/132351. Since `fpregs` and `x87` can be enabled on some builds and disabled on others, it would make sense that one can query it via `cfg`. Therefore, I made them behave in `cfg` like any other unstable target feature. The first commit prepares the infrastructure, but does not change behavior. The second commit then wires up `fpregs` and `x87` with that new infrastructure. r? `@workingjubilee`
2024-12-11Auto merge of #128004 - folkertdev:naked-fn-asm, r=Amanieubors-0/+7
codegen `#[naked]` functions using global asm tracking issue: https://github.com/rust-lang/rust/issues/90957 Fixes #124375 This implements the approach suggested in the tracking issue: use the existing global assembly infrastructure to emit the body of `#[naked]` functions. The main advantage is that we now have full control over what gets generated, and are no longer dependent on LLVM not sneakily messing with our output (inlining, adding extra instructions, etc). I discussed this approach with `@Amanieu` and while I think the general direction is correct, there is probably a bunch of stuff that needs to change or move around here. I'll leave some inline comments on things that I'm not sure about. Combined with https://github.com/rust-lang/rust/pull/127853, if both accepted, I think that resolves all steps from the tracking issue. r? `@Amanieu`
2024-12-11apply review feedbackRalf Jung-1/+3
2024-12-11generalize 'forbidden feature' concept so that even (un)stable feature can ↵Ralf Jung-14/+18
be invalid to toggle Also rename some things for extra clarity
2024-12-10codegen `#[naked]` functions using `global_asm!`Folkert-0/+7
2024-12-07Make `Copy` unsafe to implement for ADTs with `unsafe` fieldsJack Wrenn-18/+18
As a rule, the application of `unsafe` to a declaration requires that use-sites of that declaration also require `unsafe`. For example, a field declared `unsafe` may only be read in the lexical context of an `unsafe` block. For nearly all safe traits, the safety obligations of fields are explicitly discharged when they are mentioned in method definitions. For example, idiomatically implementing `Clone` (a safe trait) for a type with unsafe fields will require `unsafe` to clone those fields. Prior to this commit, `Copy` violated this rule. The trait is marked safe, and although it has no explicit methods, its implementation permits reads of `Self`. This commit resolves this by making `Copy` conditionally safe to implement. It remains safe to implement for ADTs without unsafe fields, but unsafe to implement for ADTs with unsafe fields. Tracking: #132922
2024-12-06Remove polymorphizationBen Kimock-1/+0
2024-12-06Rollup merge of #130777 - azhogin:azhogin/reg-struct-return, r=workingjubileeMatthias Krüger-1/+4
rust_for_linux: -Zreg-struct-return commandline flag for X86 (#116973) Command line flag `-Zreg-struct-return` for X86 (32-bit) for rust-for-linux. This flag enables the same behavior as the `abi_return_struct_as_int` target spec key. - Tracking issue: https://github.com/rust-lang/rust/issues/116973
2024-12-03Rollup merge of #133395 - calebzulawski:simd_relaxed_fma, r=workingjubileeMatthias Krüger-0/+1
Add simd_relaxed_fma intrinsic Adds compiler support for https://github.com/rust-lang/portable-simd/issues/387#issuecomment-2337169786 r? `@workingjubilee` cc `@RalfJung` is this kind of nondeterminism a problem for miri/opsem?
2024-12-02rust_for_linux: -Zreg-struct-return commandline flag for X86 (#116973)Andrew Zhogin-1/+4
2024-11-29Support #[repr(simd)] types in input/output of PowerPC inline assemblyTaiki Endo-4/+6
2024-11-25Support predicate registers (clobber-only) in Hexagon inline assemblyTaiki Endo-0/+6
2024-11-24Make s390x non-clobber-only vector register support unstableTaiki Endo-1/+1
2024-11-23Add simd_relaxed_fma intrinsicCaleb Zulawski-0/+1
2024-11-22Support input/output in vector registers of s390x inline assemblyTaiki Endo-4/+4
2024-11-19When the required discriminator value exceeds LLVM's limits, drop the debug ↵Kyle Huey-9/+9
info for the function instead of panicking. The maximum discriminator value LLVM can currently encode is 2^12. If macro use results in more than 2^12 calls to the same function attributed to the same callsite, and those calls are MIR-inlined, we will require more than the maximum discriminator value to completely represent the debug information. Once we reach that point drop the debug info instead.
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-28/+32
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-2/+0