Commit Graph

49 Commits

Author SHA1 Message Date
Redddy 50db919f5d Change TODO in compiler to FIXME 2026-03-07 12:12:33 +00:00
bjorn3 eff0d4c6f4 Fuse codegen into LTO optimize methods 2026-03-03 15:25:43 +00:00
bjorn3 fa753a46c1 Remove code for ThinLTO from cg_gcc
It was just a dummy implementation to workarround the fact that thin
local lto is the default in rustc. By adding a thin_lto_supported thin
local lto can be automatically disabled for cg_gcc, removing the need
for this dummy implementation. This makes improvements to the LTO
handling on the cg_ssa side a lot easier.
2026-02-15 10:05:48 +00:00
bjorn3 506ed6dcb7 Remove SelfProfilerRef from CodegenContext
It can't be serialized to a file.
2026-02-12 12:44:14 +00:00
bjorn3 f49223c443 Remove tm_factory field from CodegenContext
This is necessary to support serializing the CodegenContext to a .rlink
file in the future for moving LTO to the -Zlink-only step.
2026-02-11 12:18:04 +00:00
Jacob Pratt 2206d935f7 Rollup merge of #149209 - lto_refactors8, r=jackh726
Move LTO to OngoingCodegen::join

This will make it easier to in the future move all this code to link_binary.

Follow up to https://github.com/rust-lang/rust/pull/147810
Part of https://github.com/rust-lang/compiler-team/issues/908
2026-01-21 02:04:01 -05:00
Guillaume Gomez 9fce61b21b Merge commit '55171cfa8b53970e06dcd2f5f2e2b8d82eeb0885' into subtree-update_cg_gcc_2025-11-26 2025-11-26 19:41:43 +01:00
bjorn3 2d7c571391 Remove SharedEmitter from CodegenContext 2025-11-23 10:33:52 +00:00
bjorn3 b93b4b003e Remove opts field from CodegenContext 2025-11-23 10:33:52 +00:00
Guillaume Gomez ca3e2ea0c2 Merge commit 'e785c50dad2944c7b4fb2d929de531f859db1e99' into subtree-update_cg_gcc_2025-11-04 2025-11-04 16:01:49 +01:00
Diggory Blake c6a952159f Restrict sysroot crate imports to those defined in this repo.
It's common to import dependencies from the sysroot via `extern crate`
rather than use an explicit cargo dependency, when it's necessary to use
the same dependency version as used by rustc itself. However, this is
dangerous for crates.io crates, since rustc may not pull in the
dependency on some targets, or may pull in multiple versions. In both
cases, the `extern crate` fails to resolve.

To address this, re-export all such dependencies from the appropriate
`rustc_*` crates, and use this alias from crates which would otherwise
need to use `extern crate`.
2025-10-15 13:17:25 +01:00
bjorn3 f2933b34a8 Remove want_summary argument from prepare_thin
It is always false nowadays. ThinLTO summary writing is instead done by
llvm_optimize.
2025-09-06 18:37:23 +00:00
bjorn3 e3d0b7d648 Remove thin_link_data method from ThinBufferMethods
It is only used within cg_llvm.
2025-09-06 18:37:23 +00:00
bjorn3 319fe230f0 Special case allocator module submission to avoid special casing it elsewhere
A lot of places had special handling just in case they would get an
allocator module even though most of these places could never get one or
would have a trivial implementation for the allocator module. Moving all
handling of the allocator module to a single place simplifies things a
fair bit.
2025-09-04 08:21:10 +00:00
bjorn3 525c6a3562 Directly raise fatal errors inside the codegen backends
As opposed to passing it around through Result.
2025-08-24 11:20:41 +00:00
bjorn3 948f7798d7 Remove support for -Zcombine-cgu
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-26 13:52:24 +00:00
bjorn3 dadc4cae50 Remove each_linked_rlib_for_lto from CodegenContext 2025-07-21 07:58:44 +00:00
bjorn3 1a6f941d2b Move exported_symbols_for_lto out of CodegenContext 2025-07-21 07:58:44 +00:00
bjorn3 6e757354ad Merge exported_symbols computation into exported_symbols_for_lto
And move exported_symbols_for_lto call from backends to cg_ssa.
2025-07-21 07:58:44 +00:00
bjorn3 1c8dc6f440 Move LTO symbol export calculation from backends to cg_ssa 2025-07-21 07:58:44 +00:00
bjorn3 112799e637 Merge modules and cached_modules for fat LTO
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-21 07:58:44 +00:00
bjorn3 7fd78df346 Move dcx creation into WriteBackendMethods::codegen 2025-07-03 14:43:09 +00:00
bjorn3 653bb64c75 Remove LtoModuleCodegen
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-03 14:28:18 +00:00
Guillaume Gomez c48d8d4d80 Merge commit 'fda0bb9588912a3e0606e880ca9f6e913cf8a5a4' into subtree-update_cg_gcc_2025-06-18 2025-06-18 15:11:44 +02:00
Guillaume Gomez 1c4ab86955 Merge commit '6ba33f5e1189a5ae58fb96ce3546e76b13d090f5' into subtree-update_cg_gcc_2025-05-14 2025-05-14 13:51:02 +02:00
Bryanskiy 14535312b5 Initial support for dynamically linked crates 2025-05-04 22:03:15 +03:00
Michael Goulet 9c372d8940 Prepend temp files with a string per invocation of rustc 2025-04-07 20:48:40 +00:00
Michael Goulet effef88ac7 Simplify temp path creation a bit 2025-04-07 20:48:40 +00:00
DianQK 9431427cc3 Add new_regular and new_allocator to ModuleCodegen 2025-02-23 21:23:38 +08:00
Askar Safin 851cc4bed4 compiler/rustc_codegen_gcc/src/back/lto.rs: delete "unsafe impl Sync/Send" 2025-02-11 09:47:13 +03:00
Antoni Boucher 06f0a9bc78 Merge commit '59a81c2ca1edc88ad3ac4b27a8e03977ffb8e73a' into subtree-update_cg_gcc_2025_01_12 2025-01-13 10:53:58 -05:00
Matthew Maurer fc32dd49cb llvm: Ignore error value that is always false
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-07 01:02:22 +00:00
Michael Goulet c682aa162b Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
Nicholas Nethercote bbe28cf1d9 Remove serialized_bitcode from LtoModuleCodegen.
It's unused.
2024-09-09 09:00:50 +10:00
Guillaume Gomez 7cbe50e209 Merge commit '98ed962c7d3eebe12c97588e61245273d265e72f' into master 2024-07-10 12:44:23 +02:00
Oli Scherer 7ba82d61eb Use a dedicated type instead of a reference for the diagnostic context
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18 15:42:11 +00:00
Michael Baikov 691e953da6 Save/restore more items in cache with incremental compilation 2024-04-06 10:59:24 -04:00
Guillaume Gomez 0d359efbe6 Merge commit 'b385428e3ddf330805241e7758e773f933357c4b' into subtree-update_cg_gcc_2024-03-05 2024-03-05 19:58:36 +01:00
Nicholas Nethercote f422dca3ae Rename many DiagCtxt arguments. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote 7c656bc05b Rename CodegenContext::create_diag_handler as CodegenContext::create_dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote cde19c016e Rename Handler as DiagCtxt. 2023-12-18 16:06:19 +11:00
Antoni Boucher 30290c8b41 Merge commit '11a0cceab966e5ff1058ddbcab5977e8a1d6d290' into subtree-update_cg_gcc_2023-10-09 2023-10-09 15:53:34 -04:00
Antoni Boucher 6bb2af0e6d Merge commit '08a6d6e16b5efe217123e780398969946266268f' into sync-cg_gcc-2023-03-04 2023-03-05 12:03:19 -05:00
Rémy Rakic af22801db0 simplify a self-profiling activity call in the cg_gcc backend 2022-04-07 15:47:20 +02:00
bjorn3 bbff48e094 Merge commit '39683d8eb7a32a74bea96ecbf1e87675d3338506' into sync_cg_gcc-2022-03-26 2022-03-26 18:29:37 +01:00
bjorn3 b799d6e0a5 Merge commit '1411a98352ba6bee8ba3b0131c9243e5db1e6a2e' into sync_cg_clif-2021-12-31 2021-12-31 16:26:32 +01:00
est31 15de4cbc4b Remove redundant [..]s 2021-12-09 00:01:29 +01:00
Antoni Boucher 3d5d4e324d Merge commit 'e228f0c16ea8c34794a6285bf57aab627c26b147' into libgccjit-codegen 2021-08-15 08:29:07 -04:00
Antoni Boucher f7237f16ae Add 'compiler/rustc_codegen_gcc/' from commit 'afae271d5d3719eeb92c18bc004bb6d1965a5f3f'
git-subtree-dir: compiler/rustc_codegen_gcc
git-subtree-mainline: ae90dcf020
git-subtree-split: afae271d5d
2021-08-12 21:53:49 -04:00