Use informational target machine for metadata

Since there is nothing to optimise there...
This commit is contained in:
Simonas Kazlauskas
2019-02-20 22:27:00 +02:00
parent 54479c624c
commit 8d4afbe413
5 changed files with 35 additions and 18 deletions

View File

@@ -23,7 +23,7 @@
#![deny(rust_2018_idioms)]
#![allow(explicit_outlives_requirements)]
use back::write::create_target_machine;
use back::write::{create_target_machine, create_informational_target_machine};
use syntax_pos::symbol::Symbol;
extern crate flate2;
@@ -112,8 +112,9 @@ pub struct LlvmCodegenBackend(());
impl ExtraBackendMethods for LlvmCodegenBackend {
fn new_metadata(&self, tcx: TyCtxt<'_, '_, '_>, mod_name: &str) -> ModuleLlvm {
ModuleLlvm::new(tcx, mod_name)
ModuleLlvm::new_metadata(tcx, mod_name)
}
fn write_metadata<'b, 'gcx>(
&self,
tcx: TyCtxt<'b, 'gcx, 'gcx>,
@@ -363,7 +364,6 @@ impl ModuleLlvm {
unsafe {
let llcx = llvm::LLVMRustContextCreate(tcx.sess.fewer_names());
let llmod_raw = context::create_module(tcx, llcx, mod_name) as *const _;
ModuleLlvm {
llmod_raw,
llcx,
@@ -372,6 +372,18 @@ impl ModuleLlvm {
}
}
fn new_metadata(tcx: TyCtxt<'_, '_, '_>, mod_name: &str) -> Self {
unsafe {
let llcx = llvm::LLVMRustContextCreate(tcx.sess.fewer_names());
let llmod_raw = context::create_module(tcx, llcx, mod_name) as *const _;
ModuleLlvm {
llmod_raw,
llcx,
tm: create_informational_target_machine(&tcx.sess, false),
}
}
}
fn parse(
cgcx: &CodegenContext<LlvmCodegenBackend>,
name: &str,