pub struct WasmABI { /* private fields */ }Expand description
Platform-specific ABI utilities for WASM code generation.
Implementations§
Source§impl WasmABI
impl WasmABI
Sourcepub fn new(target_os: TargetOperatingSystem) -> Self
pub fn new(target_os: TargetOperatingSystem) -> Self
Creates a new ABI instance for the specified target OS.
Sourcepub fn mangle_function_name(&self, name: &str) -> String
pub fn mangle_function_name(&self, name: &str) -> String
Get the WASM function name (currently just the original name). WASM doesn’t require name mangling, but this method exists for consistency with other backends and future extensibility.
Sourcepub fn get_print_import(&self) -> &'static str
pub fn get_print_import(&self) -> &'static str
Get the WASM import for the print function.
Sourcepub fn get_wasm_type(&self, ty: &MirType) -> &'static str
pub fn get_wasm_type(&self, ty: &MirType) -> &'static str
Get the WASM type for MIR types (currently only i64).
Sourcepub fn generate_global_decl(&self, index: usize) -> String
pub fn generate_global_decl(&self, index: usize) -> String
Generate WASM global variable declaration for virtual registers.
Sourcepub fn generate_local_decl(&self, index: usize) -> String
pub fn generate_local_decl(&self, index: usize) -> String
Generate WASM local variable declaration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WasmABI
impl RefUnwindSafe for WasmABI
impl Send for WasmABI
impl Sync for WasmABI
impl Unpin for WasmABI
impl UnsafeUnpin for WasmABI
impl UnwindSafe for WasmABI
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more