Make get_mach_backend non-optional
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -258,10 +258,8 @@ pub trait TargetIsa: fmt::Display + Send + Sync {
|
||||
None
|
||||
}
|
||||
|
||||
/// Get the new-style MachBackend, if this is an adapter around one.
|
||||
fn get_mach_backend(&self) -> Option<&dyn MachBackend> {
|
||||
None
|
||||
}
|
||||
/// Get the new-style MachBackend.
|
||||
fn get_mach_backend(&self) -> &dyn MachBackend;
|
||||
}
|
||||
|
||||
/// Methods implemented for free for target ISA!
|
||||
|
||||
@@ -55,8 +55,8 @@ impl TargetIsa for TargetIsaAdapter {
|
||||
self.backend.isa_flags()
|
||||
}
|
||||
|
||||
fn get_mach_backend(&self) -> Option<&dyn MachBackend> {
|
||||
Some(&*self.backend)
|
||||
fn get_mach_backend(&self) -> &dyn MachBackend {
|
||||
&*self.backend
|
||||
}
|
||||
|
||||
fn unsigned_add_overflow_condition(&self) -> ir::condcodes::IntCC {
|
||||
|
||||
Reference in New Issue
Block a user