Cleanup
This commit is contained in:
parent
0eb41cb0a3
commit
eab9e60338
|
@ -1,10 +1,9 @@
|
||||||
#![no_main]
|
#![no_main]
|
||||||
use libfuzzer_sys::fuzz_target;
|
use libfuzzer_sys::fuzz_target;
|
||||||
|
|
||||||
use waffle::frontend::wasm_to_ir;
|
use waffle::Module;
|
||||||
use wasm_smith::Module;
|
|
||||||
|
|
||||||
fuzz_target!(|module: Module| {
|
fuzz_target!(|module: wasm_smith::Module| {
|
||||||
let _ = env_logger::try_init();
|
let _ = env_logger::try_init();
|
||||||
let _parsed_module = wasm_to_ir(&module.to_bytes()[..]).unwrap();
|
let _parsed_module = Module::from_wasm_bytes(&module.to_bytes()[..]).unwrap();
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,7 @@ use anyhow::Result;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
use waffle::frontend;
|
use waffle::Module;
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
#[structopt(name = "waffle-util", about = "WAFFLE utility.")]
|
#[structopt(name = "waffle-util", about = "WAFFLE utility.")]
|
||||||
|
@ -38,7 +38,7 @@ fn main() -> Result<()> {
|
||||||
Command::PrintIR { wasm } => {
|
Command::PrintIR { wasm } => {
|
||||||
let bytes = std::fs::read(wasm)?;
|
let bytes = std::fs::read(wasm)?;
|
||||||
debug!("Loaded {} bytes of Wasm data", bytes.len());
|
debug!("Loaded {} bytes of Wasm data", bytes.len());
|
||||||
let module = frontend::wasm_to_ir(&bytes[..])?;
|
let module = Module::from_wasm_bytes(&bytes[..])?;
|
||||||
println!("{:?}", module);
|
println!("{:?}", module);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
//! Intermediate representation for Wasm.
|
//! Intermediate representation for Wasm.
|
||||||
|
|
||||||
|
use crate::frontend;
|
||||||
|
use anyhow::Result;
|
||||||
use wasmparser::{FuncType, Operator, Type};
|
use wasmparser::{FuncType, Operator, Type};
|
||||||
|
|
||||||
pub type SignatureId = usize;
|
pub type SignatureId = usize;
|
||||||
|
@ -119,3 +121,9 @@ impl<'a> std::default::Default for Terminator<'a> {
|
||||||
Terminator::None
|
Terminator::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> Module<'a> {
|
||||||
|
pub fn from_wasm_bytes(bytes: &'a [u8]) -> Result<Self> {
|
||||||
|
frontend::wasm_to_ir(bytes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
pub use wasm_encoder;
|
pub use wasm_encoder;
|
||||||
pub use wasmparser;
|
pub use wasmparser;
|
||||||
|
|
||||||
pub mod frontend;
|
mod frontend;
|
||||||
pub mod ir;
|
mod ir;
|
||||||
pub mod op_traits;
|
mod localssa;
|
||||||
|
mod op_traits;
|
||||||
|
|
||||||
|
pub use ir::*;
|
||||||
|
|
2
src/localssa.rs
Normal file
2
src/localssa.rs
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
//! Local-to-SSA conversion.
|
||||||
|
|
Loading…
Reference in a new issue