Remove MachBackend

It is identical to TargetIsa
This commit is contained in:
bjorn3
2022-01-06 14:39:24 +01:00
parent 58c25d9e24
commit 376c93bda0
8 changed files with 75 additions and 189 deletions

View File

@@ -2,15 +2,15 @@
use crate::ir::condcodes::IntCC;
use crate::ir::Function;
use crate::isa::Builder as IsaBuilder;
use crate::isa::{Builder as IsaBuilder, TargetIsa};
use crate::machinst::{
compile, MachBackend, MachCompileResult, MachTextSectionBuilder, TargetIsaAdapter,
TextSectionBuilder, VCode,
compile, MachCompileResult, MachTextSectionBuilder, TextSectionBuilder, VCode,
};
use crate::result::CodegenResult;
use crate::settings;
use alloc::{boxed::Box, vec::Vec};
use core::fmt;
use regalloc::{PrettyPrint, RealRegUniverse};
use target_lexicon::{Architecture, ArmArchitecture, Triple};
@@ -53,7 +53,7 @@ impl Arm32Backend {
}
}
impl MachBackend for Arm32Backend {
impl TargetIsa for Arm32Backend {
fn compile_function(
&self,
func: &Function,
@@ -100,6 +100,15 @@ impl MachBackend for Arm32Backend {
Vec::new()
}
#[cfg(feature = "unwind")]
fn emit_unwind_info(
&self,
_result: &MachCompileResult,
_kind: crate::machinst::UnwindInfoKind,
) -> CodegenResult<Option<crate::isa::unwind::UnwindInfo>> {
Ok(None) // FIXME implement this
}
fn unsigned_add_overflow_condition(&self) -> IntCC {
// Carry flag set.
IntCC::UnsignedGreaterThanOrEqual
@@ -110,6 +119,16 @@ impl MachBackend for Arm32Backend {
}
}
impl fmt::Display for Arm32Backend {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("MachBackend")
.field("name", &self.name())
.field("triple", &self.triple())
.field("flags", &format!("{}", self.flags()))
.finish()
}
}
/// Create a new `isa::Builder`.
pub fn isa_builder(triple: Triple) -> IsaBuilder {
assert!(match triple.architecture {
@@ -123,7 +142,7 @@ pub fn isa_builder(triple: Triple) -> IsaBuilder {
setup: settings::builder(),
constructor: |triple, shared_flags, _| {
let backend = Arm32Backend::new_with_flags(triple, shared_flags);
Box::new(TargetIsaAdapter::new(backend))
Box::new(backend)
},
}
}