diff options
| author | Simonas Kazlauskas <git@kazlauskas.me> | 2019-02-20 22:27:00 +0200 |
|---|---|---|
| committer | Simonas Kazlauskas <git@kazlauskas.me> | 2019-03-27 04:03:42 +0200 |
| commit | 8d4afbe4136933b47082dd1efa9c1132a31dfb0d (patch) | |
| tree | 6d73dd5ad453677b17d88c4dccf1d4c7b1da27e2 /src/librustc_codegen_llvm/back | |
| parent | 54479c624cc24bb852291d83e11cc19389dcb21b (diff) | |
| download | rust-8d4afbe4136933b47082dd1efa9c1132a31dfb0d.tar.gz rust-8d4afbe4136933b47082dd1efa9c1132a31dfb0d.zip | |
Use informational target machine for metadata
Since there is nothing to optimise there...
Diffstat (limited to 'src/librustc_codegen_llvm/back')
| -rw-r--r-- | src/librustc_codegen_llvm/back/write.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index dc4dd4e39e1..7f259024cee 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -10,9 +10,9 @@ use crate::type_::Type; use crate::context::{is_pie_binary, get_reloc_model}; use crate::common; use crate::LlvmCodegenBackend; +use rustc::hir::def_id::LOCAL_CRATE; use rustc_codegen_ssa::back::write::{CodegenContext, ModuleConfig, run_assembler}; use rustc_codegen_ssa::traits::*; -use rustc::hir::def_id::LOCAL_CRATE; use rustc::session::config::{self, OutputType, Passes, Lto}; use rustc::session::Session; use rustc::ty::TyCtxt; @@ -82,14 +82,6 @@ pub fn write_output_file( } } -pub fn create_target_machine( - tcx: TyCtxt<'_, '_, '_>, - find_features: bool, -) -> &'static mut llvm::TargetMachine { - target_machine_factory(tcx.sess, tcx.backend_optimization_level(LOCAL_CRATE), find_features)() - .unwrap_or_else(|err| llvm_err(tcx.sess.diagnostic(), &err).raise() ) -} - pub fn create_informational_target_machine( sess: &Session, find_features: bool, @@ -99,6 +91,15 @@ pub fn create_informational_target_machine( }) } +pub fn create_target_machine( + tcx: TyCtxt<'_, '_, '_>, + find_features: bool, +) -> &'static mut llvm::TargetMachine { + target_machine_factory(&tcx.sess, tcx.backend_optimization_level(LOCAL_CRATE), find_features)() + .unwrap_or_else(|err| { + llvm_err(tcx.sess.diagnostic(), &err).raise() + }) +} pub fn to_llvm_opt_settings(cfg: config::OptLevel) -> (llvm::CodeGenOptLevel, llvm::CodeGenOptSize) { |
