use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_data_structures::profiling::TimingGuard;
use rustc_data_structures::profiling::VerboseTimingGuard;
-use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::Lrc;
use rustc_errors::emitter::Emitter;
use rustc_errors::{DiagnosticId, FatalError, Handler, Level};
let emit_obj = if !should_emit_obj {
EmitObj::None
- } else if sess.target.target.options.obj_is_bitcode
+ } else if sess.target.obj_is_bitcode
|| (sess.opts.cg.linker_plugin_lto.enabled() && !no_builtins)
{
// This case is selected if the target uses objects as bitcode, or
false
),
emit_obj,
- bc_cmdline: sess.target.target.options.bitcode_llvm_cmdline.clone(),
+ bc_cmdline: sess.target.bitcode_llvm_cmdline.clone(),
verify_llvm_ir: sess.verify_llvm_ir(),
no_prepopulate_passes: sess.opts.cg.no_prepopulate_passes,
- no_builtins: no_builtins || sess.target.target.options.no_builtins,
+ no_builtins: no_builtins || sess.target.no_builtins,
// Exclude metadata and allocator modules from time_passes output,
// since they throw off the "LLVM passes" measurement.
.opts
.debugging_opts
.merge_functions
- .unwrap_or(sess.target.target.options.merge_functions)
+ .unwrap_or(sess.target.merge_functions)
{
MergeFunctions::Disabled => false,
MergeFunctions::Trampolines | MergeFunctions::Aliases => {
pub allocator_module_config: Arc<ModuleConfig>,
pub tm_factory: TargetMachineFactory<B>,
pub msvc_imps_needed: bool,
- pub target_pointer_width: String,
+ pub target_pointer_width: u32,
pub target_arch: String,
pub debuginfo: config::DebugInfo,
let requested_for_rlib = sess.opts.cg.embed_bitcode
&& sess.crate_types().contains(&CrateType::Rlib)
&& sess.opts.output_types.contains_key(&OutputType::Exe);
- let forced_by_target = sess.target.target.options.forces_embed_bitcode;
+ let forced_by_target = sess.target.forces_embed_bitcode;
requested_for_rlib || forced_by_target
}
let sess = tcx.sess;
let crate_name = tcx.crate_name(LOCAL_CRATE);
- let crate_hash = tcx.crate_hash(LOCAL_CRATE);
let no_builtins = tcx.sess.contains_name(&tcx.hir().krate().item.attrs, sym::no_builtins);
let is_compiler_builtins =
tcx.sess.contains_name(&tcx.hir().krate().item.attrs, sym::compiler_builtins);
OngoingCodegen {
backend,
crate_name,
- crate_hash,
metadata,
windows_subsystem,
linker_info,
// These are used in linking steps and will be cleaned up afterward.
}
-pub fn dump_incremental_data(_codegen_results: &CodegenResults) {
- // FIXME(mw): This does not work at the moment because the situation has
- // become more complicated due to incremental LTO. Now a CGU
- // can have more than two caching states.
- // println!("[incremental] Re-using {} out of {} modules",
- // codegen_results.modules.iter().filter(|m| m.pre_existing).count(),
- // codegen_results.modules.len());
-}
-
pub enum WorkItem<B: WriteBackendMethods> {
/// Optimize a newly codegened, totally unoptimized module.
Optimize(ModuleCodegen<B::Module>),
tm_factory: TargetMachineFactory(backend.target_machine_factory(tcx.sess, ol)),
total_cgus,
msvc_imps_needed: msvc_imps_needed(tcx),
- target_pointer_width: tcx.sess.target.target.target_pointer_width.clone(),
- target_arch: tcx.sess.target.target.arch.clone(),
+ target_pointer_width: tcx.sess.target.pointer_width,
+ target_arch: tcx.sess.target.arch.clone(),
debuginfo: tcx.sess.opts.debuginfo,
};
// necessary. There's already optimizations in place to avoid sending work
// back to the coordinator if LTO isn't requested.
return thread::spawn(move || {
- let max_workers = ::num_cpus::get();
+ let max_workers = num_cpus::get();
let mut worker_id_counter = 0;
let mut free_worker_ids = Vec::new();
let mut get_worker_id = |free_worker_ids: &mut Vec<usize>| {
}
}
-pub const CODEGEN_WORKER_ID: usize = usize::MAX;
-
/// `FatalError` is explicitly not `Send`.
#[must_use]
pub struct WorkerFatalError;
pub struct OngoingCodegen<B: ExtraBackendMethods> {
pub backend: B,
pub crate_name: Symbol,
- pub crate_hash: Svh,
pub metadata: EncodedMetadata,
pub windows_subsystem: Option<String>,
pub linker_info: LinkerInfo,
(
CodegenResults {
crate_name: self.crate_name,
- crate_hash: self.crate_hash,
metadata: self.metadata,
windows_subsystem: self.windows_subsystem,
linker_info: self.linker_info,
// something is wrong with commandline arg validation.
assert!(
!(tcx.sess.opts.cg.linker_plugin_lto.enabled()
- && tcx.sess.target.target.options.is_like_windows
+ && tcx.sess.target.is_like_windows
&& tcx.sess.opts.cg.prefer_dynamic)
);
- tcx.sess.target.target.options.is_like_windows &&
+ tcx.sess.target.is_like_windows &&
tcx.sess.crate_types().iter().any(|ct| *ct == CrateType::Rlib) &&
// ThinLTO can't handle this workaround in all cases, so we don't
// emit the `__imp_` symbols. Instead we make them unnecessary by disallowing