Skip to content

Commit 4124aa9

Browse files
committed
Add ChiselModule implementation for Binaryen
1 parent 441aa19 commit 4124aa9

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
members = [
44
"chisel",
55
"libchisel"
6-
]
6+
]

libchisel/src/binaryenopt.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::{ModuleError, ModulePreset, ModuleTranslator};
1+
use super::{ChiselModule, ModuleError, ModuleKind, ModulePreset, ModuleTranslator};
22
use crate::utils::*;
33
use parity_wasm::elements::*;
44

@@ -13,6 +13,22 @@ pub enum BinaryenOptimiser {
1313
Oz,
1414
}
1515

16+
impl<'a> ChiselModule<'a> for BinaryenOptimiser {
17+
type ObjectReference = &'a dyn ModuleTranslator;
18+
19+
fn id(&'a self) -> String {
20+
"binaryenopt".to_string()
21+
}
22+
23+
fn kind(&'a self) -> ModuleKind {
24+
ModuleKind::Translator
25+
}
26+
27+
fn as_abstract(&'a self) -> Self::ObjectReference {
28+
self as Self::ObjectReference
29+
}
30+
}
31+
1632
impl ModulePreset for BinaryenOptimiser {
1733
fn with_preset(preset: &str) -> Result<Self, ()> {
1834
match preset {

0 commit comments

Comments
 (0)