| 45 | |
| 46 | impl Formats { |
| 47 | pub fn new(imm: &Immediates, entities: &EntityRefs) -> Self { |
| 48 | Self { |
| 49 | unary: Builder::new("Unary").value().build(), |
| 50 | |
| 51 | unary_imm: Builder::new("UnaryImm").imm(&imm.imm64).build(), |
| 52 | |
| 53 | unary_ieee16: Builder::new("UnaryIeee16").imm(&imm.ieee16).build(), |
| 54 | |
| 55 | unary_ieee32: Builder::new("UnaryIeee32").imm(&imm.ieee32).build(), |
| 56 | |
| 57 | unary_ieee64: Builder::new("UnaryIeee64").imm(&imm.ieee64).build(), |
| 58 | |
| 59 | unary_const: Builder::new("UnaryConst") |
| 60 | .imm(&entities.pool_constant) |
| 61 | .build(), |
| 62 | |
| 63 | unary_global_value: Builder::new("UnaryGlobalValue") |
| 64 | .imm(&entities.global_value) |
| 65 | .build(), |
| 66 | |
| 67 | binary: Builder::new("Binary").value().value().build(), |
| 68 | |
| 69 | binary_imm8: Builder::new("BinaryImm8").value().imm(&imm.uimm8).build(), |
| 70 | |
| 71 | // The select instructions are controlled by the second VALUE operand. |
| 72 | // The first VALUE operand is the controlling flag which has a derived type. |
| 73 | // The fma instruction has the same constraint on all inputs. |
| 74 | ternary: Builder::new("Ternary") |
| 75 | .value() |
| 76 | .value() |
| 77 | .value() |
| 78 | .typevar_operand(1) |
| 79 | .build(), |
| 80 | |
| 81 | ternary_imm8: Builder::new("TernaryImm8") |
| 82 | .value() |
| 83 | .imm(&imm.uimm8) |
| 84 | .value() |
| 85 | .build(), |
| 86 | |
| 87 | // Catch-all for instructions with many outputs and inputs and no immediate |
| 88 | // operands. |
| 89 | multiary: Builder::new("MultiAry").varargs().build(), |
| 90 | |
| 91 | nullary: Builder::new("NullAry").build(), |
| 92 | |
| 93 | shuffle: Builder::new("Shuffle") |
| 94 | .value() |
| 95 | .value() |
| 96 | .imm(&entities.uimm128) |
| 97 | .build(), |
| 98 | |
| 99 | int_compare: Builder::new("IntCompare") |
| 100 | .imm(&imm.intcc) |
| 101 | .value() |
| 102 | .value() |
| 103 | .build(), |
| 104 | |