aboutsummaryrefslogtreecommitdiffstats
path: root/bin/llvm-wasm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xbin/llvm-wasm10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/llvm-wasm b/bin/llvm-wasm
new file mode 100755
index 0000000..a1d0cfd
--- /dev/null
+++ b/bin/llvm-wasm
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+fullname=$1
+namelength=${#fullname}
+offset=$((${#fullname} - 2))
+filename=${fullname:0:$offset}
+"clang" -emit-llvm --target=wasm32 -Oz "$1" -c
+"llc" -asm-verbose=false -o $filename.s $filename.bc
+"s2wasm" $filename.s > $filename.wast
+"wast2wasm" $filename.wast -o $filename.wasm