cg_ssa: introduce TargetMachineFactoryFn
alias
This commit removes the `TargetMachineFactory` struct and adds a `TargetMachineFactoryFn` type alias which is used everywhere that the previous, long type was used. Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
parent
cf49c2a1ef
commit
6890312ea3
5 changed files with 16 additions and 21 deletions
|
@ -19,7 +19,9 @@ use back::write::{create_informational_target_machine, create_target_machine};
|
|||
pub use llvm_util::target_features;
|
||||
use rustc_ast::expand::allocator::AllocatorKind;
|
||||
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
|
||||
use rustc_codegen_ssa::back::write::{CodegenContext, FatLTOInput, ModuleConfig};
|
||||
use rustc_codegen_ssa::back::write::{
|
||||
CodegenContext, FatLTOInput, ModuleConfig, TargetMachineFactoryFn,
|
||||
};
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
use rustc_codegen_ssa::ModuleCodegen;
|
||||
use rustc_codegen_ssa::{CodegenResults, CompiledModule};
|
||||
|
@ -34,7 +36,6 @@ use rustc_span::symbol::Symbol;
|
|||
|
||||
use std::any::Any;
|
||||
use std::ffi::CStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
mod back {
|
||||
pub mod archive;
|
||||
|
@ -109,7 +110,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend {
|
|||
&self,
|
||||
sess: &Session,
|
||||
optlvl: OptLevel,
|
||||
) -> Arc<dyn Fn() -> Result<&'static mut llvm::TargetMachine, String> + Send + Sync> {
|
||||
) -> TargetMachineFactoryFn<Self> {
|
||||
back::write::target_machine_factory(sess, optlvl)
|
||||
}
|
||||
fn target_cpu<'b>(&self, sess: &'b Session) -> &'b str {
|
||||
|
@ -352,7 +353,7 @@ impl ModuleLlvm {
|
|||
unsafe {
|
||||
let llcx = llvm::LLVMRustContextCreate(cgcx.fewer_names);
|
||||
let llmod_raw = back::lto::parse_module(llcx, name, buffer, handler)?;
|
||||
let tm = match (cgcx.tm_factory.0)() {
|
||||
let tm = match (cgcx.tm_factory)() {
|
||||
Ok(m) => m,
|
||||
Err(e) => {
|
||||
handler.struct_err(&e).emit();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue