about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2025-01-24Make CodegenCx and Builder genericManuel Drehwald-2/+1
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2025-01-01upstream rustc_codegen_llvm changes for enzyme/autodiffManuel Drehwald-2/+17
2024-12-27Override `carrying_mul_add` in cg_llvmScott McMurray-0/+1
2024-12-19coverage: Store coverage source regions as `Span` until codegenZalathar-0/+1
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-1/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-11generalize 'forbidden feature' concept so that even (un)stable feature can ↵Ralf Jung-3/+3
be invalid to toggle Also rename some things for extra clarity
2024-12-06Remove all threading through of ErrorGuaranteed from the driverbjorn3-8/+3
It was inconsistently done (sometimes even within a single function) and most of the rest of the compiler uses fatal errors instead, which need to be caught using catch_with_exit_code anyway. Using fatal errors instead of ErrorGuaranteed everywhere in the driver simplifies things a bit.
2024-11-29Revert "Rollup merge of #133418 - Zalathar:spans, r=jieyouxu"Zalathar-1/+0
This reverts commit adf9b5fcd1de43eaf0a779e10612caee8b47bede, reversing changes made to af1ca153d4aed5ffe22445273aa388a8d3f8f4ae. Reverting due to <https://github.com/rust-lang/rust/issues/133606>.
2024-11-24coverage: Store coverage source regions as `Span` until codegenZalathar-0/+1
2024-11-09Pass owned CodegenResults to link_binarybjorn3-1/+1
After link_binary the temporary files referenced by CodegenResults are deleted, so calling link_binary again with the same CodegenResults should not be allowed.
2024-11-04Simplify FFI calls for `-Ztime-llvm-passes` and `-Zprint-codegen-stats`Zalathar-23/+4
2024-09-26Use `&raw` in the compilerJosh Stone-2/+2
Like #130865 did for the standard library, we can use `&raw` in the compiler now that stage0 supports it. Also like the other issue, I did not make any doc or test changes at this time.
2024-09-24Dogfood `feature(file_buffered)`Josh Stone-0/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-09-05update cfgsBoxy-1/+0
2024-08-27Rollup merge of #129635 - compiler-errors:unsafe-blocks, r=spastorinoMatthias Krüger-0/+1
Use unsafe extern blocks throughout the compiler Making this change in preparation for edition 2024. r? spastorino
2024-08-26Use unsafe extern blocks throughout the compilerMichael Goulet-0/+1
2024-08-16Add `warn(unreachable_pub)` to `rustc_codegen_llvm`.Nicholas Nethercote-4/+5
2024-08-11Use assert_matches around the compilerMichael Goulet-0/+1
2024-08-07Don't use LLVM to compute -Ctarget-featureCaleb Zulawski-2/+2
2024-08-07Don't use LLVM's target featuresCaleb Zulawski-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-9/+8
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-16Fix unsafe_op_in_unsafe_fn in compilerMichael Goulet-3/+3
2024-06-21Remove PrintBackendInfo traitbjorn3-11/+13
It is only implemented for a single type. Directly passing this type is simpler and avoids overhead from indirect calls.
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-6/+7
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-3/+5
We already do this for a number of crates, e.g. `rustc_middle`, `rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`. For the ones we don't, in many cases the attributes are a mess. - There is no consistency about order of attribute kinds (e.g. `allow`/`deny`/`feature`). - Within attribute kind groups (e.g. the `feature` attributes), sometimes the order is alphabetical, and sometimes there is no particular order. - Sometimes the attributes of a particular kind aren't even grouped all together, e.g. there might be a `feature`, then an `allow`, then another `feature`. This commit extends the existing sorting to all compiler crates, increasing consistency. If any new attribute line is added there is now only one place it can go -- no need for arbitrary decisions. Exceptions: - `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`, because they have no crate attributes. - `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's ignored in `rustfmt.toml`).
2024-05-24Auto merge of #125463 - GuillaumeGomez:rollup-287wx4y, r=GuillaumeGomezbors-2/+5
Rollup of 6 pull requests Successful merges: - #125263 (rust-lld: fallback to rustc's sysroot if there's no path to the linker in the target sysroot) - #125345 (rustc_codegen_llvm: add support for writing summary bitcode) - #125362 (Actually use TAIT instead of emulating it) - #125412 (Don't suggest adding the unexpected cfgs to the build-script it-self) - #125445 (Migrate `run-make/rustdoc-with-short-out-dir-option` to `rmake.rs`) - #125452 (Cleanup check-cfg handling in core and std) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-23cleanup: run rustfmtAugie Fackler-1/+4
2024-05-23thinlto: only build summary file if neededAugie Fackler-2/+2
If we don't do this, some versions of LLVM (at least 17, experimentally) will double-emit some error messages, which is how I noticed this. Given that it seems to be costing some extra work, let's only request the summary bitcode production if we'll actually bother writing it down, otherwise skip it.
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_codegen_llvm`.Nicholas Nethercote-3/+0
2024-04-29Remove `extern crate rustc_macros` from numerous crates.Nicholas Nethercote-2/+0
2024-02-24compiler: use `addr_of!`Pavel Grigorenko-2/+2
2024-02-17Make `CodegenBackend::join_codegen` infallible.Nicholas Nethercote-2/+2
Because they all are, in practice.
2024-02-10Remove unnecessary `#![feature(min_specialization)]`Zalathar-1/+0
2024-02-06Invert diagnostic lints.Nicholas Nethercote-2/+0
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2024-01-25Remove unused featuresclubby789-2/+0
2023-12-22update cfg(bootstrap)sPietro Albini-1/+0
2023-12-18Rename many `DiagCtxt` and `EarlyDiagCtxt` locals.Nicholas Nethercote-2/+2
2023-12-18Rename many `DiagCtxt` arguments.Nicholas Nethercote-9/+9
2023-12-18Rename `CodegenContext::create_diag_handler` as `CodegenContext::create_dcx`.Nicholas Nethercote-1/+1
2023-12-18Rename `Handler` as `DiagCtxt`.Nicholas Nethercote-5/+5
2023-12-14Auto merge of #118566 - klensy:cstr-new, r=WaffleLapkinbors-0/+1
use c literals in compiler and library Relands refreshed https://github.com/rust-lang/rust/pull/111647
2023-12-12rustc_codegen_llvm: Enforce `rustc::potential_query_instability` lintMartin Nordholts-1/+0
Stop allowing `rustc::potential_query_instability` on all of `rustc_codegen_llvm` and instead allow it on a case-by-case basis. In this case, both instances are safe to allow.
2023-12-07Add emulated TLS supportquininer-1/+3
Currently LLVM uses emutls by default for some targets (such as android, openbsd), but rust does not use it, because `has_thread_local` is false. This commit has some changes to allow users to enable emutls: 1. add `-Zhas-thread-local` flag to specify that std uses `#[thread_local]` instead of pthread key. 2. when using emutls, decorate symbol names to find thread local symbol correctly. 3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated` to explicitly specify whether to generate emutls.
2023-12-03compiler: replace cstr macro with c str literals in compiler and few other c ↵klensy-0/+1
str replacements
2023-11-29Update compiler/rustc_codegen_llvm/src/lib.rsWesley Wiser-1/+1
Co-authored-by: Josh Stone <cuviper@gmail.com>
2023-11-29Dispose llvm::TargetMachines prior to llvm::Context being disposedWesley Wiser-5/+16
If the TargetMachine is disposed after the Context is disposed, it can lead to use after frees in some cases. I've observed this happening occasionally on code compiled for aarch64-pc-windows-msvc using `-Zstack-protector=strong` but other users have reported AVs from host aarch64-pc-windows-msvc compilers as well.
2023-11-26Use `rustc_fluent_macro::fluent_messages!` directly.Nicholas Nethercote-2/+1
Currently we always do this: ``` use rustc_fluent_macro::fluent_messages; ... fluent_messages! { "./example.ftl" } ``` But there is no need, we can just do this everywhere: ``` rustc_fluent_macro::fluent_messages! { "./example.ftl" } ``` which is shorter.
2023-11-26Avoid need for `{D,Subd}iagnosticMessage` imports.Nicholas Nethercote-1/+1
The `fluent_messages!` macro produces uses of `crate::{D,Subd}iagnosticMessage`, which means that every crate using the macro must have this import: ``` use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; ``` This commit changes the macro to instead use `rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the imports.
2023-11-21Tighten up linkage settings for LLVM bindingsBen Kimock-2/+2