aboutsummaryrefslogtreecommitdiff
path: root/tools/translate_xmacro.h
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-09-21 17:47:22 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-09-21 17:47:22 +0200
commit155e9b30b135a99b42e0f42e9062c266f527df4b (patch)
tree1189f07c4e7eef8e97dff1cd94e0dd46df5a70db /tools/translate_xmacro.h
parentc75dcab5988f5c0b5e0629015f384e5aa1440690 (diff)
downloadAGH-engineering-thesis-155e9b30b135a99b42e0f42e9062c266f527df4b.tar.gz
AGH-engineering-thesis-155e9b30b135a99b42e0f42e9062c266f527df4b.zip
use function pointer array in Wasm opcode translation
Diffstat (limited to 'tools/translate_xmacro.h')
-rw-r--r--tools/translate_xmacro.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/translate_xmacro.h b/tools/translate_xmacro.h
new file mode 100644
index 0000000..2fc4558
--- /dev/null
+++ b/tools/translate_xmacro.h
@@ -0,0 +1,19 @@
+/* X-macro-like definition of translation routines for each webasm opcode */
+
+TS(WASM_I32_ADD, add)
+TS(WASM_I32_SUB, sub)
+TS(WASM_I32_DIV_U, div)
+TS(WASM_I32_MUL, mul)
+
+TLS(WASM_I32_LOAD, load_p)
+TLS(WASM_I32_LOAD8_S, loadbsx_p)
+TLS(WASM_I32_LOAD8_U, loadbzx_p)
+TLS(WASM_I32_LOAD16_S, loadwsx_p)
+TLS(WASM_I32_LOAD16_U, loadwzx_p)
+TLS(WASM_I32_STORE, store_p)
+TLS(WASM_I32_STORE8, storeb_p)
+TLS(WASM_I32_STORE16, storew_p)
+
+TC(WASM_CALL, call)
+TC(WASM_LOCAL_GET, local_get)
+TC(WASM_I32_CONST, const)