about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2022-09-06Fix CI failures on windows and aarch64-linuxVadim Petrochenkov-20/+36
2022-09-06change stdlib circular dependencies handlingDaniil Belov-122/+35
2022-09-04Make `const_eval_select` a real intrinsicDeadbeef-2/+1
2022-09-02Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplettbors-6/+10
Support `#[unix_sigpipe = "inherit|sig_dfl"]` on `fn main()` to prevent ignoring `SIGPIPE` When enabled, programs don't have to explicitly handle `ErrorKind::BrokenPipe` any longer. Currently, the program ```rust fn main() { loop { println!("hello world"); } } ``` will print an error if used with a short-lived pipe, e.g. % ./main | head -n 1 hello world thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace by enabling `#[unix_sigpipe = "sig_dfl"]` like this ```rust #![feature(unix_sigpipe)] #[unix_sigpipe = "sig_dfl"] fn main() { loop { println!("hello world"); } } ``` there is no error, because `SIGPIPE` will not be ignored and thus the program will be killed appropriately: % ./main | head -n 1 hello world The current libstd behaviour of ignoring `SIGPIPE` before `fn main()` can be explicitly requested by using `#[unix_sigpipe = "sig_ign"]`. With `#[unix_sigpipe = "inherit"]`, no change at all is made to `SIGPIPE`, which typically means the behaviour will be the same as `#[unix_sigpipe = "sig_dfl"]`. See https://github.com/rust-lang/rust/issues/62569 and referenced issues for discussions regarding the `SIGPIPE` problem itself See the [this](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Proposal.3A.20First.20step.20towards.20solving.20the.20SIGPIPE.20problem) Zulip topic for more discussions, including about this PR. Tracking issue: https://github.com/rust-lang/rust/issues/97889
2022-09-02Rollup merge of #100200 - petrochenkov:zgccld2, r=lqd,Mark-SimulacrumMatthias Krüger-14/+18
Change implementation of `-Z gcc-ld` and `lld-wrapper` again This PR partially reverts https://github.com/rust-lang/rust/pull/97375 and uses the strategy described in https://github.com/rust-lang/rust/issues/97402#issuecomment-1147404520 instead, thus fixes https://github.com/rust-lang/rust/issues/97755.
2022-09-01rustc_target: Refactor internal linker flavors slightlyVadim Petrochenkov-26/+22
Remove one unstable user-facing linker flavor (l4-bender)
2022-09-01rustc_target: Add a compatibility layer to separate internal and user-facing ↵Vadim Petrochenkov-1/+2
linker flavors
2022-09-01Auto merge of #100958 - mikebenfield:workaround, r=nikicbors-11/+0
compiler/rustc_codegen_ssa/src/mir/place.rs: Remove LLVM bug workaround This memset was inserted as a workaround to Rust issue #34427, which was an LLVM bug that apparently no longer manifests.
2022-09-01Auto merge of #100707 - dzvon:fix-typo, r=davidtwcobors-2/+2
Fix a bunch of typo This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-31Rollup merge of #100753 - LuisCardosoOliveira:translation-migrate-session, ↵Ralf Jung-1/+1
r=davidtwco translations(rustc_session): migrates `rustc_session` to use `SessionDiagnostic` - Pt. 1 ## Description This is the first PR for the migration of the module `rustc_session`. You can follow my progress [here](https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883). The PR migrates the files `cgu_reuse_tracker` and `parse.rs` to use `SessionDiagnostic `.
2022-08-31Fix a bunch of typoDezhi Wu-2/+2
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-30Rollup merge of #100653 - cuviper:fptoint_sat, r=michaelwoerister,antoyoDylan DPC-155/+3
Move the cast_float_to_int fallback code to GCC Now that we require at least LLVM 13, that codegen backend is always using its intrinsic `fptosi.sat` and `fptoui.sat` conversions, so it doesn't need the manual implementation. However, the GCC backend still needs it, so we can move all of that code down there.
2022-08-29Rollup merge of #101141 - ↵Matthias Krüger-11/+7
compiler-errors:get-trait-ref-is-a-misleading-name, r=oli-obk Simplify `get_trait_ref` fn used for `virtual_function_elimination` 1. The name `get_trait_ref` is misleading, so I renamed it to something more like `expect_...` because it ICEs if used incorrectly. 2. No need to manually go through the existential trait refs, we already have `.principal()` for that.
2022-08-29Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obkMatthias Krüger-7/+7
Replace `Body::basic_blocks()` with field access Since the refactoring in #98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
2022-08-29Simplify get_trait_ref a bitMichael Goulet-11/+7
2022-08-28Support `#[unix_sigpipe = "inherit|sig_dfl|sig_ign"]` on `fn main()`Martin Nordholts-6/+10
This makes it possible to instruct libstd to never touch the signal handler for `SIGPIPE`, which makes programs pipeable by default (e.g. with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe` errors.
2022-08-28Auto merge of #92845 - Amanieu:std_personality, r=Mark-Simulacrumbors-11/+7
Move EH personality functions to std These were previously in the panic_unwind crate with dummy stubs in the panic_abort crate. However it turns out that this is insufficient: we still need a proper personality function even with -C panic=abort to handle the following cases: 1) `extern "C-unwind"` still needs to catch foreign exceptions with -C panic=abort to turn them into aborts. This requires landing pads and a personality function. 2) ARM EHABI uses the personality function when creating backtraces. The dummy personality function in panic_abort was causing backtrace generation to get stuck in a loop since the personality function is responsible for advancing the unwind state to the next frame. Fixes #41004
2022-08-28Fix handling of rust_eh_personality in reachable_non_genericsAmanieu d'Antras-11/+7
2022-08-27Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3bors-27/+23
Shrink `FnAbi` Because they can take up a lot of memory in debug and release builds. r? `@bjorn3`
2022-08-26translations(rustc_session): migrate check_expected_reuseLuis Cardoso-1/+1
This commit migrates the errors in the function check_expected_reuse to use the new SessionDiagnostic. It also does some small refactor for the IncorrectCguReuseType to include the 'at least' word in the fluent translation file
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-7/+7
2022-08-26Move `ArgAbi::pad_i32` into `PassMode::Cast`.Nicholas Nethercote-22/+18
Because it's only needed for that variant. This shrinks the types and clarifies the logic.
2022-08-26Turn `ArgAbi::pad` into a `bool`.Nicholas Nethercote-5/+5
Because it's only ever set to `None` or `Some(Reg::i32())`.
2022-08-26Box `CastTarget` within `PassMode`.Nicholas Nethercote-6/+6
Because `PassMode::Cast` is by far the largest variant, but is relatively rare. This requires making `PassMode` not impl `Copy`, and `Clone` is no longer necessary. This causes lots of sigil adjusting, but nothing very notable.
2022-08-25Code cleaningAdrian Tombu-6/+6
2022-08-25Replace spaghetti with a simple errors enumAdrian Tombu-59/+16
2022-08-25Start adding enum errors for deserialize_rlinkAdrian Tombu-7/+61
2022-08-24Remove LLVM ARM bug workaroundMichael Benfield-11/+0
This memset was inserted as a workaround to Rust issue #34427, which was an LLVM bug that apparently no longer manifests.
2022-08-24Rollup merge of #99993 - petrochenkov:linkdated, r=bjorn3Matthias Krüger-18/+18
linker: Update some outdated comments r? ``@bjorn3``
2022-08-22Refactor part of codegen_call_terminatorEric Holk-47/+44
2022-08-19use <[u8]>::escape_ascii instead of core::ascii::escape_defaultKaDiWa-17/+8
2022-08-19Rollup merge of #100208 - RalfJung:dyn-upcast-nop, r=petrochenkovDylan DPC-0/+1
make NOP dyn casts not require anything about the vtable As suggested [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/dyn-upcasting.20stabilization/near/292151439). This matches what the codegen backends already do, and what Miri did do until https://github.com/rust-lang/rust/pull/99420 when I made it super extra paranoid.
2022-08-17Rollup merge of #100379 - davidtwco:triagebot-diag, r=Mark-SimulacrumMatthias Krüger-9/+11
triagebot: add translation-related mention groups - Move some code around so that triagebot can ping relevant parties when translation logic is modified. - Add mention groups to triagebot for translation-related files/folders. - Auto-label pull requests with changes to translation-related files/folders with `A-translation`. r? `@Mark-Simulacrum`
2022-08-16Move the cast_float_to_int fallback code to GCCJosh Stone-155/+3
Now that we require at least LLVM 13, that codegen backend is always using its intrinsic `fptosi.sat` and `fptoui.sat` conversions, so it doesn't need the manual implementation. However, the GCC backend still needs it, so we can move all of that code down there.
2022-08-15Rollup merge of #100528 - tux3:riscv-bitmanip-features, r=davidtwcoMatthias Krüger-0/+4
Support 1st group of RISC-V Bitmanip backend target features These target features use the same names as LLVM and `is_riscv_feature_detected!`, they are: - zba (address generation instructions) - zbb (basic bit manipulation) - zbc (carry-less multiplication) - zbs (single-bit manipulation) The extension is frozen and ratified, and I don't think we should expect LLVM to change those feature names in the future. For reference, the specification for the B extension can be found here: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf) On my current project, I see a 7.6% reduction in binary size with these features on, so I have some incentive to try to silence the "unknown feature" warning from `-Ctarget-feature` =)
2022-08-15Auto merge of #98393 - michaelwoerister:new-cpp-like-enum-debuginfo, ↵bors-50/+6
r=wesleywiser debuginfo: Generalize C++-like encoding for enums. The updated encoding should be able to handle niche layouts where more than one variant has fields (as introduced in https://github.com/rust-lang/rust/pull/94075). The new encoding is more uniform as there is no structural difference between direct-tag, niche-tag, and no-tag layouts anymore. The only difference between those cases is that the "dataful" variant in a niche-tag enum will have a `(start, end)` pair denoting the tag range instead of a single value. The new encoding now also supports 128-bit tags, which occur in at least some standard library types. These tags are represented as `u64` pairs so that debuggers (which don't always have support for 128-bit integers) can reliably deal with them. The downside is that this adds quite a bit of complexity to the encoding and especially to the corresponding NatVis. The new encoding seems to increase the size of (x86_64-pc-windows-msvc) debuginfo by 10-15%. The size of binaries is not affected (release builds were built with `-Cdebuginfo=2`, numbers are in kilobytes): EXE | before | after | relative -- | -- | -- | -- cargo (debug) | 40453 | 40450 | +0% ripgrep (debug) | 10275 | 10273 | +0% cargo (release) | 16186 | 16185 | +0% ripgrep (release) | 4727 | 4726 | +0% PDB | before | after | relative -- | -- | -- | -- cargo (debug) | 236524 | 261412 | +11% ripgrep (debug) | 53140 | 59060 | +11% cargo (release) | 148516 | 169620 | +14% ripgrep (release) | 10676 | 11804 | +11% Given that the new encoding is more general, this is to be expected. Only platforms using C++-like debuginfo are affected -- which currently is only `*-pc-windows-msvc`. *TODO* - [x] Properly update documentation - [x] Add regression tests for new optimized enum layouts as introduced by #94075. r? `@wesleywiser`
2022-08-15errors: move translation logic into moduleDavid Wood-9/+11
Just moving code around so that triagebot can ping relevant parties when translation logic is modified. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-14feat: Target features for 1st group of RISC-V Bitmanip extensionstux3-0/+4
These use the same names as LLVM and is_riscv_feature_detected!: - zba (address generation instructions) - zbb (basic bit manipulation) - zbc (carry-less multiplication) - zbs (single-bit manipulation)
2022-08-12rustc_target: Update some old naming around self contained linkingVadim Petrochenkov-24/+26
The "fallback" naming pre-dates introduction of `-Clink-self-contained`
2022-08-12Use enum2<_> instead of enum<_> for Cpp-like debuginfo enum type names.Michael Woerister-2/+2
And add more comments about niche tag enum encoding.
2022-08-12debuginfo: Change C++-like encoding for enums.Michael Woerister-48/+4
The updated encoding should be able to handle niche layouts where more than one variant has fields.
2022-08-11Rollup merge of #99500 - tmandry:fuchsia-flags, r=petrochenkovMatthias Krüger-4/+16
Fix flags when using clang as linker for Fuchsia Don't add C runtime or set dynamic linker when linking with clang for Fuchsia. Clang already does this for us.
2022-08-10Fix flags when using clang as linker for FuchsiaTyler Mandry-4/+16
Don't add C runtime or set dynamic linker when linking with clang for Fuchsia. Clang already does this for us.
2022-08-09Add support for link-flavor rust-lld for macOSMary-1/+7
Also refactor iOS, watchOS and tvOS common code.
2022-08-06make NOP dyn casts not require anything about the vtableRalf Jung-0/+1
2022-08-06Change implementation of `-Z gcc-ld` and `lld-wrapper` againVadim Petrochenkov-14/+18
2022-08-05Auto merge of #100035 - workingjubilee:merge-functions, r=nikicbors-2/+5
Enable function merging when opt is for size It is, of course, natural to want to merge aliasing functions when optimizing for code size, since that can eliminate several bytes. And an exhaustive match helps make the code less brittle. Closes #98215.
2022-08-05Enable function merging when opt is for sizeJubilee Young-2/+5
It is, of course, natural to want to merge aliasing functions when optimizing for code size, since that can eliminate several bytes. And an exhaustive match helps make the code less brittle.
2022-08-04Auto merge of #100120 - matthiaskrgr:rollup-g6ycykq, r=matthiaskrgrbors-7/+10
Rollup of 6 pull requests Successful merges: - #98771 (Add support for link-flavor rust-lld for iOS, tvOS and watchOS) - #98835 (relate `closure_substs.parent_substs()` to parent fn in NLL) - #99746 (Use `TraitEngine` in more places that don't specifically need `FulfillmentContext::new_in_snapshot`) - #99786 (Recover from C++ style `enum struct`) - #99795 (Delay a bug when failed to normalize trait ref during specialization) - #100029 (Prevent ICE for `doc_alias` on match arm, statement, expression) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-03Add support for link-flavor rust-lld for iOS, tvOS and watchOSmary-7/+10
This adds support for rust-lld for Apple *OS targets. This was tested against targets "aarch64-apple-ios" and "aarch64-apple-ios-sim". For targets "armv7-apple-ios" and "armv7s-apple-ios", it doesn't link because of "symbols.o" not being generated with the correct CPU subtype (changes in the "object" crate needs to be done to support it).