aboutsummaryrefslogtreecommitdiffstats
path: root/bin/llvm-wasm
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2021-05-14 18:14:50 +0000
committerterminaldweller <thabogre@gmail.com>2021-05-14 18:14:50 +0000
commit6e528248414e330c9e25e81596ab47b8b8a5b701 (patch)
treee1aa41a7f3198eeac187e6177ec7d4a33db229d3 /bin/llvm-wasm
downloadscripts-6e528248414e330c9e25e81596ab47b8b8a5b701.tar.gz
scripts-6e528248414e330c9e25e81596ab47b8b8a5b701.zip
first commitmaster
Diffstat (limited to 'bin/llvm-wasm')
-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