(
inst: parser.InstDef, instructions: dict[str, Instruction], uops: dict[str, Uop]
)
| 1101 | |
| 1102 | |
| 1103 | def desugar_inst( |
| 1104 | inst: parser.InstDef, instructions: dict[str, Instruction], uops: dict[str, Uop] |
| 1105 | ) -> None: |
| 1106 | assert inst.kind == "inst" |
| 1107 | name = inst.name |
| 1108 | op_inputs: list[parser.InputEffect] = [] |
| 1109 | parts: list[Part] = [] |
| 1110 | uop_index = -1 |
| 1111 | # Move unused cache entries to the Instruction, removing them from the Uop. |
| 1112 | for input in inst.inputs: |
| 1113 | if isinstance(input, parser.CacheEffect) and input.name == "unused": |
| 1114 | parts.append(Skip(input.size)) |
| 1115 | else: |
| 1116 | op_inputs.append(input) |
| 1117 | if uop_index < 0: |
| 1118 | uop_index = len(parts) |
| 1119 | # Place holder for the uop. |
| 1120 | parts.append(Skip(0)) |
| 1121 | uop = make_uop("_" + inst.name, inst, op_inputs, uops) |
| 1122 | uop.implicitly_created = True |
| 1123 | uops[inst.name] = uop |
| 1124 | if uop_index < 0: |
| 1125 | parts.append(uop) |
| 1126 | else: |
| 1127 | parts[uop_index] = uop |
| 1128 | add_instruction(inst.first_token, name, parts, instructions) |
| 1129 | |
| 1130 | |
| 1131 | def add_macro( |
no test coverage detected
searching dependent graphs…