Skip to content

Commit 8055b0a

Browse files
nnethercoteLegNeato
authored andcommitted
Update to nightly-2025-07-28.
- Need to create `dcx` in `back::codegen` instead of passing it in. - LTO changes from rust-lang/rust PR 143388 and PR 144062: - `run_fat_lto`, `optimize_fat`, and `autodiff` were merged into `run_and_optimize_fat_lto`, and the parameters were changed. - `run_thin_lto` parameters were changed. - `codegen` parameters were changed. - `LtoModuleCodegen` was removed. - Some `TypeMembershipCodegenMethods` methods changed arguments from `String` to `&[u8]`. - Need to update `target_feature_base_cc.stderr` for an innocuous looking DWARF `.loc` entry change.
1 parent e49a0cc commit 8055b0a

File tree

6 files changed

+27
-35
lines changed

6 files changed

+27
-35
lines changed

crates/rustc_codegen_nvvm/src/back.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,12 @@ pub extern "C" fn demangle_callback(
157157
/// Compile a single module (in an nvvm context this means getting the llvm bitcode out of it)
158158
pub(crate) unsafe fn codegen(
159159
cgcx: &CodegenContext<NvvmCodegenBackend>,
160-
dcx: DiagCtxtHandle<'_>,
161160
module: ModuleCodegen<LlvmMod>,
162161
config: &ModuleConfig,
163162
) -> Result<CompiledModule, FatalError> {
163+
let dcx = cgcx.create_dcx();
164+
let dcx = dcx.handle();
165+
164166
// For NVVM, all the codegen we need to do is turn the llvm modules
165167
// into llvm bitcode and write them to a tempdir. nvvm expects llvm
166168
// bitcode as the modules to be added to the program. Then as the last step

crates/rustc_codegen_nvvm/src/lib.rs

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ use rustc_ast::expand::autodiff_attrs::AutoDiffItem;
6363
use rustc_codegen_ssa::{
6464
CodegenResults, CompiledModule, ModuleCodegen, TargetConfig,
6565
back::{
66-
lto::{LtoModuleCodegen, SerializedModule, ThinModule},
66+
lto::{SerializedModule, ThinModule},
6767
write::{CodegenContext, FatLtoInput, ModuleConfig, OngoingCodegen},
6868
},
6969
traits::{CodegenBackend, ExtraBackendMethods, WriteBackendMethods},
@@ -83,6 +83,7 @@ use rustc_session::{
8383
use tracing::debug;
8484

8585
use std::ffi::CString;
86+
use std::path::PathBuf;
8687

8788
// codegen dylib entrypoint
8889
#[unsafe(no_mangle)]
@@ -275,19 +276,25 @@ impl WriteBackendMethods for NvvmCodegenBackend {
275276
todo!();
276277
}
277278

278-
fn run_fat_lto(
279-
_: &CodegenContext<Self>,
280-
_: Vec<FatLtoInput<Self>>,
281-
_: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
282-
) -> Result<LtoModuleCodegen<Self>, FatalError> {
279+
fn run_and_optimize_fat_lto(
280+
_cgcx: &CodegenContext<Self>,
281+
_exported_symbols_for_lto: &[String],
282+
_each_linked_rlib_for_lto: &[PathBuf],
283+
_modules: Vec<FatLtoInput<Self>>,
284+
_diff_fncs: Vec<AutoDiffItem>,
285+
) -> Result<ModuleCodegen<Self::Module>, FatalError> {
283286
todo!()
284287
}
285288

286289
fn run_thin_lto(
287290
cgcx: &CodegenContext<Self>,
291+
// FIXME: Limit LTO exports to these symbols
292+
_exported_symbols_for_lto: &[String],
293+
// FIXME: handle these? but only relevant for non-thin LTO?
294+
_each_linked_rlib_for_lto: &[PathBuf],
288295
modules: Vec<(String, Self::ThinBuffer)>,
289296
cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
290-
) -> Result<(Vec<LtoModuleCodegen<Self>>, Vec<WorkProduct>), FatalError> {
297+
) -> Result<(Vec<ThinModule<Self>>, Vec<WorkProduct>), FatalError> {
291298
lto::run_thin(cgcx, modules, cached_modules)
292299
}
293300

@@ -317,11 +324,10 @@ impl WriteBackendMethods for NvvmCodegenBackend {
317324

318325
fn codegen(
319326
cgcx: &CodegenContext<Self>,
320-
diag_handler: DiagCtxtHandle<'_>,
321327
module: ModuleCodegen<Self::Module>,
322328
config: &ModuleConfig,
323329
) -> Result<CompiledModule, FatalError> {
324-
unsafe { back::codegen(cgcx, diag_handler, module, config) }
330+
unsafe { back::codegen(cgcx, module, config) }
325331
}
326332

327333
fn prepare_thin(
@@ -346,22 +352,6 @@ impl WriteBackendMethods for NvvmCodegenBackend {
346352
)
347353
}
348354
}
349-
350-
fn optimize_fat(
351-
_cgcx: &CodegenContext<Self>,
352-
_llmod: &mut ModuleCodegen<Self::Module>,
353-
) -> Result<(), FatalError> {
354-
todo!()
355-
}
356-
357-
fn autodiff(
358-
_cgcx: &CodegenContext<Self>,
359-
_module: &ModuleCodegen<Self::Module>,
360-
_diff_fncs: Vec<AutoDiffItem>,
361-
_config: &ModuleConfig,
362-
) -> Result<(), FatalError> {
363-
todo!()
364-
}
365355
}
366356

367357
impl ExtraBackendMethods for NvvmCodegenBackend {

crates/rustc_codegen_nvvm/src/lto.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::sync::Arc;
44
use rustc_codegen_ssa::{
55
ModuleCodegen,
66
back::{
7-
lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared},
7+
lto::{SerializedModule, ThinModule, ThinShared},
88
write::CodegenContext,
99
},
1010
traits::{ModuleBufferMethods, ThinBufferMethods},
@@ -106,7 +106,7 @@ pub(crate) fn run_thin(
106106
_cgcx: &CodegenContext<NvvmCodegenBackend>,
107107
modules: Vec<(String, ThinBuffer)>,
108108
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
109-
) -> Result<(Vec<LtoModuleCodegen<NvvmCodegenBackend>>, Vec<WorkProduct>), FatalError> {
109+
) -> Result<(Vec<ThinModule<NvvmCodegenBackend>>, Vec<WorkProduct>), FatalError> {
110110
debug!("Running thin LTO");
111111
let mut thin_buffers = Vec::with_capacity(modules.len());
112112
let mut module_names = Vec::with_capacity(modules.len() + cached_modules.len());
@@ -142,10 +142,10 @@ pub(crate) fn run_thin(
142142

143143
let mut opt_jobs = vec![];
144144
for (module_index, _) in shared.module_names.iter().enumerate() {
145-
opt_jobs.push(LtoModuleCodegen::Thin(ThinModule {
145+
opt_jobs.push(ThinModule {
146146
shared: shared.clone(),
147147
idx: module_index,
148-
}));
148+
});
149149
}
150150

151151
Ok((opt_jobs, vec![]))

crates/rustc_codegen_nvvm/src/ty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,11 @@ impl<'tcx> CodegenCx<'_, 'tcx> {
651651
}
652652

653653
impl<'tcx> TypeMembershipCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
654-
fn add_type_metadata(&self, _function: Self::Function, _typeid: String) {}
654+
fn add_type_metadata(&self, _function: Self::Function, _typeid: &[u8]) {}
655655

656-
fn set_type_metadata(&self, _function: Self::Function, _typeid: String) {}
656+
fn set_type_metadata(&self, _function: Self::Function, _typeid: &[u8]) {}
657657

658-
fn typeid_metadata(&self, _typeid: String) -> Option<Self::Metadata> {
658+
fn typeid_metadata(&self, _typeid: &[u8]) -> Option<Self::Metadata> {
659659
None
660660
}
661661

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2025-07-14"
2+
channel = "nightly-2025-07-28"
33
components = ["clippy", "llvm-tools-preview", "rust-src", "rustc-dev", "rustfmt", "rust-analyzer"]

tests/compiletests/ui/dis/target_feature_base_cc.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ $L__tmp1:
1717
.loc 1 38 5
1818
bra.uni $L__tmp2;
1919
$L__tmp2:
20-
.loc 2 2180 9
20+
.loc 2 2198 9
2121
mov.u32 %r1, 1124204544;
2222
st.volatile.global.u32 [%rd2], %r1;
2323
$L__tmp3:

0 commit comments

Comments
 (0)