Generate the Rust assembler code; e.g., `enum Inst { ... }`.
(f: &mut Formatter, insts: &[dsl::Inst])
| 10 | |
| 11 | /// Generate the Rust assembler code; e.g., `enum Inst { ... }`. |
| 12 | pub fn rust_assembler(f: &mut Formatter, insts: &[dsl::Inst]) { |
| 13 | // Generate "all instructions" enum. |
| 14 | generate_inst_enum(f, insts); |
| 15 | generate_inst_impls(f, insts); |
| 16 | generate_inst_display_impl(f, insts); |
| 17 | |
| 18 | // Generate per-instruction structs. |
| 19 | f.empty_line(); |
| 20 | for inst in insts { |
| 21 | inst.generate_struct(f); |
| 22 | inst.generate_struct_impl(f); |
| 23 | inst.generate_display_impl(f); |
| 24 | inst.generate_from_impl(f); |
| 25 | f.empty_line(); |
| 26 | } |
| 27 | |
| 28 | // Generate the `Feature` trait. |
| 29 | dsl::Feature::generate_macro(f); |
| 30 | } |
| 31 | |
| 32 | /// `enum Inst { ... }` |
| 33 | fn generate_inst_enum(f: &mut Formatter, insts: &[dsl::Inst]) { |
no test coverage detected