In #3721, we have been discussing what to do about the ARM32 backend in Cranelift. Currently, this backend supports only 32-bit types, which is insufficient for full Wasm-MVP; it's missing other critical bits, like floating-point support; and it has only ever been exercised, AFAIK, via the filetests for the individual CLIF instructions that are implemented. We were very very thankful for the original contribution of this backend, even in its partial state, and we had hoped at the time that we could eventually mature it in-tree until it supported e.g. Wasm and other use-cases. But that hasn't yet happened -- to the blame of no-one, to be clear, we just haven't had a contributor with sufficient time. Unfortunately, the existence of the backend and lack of active maintainer now potentially pose a bit of a burden as we hope to make continuing changes to the backend framework. For example, the ISLE migration, and the use of regalloc2 that it will allow, would need all of the existing lowering patterns in the hand-written ARM32 backend to be rewritten as ISLE rules. Given that we don't currently have the resources to do this, we think it's probably best if we, sadly, for now remove this partial backend. This is not in any way a statement of what we might accept in the future, though. If, in the future, an ARM32 backend updated to our latest codebase with an active maintainer were to appear, we'd be happy to merge it (and likewise for any other architecture!). But for now, this is probably the best path. Thanks again to the original contributor @jmkrauz and we hope that this work can eventually be brought back and reused if someone has the time to do so!
63 lines
1.6 KiB
Rust
63 lines
1.6 KiB
Rust
//! Define supported ISAs; includes ISA-specific instructions, encodings, registers, settings, etc.
|
|
use crate::cdsl::isa::TargetIsa;
|
|
use crate::shared::Definitions as SharedDefinitions;
|
|
use std::fmt;
|
|
|
|
mod arm64;
|
|
mod s390x;
|
|
pub(crate) mod x86;
|
|
|
|
/// Represents known ISA target.
|
|
#[derive(PartialEq, Copy, Clone)]
|
|
pub enum Isa {
|
|
X86,
|
|
Arm64,
|
|
S390x,
|
|
}
|
|
|
|
impl Isa {
|
|
/// Creates isa target using name.
|
|
pub fn from_name(name: &str) -> Option<Self> {
|
|
Isa::all()
|
|
.iter()
|
|
.cloned()
|
|
.find(|isa| isa.to_string() == name)
|
|
}
|
|
|
|
/// Creates isa target from arch.
|
|
pub fn from_arch(arch: &str) -> Option<Self> {
|
|
match arch {
|
|
"aarch64" => Some(Isa::Arm64),
|
|
"s390x" => Some(Isa::S390x),
|
|
x if ["x86_64", "i386", "i586", "i686"].contains(&x) => Some(Isa::X86),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
/// Returns all supported isa targets.
|
|
pub fn all() -> &'static [Isa] {
|
|
&[Isa::X86, Isa::Arm64, Isa::S390x]
|
|
}
|
|
}
|
|
|
|
impl fmt::Display for Isa {
|
|
// These names should be kept in sync with the crate features.
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
match *self {
|
|
Isa::X86 => write!(f, "x86"),
|
|
Isa::Arm64 => write!(f, "arm64"),
|
|
Isa::S390x => write!(f, "s390x"),
|
|
}
|
|
}
|
|
}
|
|
|
|
pub(crate) fn define(isas: &[Isa], shared_defs: &mut SharedDefinitions) -> Vec<TargetIsa> {
|
|
isas.iter()
|
|
.map(|isa| match isa {
|
|
Isa::X86 => x86::define(shared_defs),
|
|
Isa::Arm64 => arm64::define(shared_defs),
|
|
Isa::S390x => s390x::define(shared_defs),
|
|
})
|
|
.collect()
|
|
}
|