Make get_mach_backend non-optional

This commit is contained in:
bjorn3
2022-01-03 19:32:42 +01:00
parent b3aa692a44
commit e98a85e1e2
4 changed files with 13 additions and 55 deletions

View File

@@ -167,8 +167,7 @@ impl Context {
self.remove_constant_phis(isa)?;
// FIXME: make this non optional
let backend = isa.get_mach_backend().expect("only mach backends nowadays");
let backend = isa.get_mach_backend();
let result = backend.compile_function(&self.func, self.want_disasm)?;
let info = result.code_info();
self.mach_compile_result = Some(result);
@@ -243,12 +242,10 @@ impl Context {
&self,
isa: &dyn TargetIsa,
) -> CodegenResult<Option<crate::isa::unwind::UnwindInfo>> {
if let Some(backend) = isa.get_mach_backend() {
let unwind_info_kind = isa.unwind_info_kind();
let result = self.mach_compile_result.as_ref().unwrap();
return backend.emit_unwind_info(result, unwind_info_kind);
}
isa.create_unwind_info(&self.func)
let backend = isa.get_mach_backend();
let unwind_info_kind = isa.unwind_info_kind();
let result = self.mach_compile_result.as_ref().unwrap();
backend.emit_unwind_info(result, unwind_info_kind)
}
/// Run the verifier on the function.