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