Skip to main content

Crate formawasm

Crate formawasm 

Source
Expand description

formawasm — WebAssembly component backend for the formalang IR.

See README.md for the project spec and CHANGELOG.md for the phase-by-phase history. This crate re-exports the upstream IR types it consumes so callers do not need a separate formalang dependency to use the backend.

Re-exports§

pub use component::ComponentWrapError;
pub use component::wrap_component;
pub use layout::ArrayLayout;
pub use layout::EnumLayout;
pub use layout::FieldLayout;
pub use layout::LayoutError;
pub use layout::RangeLayout;
pub use layout::StructLayout;
pub use layout::VTableLayout;
pub use layout::VariantLayout;
pub use layout::plan_array;
pub use layout::plan_enum;
pub use layout::plan_range;
pub use layout::plan_struct;
pub use layout::plan_vtable;
pub use lower::BindingMap;
pub use lower::FunctionMap;
pub use lower::LowerContext;
pub use lower::LowerError;
pub use module::ModuleBuilder;
pub use module_lowering::ModuleLowerError;
pub use module_lowering::lower_module;
pub use preflight::PreflightError;
pub use survey::PublicSurface;
pub use types::TypeMapError;
pub use wit::WitEmitError;
pub use wit::emit_wit;

Modules§

component
Component-Model wrap layer.
dwarf
DWARF debug-info emission for the wasm core module.
layout
Memory-layout planner for every type the backend lays out in linear memory.
lower
Per-expression lowering from formalang IR to core-Wasm instructions.
module
Builder for the core WebAssembly module the backend assembles during code generation.
module_lowering
Bridge between the formalang IrModule and the core-Wasm ModuleBuilder.
preflight
Pre-flight rejection of IR shapes the backend cannot handle.
survey
Classification of an IrModule’s top-level items into exports, imports, and exported types.
types
Mapping from formalang ResolvedType / PrimitiveType to core-wasm value types.
wit
WIT-document generation for the component boundary.

Structs§

EnumId
ID for referencing enum definitions.
FunctionId
ID for referencing standalone function definitions.
IrFunction
A function definition in the IR.
IrFunctionParam
A function parameter in the IR.
IrFunctionSig
A function signature in the IR (without a body).
IrImport
An import from another module. Tracks which types were imported from external modules so codegen can emit proper import statements.
IrImportItem
A single imported item from a module.
IrModule
The root IR node containing all definitions.
IrTrait
A trait definition in the IR.
Pipeline
A composable sequence of IR passes.
StructId
ID for referencing struct definitions.
TraitId
ID for referencing trait definitions.
WasmBackend
Backend that lowers a typed IR module to a WebAssembly component.

Enums§

PipelineError
Error produced by a Pipeline.
ResolvedType
A fully resolved type.
WasmBackendError
Errors produced by WasmBackend::generate.

Traits§

Backend
A code generation backend.
IrPass
An IR transformation pass.

Functions§

optimize_core_module
Run binaryen’s wasm-opt over a core-Wasm byte slice and return the optimized output.