diff options
| author | bors <bors@rust-lang.org> | 2020-10-14 02:48:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-10-14 02:48:05 +0000 |
| commit | 31e4087b9098c6174a22b294bea960d54013fe22 (patch) | |
| tree | 25be91294c8440c4c633661b4afde3a149a55fbe /compiler/rustc_codegen_llvm/src/lib.rs | |
| parent | 4ba5068815137eef403383582d3f17f3b6802217 (diff) | |
| parent | 54151a6afc1e3e5b7894da0635084ad35fc7d3c2 (diff) | |
| download | rust-31e4087b9098c6174a22b294bea960d54013fe22.tar.gz rust-31e4087b9098c6174a22b294bea960d54013fe22.zip | |
Auto merge of #77926 - Dylan-DPC:rollup-wttr8a1, r=Dylan-DPC
Rollup of 8 pull requests Successful merges: - #77765 (Add LLVM flags to limit DWARF version to 2 on BSD) - #77788 (BTreeMap: fix gdb provider on BTreeMap with ZST keys or values) - #77795 (Codegen backend interface refactor) - #77808 (Moved the main `impl` for FnCtxt to its own file.) - #77817 (Switch rustdoc from `clean::Stability` to `rustc_attr::Stability`) - #77829 (bootstrap: only use compiler-builtins-c if they exist) - #77870 (Use intra-doc links for links to module-level docs) - #77897 (Move `Strip` into a separate rustdoc pass) Failed merges: - #77879 (Provide better documentation and help messages for x.py setup) - #77902 (Include aarch64-pc-windows-msvc in the dist manifests) r? `@ghost`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/lib.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/lib.rs | 55 |
1 files changed, 12 insertions, 43 deletions
diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index b5f83118d0c..5974b59d39e 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -23,18 +23,17 @@ use rustc_codegen_ssa::back::write::{CodegenContext, FatLTOInput, ModuleConfig}; use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::ModuleCodegen; use rustc_codegen_ssa::{CodegenResults, CompiledModule}; +use rustc_data_structures::fx::FxHashMap; use rustc_errors::{ErrorReported, FatalError, Handler}; -use rustc_middle::dep_graph::{DepGraph, WorkProduct}; +use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; use rustc_middle::middle::cstore::{EncodedMetadata, MetadataLoaderDyn}; use rustc_middle::ty::{self, TyCtxt}; -use rustc_serialize::json; -use rustc_session::config::{self, OptLevel, OutputFilenames, PrintRequest}; +use rustc_session::config::{OptLevel, OutputFilenames, PrintRequest}; use rustc_session::Session; use rustc_span::symbol::Symbol; use std::any::Any; use std::ffi::CStr; -use std::fs; use std::sync::Arc; mod back { @@ -252,11 +251,11 @@ impl CodegenBackend for LlvmCodegenBackend { } fn provide(&self, providers: &mut ty::query::Providers) { - attributes::provide(providers); + attributes::provide_both(providers); } fn provide_extern(&self, providers: &mut ty::query::Providers) { - attributes::provide_extern(providers); + attributes::provide_both(providers); } fn codegen_crate<'tcx>( @@ -277,47 +276,27 @@ impl CodegenBackend for LlvmCodegenBackend { &self, ongoing_codegen: Box<dyn Any>, sess: &Session, - dep_graph: &DepGraph, - ) -> Result<Box<dyn Any>, ErrorReported> { + ) -> Result<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>), ErrorReported> { let (codegen_results, work_products) = ongoing_codegen .downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<LlvmCodegenBackend>>() .expect("Expected LlvmCodegenBackend's OngoingCodegen, found Box<Any>") .join(sess); - if sess.opts.debugging_opts.incremental_info { - rustc_codegen_ssa::back::write::dump_incremental_data(&codegen_results); - } - sess.time("serialize_work_products", move || { - rustc_incremental::save_work_product_index(sess, &dep_graph, work_products) + sess.time("llvm_dump_timing_file", || { + if sess.opts.debugging_opts.llvm_time_trace { + llvm_util::time_trace_profiler_finish("llvm_timings.json"); + } }); - sess.compile_status()?; - - Ok(Box::new(codegen_results)) + Ok((codegen_results, work_products)) } fn link( &self, sess: &Session, - codegen_results: Box<dyn Any>, + codegen_results: CodegenResults, outputs: &OutputFilenames, ) -> Result<(), ErrorReported> { - let codegen_results = codegen_results - .downcast::<CodegenResults>() - .expect("Expected CodegenResults, found Box<Any>"); - - if sess.opts.debugging_opts.no_link { - // FIXME: use a binary format to encode the `.rlink` file - let rlink_data = json::encode(&codegen_results).map_err(|err| { - sess.fatal(&format!("failed to encode rlink: {}", err)); - })?; - let rlink_file = outputs.with_extension(config::RLINK_EXT); - fs::write(&rlink_file, rlink_data).map_err(|err| { - sess.fatal(&format!("failed to write file {}: {}", rlink_file.display(), err)); - })?; - return Ok(()); - } - // Run the linker on any artifacts that resulted from the LLVM run. // This should produce either a finished executable or library. sess.time("link_crate", || { @@ -334,16 +313,6 @@ impl CodegenBackend for LlvmCodegenBackend { ); }); - // Now that we won't touch anything in the incremental compilation directory - // any more, we can finalize it (which involves renaming it) - rustc_incremental::finalize_session_directory(sess, codegen_results.crate_hash); - - sess.time("llvm_dump_timing_file", || { - if sess.opts.debugging_opts.llvm_time_trace { - llvm_util::time_trace_profiler_finish("llvm_timings.json"); - } - }); - Ok(()) } } |
