Link integer emit and runtime

This commit is contained in:
Rerumu
2022-05-21 02:50:11 -04:00
parent aea1df4e90
commit 3fa4fa5d83
4 changed files with 45 additions and 3 deletions
+12 -1
View File
@@ -1,7 +1,7 @@
use std::collections::BTreeSet;
use wasm_ast::{
node::{BinOp, CmpOp, Intermediate, LoadAt, StoreAt, UnOp},
node::{BinOp, CmpOp, Intermediate, LoadAt, StoreAt, UnOp, Value},
visit::{Driver, Visitor},
};
@@ -24,6 +24,17 @@ impl Visitor for Visit {
self.result.insert(("store", name));
}
fn visit_value(&mut self, v: &Value) {
let name = match v {
Value::I64(0) => "K_ZERO",
Value::I64(1) => "K_ONE",
Value::I64(_) => "from_u32",
_ => return,
};
self.result.insert(("num", name));
}
fn visit_un_op(&mut self, v: &UnOp) {
let name = v.op.as_name();