mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-01 15:31:04 +00:00
48 lines
1.6 KiB
Rust
48 lines
1.6 KiB
Rust
|
#[macro_export]
|
||
|
macro_rules! wasmer_backends {
|
||
|
{ $($code:item)* } => {
|
||
|
#[cfg(feature = "backend-singlepass")]
|
||
|
#[cfg(test)]
|
||
|
mod singlepass {
|
||
|
use wasmer::compiler::{Backend, Compiler, compiler_for_backend};
|
||
|
#[allow(dead_code)]
|
||
|
fn get_backend() -> Backend {
|
||
|
Backend::Singlepass
|
||
|
}
|
||
|
#[allow(dead_code)]
|
||
|
fn get_compiler() -> Box<dyn Compiler> {
|
||
|
compiler_for_backend(get_backend()).expect("Backend must have a compiler")
|
||
|
}
|
||
|
$($code)*
|
||
|
}
|
||
|
#[cfg(feature = "backend-cranelift")]
|
||
|
#[cfg(test)]
|
||
|
mod cranelift {
|
||
|
use wasmer::compiler::{Backend, Compiler, compiler_for_backend};
|
||
|
#[allow(dead_code)]
|
||
|
fn get_backend() -> Backend {
|
||
|
Backend::Cranelift
|
||
|
}
|
||
|
#[allow(dead_code)]
|
||
|
fn get_compiler() -> Box<dyn Compiler> {
|
||
|
compiler_for_backend(get_backend()).expect("Backend must have a compiler")
|
||
|
}
|
||
|
$($code)*
|
||
|
}
|
||
|
#[cfg(feature = "backend-llvm")]
|
||
|
#[cfg(test)]
|
||
|
mod llvm {
|
||
|
use wasmer::compiler::{Backend, Compiler, compiler_for_backend};
|
||
|
#[allow(dead_code)]
|
||
|
fn get_backend() -> Backend {
|
||
|
Backend::LLVM
|
||
|
}
|
||
|
#[allow(dead_code)]
|
||
|
fn get_compiler() -> Box<dyn Compiler> {
|
||
|
compiler_for_backend(get_backend()).expect("Backend must have a compiler")
|
||
|
}
|
||
|
$($code)*
|
||
|
}
|
||
|
};
|
||
|
}
|