waffle/src/ir.rs

27 lines
513 B
Rust
Raw Normal View History

2021-11-13 06:16:54 +00:00
//! Intermediate representation for Wasm.
use wasmparser::{FuncType, Type};
pub type SignatureId = usize;
pub type FuncId = usize;
2021-11-13 08:20:02 +00:00
pub type BlockId = usize;
pub type InstId = usize;
2021-11-13 06:16:54 +00:00
#[derive(Clone, Debug)]
pub struct Module {
pub funcs: Vec<FuncDecl>,
pub signatures: Vec<FuncType>,
}
#[derive(Clone, Debug)]
pub enum FuncDecl {
Import(SignatureId),
2021-11-13 08:20:02 +00:00
Body(SignatureId, FunctionBody),
2021-11-13 06:16:54 +00:00
}
#[derive(Clone, Debug)]
2021-11-13 08:20:02 +00:00
pub struct FunctionBody {
2021-11-13 06:16:54 +00:00
pub locals: Vec<Type>,
2021-11-13 08:20:02 +00:00
pub blocks: Vec<Block>,
2021-11-13 06:16:54 +00:00
}