1 use super::*;
2 use std::convert::TryFrom;
3
4 impl Module {
5 /// Encode this Wasm module into bytes.
to_bytes(&self) -> Vec<u8>6 pub fn to_bytes(&self) -> Vec<u8> {
7 self.encoded().finish()
8 }
9
encoded(&self) -> wasm_encoder::Module10 fn encoded(&self) -> wasm_encoder::Module {
11 let mut module = wasm_encoder::Module::new();
12
13 self.encode_initializers(&mut module);
14 self.encode_funcs(&mut module);
15 self.encode_tables(&mut module);
16 self.encode_memories(&mut module);
17 self.encode_tags(&mut module);
18 self.encode_globals(&mut module);
19 self.encode_exports(&mut module);
20 self.encode_start(&mut module);
21 self.encode_elems(&mut module);
22 self.encode_data_count(&mut module);
23 self.encode_code(&mut module);
24 self.encode_data(&mut module);
25
26 module
27 }
28
encode_initializers(&self, module: &mut wasm_encoder::Module)29 fn encode_initializers(&self, module: &mut wasm_encoder::Module) {
30 for init in self.initial_sections.iter() {
31 match init {
32 InitialSection::Type(types) => self.encode_types(module, types),
33 InitialSection::Import(imports) => self.encode_imports(module, imports),
34 InitialSection::Alias(aliases) => self.encode_aliases(module, aliases),
35 InitialSection::Instance(list) => self.encode_instances(module, list),
36 InitialSection::Module(list) => self.encode_modules(module, list),
37 }
38 }
39 }
40
encode_types(&self, module: &mut wasm_encoder::Module, types: &[Type])41 fn encode_types(&self, module: &mut wasm_encoder::Module, types: &[Type]) {
42 let mut section = wasm_encoder::TypeSection::new();
43 for ty in types {
44 match ty {
45 Type::Func(ty) => {
46 section.function(
47 ty.params.iter().map(|t| translate_val_type(*t)),
48 ty.results.iter().map(|t| translate_val_type(*t)),
49 );
50 }
51 Type::Module(ty) => {
52 section.module(
53 ty.imports.iter().map(|(module, name, ty)| {
54 (module.as_str(), name.as_deref(), translate_entity_type(ty))
55 }),
56 ty.exports
57 .exports
58 .iter()
59 .map(|(name, ty)| (name.as_str(), translate_entity_type(ty))),
60 );
61 }
62 Type::Instance(ty) => {
63 section.instance(
64 ty.exports
65 .iter()
66 .map(|(name, ty)| (name.as_str(), translate_entity_type(ty))),
67 );
68 }
69 }
70 }
71 module.section(§ion);
72 }
73
encode_imports( &self, module: &mut wasm_encoder::Module, imports: &[(String, Option<String>, EntityType)], )74 fn encode_imports(
75 &self,
76 module: &mut wasm_encoder::Module,
77 imports: &[(String, Option<String>, EntityType)],
78 ) {
79 let mut section = wasm_encoder::ImportSection::new();
80 for (module, name, ty) in imports {
81 section.import(module, name.as_deref(), translate_entity_type(ty));
82 }
83 module.section(§ion);
84 }
85
encode_aliases(&self, module: &mut wasm_encoder::Module, imports: &[Alias])86 fn encode_aliases(&self, module: &mut wasm_encoder::Module, imports: &[Alias]) {
87 let mut section = wasm_encoder::AliasSection::new();
88 for alias in imports {
89 match alias {
90 Alias::InstanceExport {
91 instance,
92 kind,
93 name,
94 } => {
95 section.instance_export(*instance, translate_item_kind(kind), name);
96 }
97 Alias::OuterType { depth, index } => {
98 section.outer_type(*depth, *index);
99 }
100 Alias::OuterModule { depth, index } => {
101 section.outer_module(*depth, *index);
102 }
103 }
104 }
105 module.section(§ion);
106 }
107
encode_instances(&self, module: &mut wasm_encoder::Module, list: &[Instance])108 fn encode_instances(&self, module: &mut wasm_encoder::Module, list: &[Instance]) {
109 let mut section = wasm_encoder::InstanceSection::new();
110 for instance in list {
111 section.instantiate(
112 instance.module,
113 instance
114 .args
115 .iter()
116 .map(|(name, export)| (name.as_str(), translate_export(export))),
117 );
118 }
119 module.section(§ion);
120 }
121
encode_modules(&self, module: &mut wasm_encoder::Module, list: &[Self])122 fn encode_modules(&self, module: &mut wasm_encoder::Module, list: &[Self]) {
123 let mut section = wasm_encoder::ModuleSection::new();
124 for module in list {
125 let encoded = module.encoded();
126 section.module(&encoded);
127 }
128 module.section(§ion);
129 }
130
encode_tags(&self, module: &mut wasm_encoder::Module)131 fn encode_tags(&self, module: &mut wasm_encoder::Module) {
132 if self.num_defined_tags == 0 {
133 return;
134 }
135 let mut tags = wasm_encoder::TagSection::new();
136 for tag in self.tags[self.tags.len() - self.num_defined_tags..].iter() {
137 tags.tag(wasm_encoder::TagType {
138 kind: wasm_encoder::TagKind::Exception,
139 func_type_idx: tag.func_type_idx,
140 });
141 }
142 module.section(&tags);
143 }
144
encode_funcs(&self, module: &mut wasm_encoder::Module)145 fn encode_funcs(&self, module: &mut wasm_encoder::Module) {
146 if self.num_defined_funcs == 0 {
147 return;
148 }
149 let mut funcs = wasm_encoder::FunctionSection::new();
150 for (ty, _) in self.funcs[self.funcs.len() - self.num_defined_funcs..].iter() {
151 funcs.function(ty.unwrap());
152 }
153 module.section(&funcs);
154 }
155
encode_tables(&self, module: &mut wasm_encoder::Module)156 fn encode_tables(&self, module: &mut wasm_encoder::Module) {
157 if self.num_defined_tables == 0 {
158 return;
159 }
160 let mut tables = wasm_encoder::TableSection::new();
161 for t in self.tables[self.tables.len() - self.num_defined_tables..].iter() {
162 tables.table(translate_table_type(t));
163 }
164 module.section(&tables);
165 }
166
encode_memories(&self, module: &mut wasm_encoder::Module)167 fn encode_memories(&self, module: &mut wasm_encoder::Module) {
168 if self.num_defined_memories == 0 {
169 return;
170 }
171 let mut mems = wasm_encoder::MemorySection::new();
172 for m in self.memories[self.memories.len() - self.num_defined_memories..].iter() {
173 mems.memory(translate_memory_type(m));
174 }
175 module.section(&mems);
176 }
177
encode_globals(&self, module: &mut wasm_encoder::Module)178 fn encode_globals(&self, module: &mut wasm_encoder::Module) {
179 if self.globals.is_empty() {
180 return;
181 }
182 let mut globals = wasm_encoder::GlobalSection::new();
183 for (idx, expr) in &self.defined_globals {
184 let ty = &self.globals[*idx as usize];
185 globals.global(translate_global_type(ty), translate_instruction(expr));
186 }
187 module.section(&globals);
188 }
189
encode_exports(&self, module: &mut wasm_encoder::Module)190 fn encode_exports(&self, module: &mut wasm_encoder::Module) {
191 if self.exports.is_empty() {
192 return;
193 }
194 let mut exports = wasm_encoder::ExportSection::new();
195 for (name, export) in &self.exports {
196 exports.export(name, translate_export(export));
197 }
198 module.section(&exports);
199 }
200
encode_start(&self, module: &mut wasm_encoder::Module)201 fn encode_start(&self, module: &mut wasm_encoder::Module) {
202 if let Some(f) = self.start {
203 module.section(&wasm_encoder::StartSection { function_index: f });
204 }
205 }
206
encode_elems(&self, module: &mut wasm_encoder::Module)207 fn encode_elems(&self, module: &mut wasm_encoder::Module) {
208 if self.elems.is_empty() {
209 return;
210 }
211 let mut elems = wasm_encoder::ElementSection::new();
212 let mut exps = vec![];
213 for el in &self.elems {
214 let elem_ty = translate_val_type(el.ty);
215 let elements = match &el.items {
216 Elements::Expressions(es) => {
217 exps.clear();
218 exps.extend(es.iter().map(|e| match e {
219 Some(i) => wasm_encoder::Element::Func(*i),
220 None => wasm_encoder::Element::Null,
221 }));
222 wasm_encoder::Elements::Expressions(&exps)
223 }
224 Elements::Functions(fs) => wasm_encoder::Elements::Functions(fs),
225 };
226 match &el.kind {
227 ElementKind::Active { table, offset } => {
228 elems.active(*table, translate_instruction(offset), elem_ty, elements);
229 }
230 ElementKind::Passive => {
231 elems.passive(elem_ty, elements);
232 }
233 ElementKind::Declared => {
234 elems.declared(elem_ty, elements);
235 }
236 }
237 }
238 module.section(&elems);
239 }
240
encode_data_count(&self, module: &mut wasm_encoder::Module)241 fn encode_data_count(&self, module: &mut wasm_encoder::Module) {
242 // Without bulk memory there's no need for a data count section,
243 if !self.config.bulk_memory_enabled() {
244 return;
245 }
246 // ... and also if there's no data no need for a data count section.
247 if self.data.is_empty() {
248 return;
249 }
250 module.section(&wasm_encoder::DataCountSection {
251 count: u32::try_from(self.data.len()).unwrap(),
252 });
253 }
254
encode_code(&self, module: &mut wasm_encoder::Module)255 fn encode_code(&self, module: &mut wasm_encoder::Module) {
256 if self.code.is_empty() {
257 return;
258 }
259 let mut code = wasm_encoder::CodeSection::new();
260 for c in &self.code {
261 // Skip the run-length encoding because it is a little
262 // annoying to compute; use a length of one for every local.
263 let mut func =
264 wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
265 match &c.instructions {
266 Instructions::Generated(instrs) => {
267 for instr in instrs {
268 func.instruction(translate_instruction(instr));
269 }
270 func.instruction(wasm_encoder::Instruction::End);
271 }
272 Instructions::Arbitrary(body) => {
273 func.raw(body.iter().copied());
274 }
275 }
276 code.function(&func);
277 }
278 module.section(&code);
279 }
280
encode_data(&self, module: &mut wasm_encoder::Module)281 fn encode_data(&self, module: &mut wasm_encoder::Module) {
282 if self.data.is_empty() {
283 return;
284 }
285 let mut data = wasm_encoder::DataSection::new();
286 for seg in &self.data {
287 match &seg.kind {
288 DataSegmentKind::Active {
289 memory_index,
290 offset,
291 } => {
292 data.active(
293 *memory_index,
294 translate_instruction(offset),
295 seg.init.iter().copied(),
296 );
297 }
298 DataSegmentKind::Passive => {
299 data.passive(seg.init.iter().copied());
300 }
301 }
302 }
303 module.section(&data);
304 }
305 }
306
translate_val_type(ty: ValType) -> wasm_encoder::ValType307 fn translate_val_type(ty: ValType) -> wasm_encoder::ValType {
308 match ty {
309 ValType::I32 => wasm_encoder::ValType::I32,
310 ValType::I64 => wasm_encoder::ValType::I64,
311 ValType::F32 => wasm_encoder::ValType::F32,
312 ValType::F64 => wasm_encoder::ValType::F64,
313 ValType::V128 => wasm_encoder::ValType::V128,
314 ValType::FuncRef => wasm_encoder::ValType::FuncRef,
315 ValType::ExternRef => wasm_encoder::ValType::ExternRef,
316 }
317 }
318
translate_entity_type(ty: &EntityType) -> wasm_encoder::EntityType319 fn translate_entity_type(ty: &EntityType) -> wasm_encoder::EntityType {
320 match ty {
321 EntityType::Tag(t) => wasm_encoder::EntityType::Tag(wasm_encoder::TagType {
322 kind: wasm_encoder::TagKind::Exception,
323 func_type_idx: t.func_type_idx,
324 }),
325 EntityType::Func(f, _) => wasm_encoder::EntityType::Function(*f),
326 EntityType::Instance(i, _) => wasm_encoder::EntityType::Instance(*i),
327 EntityType::Module(i, _) => wasm_encoder::EntityType::Module(*i),
328 EntityType::Table(ty) => translate_table_type(ty).into(),
329 EntityType::Memory(m) => translate_memory_type(m).into(),
330 EntityType::Global(g) => translate_global_type(g).into(),
331 }
332 }
333
translate_table_type(ty: &TableType) -> wasm_encoder::TableType334 fn translate_table_type(ty: &TableType) -> wasm_encoder::TableType {
335 wasm_encoder::TableType {
336 element_type: translate_val_type(ty.elem_ty),
337 minimum: ty.minimum,
338 maximum: ty.maximum,
339 }
340 }
341
translate_memory_type(ty: &MemoryType) -> wasm_encoder::MemoryType342 fn translate_memory_type(ty: &MemoryType) -> wasm_encoder::MemoryType {
343 wasm_encoder::MemoryType {
344 minimum: ty.minimum,
345 maximum: ty.maximum,
346 memory64: ty.memory64,
347 }
348 }
349
translate_global_type(ty: &GlobalType) -> wasm_encoder::GlobalType350 fn translate_global_type(ty: &GlobalType) -> wasm_encoder::GlobalType {
351 wasm_encoder::GlobalType {
352 val_type: translate_val_type(ty.val_type),
353 mutable: ty.mutable,
354 }
355 }
356
translate_block_type(ty: BlockType) -> wasm_encoder::BlockType357 fn translate_block_type(ty: BlockType) -> wasm_encoder::BlockType {
358 match ty {
359 BlockType::Empty => wasm_encoder::BlockType::Empty,
360 BlockType::Result(ty) => wasm_encoder::BlockType::Result(translate_val_type(ty)),
361 BlockType::FuncType(f) => wasm_encoder::BlockType::FunctionType(f),
362 }
363 }
364
translate_mem_arg(m: MemArg) -> wasm_encoder::MemArg365 fn translate_mem_arg(m: MemArg) -> wasm_encoder::MemArg {
366 wasm_encoder::MemArg {
367 offset: m.offset,
368 align: m.align,
369 memory_index: m.memory_index,
370 }
371 }
372
translate_item_kind(kind: &ItemKind) -> wasm_encoder::ItemKind373 fn translate_item_kind(kind: &ItemKind) -> wasm_encoder::ItemKind {
374 match kind {
375 ItemKind::Tag => wasm_encoder::ItemKind::Tag,
376 ItemKind::Func => wasm_encoder::ItemKind::Function,
377 ItemKind::Table => wasm_encoder::ItemKind::Table,
378 ItemKind::Memory => wasm_encoder::ItemKind::Memory,
379 ItemKind::Global => wasm_encoder::ItemKind::Global,
380 ItemKind::Instance => wasm_encoder::ItemKind::Instance,
381 ItemKind::Module => wasm_encoder::ItemKind::Module,
382 }
383 }
384
translate_export(export: &Export) -> wasm_encoder::Export385 fn translate_export(export: &Export) -> wasm_encoder::Export {
386 match export {
387 Export::Tag(idx) => wasm_encoder::Export::Tag(*idx),
388 Export::Func(idx) => wasm_encoder::Export::Function(*idx),
389 Export::Table(idx) => wasm_encoder::Export::Table(*idx),
390 Export::Memory(idx) => wasm_encoder::Export::Memory(*idx),
391 Export::Global(idx) => wasm_encoder::Export::Global(*idx),
392 Export::Instance(idx) => wasm_encoder::Export::Instance(*idx),
393 Export::Module(idx) => wasm_encoder::Export::Module(*idx),
394 }
395 }
396
translate_instruction(inst: &Instruction) -> wasm_encoder::Instruction397 fn translate_instruction(inst: &Instruction) -> wasm_encoder::Instruction {
398 use Instruction::*;
399 match *inst {
400 // Control instructions.
401 Unreachable => wasm_encoder::Instruction::Unreachable,
402 Nop => wasm_encoder::Instruction::Nop,
403 Block(bt) => wasm_encoder::Instruction::Block(translate_block_type(bt)),
404 Loop(bt) => wasm_encoder::Instruction::Loop(translate_block_type(bt)),
405 If(bt) => wasm_encoder::Instruction::If(translate_block_type(bt)),
406 Else => wasm_encoder::Instruction::Else,
407 Try(bt) => wasm_encoder::Instruction::Try(translate_block_type(bt)),
408 Delegate(l) => wasm_encoder::Instruction::Delegate(l),
409 Catch(t) => wasm_encoder::Instruction::Catch(t),
410 CatchAll => wasm_encoder::Instruction::CatchAll,
411 End => wasm_encoder::Instruction::End,
412 Br(x) => wasm_encoder::Instruction::Br(x),
413 BrIf(x) => wasm_encoder::Instruction::BrIf(x),
414 BrTable(ref ls, l) => wasm_encoder::Instruction::BrTable(ls, l),
415 Return => wasm_encoder::Instruction::Return,
416 Call(x) => wasm_encoder::Instruction::Call(x),
417 CallIndirect { ty, table } => wasm_encoder::Instruction::CallIndirect { ty, table },
418 Throw(t) => wasm_encoder::Instruction::Throw(t),
419 Rethrow(l) => wasm_encoder::Instruction::Rethrow(l),
420
421 // Parametric instructions.
422 Drop => wasm_encoder::Instruction::Drop,
423 Select => wasm_encoder::Instruction::Select,
424
425 // Variable instructions.
426 LocalGet(x) => wasm_encoder::Instruction::LocalGet(x),
427 LocalSet(x) => wasm_encoder::Instruction::LocalSet(x),
428 LocalTee(x) => wasm_encoder::Instruction::LocalTee(x),
429 GlobalGet(x) => wasm_encoder::Instruction::GlobalGet(x),
430 GlobalSet(x) => wasm_encoder::Instruction::GlobalSet(x),
431
432 // Memory instructions.
433 I32Load(m) => wasm_encoder::Instruction::I32Load(translate_mem_arg(m)),
434 I64Load(m) => wasm_encoder::Instruction::I64Load(translate_mem_arg(m)),
435 F32Load(m) => wasm_encoder::Instruction::F32Load(translate_mem_arg(m)),
436 F64Load(m) => wasm_encoder::Instruction::F64Load(translate_mem_arg(m)),
437 I32Load8_S(m) => wasm_encoder::Instruction::I32Load8_S(translate_mem_arg(m)),
438 I32Load8_U(m) => wasm_encoder::Instruction::I32Load8_U(translate_mem_arg(m)),
439 I32Load16_S(m) => wasm_encoder::Instruction::I32Load16_S(translate_mem_arg(m)),
440 I32Load16_U(m) => wasm_encoder::Instruction::I32Load16_U(translate_mem_arg(m)),
441 I64Load8_S(m) => wasm_encoder::Instruction::I64Load8_S(translate_mem_arg(m)),
442 I64Load8_U(m) => wasm_encoder::Instruction::I64Load8_U(translate_mem_arg(m)),
443 I64Load16_S(m) => wasm_encoder::Instruction::I64Load16_S(translate_mem_arg(m)),
444 I64Load16_U(m) => wasm_encoder::Instruction::I64Load16_U(translate_mem_arg(m)),
445 I64Load32_S(m) => wasm_encoder::Instruction::I64Load32_S(translate_mem_arg(m)),
446 I64Load32_U(m) => wasm_encoder::Instruction::I64Load32_U(translate_mem_arg(m)),
447 I32Store(m) => wasm_encoder::Instruction::I32Store(translate_mem_arg(m)),
448 I64Store(m) => wasm_encoder::Instruction::I64Store(translate_mem_arg(m)),
449 F32Store(m) => wasm_encoder::Instruction::F32Store(translate_mem_arg(m)),
450 F64Store(m) => wasm_encoder::Instruction::F64Store(translate_mem_arg(m)),
451 I32Store8(m) => wasm_encoder::Instruction::I32Store8(translate_mem_arg(m)),
452 I32Store16(m) => wasm_encoder::Instruction::I32Store16(translate_mem_arg(m)),
453 I64Store8(m) => wasm_encoder::Instruction::I64Store8(translate_mem_arg(m)),
454 I64Store16(m) => wasm_encoder::Instruction::I64Store16(translate_mem_arg(m)),
455 I64Store32(m) => wasm_encoder::Instruction::I64Store32(translate_mem_arg(m)),
456 MemorySize(x) => wasm_encoder::Instruction::MemorySize(x),
457 MemoryGrow(x) => wasm_encoder::Instruction::MemoryGrow(x),
458 MemoryInit { mem, data } => wasm_encoder::Instruction::MemoryInit { mem, data },
459 DataDrop(x) => wasm_encoder::Instruction::DataDrop(x),
460 MemoryCopy { src, dst } => wasm_encoder::Instruction::MemoryCopy { src, dst },
461 MemoryFill(x) => wasm_encoder::Instruction::MemoryFill(x),
462
463 // Numeric instructions.
464 I32Const(x) => wasm_encoder::Instruction::I32Const(x),
465 I64Const(x) => wasm_encoder::Instruction::I64Const(x),
466 F32Const(x) => wasm_encoder::Instruction::F32Const(x),
467 F64Const(x) => wasm_encoder::Instruction::F64Const(x),
468 I32Eqz => wasm_encoder::Instruction::I32Eqz,
469 I32Eq => wasm_encoder::Instruction::I32Eq,
470 I32Neq => wasm_encoder::Instruction::I32Neq,
471 I32LtS => wasm_encoder::Instruction::I32LtS,
472 I32LtU => wasm_encoder::Instruction::I32LtU,
473 I32GtS => wasm_encoder::Instruction::I32GtS,
474 I32GtU => wasm_encoder::Instruction::I32GtU,
475 I32LeS => wasm_encoder::Instruction::I32LeS,
476 I32LeU => wasm_encoder::Instruction::I32LeU,
477 I32GeS => wasm_encoder::Instruction::I32GeS,
478 I32GeU => wasm_encoder::Instruction::I32GeU,
479 I64Eqz => wasm_encoder::Instruction::I64Eqz,
480 I64Eq => wasm_encoder::Instruction::I64Eq,
481 I64Neq => wasm_encoder::Instruction::I64Neq,
482 I64LtS => wasm_encoder::Instruction::I64LtS,
483 I64LtU => wasm_encoder::Instruction::I64LtU,
484 I64GtS => wasm_encoder::Instruction::I64GtS,
485 I64GtU => wasm_encoder::Instruction::I64GtU,
486 I64LeS => wasm_encoder::Instruction::I64LeS,
487 I64LeU => wasm_encoder::Instruction::I64LeU,
488 I64GeS => wasm_encoder::Instruction::I64GeS,
489 I64GeU => wasm_encoder::Instruction::I64GeU,
490 F32Eq => wasm_encoder::Instruction::F32Eq,
491 F32Neq => wasm_encoder::Instruction::F32Neq,
492 F32Lt => wasm_encoder::Instruction::F32Lt,
493 F32Gt => wasm_encoder::Instruction::F32Gt,
494 F32Le => wasm_encoder::Instruction::F32Le,
495 F32Ge => wasm_encoder::Instruction::F32Ge,
496 F64Eq => wasm_encoder::Instruction::F64Eq,
497 F64Neq => wasm_encoder::Instruction::F64Neq,
498 F64Lt => wasm_encoder::Instruction::F64Lt,
499 F64Gt => wasm_encoder::Instruction::F64Gt,
500 F64Le => wasm_encoder::Instruction::F64Le,
501 F64Ge => wasm_encoder::Instruction::F64Ge,
502 I32Clz => wasm_encoder::Instruction::I32Clz,
503 I32Ctz => wasm_encoder::Instruction::I32Ctz,
504 I32Popcnt => wasm_encoder::Instruction::I32Popcnt,
505 I32Add => wasm_encoder::Instruction::I32Add,
506 I32Sub => wasm_encoder::Instruction::I32Sub,
507 I32Mul => wasm_encoder::Instruction::I32Mul,
508 I32DivS => wasm_encoder::Instruction::I32DivS,
509 I32DivU => wasm_encoder::Instruction::I32DivU,
510 I32RemS => wasm_encoder::Instruction::I32RemS,
511 I32RemU => wasm_encoder::Instruction::I32RemU,
512 I32And => wasm_encoder::Instruction::I32And,
513 I32Or => wasm_encoder::Instruction::I32Or,
514 I32Xor => wasm_encoder::Instruction::I32Xor,
515 I32Shl => wasm_encoder::Instruction::I32Shl,
516 I32ShrS => wasm_encoder::Instruction::I32ShrS,
517 I32ShrU => wasm_encoder::Instruction::I32ShrU,
518 I32Rotl => wasm_encoder::Instruction::I32Rotl,
519 I32Rotr => wasm_encoder::Instruction::I32Rotr,
520 I64Clz => wasm_encoder::Instruction::I64Clz,
521 I64Ctz => wasm_encoder::Instruction::I64Ctz,
522 I64Popcnt => wasm_encoder::Instruction::I64Popcnt,
523 I64Add => wasm_encoder::Instruction::I64Add,
524 I64Sub => wasm_encoder::Instruction::I64Sub,
525 I64Mul => wasm_encoder::Instruction::I64Mul,
526 I64DivS => wasm_encoder::Instruction::I64DivS,
527 I64DivU => wasm_encoder::Instruction::I64DivU,
528 I64RemS => wasm_encoder::Instruction::I64RemS,
529 I64RemU => wasm_encoder::Instruction::I64RemU,
530 I64And => wasm_encoder::Instruction::I64And,
531 I64Or => wasm_encoder::Instruction::I64Or,
532 I64Xor => wasm_encoder::Instruction::I64Xor,
533 I64Shl => wasm_encoder::Instruction::I64Shl,
534 I64ShrS => wasm_encoder::Instruction::I64ShrS,
535 I64ShrU => wasm_encoder::Instruction::I64ShrU,
536 I64Rotl => wasm_encoder::Instruction::I64Rotl,
537 I64Rotr => wasm_encoder::Instruction::I64Rotr,
538 F32Abs => wasm_encoder::Instruction::F32Abs,
539 F32Neg => wasm_encoder::Instruction::F32Neg,
540 F32Ceil => wasm_encoder::Instruction::F32Ceil,
541 F32Floor => wasm_encoder::Instruction::F32Floor,
542 F32Trunc => wasm_encoder::Instruction::F32Trunc,
543 F32Nearest => wasm_encoder::Instruction::F32Nearest,
544 F32Sqrt => wasm_encoder::Instruction::F32Sqrt,
545 F32Add => wasm_encoder::Instruction::F32Add,
546 F32Sub => wasm_encoder::Instruction::F32Sub,
547 F32Mul => wasm_encoder::Instruction::F32Mul,
548 F32Div => wasm_encoder::Instruction::F32Div,
549 F32Min => wasm_encoder::Instruction::F32Min,
550 F32Max => wasm_encoder::Instruction::F32Max,
551 F32Copysign => wasm_encoder::Instruction::F32Copysign,
552 F64Abs => wasm_encoder::Instruction::F64Abs,
553 F64Neg => wasm_encoder::Instruction::F64Neg,
554 F64Ceil => wasm_encoder::Instruction::F64Ceil,
555 F64Floor => wasm_encoder::Instruction::F64Floor,
556 F64Trunc => wasm_encoder::Instruction::F64Trunc,
557 F64Nearest => wasm_encoder::Instruction::F64Nearest,
558 F64Sqrt => wasm_encoder::Instruction::F64Sqrt,
559 F64Add => wasm_encoder::Instruction::F64Add,
560 F64Sub => wasm_encoder::Instruction::F64Sub,
561 F64Mul => wasm_encoder::Instruction::F64Mul,
562 F64Div => wasm_encoder::Instruction::F64Div,
563 F64Min => wasm_encoder::Instruction::F64Min,
564 F64Max => wasm_encoder::Instruction::F64Max,
565 F64Copysign => wasm_encoder::Instruction::F64Copysign,
566 I32WrapI64 => wasm_encoder::Instruction::I32WrapI64,
567 I32TruncF32S => wasm_encoder::Instruction::I32TruncF32S,
568 I32TruncF32U => wasm_encoder::Instruction::I32TruncF32U,
569 I32TruncF64S => wasm_encoder::Instruction::I32TruncF64S,
570 I32TruncF64U => wasm_encoder::Instruction::I32TruncF64U,
571 I64ExtendI32S => wasm_encoder::Instruction::I64ExtendI32S,
572 I64ExtendI32U => wasm_encoder::Instruction::I64ExtendI32U,
573 I64TruncF32S => wasm_encoder::Instruction::I64TruncF32S,
574 I64TruncF32U => wasm_encoder::Instruction::I64TruncF32U,
575 I64TruncF64S => wasm_encoder::Instruction::I64TruncF64S,
576 I64TruncF64U => wasm_encoder::Instruction::I64TruncF64U,
577 F32ConvertI32S => wasm_encoder::Instruction::F32ConvertI32S,
578 F32ConvertI32U => wasm_encoder::Instruction::F32ConvertI32U,
579 F32ConvertI64S => wasm_encoder::Instruction::F32ConvertI64S,
580 F32ConvertI64U => wasm_encoder::Instruction::F32ConvertI64U,
581 F32DemoteF64 => wasm_encoder::Instruction::F32DemoteF64,
582 F64ConvertI32S => wasm_encoder::Instruction::F64ConvertI32S,
583 F64ConvertI32U => wasm_encoder::Instruction::F64ConvertI32U,
584 F64ConvertI64S => wasm_encoder::Instruction::F64ConvertI64S,
585 F64ConvertI64U => wasm_encoder::Instruction::F64ConvertI64U,
586 F64PromoteF32 => wasm_encoder::Instruction::F64PromoteF32,
587 I32ReinterpretF32 => wasm_encoder::Instruction::I32ReinterpretF32,
588 I64ReinterpretF64 => wasm_encoder::Instruction::I64ReinterpretF64,
589 F32ReinterpretI32 => wasm_encoder::Instruction::F32ReinterpretI32,
590 F64ReinterpretI64 => wasm_encoder::Instruction::F64ReinterpretI64,
591 I32Extend8S => wasm_encoder::Instruction::I32Extend8S,
592 I32Extend16S => wasm_encoder::Instruction::I32Extend16S,
593 I64Extend8S => wasm_encoder::Instruction::I64Extend8S,
594 I64Extend16S => wasm_encoder::Instruction::I64Extend16S,
595 I64Extend32S => wasm_encoder::Instruction::I64Extend32S,
596 I32TruncSatF32S => wasm_encoder::Instruction::I32TruncSatF32S,
597 I32TruncSatF32U => wasm_encoder::Instruction::I32TruncSatF32U,
598 I32TruncSatF64S => wasm_encoder::Instruction::I32TruncSatF64S,
599 I32TruncSatF64U => wasm_encoder::Instruction::I32TruncSatF64U,
600 I64TruncSatF32S => wasm_encoder::Instruction::I64TruncSatF32S,
601 I64TruncSatF32U => wasm_encoder::Instruction::I64TruncSatF32U,
602 I64TruncSatF64S => wasm_encoder::Instruction::I64TruncSatF64S,
603 I64TruncSatF64U => wasm_encoder::Instruction::I64TruncSatF64U,
604 TypedSelect(ty) => wasm_encoder::Instruction::TypedSelect(translate_val_type(ty)),
605 RefNull(ty) => wasm_encoder::Instruction::RefNull(translate_val_type(ty)),
606 RefIsNull => wasm_encoder::Instruction::RefIsNull,
607 RefFunc(x) => wasm_encoder::Instruction::RefFunc(x),
608 TableInit { segment, table } => wasm_encoder::Instruction::TableInit { segment, table },
609 ElemDrop { segment } => wasm_encoder::Instruction::ElemDrop { segment },
610 TableFill { table } => wasm_encoder::Instruction::TableFill { table },
611 TableSet { table } => wasm_encoder::Instruction::TableSet { table },
612 TableGet { table } => wasm_encoder::Instruction::TableGet { table },
613 TableGrow { table } => wasm_encoder::Instruction::TableGrow { table },
614 TableSize { table } => wasm_encoder::Instruction::TableSize { table },
615 TableCopy { src, dst } => wasm_encoder::Instruction::TableCopy { src, dst },
616
617 // SIMD instructions.
618 V128Load { memarg } => wasm_encoder::Instruction::V128Load {
619 memarg: translate_mem_arg(memarg),
620 },
621 V128Load8x8S { memarg } => wasm_encoder::Instruction::V128Load8x8S {
622 memarg: translate_mem_arg(memarg),
623 },
624 V128Load8x8U { memarg } => wasm_encoder::Instruction::V128Load8x8U {
625 memarg: translate_mem_arg(memarg),
626 },
627 V128Load16x4S { memarg } => wasm_encoder::Instruction::V128Load16x4S {
628 memarg: translate_mem_arg(memarg),
629 },
630 V128Load16x4U { memarg } => wasm_encoder::Instruction::V128Load16x4U {
631 memarg: translate_mem_arg(memarg),
632 },
633 V128Load32x2S { memarg } => wasm_encoder::Instruction::V128Load32x2S {
634 memarg: translate_mem_arg(memarg),
635 },
636 V128Load32x2U { memarg } => wasm_encoder::Instruction::V128Load32x2U {
637 memarg: translate_mem_arg(memarg),
638 },
639 V128Load8Splat { memarg } => wasm_encoder::Instruction::V128Load8Splat {
640 memarg: translate_mem_arg(memarg),
641 },
642 V128Load16Splat { memarg } => wasm_encoder::Instruction::V128Load16Splat {
643 memarg: translate_mem_arg(memarg),
644 },
645 V128Load32Splat { memarg } => wasm_encoder::Instruction::V128Load32Splat {
646 memarg: translate_mem_arg(memarg),
647 },
648 V128Load64Splat { memarg } => wasm_encoder::Instruction::V128Load64Splat {
649 memarg: translate_mem_arg(memarg),
650 },
651 V128Load32Zero { memarg } => wasm_encoder::Instruction::V128Load32Zero {
652 memarg: translate_mem_arg(memarg),
653 },
654 V128Load64Zero { memarg } => wasm_encoder::Instruction::V128Load64Zero {
655 memarg: translate_mem_arg(memarg),
656 },
657 V128Store { memarg } => wasm_encoder::Instruction::V128Store {
658 memarg: translate_mem_arg(memarg),
659 },
660 V128Load8Lane { memarg, lane } => wasm_encoder::Instruction::V128Load8Lane {
661 memarg: translate_mem_arg(memarg),
662 lane,
663 },
664 V128Load16Lane { memarg, lane } => wasm_encoder::Instruction::V128Load16Lane {
665 memarg: translate_mem_arg(memarg),
666 lane,
667 },
668 V128Load32Lane { memarg, lane } => wasm_encoder::Instruction::V128Load32Lane {
669 memarg: translate_mem_arg(memarg),
670 lane,
671 },
672 V128Load64Lane { memarg, lane } => wasm_encoder::Instruction::V128Load64Lane {
673 memarg: translate_mem_arg(memarg),
674 lane,
675 },
676 V128Store8Lane { memarg, lane } => wasm_encoder::Instruction::V128Store8Lane {
677 memarg: translate_mem_arg(memarg),
678 lane,
679 },
680 V128Store16Lane { memarg, lane } => wasm_encoder::Instruction::V128Store16Lane {
681 memarg: translate_mem_arg(memarg),
682 lane,
683 },
684 V128Store32Lane { memarg, lane } => wasm_encoder::Instruction::V128Store32Lane {
685 memarg: translate_mem_arg(memarg),
686 lane,
687 },
688 V128Store64Lane { memarg, lane } => wasm_encoder::Instruction::V128Store64Lane {
689 memarg: translate_mem_arg(memarg),
690 lane,
691 },
692 V128Const(c) => wasm_encoder::Instruction::V128Const(c),
693 I8x16Shuffle { lanes } => wasm_encoder::Instruction::I8x16Shuffle { lanes },
694 I8x16ExtractLaneS { lane } => wasm_encoder::Instruction::I8x16ExtractLaneS { lane },
695 I8x16ExtractLaneU { lane } => wasm_encoder::Instruction::I8x16ExtractLaneU { lane },
696 I8x16ReplaceLane { lane } => wasm_encoder::Instruction::I8x16ReplaceLane { lane },
697 I16x8ExtractLaneS { lane } => wasm_encoder::Instruction::I16x8ExtractLaneS { lane },
698 I16x8ExtractLaneU { lane } => wasm_encoder::Instruction::I16x8ExtractLaneU { lane },
699 I16x8ReplaceLane { lane } => wasm_encoder::Instruction::I16x8ReplaceLane { lane },
700 I32x4ExtractLane { lane } => wasm_encoder::Instruction::I32x4ExtractLane { lane },
701 I32x4ReplaceLane { lane } => wasm_encoder::Instruction::I32x4ReplaceLane { lane },
702 I64x2ExtractLane { lane } => wasm_encoder::Instruction::I64x2ExtractLane { lane },
703 I64x2ReplaceLane { lane } => wasm_encoder::Instruction::I64x2ReplaceLane { lane },
704 F32x4ExtractLane { lane } => wasm_encoder::Instruction::F32x4ExtractLane { lane },
705 F32x4ReplaceLane { lane } => wasm_encoder::Instruction::F32x4ReplaceLane { lane },
706 F64x2ExtractLane { lane } => wasm_encoder::Instruction::F64x2ExtractLane { lane },
707 F64x2ReplaceLane { lane } => wasm_encoder::Instruction::F64x2ReplaceLane { lane },
708 I8x16Swizzle => wasm_encoder::Instruction::I8x16Swizzle,
709 I8x16Splat => wasm_encoder::Instruction::I8x16Splat,
710 I16x8Splat => wasm_encoder::Instruction::I16x8Splat,
711 I32x4Splat => wasm_encoder::Instruction::I32x4Splat,
712 I64x2Splat => wasm_encoder::Instruction::I64x2Splat,
713 F32x4Splat => wasm_encoder::Instruction::F32x4Splat,
714 F64x2Splat => wasm_encoder::Instruction::F64x2Splat,
715 I8x16Eq => wasm_encoder::Instruction::I8x16Eq,
716 I8x16Ne => wasm_encoder::Instruction::I8x16Ne,
717 I8x16LtS => wasm_encoder::Instruction::I8x16LtS,
718 I8x16LtU => wasm_encoder::Instruction::I8x16LtU,
719 I8x16GtS => wasm_encoder::Instruction::I8x16GtS,
720 I8x16GtU => wasm_encoder::Instruction::I8x16GtU,
721 I8x16LeS => wasm_encoder::Instruction::I8x16LeS,
722 I8x16LeU => wasm_encoder::Instruction::I8x16LeU,
723 I8x16GeS => wasm_encoder::Instruction::I8x16GeS,
724 I8x16GeU => wasm_encoder::Instruction::I8x16GeU,
725 I16x8Eq => wasm_encoder::Instruction::I16x8Eq,
726 I16x8Ne => wasm_encoder::Instruction::I16x8Ne,
727 I16x8LtS => wasm_encoder::Instruction::I16x8LtS,
728 I16x8LtU => wasm_encoder::Instruction::I16x8LtU,
729 I16x8GtS => wasm_encoder::Instruction::I16x8GtS,
730 I16x8GtU => wasm_encoder::Instruction::I16x8GtU,
731 I16x8LeS => wasm_encoder::Instruction::I16x8LeS,
732 I16x8LeU => wasm_encoder::Instruction::I16x8LeU,
733 I16x8GeS => wasm_encoder::Instruction::I16x8GeS,
734 I16x8GeU => wasm_encoder::Instruction::I16x8GeU,
735 I32x4Eq => wasm_encoder::Instruction::I32x4Eq,
736 I32x4Ne => wasm_encoder::Instruction::I32x4Ne,
737 I32x4LtS => wasm_encoder::Instruction::I32x4LtS,
738 I32x4LtU => wasm_encoder::Instruction::I32x4LtU,
739 I32x4GtS => wasm_encoder::Instruction::I32x4GtS,
740 I32x4GtU => wasm_encoder::Instruction::I32x4GtU,
741 I32x4LeS => wasm_encoder::Instruction::I32x4LeS,
742 I32x4LeU => wasm_encoder::Instruction::I32x4LeU,
743 I32x4GeS => wasm_encoder::Instruction::I32x4GeS,
744 I32x4GeU => wasm_encoder::Instruction::I32x4GeU,
745 I64x2Eq => wasm_encoder::Instruction::I64x2Eq,
746 I64x2Ne => wasm_encoder::Instruction::I64x2Ne,
747 I64x2LtS => wasm_encoder::Instruction::I64x2LtS,
748 I64x2GtS => wasm_encoder::Instruction::I64x2GtS,
749 I64x2LeS => wasm_encoder::Instruction::I64x2LeS,
750 I64x2GeS => wasm_encoder::Instruction::I64x2GeS,
751 F32x4Eq => wasm_encoder::Instruction::F32x4Eq,
752 F32x4Ne => wasm_encoder::Instruction::F32x4Ne,
753 F32x4Lt => wasm_encoder::Instruction::F32x4Lt,
754 F32x4Gt => wasm_encoder::Instruction::F32x4Gt,
755 F32x4Le => wasm_encoder::Instruction::F32x4Le,
756 F32x4Ge => wasm_encoder::Instruction::F32x4Ge,
757 F64x2Eq => wasm_encoder::Instruction::F64x2Eq,
758 F64x2Ne => wasm_encoder::Instruction::F64x2Ne,
759 F64x2Lt => wasm_encoder::Instruction::F64x2Lt,
760 F64x2Gt => wasm_encoder::Instruction::F64x2Gt,
761 F64x2Le => wasm_encoder::Instruction::F64x2Le,
762 F64x2Ge => wasm_encoder::Instruction::F64x2Ge,
763 V128Not => wasm_encoder::Instruction::V128Not,
764 V128And => wasm_encoder::Instruction::V128And,
765 V128AndNot => wasm_encoder::Instruction::V128AndNot,
766 V128Or => wasm_encoder::Instruction::V128Or,
767 V128Xor => wasm_encoder::Instruction::V128Xor,
768 V128Bitselect => wasm_encoder::Instruction::V128Bitselect,
769 V128AnyTrue => wasm_encoder::Instruction::V128AnyTrue,
770 I8x16Abs => wasm_encoder::Instruction::I8x16Abs,
771 I8x16Neg => wasm_encoder::Instruction::I8x16Neg,
772 I8x16Popcnt => wasm_encoder::Instruction::I8x16Popcnt,
773 I8x16AllTrue => wasm_encoder::Instruction::I8x16AllTrue,
774 I8x16Bitmask => wasm_encoder::Instruction::I8x16Bitmask,
775 I8x16NarrowI16x8S => wasm_encoder::Instruction::I8x16NarrowI16x8S,
776 I8x16NarrowI16x8U => wasm_encoder::Instruction::I8x16NarrowI16x8U,
777 I8x16Shl => wasm_encoder::Instruction::I8x16Shl,
778 I8x16ShrS => wasm_encoder::Instruction::I8x16ShrS,
779 I8x16ShrU => wasm_encoder::Instruction::I8x16ShrU,
780 I8x16Add => wasm_encoder::Instruction::I8x16Add,
781 I8x16AddSatS => wasm_encoder::Instruction::I8x16AddSatS,
782 I8x16AddSatU => wasm_encoder::Instruction::I8x16AddSatU,
783 I8x16Sub => wasm_encoder::Instruction::I8x16Sub,
784 I8x16SubSatS => wasm_encoder::Instruction::I8x16SubSatS,
785 I8x16SubSatU => wasm_encoder::Instruction::I8x16SubSatU,
786 I8x16MinS => wasm_encoder::Instruction::I8x16MinS,
787 I8x16MinU => wasm_encoder::Instruction::I8x16MinU,
788 I8x16MaxS => wasm_encoder::Instruction::I8x16MaxS,
789 I8x16MaxU => wasm_encoder::Instruction::I8x16MaxU,
790 I8x16RoundingAverageU => wasm_encoder::Instruction::I8x16RoundingAverageU,
791 I16x8ExtAddPairwiseI8x16S => wasm_encoder::Instruction::I16x8ExtAddPairwiseI8x16S,
792 I16x8ExtAddPairwiseI8x16U => wasm_encoder::Instruction::I16x8ExtAddPairwiseI8x16U,
793 I16x8Abs => wasm_encoder::Instruction::I16x8Abs,
794 I16x8Neg => wasm_encoder::Instruction::I16x8Neg,
795 I16x8Q15MulrSatS => wasm_encoder::Instruction::I16x8Q15MulrSatS,
796 I16x8AllTrue => wasm_encoder::Instruction::I16x8AllTrue,
797 I16x8Bitmask => wasm_encoder::Instruction::I16x8Bitmask,
798 I16x8NarrowI32x4S => wasm_encoder::Instruction::I16x8NarrowI32x4S,
799 I16x8NarrowI32x4U => wasm_encoder::Instruction::I16x8NarrowI32x4U,
800 I16x8ExtendLowI8x16S => wasm_encoder::Instruction::I16x8ExtendLowI8x16S,
801 I16x8ExtendHighI8x16S => wasm_encoder::Instruction::I16x8ExtendHighI8x16S,
802 I16x8ExtendLowI8x16U => wasm_encoder::Instruction::I16x8ExtendLowI8x16U,
803 I16x8ExtendHighI8x16U => wasm_encoder::Instruction::I16x8ExtendHighI8x16U,
804 I16x8Shl => wasm_encoder::Instruction::I16x8Shl,
805 I16x8ShrS => wasm_encoder::Instruction::I16x8ShrS,
806 I16x8ShrU => wasm_encoder::Instruction::I16x8ShrU,
807 I16x8Add => wasm_encoder::Instruction::I16x8Add,
808 I16x8AddSatS => wasm_encoder::Instruction::I16x8AddSatS,
809 I16x8AddSatU => wasm_encoder::Instruction::I16x8AddSatU,
810 I16x8Sub => wasm_encoder::Instruction::I16x8Sub,
811 I16x8SubSatS => wasm_encoder::Instruction::I16x8SubSatS,
812 I16x8SubSatU => wasm_encoder::Instruction::I16x8SubSatU,
813 I16x8Mul => wasm_encoder::Instruction::I16x8Mul,
814 I16x8MinS => wasm_encoder::Instruction::I16x8MinS,
815 I16x8MinU => wasm_encoder::Instruction::I16x8MinU,
816 I16x8MaxS => wasm_encoder::Instruction::I16x8MaxS,
817 I16x8MaxU => wasm_encoder::Instruction::I16x8MaxU,
818 I16x8RoundingAverageU => wasm_encoder::Instruction::I16x8RoundingAverageU,
819 I16x8ExtMulLowI8x16S => wasm_encoder::Instruction::I16x8ExtMulLowI8x16S,
820 I16x8ExtMulHighI8x16S => wasm_encoder::Instruction::I16x8ExtMulHighI8x16S,
821 I16x8ExtMulLowI8x16U => wasm_encoder::Instruction::I16x8ExtMulLowI8x16U,
822 I16x8ExtMulHighI8x16U => wasm_encoder::Instruction::I16x8ExtMulHighI8x16U,
823 I32x4ExtAddPairwiseI16x8S => wasm_encoder::Instruction::I32x4ExtAddPairwiseI16x8S,
824 I32x4ExtAddPairwiseI16x8U => wasm_encoder::Instruction::I32x4ExtAddPairwiseI16x8U,
825 I32x4Abs => wasm_encoder::Instruction::I32x4Abs,
826 I32x4Neg => wasm_encoder::Instruction::I32x4Neg,
827 I32x4AllTrue => wasm_encoder::Instruction::I32x4AllTrue,
828 I32x4Bitmask => wasm_encoder::Instruction::I32x4Bitmask,
829 I32x4ExtendLowI16x8S => wasm_encoder::Instruction::I32x4ExtendLowI16x8S,
830 I32x4ExtendHighI16x8S => wasm_encoder::Instruction::I32x4ExtendHighI16x8S,
831 I32x4ExtendLowI16x8U => wasm_encoder::Instruction::I32x4ExtendLowI16x8U,
832 I32x4ExtendHighI16x8U => wasm_encoder::Instruction::I32x4ExtendHighI16x8U,
833 I32x4Shl => wasm_encoder::Instruction::I32x4Shl,
834 I32x4ShrS => wasm_encoder::Instruction::I32x4ShrS,
835 I32x4ShrU => wasm_encoder::Instruction::I32x4ShrU,
836 I32x4Add => wasm_encoder::Instruction::I32x4Add,
837 I32x4Sub => wasm_encoder::Instruction::I32x4Sub,
838 I32x4Mul => wasm_encoder::Instruction::I32x4Mul,
839 I32x4MinS => wasm_encoder::Instruction::I32x4MinS,
840 I32x4MinU => wasm_encoder::Instruction::I32x4MinU,
841 I32x4MaxS => wasm_encoder::Instruction::I32x4MaxS,
842 I32x4MaxU => wasm_encoder::Instruction::I32x4MaxU,
843 I32x4DotI16x8S => wasm_encoder::Instruction::I32x4DotI16x8S,
844 I32x4ExtMulLowI16x8S => wasm_encoder::Instruction::I32x4ExtMulLowI16x8S,
845 I32x4ExtMulHighI16x8S => wasm_encoder::Instruction::I32x4ExtMulHighI16x8S,
846 I32x4ExtMulLowI16x8U => wasm_encoder::Instruction::I32x4ExtMulLowI16x8U,
847 I32x4ExtMulHighI16x8U => wasm_encoder::Instruction::I32x4ExtMulHighI16x8U,
848 I64x2Abs => wasm_encoder::Instruction::I64x2Abs,
849 I64x2Neg => wasm_encoder::Instruction::I64x2Neg,
850 I64x2AllTrue => wasm_encoder::Instruction::I64x2AllTrue,
851 I64x2Bitmask => wasm_encoder::Instruction::I64x2Bitmask,
852 I64x2ExtendLowI32x4S => wasm_encoder::Instruction::I64x2ExtendLowI32x4S,
853 I64x2ExtendHighI32x4S => wasm_encoder::Instruction::I64x2ExtendHighI32x4S,
854 I64x2ExtendLowI32x4U => wasm_encoder::Instruction::I64x2ExtendLowI32x4U,
855 I64x2ExtendHighI32x4U => wasm_encoder::Instruction::I64x2ExtendHighI32x4U,
856 I64x2Shl => wasm_encoder::Instruction::I64x2Shl,
857 I64x2ShrS => wasm_encoder::Instruction::I64x2ShrS,
858 I64x2ShrU => wasm_encoder::Instruction::I64x2ShrU,
859 I64x2Add => wasm_encoder::Instruction::I64x2Add,
860 I64x2Sub => wasm_encoder::Instruction::I64x2Sub,
861 I64x2Mul => wasm_encoder::Instruction::I64x2Mul,
862 I64x2ExtMulLowI32x4S => wasm_encoder::Instruction::I64x2ExtMulLowI32x4S,
863 I64x2ExtMulHighI32x4S => wasm_encoder::Instruction::I64x2ExtMulHighI32x4S,
864 I64x2ExtMulLowI32x4U => wasm_encoder::Instruction::I64x2ExtMulLowI32x4U,
865 I64x2ExtMulHighI32x4U => wasm_encoder::Instruction::I64x2ExtMulHighI32x4U,
866 F32x4Ceil => wasm_encoder::Instruction::F32x4Ceil,
867 F32x4Floor => wasm_encoder::Instruction::F32x4Floor,
868 F32x4Trunc => wasm_encoder::Instruction::F32x4Trunc,
869 F32x4Nearest => wasm_encoder::Instruction::F32x4Nearest,
870 F32x4Abs => wasm_encoder::Instruction::F32x4Abs,
871 F32x4Neg => wasm_encoder::Instruction::F32x4Neg,
872 F32x4Sqrt => wasm_encoder::Instruction::F32x4Sqrt,
873 F32x4Add => wasm_encoder::Instruction::F32x4Add,
874 F32x4Sub => wasm_encoder::Instruction::F32x4Sub,
875 F32x4Mul => wasm_encoder::Instruction::F32x4Mul,
876 F32x4Div => wasm_encoder::Instruction::F32x4Div,
877 F32x4Min => wasm_encoder::Instruction::F32x4Min,
878 F32x4Max => wasm_encoder::Instruction::F32x4Max,
879 F32x4PMin => wasm_encoder::Instruction::F32x4PMin,
880 F32x4PMax => wasm_encoder::Instruction::F32x4PMax,
881 F64x2Ceil => wasm_encoder::Instruction::F64x2Ceil,
882 F64x2Floor => wasm_encoder::Instruction::F64x2Floor,
883 F64x2Trunc => wasm_encoder::Instruction::F64x2Trunc,
884 F64x2Nearest => wasm_encoder::Instruction::F64x2Nearest,
885 F64x2Abs => wasm_encoder::Instruction::F64x2Abs,
886 F64x2Neg => wasm_encoder::Instruction::F64x2Neg,
887 F64x2Sqrt => wasm_encoder::Instruction::F64x2Sqrt,
888 F64x2Add => wasm_encoder::Instruction::F64x2Add,
889 F64x2Sub => wasm_encoder::Instruction::F64x2Sub,
890 F64x2Mul => wasm_encoder::Instruction::F64x2Mul,
891 F64x2Div => wasm_encoder::Instruction::F64x2Div,
892 F64x2Min => wasm_encoder::Instruction::F64x2Min,
893 F64x2Max => wasm_encoder::Instruction::F64x2Max,
894 F64x2PMin => wasm_encoder::Instruction::F64x2PMin,
895 F64x2PMax => wasm_encoder::Instruction::F64x2PMax,
896 I32x4TruncSatF32x4S => wasm_encoder::Instruction::I32x4TruncSatF32x4S,
897 I32x4TruncSatF32x4U => wasm_encoder::Instruction::I32x4TruncSatF32x4U,
898 F32x4ConvertI32x4S => wasm_encoder::Instruction::F32x4ConvertI32x4S,
899 F32x4ConvertI32x4U => wasm_encoder::Instruction::F32x4ConvertI32x4U,
900 I32x4TruncSatF64x2SZero => wasm_encoder::Instruction::I32x4TruncSatF64x2SZero,
901 I32x4TruncSatF64x2UZero => wasm_encoder::Instruction::I32x4TruncSatF64x2UZero,
902 F64x2ConvertLowI32x4S => wasm_encoder::Instruction::F64x2ConvertLowI32x4S,
903 F64x2ConvertLowI32x4U => wasm_encoder::Instruction::F64x2ConvertLowI32x4U,
904 F32x4DemoteF64x2Zero => wasm_encoder::Instruction::F32x4DemoteF64x2Zero,
905 F64x2PromoteLowF32x4 => wasm_encoder::Instruction::F64x2PromoteLowF32x4,
906 }
907 }
908