Skeleton of IR.
This commit is contained in:
parent
d9eeaaa819
commit
6bb4f42f6d
11
Cargo.toml
Normal file
11
Cargo.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "waffle"
|
||||
version = "0.0.1"
|
||||
description = "Wasm Analysis Framework For Lightweight Experiments"
|
||||
author = ["Chris Fallin <chris@cfallin.org>"]
|
||||
license = "Apache-2.0 WITH LLVM-exception"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
wasmparser = "0.81"
|
||||
wasm-encoder = "0.3"
|
25
src/ir.rs
Normal file
25
src/ir.rs
Normal file
|
@ -0,0 +1,25 @@
|
|||
//! Intermediate representation for Wasm.
|
||||
|
||||
use wasmparser::{FuncType, Type};
|
||||
|
||||
pub type SignatureId = usize;
|
||||
pub type FuncId = usize;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Module {
|
||||
pub funcs: Vec<FuncDecl>,
|
||||
pub signatures: Vec<FuncType>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum FuncDecl {
|
||||
Import(SignatureId),
|
||||
Body(SignatureId, Function),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Function {
|
||||
pub id: FuncId,
|
||||
pub signature: SignatureId,
|
||||
pub locals: Vec<Type>,
|
||||
}
|
8
src/lib.rs
Normal file
8
src/lib.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
//! WAFFLE Wasm analysis framework.
|
||||
|
||||
// Re-export wasmparser and wasmencoder for easier use of the right
|
||||
// version by our embedders.
|
||||
pub use wasmparser;
|
||||
pub use wasm_encoder;
|
||||
|
||||
pub mod ir;
|
Loading…
Reference in a new issue