Skip to content

Commit fae4f45

Browse files
committed
Remove unused fields from CodegenContext.
1 parent 3bbf9f0 commit fae4f45

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

compiler/rustc_codegen_ssa/src/back/write.rs

-12
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ pub type ExportedSymbols = FxHashMap<CrateNum, Arc<Vec<(String, SymbolExportInfo
320320
#[derive(Clone)]
321321
pub struct CodegenContext<B: WriteBackendMethods> {
322322
// Resources needed when running LTO
323-
pub backend: B,
324323
pub prof: SelfProfilerRef,
325324
pub lto: Lto,
326325
pub save_temps: bool,
@@ -338,14 +337,10 @@ pub struct CodegenContext<B: WriteBackendMethods> {
338337
pub msvc_imps_needed: bool,
339338
pub is_pe_coff: bool,
340339
pub target_can_use_split_dwarf: bool,
341-
pub target_pointer_width: u32,
342340
pub target_arch: String,
343-
pub debuginfo: config::DebugInfo,
344341
pub split_debuginfo: rustc_target::spec::SplitDebuginfo,
345342
pub split_dwarf_kind: rustc_session::config::SplitDwarfKind,
346343

347-
/// Number of cgus excluding the allocator/metadata modules
348-
pub total_cgus: usize,
349344
/// Handler to use for diagnostics produced during codegen.
350345
pub diag_emitter: SharedEmitter,
351346
/// LLVM optimizations for which we want to print remarks.
@@ -441,7 +436,6 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
441436
target_cpu: String,
442437
metadata: EncodedMetadata,
443438
metadata_module: Option<CompiledModule>,
444-
total_cgus: usize,
445439
) -> OngoingCodegen<B> {
446440
let (coordinator_send, coordinator_receive) = channel();
447441
let sess = tcx.sess;
@@ -469,7 +463,6 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
469463
shared_emitter,
470464
codegen_worker_send,
471465
coordinator_receive,
472-
total_cgus,
473466
sess.jobserver.clone(),
474467
Arc::new(regular_config),
475468
Arc::new(metadata_config),
@@ -982,7 +975,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
982975
shared_emitter: SharedEmitter,
983976
codegen_worker_send: Sender<CguMessage>,
984977
coordinator_receive: Receiver<Box<dyn Any + Send>>,
985-
total_cgus: usize,
986978
jobserver: Client,
987979
regular_config: Arc<ModuleConfig>,
988980
metadata_config: Arc<ModuleConfig>,
@@ -1050,7 +1042,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
10501042
};
10511043
let backend_features = tcx.global_backend_features(());
10521044
let cgcx = CodegenContext::<B> {
1053-
backend: backend.clone(),
10541045
crate_types: sess.crate_types().to_vec(),
10551046
each_linked_rlib_for_lto,
10561047
lto: sess.lto(),
@@ -1071,13 +1062,10 @@ fn start_executing_work<B: ExtraBackendMethods>(
10711062
metadata_module_config: metadata_config,
10721063
allocator_module_config: allocator_config,
10731064
tm_factory: backend.target_machine_factory(tcx.sess, ol, backend_features),
1074-
total_cgus,
10751065
msvc_imps_needed: msvc_imps_needed(tcx),
10761066
is_pe_coff: tcx.sess.target.is_like_windows,
10771067
target_can_use_split_dwarf: tcx.sess.target_can_use_split_dwarf(),
1078-
target_pointer_width: tcx.sess.target.pointer_width,
10791068
target_arch: tcx.sess.target.arch.to_string(),
1080-
debuginfo: tcx.sess.opts.debuginfo,
10811069
split_debuginfo: tcx.sess.split_debuginfo(),
10821070
split_dwarf_kind: tcx.sess.opts.unstable_opts.split_dwarf_kind,
10831071
};

compiler/rustc_codegen_ssa/src/base.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
580580
) -> OngoingCodegen<B> {
581581
// Skip crate items and just output metadata in -Z no-codegen mode.
582582
if tcx.sess.opts.unstable_opts.no_codegen || !tcx.sess.opts.output_types.should_codegen() {
583-
let ongoing_codegen = start_async_codegen(backend, tcx, target_cpu, metadata, None, 1);
583+
let ongoing_codegen = start_async_codegen(backend, tcx, target_cpu, metadata, None);
584584

585585
ongoing_codegen.codegen_finished(tcx);
586586

@@ -631,14 +631,8 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
631631
})
632632
});
633633

634-
let ongoing_codegen = start_async_codegen(
635-
backend.clone(),
636-
tcx,
637-
target_cpu,
638-
metadata,
639-
metadata_module,
640-
codegen_units.len(),
641-
);
634+
let ongoing_codegen =
635+
start_async_codegen(backend.clone(), tcx, target_cpu, metadata, metadata_module);
642636

643637
// Codegen an allocator shim, if necessary.
644638
if let Some(kind) = allocator_kind_for_codegen(tcx) {

0 commit comments

Comments
 (0)