summaryrefslogtreecommitdiff
path: root/test/lld/basic_safe_stack.wat
diff options
context:
space:
mode:
Diffstat (limited to 'test/lld/basic_safe_stack.wat')
-rw-r--r--test/lld/basic_safe_stack.wat41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/lld/basic_safe_stack.wat b/test/lld/basic_safe_stack.wat
new file mode 100644
index 000000000..27f172913
--- /dev/null
+++ b/test/lld/basic_safe_stack.wat
@@ -0,0 +1,41 @@
+(module
+ (type $none_=>_none (func))
+ (type $i32_=>_none (func (param i32)))
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (memory $0 2)
+ (table $0 1 1 funcref)
+ (global $global$0 (mut i32) (i32.const 66112))
+ (global $global$1 i32 (i32.const 568))
+ (export "memory" (memory $0))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
+ (export "stackRestore" (func $stackRestore))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "main" (func $main))
+ (export "__data_end" (global $global$1))
+ (func $__wasm_call_ctors
+ )
+ (func $stackRestore (param $0 i32)
+ (global.set $global$0
+ (local.get $0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (local $2 i32)
+ (global.set $global$0
+ (local.tee $1
+ (i32.and
+ (i32.sub
+ (global.get $global$0)
+ (local.get $0)
+ )
+ (i32.const -16)
+ )
+ )
+ )
+ (local.get $1)
+ )
+ (func $main
+ )
+)
+