diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2021-03-29 10:13:50 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2021-05-02 18:00:20 +0200 |
| commit | c47eeac61290cd3ef7994e0d68e754eb36d15001 (patch) | |
| tree | 33ca743d8db6246707692a5f383550d09f4bc0ee /compiler/rustc_codegen_llvm/src | |
| parent | 808090eb073d8b2d56479045b6ef0fe67872a077 (diff) | |
| download | rust-c47eeac61290cd3ef7994e0d68e754eb36d15001.tar.gz rust-c47eeac61290cd3ef7994e0d68e754eb36d15001.zip | |
Move wasm_import_module_map provider to cg_ssa
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/attributes.rs | 31 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/lib.rs | 9 |
2 files changed, 2 insertions, 38 deletions
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 64ebe585dd8..aed61e37646 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -4,12 +4,10 @@ use std::ffi::CString; use cstr::cstr; use rustc_codegen_ssa::traits::*; -use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::small_c_str::SmallCStr; use rustc_hir::def_id::DefId; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::ty::layout::HasTyCtxt; -use rustc_middle::ty::query::Providers; use rustc_middle::ty::{self, TyCtxt}; use rustc_session::config::{OptLevel, SanitizerSet}; use rustc_session::Session; @@ -339,35 +337,6 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty:: } } -pub fn provide_both(providers: &mut Providers) { - providers.wasm_import_module_map = |tcx, cnum| { - // Build up a map from DefId to a `NativeLib` structure, where - // `NativeLib` internally contains information about - // `#[link(wasm_import_module = "...")]` for example. - let native_libs = tcx.native_libraries(cnum); - - let def_id_to_native_lib = native_libs - .iter() - .filter_map(|lib| lib.foreign_module.map(|id| (id, lib))) - .collect::<FxHashMap<_, _>>(); - - let mut ret = FxHashMap::default(); - for (def_id, lib) in tcx.foreign_modules(cnum).iter() { - let module = def_id_to_native_lib.get(&def_id).and_then(|s| s.wasm_import_module); - let module = match module { - Some(s) => s, - None => continue, - }; - ret.extend(lib.foreign_items.iter().map(|id| { - assert_eq!(id.krate, cnum); - (*id, module.to_string()) - })); - } - - ret - }; -} - fn wasm_import_module(tcx: TyCtxt<'_>, id: DefId) -> Option<CString> { tcx.wasm_import_module_map(id.krate).get(&id).map(|s| CString::new(&s[..]).unwrap()) } diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index 4707d17f18e..6ce11a9dfcf 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -253,13 +253,8 @@ impl CodegenBackend for LlvmCodegenBackend { Box::new(metadata::LlvmMetadataLoader) } - fn provide(&self, providers: &mut ty::query::Providers) { - attributes::provide_both(providers); - } - - fn provide_extern(&self, providers: &mut ty::query::Providers) { - attributes::provide_both(providers); - } + fn provide(&self, _providers: &mut ty::query::Providers) {} + fn provide_extern(&self, _providers: &mut ty::query::Providers) {} fn codegen_crate<'tcx>( &self, |
