diff --git a/cranelift/codegen/src/isa/legacy/mod.rs b/cranelift/codegen/src/isa/legacy/mod.rs new file mode 100644 index 0000000000..a89230f941 --- /dev/null +++ b/cranelift/codegen/src/isa/legacy/mod.rs @@ -0,0 +1,12 @@ +//! Legacy ("old-style") backends that will be removed in the future. + +// N.B.: the old x86-64 backend (`x86`) and the new one (`x64`) are both +// included whenever building with x86 support. The new backend is the default, +// but the old can be requested with `BackendVariant::Legacy`. However, if this +// crate is built with the `old-x86-backend` feature, then the old backend is +// default instead. +#[cfg(feature = "x86")] +pub(crate) mod x86; + +#[cfg(feature = "riscv")] +pub(crate) mod riscv; diff --git a/cranelift/codegen/src/isa/riscv/abi.rs b/cranelift/codegen/src/isa/legacy/riscv/abi.rs similarity index 100% rename from cranelift/codegen/src/isa/riscv/abi.rs rename to cranelift/codegen/src/isa/legacy/riscv/abi.rs diff --git a/cranelift/codegen/src/isa/riscv/binemit.rs b/cranelift/codegen/src/isa/legacy/riscv/binemit.rs similarity index 100% rename from cranelift/codegen/src/isa/riscv/binemit.rs rename to cranelift/codegen/src/isa/legacy/riscv/binemit.rs diff --git a/cranelift/codegen/src/isa/riscv/enc_tables.rs b/cranelift/codegen/src/isa/legacy/riscv/enc_tables.rs similarity index 100% rename from cranelift/codegen/src/isa/riscv/enc_tables.rs rename to cranelift/codegen/src/isa/legacy/riscv/enc_tables.rs diff --git a/cranelift/codegen/src/isa/riscv/mod.rs b/cranelift/codegen/src/isa/legacy/riscv/mod.rs similarity index 100% rename from cranelift/codegen/src/isa/riscv/mod.rs rename to cranelift/codegen/src/isa/legacy/riscv/mod.rs diff --git a/cranelift/codegen/src/isa/riscv/registers.rs b/cranelift/codegen/src/isa/legacy/riscv/registers.rs similarity index 100% rename from cranelift/codegen/src/isa/riscv/registers.rs rename to cranelift/codegen/src/isa/legacy/riscv/registers.rs diff --git a/cranelift/codegen/src/isa/riscv/settings.rs b/cranelift/codegen/src/isa/legacy/riscv/settings.rs similarity index 100% rename from cranelift/codegen/src/isa/riscv/settings.rs rename to cranelift/codegen/src/isa/legacy/riscv/settings.rs diff --git a/cranelift/codegen/src/isa/x86/abi.rs b/cranelift/codegen/src/isa/legacy/x86/abi.rs similarity index 99% rename from cranelift/codegen/src/isa/x86/abi.rs rename to cranelift/codegen/src/isa/legacy/x86/abi.rs index 69c1e1b761..934cfec4dd 100644 --- a/cranelift/codegen/src/isa/x86/abi.rs +++ b/cranelift/codegen/src/isa/legacy/x86/abi.rs @@ -1,6 +1,6 @@ //! x86 ABI implementation. -use super::super::settings as shared_settings; +use super::super::super::settings as shared_settings; use super::registers::{FPR, GPR, RU}; use super::settings as isa_settings; use crate::abi::{legalize_args, ArgAction, ArgAssigner, ValueConversion}; diff --git a/cranelift/codegen/src/isa/x86/binemit.rs b/cranelift/codegen/src/isa/legacy/x86/binemit.rs similarity index 100% rename from cranelift/codegen/src/isa/x86/binemit.rs rename to cranelift/codegen/src/isa/legacy/x86/binemit.rs diff --git a/cranelift/codegen/src/isa/x86/enc_tables.rs b/cranelift/codegen/src/isa/legacy/x86/enc_tables.rs similarity index 100% rename from cranelift/codegen/src/isa/x86/enc_tables.rs rename to cranelift/codegen/src/isa/legacy/x86/enc_tables.rs diff --git a/cranelift/codegen/src/isa/x86/mod.rs b/cranelift/codegen/src/isa/legacy/x86/mod.rs similarity index 98% rename from cranelift/codegen/src/isa/x86/mod.rs rename to cranelift/codegen/src/isa/legacy/x86/mod.rs index 54efe7fcfd..e61fda1931 100644 --- a/cranelift/codegen/src/isa/x86/mod.rs +++ b/cranelift/codegen/src/isa/legacy/x86/mod.rs @@ -178,7 +178,7 @@ impl TargetIsa for Isa { fn create_unwind_info( &self, func: &ir::Function, - ) -> CodegenResult> { + ) -> CodegenResult> { abi::create_unwind_info(func, self) } diff --git a/cranelift/codegen/src/isa/x86/registers.rs b/cranelift/codegen/src/isa/legacy/x86/registers.rs similarity index 100% rename from cranelift/codegen/src/isa/x86/registers.rs rename to cranelift/codegen/src/isa/legacy/x86/registers.rs diff --git a/cranelift/codegen/src/isa/x86/settings.rs b/cranelift/codegen/src/isa/legacy/x86/settings.rs similarity index 100% rename from cranelift/codegen/src/isa/x86/settings.rs rename to cranelift/codegen/src/isa/legacy/x86/settings.rs diff --git a/cranelift/codegen/src/isa/x86/unwind.rs b/cranelift/codegen/src/isa/legacy/x86/unwind.rs similarity index 100% rename from cranelift/codegen/src/isa/x86/unwind.rs rename to cranelift/codegen/src/isa/legacy/x86/unwind.rs diff --git a/cranelift/codegen/src/isa/x86/unwind/systemv.rs b/cranelift/codegen/src/isa/legacy/x86/unwind/systemv.rs similarity index 100% rename from cranelift/codegen/src/isa/x86/unwind/systemv.rs rename to cranelift/codegen/src/isa/legacy/x86/unwind/systemv.rs diff --git a/cranelift/codegen/src/isa/x86/unwind/winx64.rs b/cranelift/codegen/src/isa/legacy/x86/unwind/winx64.rs similarity index 100% rename from cranelift/codegen/src/isa/x86/unwind/winx64.rs rename to cranelift/codegen/src/isa/legacy/x86/unwind/winx64.rs diff --git a/cranelift/codegen/src/isa/mod.rs b/cranelift/codegen/src/isa/mod.rs index 481c0c8de3..80a2599d38 100644 --- a/cranelift/codegen/src/isa/mod.rs +++ b/cranelift/codegen/src/isa/mod.rs @@ -70,17 +70,6 @@ use core::fmt::{Debug, Formatter}; use core::hash::Hasher; use target_lexicon::{triple, Architecture, OperatingSystem, PointerWidth, Triple}; -#[cfg(feature = "riscv")] -mod riscv; - -// N.B.: the old x86-64 backend (`x86`) and the new one (`x64`) are both -// included whenever building with x86 support. The new backend is the default, -// but the old can be requested with `BackendVariant::Legacy`. However, if this -// crate is built with the `old-x86-backend` feature, then the old backend is -// default instead. -#[cfg(feature = "x86")] -mod x86; - // This module is made public here for benchmarking purposes. No guarantees are // made regarding API stability. #[cfg(feature = "x86")] @@ -95,6 +84,15 @@ pub(crate) mod aarch64; #[cfg(feature = "s390x")] mod s390x; +#[cfg(any(feature = "x86", feature = "riscv"))] +mod legacy; + +#[cfg(feature = "x86")] +use legacy::x86; + +#[cfg(feature = "riscv")] +use legacy::riscv; + pub mod unwind; mod call_conv;