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
|
@ -274,16 +274,8 @@ impl ModuleConfig {
|
|||
}
|
||||
}
|
||||
|
||||
// HACK(eddyb) work around `#[derive]` producing wrong bounds for `Clone`.
|
||||
pub struct TargetMachineFactory<B: WriteBackendMethods>(
|
||||
pub Arc<dyn Fn() -> Result<B::TargetMachine, String> + Send + Sync>,
|
||||
);
|
||||
|
||||
impl<B: WriteBackendMethods> Clone for TargetMachineFactory<B> {
|
||||
fn clone(&self) -> Self {
|
||||
TargetMachineFactory(self.0.clone())
|
||||
}
|
||||
}
|
||||
pub type TargetMachineFactoryFn<B> =
|
||||
Arc<dyn Fn() -> Result<<B as WriteBackendMethods>::TargetMachine, String> + Send + Sync>;
|
||||
|
||||
pub type ExportedSymbols = FxHashMap<CrateNum, Arc<Vec<(String, SymbolExportLevel)>>>;
|
||||
|
||||
|
@ -305,7 +297,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
|
|||
pub regular_module_config: Arc<ModuleConfig>,
|
||||
pub metadata_module_config: Arc<ModuleConfig>,
|
||||
pub allocator_module_config: Arc<ModuleConfig>,
|
||||
pub tm_factory: TargetMachineFactory<B>,
|
||||
pub tm_factory: TargetMachineFactoryFn<B>,
|
||||
pub msvc_imps_needed: bool,
|
||||
pub is_pe_coff: bool,
|
||||
pub target_pointer_width: u32,
|
||||
|
@ -1020,7 +1012,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
|||
regular_module_config: regular_config,
|
||||
metadata_module_config: metadata_config,
|
||||
allocator_module_config: allocator_config,
|
||||
tm_factory: TargetMachineFactory(backend.target_machine_factory(tcx.sess, ol)),
|
||||
tm_factory: backend.target_machine_factory(tcx.sess, ol),
|
||||
total_cgus,
|
||||
msvc_imps_needed: msvc_imps_needed(tcx),
|
||||
is_pe_coff: tcx.sess.target.is_like_windows,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue