1 | function sign(input, output) {
|
---|
2 | return [input, output];
|
---|
3 | }
|
---|
4 |
|
---|
5 | var u32 = "u32";
|
---|
6 | var i32 = "i32";
|
---|
7 | var i64 = "i64";
|
---|
8 | var f32 = "f32";
|
---|
9 | var f64 = "f64";
|
---|
10 |
|
---|
11 | var vector = function vector(t) {
|
---|
12 | var vecType = [t]; // $FlowIgnore
|
---|
13 |
|
---|
14 | vecType.vector = true;
|
---|
15 | return vecType;
|
---|
16 | };
|
---|
17 |
|
---|
18 | var controlInstructions = {
|
---|
19 | unreachable: sign([], []),
|
---|
20 | nop: sign([], []),
|
---|
21 | // block ?
|
---|
22 | // loop ?
|
---|
23 | // if ?
|
---|
24 | // if else ?
|
---|
25 | br: sign([u32], []),
|
---|
26 | br_if: sign([u32], []),
|
---|
27 | br_table: sign(vector(u32), []),
|
---|
28 | return: sign([], []),
|
---|
29 | call: sign([u32], []),
|
---|
30 | call_indirect: sign([u32], [])
|
---|
31 | };
|
---|
32 | var parametricInstructions = {
|
---|
33 | drop: sign([], []),
|
---|
34 | select: sign([], [])
|
---|
35 | };
|
---|
36 | var variableInstructions = {
|
---|
37 | get_local: sign([u32], []),
|
---|
38 | set_local: sign([u32], []),
|
---|
39 | tee_local: sign([u32], []),
|
---|
40 | get_global: sign([u32], []),
|
---|
41 | set_global: sign([u32], [])
|
---|
42 | };
|
---|
43 | var memoryInstructions = {
|
---|
44 | "i32.load": sign([u32, u32], [i32]),
|
---|
45 | "i64.load": sign([u32, u32], []),
|
---|
46 | "f32.load": sign([u32, u32], []),
|
---|
47 | "f64.load": sign([u32, u32], []),
|
---|
48 | "i32.load8_s": sign([u32, u32], [i32]),
|
---|
49 | "i32.load8_u": sign([u32, u32], [i32]),
|
---|
50 | "i32.load16_s": sign([u32, u32], [i32]),
|
---|
51 | "i32.load16_u": sign([u32, u32], [i32]),
|
---|
52 | "i64.load8_s": sign([u32, u32], [i64]),
|
---|
53 | "i64.load8_u": sign([u32, u32], [i64]),
|
---|
54 | "i64.load16_s": sign([u32, u32], [i64]),
|
---|
55 | "i64.load16_u": sign([u32, u32], [i64]),
|
---|
56 | "i64.load32_s": sign([u32, u32], [i64]),
|
---|
57 | "i64.load32_u": sign([u32, u32], [i64]),
|
---|
58 | "i32.store": sign([u32, u32], []),
|
---|
59 | "i64.store": sign([u32, u32], []),
|
---|
60 | "f32.store": sign([u32, u32], []),
|
---|
61 | "f64.store": sign([u32, u32], []),
|
---|
62 | "i32.store8": sign([u32, u32], []),
|
---|
63 | "i32.store16": sign([u32, u32], []),
|
---|
64 | "i64.store8": sign([u32, u32], []),
|
---|
65 | "i64.store16": sign([u32, u32], []),
|
---|
66 | "i64.store32": sign([u32, u32], []),
|
---|
67 | current_memory: sign([], []),
|
---|
68 | grow_memory: sign([], [])
|
---|
69 | };
|
---|
70 | var numericInstructions = {
|
---|
71 | "i32.const": sign([i32], [i32]),
|
---|
72 | "i64.const": sign([i64], [i64]),
|
---|
73 | "f32.const": sign([f32], [f32]),
|
---|
74 | "f64.const": sign([f64], [f64]),
|
---|
75 | "i32.eqz": sign([i32], [i32]),
|
---|
76 | "i32.eq": sign([i32, i32], [i32]),
|
---|
77 | "i32.ne": sign([i32, i32], [i32]),
|
---|
78 | "i32.lt_s": sign([i32, i32], [i32]),
|
---|
79 | "i32.lt_u": sign([i32, i32], [i32]),
|
---|
80 | "i32.gt_s": sign([i32, i32], [i32]),
|
---|
81 | "i32.gt_u": sign([i32, i32], [i32]),
|
---|
82 | "i32.le_s": sign([i32, i32], [i32]),
|
---|
83 | "i32.le_u": sign([i32, i32], [i32]),
|
---|
84 | "i32.ge_s": sign([i32, i32], [i32]),
|
---|
85 | "i32.ge_u": sign([i32, i32], [i32]),
|
---|
86 | "i64.eqz": sign([i64], [i64]),
|
---|
87 | "i64.eq": sign([i64, i64], [i32]),
|
---|
88 | "i64.ne": sign([i64, i64], [i32]),
|
---|
89 | "i64.lt_s": sign([i64, i64], [i32]),
|
---|
90 | "i64.lt_u": sign([i64, i64], [i32]),
|
---|
91 | "i64.gt_s": sign([i64, i64], [i32]),
|
---|
92 | "i64.gt_u": sign([i64, i64], [i32]),
|
---|
93 | "i64.le_s": sign([i64, i64], [i32]),
|
---|
94 | "i64.le_u": sign([i64, i64], [i32]),
|
---|
95 | "i64.ge_s": sign([i64, i64], [i32]),
|
---|
96 | "i64.ge_u": sign([i64, i64], [i32]),
|
---|
97 | "f32.eq": sign([f32, f32], [i32]),
|
---|
98 | "f32.ne": sign([f32, f32], [i32]),
|
---|
99 | "f32.lt": sign([f32, f32], [i32]),
|
---|
100 | "f32.gt": sign([f32, f32], [i32]),
|
---|
101 | "f32.le": sign([f32, f32], [i32]),
|
---|
102 | "f32.ge": sign([f32, f32], [i32]),
|
---|
103 | "f64.eq": sign([f64, f64], [i32]),
|
---|
104 | "f64.ne": sign([f64, f64], [i32]),
|
---|
105 | "f64.lt": sign([f64, f64], [i32]),
|
---|
106 | "f64.gt": sign([f64, f64], [i32]),
|
---|
107 | "f64.le": sign([f64, f64], [i32]),
|
---|
108 | "f64.ge": sign([f64, f64], [i32]),
|
---|
109 | "i32.clz": sign([i32], [i32]),
|
---|
110 | "i32.ctz": sign([i32], [i32]),
|
---|
111 | "i32.popcnt": sign([i32], [i32]),
|
---|
112 | "i32.add": sign([i32, i32], [i32]),
|
---|
113 | "i32.sub": sign([i32, i32], [i32]),
|
---|
114 | "i32.mul": sign([i32, i32], [i32]),
|
---|
115 | "i32.div_s": sign([i32, i32], [i32]),
|
---|
116 | "i32.div_u": sign([i32, i32], [i32]),
|
---|
117 | "i32.rem_s": sign([i32, i32], [i32]),
|
---|
118 | "i32.rem_u": sign([i32, i32], [i32]),
|
---|
119 | "i32.and": sign([i32, i32], [i32]),
|
---|
120 | "i32.or": sign([i32, i32], [i32]),
|
---|
121 | "i32.xor": sign([i32, i32], [i32]),
|
---|
122 | "i32.shl": sign([i32, i32], [i32]),
|
---|
123 | "i32.shr_s": sign([i32, i32], [i32]),
|
---|
124 | "i32.shr_u": sign([i32, i32], [i32]),
|
---|
125 | "i32.rotl": sign([i32, i32], [i32]),
|
---|
126 | "i32.rotr": sign([i32, i32], [i32]),
|
---|
127 | "i64.clz": sign([i64], [i64]),
|
---|
128 | "i64.ctz": sign([i64], [i64]),
|
---|
129 | "i64.popcnt": sign([i64], [i64]),
|
---|
130 | "i64.add": sign([i64, i64], [i64]),
|
---|
131 | "i64.sub": sign([i64, i64], [i64]),
|
---|
132 | "i64.mul": sign([i64, i64], [i64]),
|
---|
133 | "i64.div_s": sign([i64, i64], [i64]),
|
---|
134 | "i64.div_u": sign([i64, i64], [i64]),
|
---|
135 | "i64.rem_s": sign([i64, i64], [i64]),
|
---|
136 | "i64.rem_u": sign([i64, i64], [i64]),
|
---|
137 | "i64.and": sign([i64, i64], [i64]),
|
---|
138 | "i64.or": sign([i64, i64], [i64]),
|
---|
139 | "i64.xor": sign([i64, i64], [i64]),
|
---|
140 | "i64.shl": sign([i64, i64], [i64]),
|
---|
141 | "i64.shr_s": sign([i64, i64], [i64]),
|
---|
142 | "i64.shr_u": sign([i64, i64], [i64]),
|
---|
143 | "i64.rotl": sign([i64, i64], [i64]),
|
---|
144 | "i64.rotr": sign([i64, i64], [i64]),
|
---|
145 | "f32.abs": sign([f32], [f32]),
|
---|
146 | "f32.neg": sign([f32], [f32]),
|
---|
147 | "f32.ceil": sign([f32], [f32]),
|
---|
148 | "f32.floor": sign([f32], [f32]),
|
---|
149 | "f32.trunc": sign([f32], [f32]),
|
---|
150 | "f32.nearest": sign([f32], [f32]),
|
---|
151 | "f32.sqrt": sign([f32], [f32]),
|
---|
152 | "f32.add": sign([f32, f32], [f32]),
|
---|
153 | "f32.sub": sign([f32, f32], [f32]),
|
---|
154 | "f32.mul": sign([f32, f32], [f32]),
|
---|
155 | "f32.div": sign([f32, f32], [f32]),
|
---|
156 | "f32.min": sign([f32, f32], [f32]),
|
---|
157 | "f32.max": sign([f32, f32], [f32]),
|
---|
158 | "f32.copysign": sign([f32, f32], [f32]),
|
---|
159 | "f64.abs": sign([f64], [f64]),
|
---|
160 | "f64.neg": sign([f64], [f64]),
|
---|
161 | "f64.ceil": sign([f64], [f64]),
|
---|
162 | "f64.floor": sign([f64], [f64]),
|
---|
163 | "f64.trunc": sign([f64], [f64]),
|
---|
164 | "f64.nearest": sign([f64], [f64]),
|
---|
165 | "f64.sqrt": sign([f64], [f64]),
|
---|
166 | "f64.add": sign([f64, f64], [f64]),
|
---|
167 | "f64.sub": sign([f64, f64], [f64]),
|
---|
168 | "f64.mul": sign([f64, f64], [f64]),
|
---|
169 | "f64.div": sign([f64, f64], [f64]),
|
---|
170 | "f64.min": sign([f64, f64], [f64]),
|
---|
171 | "f64.max": sign([f64, f64], [f64]),
|
---|
172 | "f64.copysign": sign([f64, f64], [f64]),
|
---|
173 | "i32.wrap/i64": sign([i64], [i32]),
|
---|
174 | "i32.trunc_s/f32": sign([f32], [i32]),
|
---|
175 | "i32.trunc_u/f32": sign([f32], [i32]),
|
---|
176 | "i32.trunc_s/f64": sign([f32], [i32]),
|
---|
177 | "i32.trunc_u/f64": sign([f64], [i32]),
|
---|
178 | "i64.extend_s/i32": sign([i32], [i64]),
|
---|
179 | "i64.extend_u/i32": sign([i32], [i64]),
|
---|
180 | "i64.trunc_s/f32": sign([f32], [i64]),
|
---|
181 | "i64.trunc_u/f32": sign([f32], [i64]),
|
---|
182 | "i64.trunc_s/f64": sign([f64], [i64]),
|
---|
183 | "i64.trunc_u/f64": sign([f64], [i64]),
|
---|
184 | "f32.convert_s/i32": sign([i32], [f32]),
|
---|
185 | "f32.convert_u/i32": sign([i32], [f32]),
|
---|
186 | "f32.convert_s/i64": sign([i64], [f32]),
|
---|
187 | "f32.convert_u/i64": sign([i64], [f32]),
|
---|
188 | "f32.demote/f64": sign([f64], [f32]),
|
---|
189 | "f64.convert_s/i32": sign([i32], [f64]),
|
---|
190 | "f64.convert_u/i32": sign([i32], [f64]),
|
---|
191 | "f64.convert_s/i64": sign([i64], [f64]),
|
---|
192 | "f64.convert_u/i64": sign([i64], [f64]),
|
---|
193 | "f64.promote/f32": sign([f32], [f64]),
|
---|
194 | "i32.reinterpret/f32": sign([f32], [i32]),
|
---|
195 | "i64.reinterpret/f64": sign([f64], [i64]),
|
---|
196 | "f32.reinterpret/i32": sign([i32], [f32]),
|
---|
197 | "f64.reinterpret/i64": sign([i64], [f64])
|
---|
198 | };
|
---|
199 | export var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions); |
---|