Expand inlineable runtime functions
This commit is contained in:
@@ -177,13 +177,8 @@ do
|
||||
end
|
||||
|
||||
do
|
||||
local clz = {}
|
||||
local ctz = {}
|
||||
local popcnt = {}
|
||||
|
||||
clz.i32 = bit32.countlz
|
||||
ctz.i32 = bit32.countrz
|
||||
|
||||
function popcnt.i32(num)
|
||||
local count = 0
|
||||
|
||||
@@ -195,8 +190,6 @@ do
|
||||
return count
|
||||
end
|
||||
|
||||
module.clz = clz
|
||||
module.ctz = ctz
|
||||
module.popcnt = popcnt
|
||||
end
|
||||
|
||||
@@ -272,8 +265,6 @@ do
|
||||
local bxor = {}
|
||||
local bnot = {}
|
||||
|
||||
bnot.i32 = bit32.bnot
|
||||
|
||||
band.i64 = I64.bit_and
|
||||
bor.i64 = I64.bit_or
|
||||
bxor.i64 = I64.bit_xor
|
||||
|
||||
@@ -213,14 +213,14 @@ fn build_func_list(wasm: &Module, type_info: &TypeInfo) -> Vec<FuncData> {
|
||||
}
|
||||
|
||||
fn write_local_operation(head: &str, tail: &str, w: &mut dyn Write) -> Result<()> {
|
||||
write!(w, "local {head}_{tail} = ")?;
|
||||
|
||||
match (head, tail) {
|
||||
("band" | "bor" | "bxor", "i32") => {
|
||||
write!(w, "local {head}_{tail} = bit32.{head} ")
|
||||
}
|
||||
("abs" | "ceil" | "floor" | "sqrt", _) => {
|
||||
write!(w, "local {head}_{tail} = math.{head} ")
|
||||
}
|
||||
_ => write!(w, "local {head}_{tail} = rt.{head}.{tail} "),
|
||||
("abs" | "ceil" | "floor" | "sqrt", _) => write!(w, "math.{head} "),
|
||||
("band" | "bor" | "bxor" | "bnot", "i32") => write!(w, "bit32.{head} "),
|
||||
("clz", "i32") => write!(w, "bit32.countlz "),
|
||||
("ctz", "i32") => write!(w, "bit32.countrz "),
|
||||
_ => write!(w, "rt.{head}.{tail} "),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user