summaryrefslogtreecommitdiff
path: root/test/binaryen.js/expressions.js.txt
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-07-22 21:42:34 +0200
committerGitHub <noreply@github.com>2020-07-22 12:42:34 -0700
commitd406654f7cd6249277a2eef542c883603b4b3b53 (patch)
treee12f298fe16438a1522980ca16b588de5b4fa00d /test/binaryen.js/expressions.js.txt
parentc9ef77622de3bc0112fafd5ef0fd6f2eab8fe4fe (diff)
downloadbinaryen-d406654f7cd6249277a2eef542c883603b4b3b53.tar.gz
binaryen-d406654f7cd6249277a2eef542c883603b4b3b53.tar.bz2
binaryen-d406654f7cd6249277a2eef542c883603b4b3b53.zip
Extend the C- and JS-APIs (#2586)
Renames the following C-API functions BinaryenBlockGetChild to BinaryenBlockGetChildAt BinaryenSwitchGetName to BinaryenSwitchGetNameAt BinaryenCallGetOperand to BinaryenCallGetOperandAt BinaryenCallIndirectGetOperand to BinaryenCallIndirectGetOperandAt BinaryenHostGetOperand to BinaryenHostGetOperandAt BinaryenThrowGetOperand to BinaryenThrowGetOperandAt BinaryenTupleMakeGetOperand to BinaryenTupleMakeGetOperandAt Adds the following C-API functions BinaryenExpressionSetType BinaryenExpressionFinalize BinaryenBlockSetName BinaryenBlockSetChildAt BinaryenBlockAppendChild BinaryenBlockInsertChildAt BinaryenBlockRemoveChildAt BinaryenIfSetCondition BinaryenIfSetIfTrue BinaryenIfSetIfFalse BinaryenLoopSetName BinaryenLoopSetBody BinaryenBreakSetName BinaryenBreakSetCondition BinaryenBreakSetValue BinaryenSwitchSetNameAt BinaryenSwitchAppendName BinaryenSwitchInsertNameAt BinaryenSwitchRemoveNameAt BinaryenSwitchSetDefaultName BinaryenSwitchSetCondition BinaryenSwitchSetValue BinaryenCallSetTarget BinaryenCallSetOperandAt BinaryenCallAppendOperand BinaryenCallInsertOperandAt BinaryenCallRemoveOperandAt BinaryenCallSetReturn BinaryenCallIndirectSetTarget BinaryenCallIndirectSetOperandAt BinaryenCallIndirectAppendOperand BinaryenCallIndirectInsertOperandAt BinaryenCallIndirectRemoveOperandAt BinaryenCallIndirectSetReturn BinaryenCallIndirectGetParams BinaryenCallIndirectSetParams BinaryenCallIndirectGetResults BinaryenCallIndirectSetResults BinaryenLocalGetSetIndex BinaryenLocalSetSetIndex BinaryenLocalSetSetValue BinaryenGlobalGetSetName BinaryenGlobalSetSetName BinaryenGlobalSetSetValue BinaryenHostSetOp BinaryenHostSetNameOperand BinaryenHostSetOperandAt BinaryenHostAppendOperand BinaryenHostInsertOperandAt BinaryenHostRemoveOperandAt BinaryenLoadSetAtomic BinaryenLoadSetSigned BinaryenLoadSetOffset BinaryenLoadSetBytes BinaryenLoadSetAlign BinaryenLoadSetPtr BinaryenStoreSetAtomic BinaryenStoreSetBytes BinaryenStoreSetOffset BinaryenStoreSetAlign BinaryenStoreSetPtr BinaryenStoreSetValue BinaryenStoreGetValueType BinaryenStoreSetValueType BinaryenConstSetValueI32 BinaryenConstSetValueI64 BinaryenConstSetValueI64Low BinaryenConstSetValueI64High BinaryenConstSetValueF32 BinaryenConstSetValueF64 BinaryenConstSetValueV128 BinaryenUnarySetOp BinaryenUnarySetValue BinaryenBinarySetOp BinaryenBinarySetLeft BinaryenBinarySetRight BinaryenSelectSetIfTrue BinaryenSelectSetIfFalse BinaryenSelectSetCondition BinaryenDropSetValue BinaryenReturnSetValue BinaryenAtomicRMWSetOp BinaryenAtomicRMWSetBytes BinaryenAtomicRMWSetOffset BinaryenAtomicRMWSetPtr BinaryenAtomicRMWSetValue BinaryenAtomicCmpxchgSetBytes BinaryenAtomicCmpxchgSetOffset BinaryenAtomicCmpxchgSetPtr BinaryenAtomicCmpxchgSetExpected BinaryenAtomicCmpxchgSetReplacement BinaryenAtomicWaitSetPtr BinaryenAtomicWaitSetExpected BinaryenAtomicWaitSetTimeout BinaryenAtomicWaitSetExpectedType BinaryenAtomicNotifySetPtr BinaryenAtomicNotifySetNotifyCount BinaryenAtomicFenceSetOrder BinaryenSIMDExtractSetOp BinaryenSIMDExtractSetVec BinaryenSIMDExtractSetIndex BinaryenSIMDReplaceSetOp BinaryenSIMDReplaceSetVec BinaryenSIMDReplaceSetIndex BinaryenSIMDReplaceSetValue BinaryenSIMDShuffleSetLeft BinaryenSIMDShuffleSetRight BinaryenSIMDShuffleSetMask BinaryenSIMDTernarySetOp BinaryenSIMDTernarySetA BinaryenSIMDTernarySetB BinaryenSIMDTernarySetC BinaryenSIMDShiftSetOp BinaryenSIMDShiftSetVec BinaryenSIMDShiftSetShift BinaryenSIMDLoadSetOp BinaryenSIMDLoadSetOffset BinaryenSIMDLoadSetAlign BinaryenSIMDLoadSetPtr BinaryenMemoryInitSetSegment BinaryenMemoryInitSetDest BinaryenMemoryInitSetOffset BinaryenMemoryInitSetSize BinaryenDataDropSetSegment BinaryenMemoryCopySetDest BinaryenMemoryCopySetSource BinaryenMemoryCopySetSize BinaryenMemoryFillSetDest BinaryenMemoryFillSetValue BinaryenMemoryFillSetSize BinaryenRefIsNullSetValue BinaryenRefFuncSetFunc BinaryenTrySetBody BinaryenTrySetCatchBody BinaryenThrowSetEvent BinaryenThrowSetOperandAt BinaryenThrowAppendOperand BinaryenThrowInsertOperandAt BinaryenThrowRemoveOperandAt BinaryenRethrowSetExnref BinaryenBrOnExnSetEvent BinaryenBrOnExnSetName BinaryenBrOnExnSetExnref BinaryenTupleMakeSetOperandAt BinaryenTupleMakeAppendOperand BinaryenTupleMakeInsertOperandAt BinaryenTupleMakeRemoveOperandAt BinaryenTupleExtractSetTuple BinaryenTupleExtractSetIndex BinaryenFunctionSetBody Also introduces wrappers to the JS-API resembling the classes in C++ to perform the above operations on an expression. For example: var unary = binaryen.Unary(module.i32.eqz(1)); unary.getOp(...) / .op unary.setOp(...) / .op = ... unary.getValue(...) / .value unary.setValue(...) / .value = ... unary.getType(...) / .type unary.finalize() ... Usage of wrappers is optional, and one can also use plain functions: var unary = module.i32.eqz(1); binaryen.Unary.getOp(unary, ...) ... Also adds comments to all affected functions in case we'd like to generate API documentation at some point.
Diffstat (limited to 'test/binaryen.js/expressions.js.txt')
-rw-r--r--test/binaryen.js/expressions.js.txt249
1 files changed, 249 insertions, 0 deletions
diff --git a/test/binaryen.js/expressions.js.txt b/test/binaryen.js/expressions.js.txt
new file mode 100644
index 000000000..239498b1f
--- /dev/null
+++ b/test/binaryen.js/expressions.js.txt
@@ -0,0 +1,249 @@
+# Expression
+# Block
+(block $theName (result i32)
+ (i32.const 0)
+)
+
+# If
+(if (result i32)
+ (i32.const 4)
+ (i32.const 5)
+ (i32.const 6)
+)
+
+(if (result i32)
+ (i32.const 4)
+ (i32.const 5)
+)
+
+# Loop
+(loop $theName
+ (drop
+ (i32.const 1)
+ )
+)
+
+# Break
+(br_if $theNewName
+ (i32.const 4)
+ (i32.const 3)
+)
+
+# Switch
+(br_table $x $y $c
+ (i32.const 4)
+ (i32.const 3)
+)
+
+# Call
+(call $bar
+ (i32.const 7)
+ (i32.const 6)
+)
+
+# CallIndirect
+(call_indirect (type $i32_i32_=>_i32)
+ (i32.const 7)
+ (i32.const 6)
+ (i32.const 9000)
+)
+
+# LocalGet
+(local.get $2)
+
+# LocalSet
+(local.set $2
+ (i32.const 3)
+)
+
+# GlobalGet
+(global.get $b)
+
+# GlobalSet
+(global.set $b
+ (f64.const 3)
+)
+
+# Host
+(memory.grow
+ (i32.const 1)
+)
+
+# Load
+(i64.atomic.load offset=32 align=4
+ (i32.const 128)
+)
+
+# Store
+(i64.atomic.store offset=32 align=4
+ (i32.const 128)
+ (i32.const 2)
+)
+
+# Const
+(v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d)
+
+# Unary
+(i64.eqz
+ (i64.const 2)
+)
+
+# Binary
+(i64.add
+ (i64.const 3)
+ (i64.const 4)
+)
+
+# Select
+(select
+ (i64.const 5)
+ (i64.const 6)
+ (i32.const 4)
+)
+
+# Drop
+(drop
+ (i32.const 2)
+)
+
+# Return
+(return
+ (i32.const 2)
+)
+
+# AtomicRMW
+(i64.atomic.rmw16.sub_u offset=16
+ (i32.const 4)
+ (i64.const 5)
+)
+
+# AtomicCmpxchg
+(i64.atomic.rmw16.cmpxchg_u offset=16
+ (i32.const 5)
+ (i64.const 6)
+ (i64.const 7)
+)
+
+# AtomicWait
+(i64.atomic.wait
+ (i32.const 5)
+ (i32.const 6)
+ (i64.const 7)
+)
+
+# AtomicNotify
+(atomic.notify
+ (i32.const 3)
+ (i32.const 4)
+)
+
+# AtomicFence
+(atomic.fence)
+
+# SIMDExtract
+(i16x8.extract_lane_s 1
+ (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)
+)
+
+# SIMDReplace
+(i16x8.replace_lane 1
+ (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)
+ (i32.const 2)
+)
+
+# SIMDShuffle
+(v8x16.shuffle 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
+ (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)
+ (v128.const i32x4 0x02020202 0x02020202 0x02020202 0x02020202)
+)
+
+# SIMDTernary
+(f64x2.qfma
+ (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)
+ (v128.const i32x4 0x02020202 0x02020202 0x02020202 0x02020202)
+ (v128.const i32x4 0x03030303 0x03030303 0x03030303 0x03030303)
+)
+
+# SIMDShift
+(i8x16.shr_s
+ (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)
+ (i32.const 2)
+)
+
+# SIMDLoad
+(v8x16.load_splat offset=32 align=4
+ (i32.const 2)
+)
+
+# MemoryInit
+(memory.init 5
+ (i32.const 6)
+ (i32.const 7)
+ (i32.const 8)
+)
+
+# DataDrop
+(data.drop 2)
+
+# MemoryCopy
+(memory.copy
+ (i32.const 4)
+ (i32.const 5)
+ (i32.const 6)
+)
+
+# MemoryFill
+(memory.fill
+ (i32.const 4)
+ (i32.const 5)
+ (i32.const 6)
+)
+
+# RefIsNull
+(ref.is_null
+ (local.get $2)
+)
+
+# RefFunc
+(ref.func $b)
+
+# Try
+(try (result i32)
+ (do
+ (i32.const 3)
+ )
+ (catch
+ (i32.const 4)
+ )
+)
+
+# Throw
+(throw $bar
+ (i32.const 6)
+ (i32.const 7)
+)
+
+# Rethrow
+(rethrow
+ (local.get $2)
+)
+
+# BrOnExn
+(br_on_exn $bar $event2
+ (local.get $2)
+)
+
+# TupleMake
+(tuple.make
+ (i32.const 6)
+ (i32.const 7)
+)
+
+# TupleExtract
+(tuple.extract 0
+ (tuple.make
+ (f64.const 3)
+ (f64.const 4)
+ )
+)
+