(
decs: Decs, incs: Incs, cache: BlockCache, blocks: list[BasicBlock], label: BasicBlock
)
| 246 | |
| 247 | |
| 248 | def add_block( |
| 249 | decs: Decs, incs: Incs, cache: BlockCache, blocks: list[BasicBlock], label: BasicBlock |
| 250 | ) -> BasicBlock: |
| 251 | if not decs and not incs: |
| 252 | return label |
| 253 | |
| 254 | # TODO: be able to share *partial* results |
| 255 | if (label, decs, incs) in cache: |
| 256 | return cache[label, decs, incs] |
| 257 | |
| 258 | block = BasicBlock() |
| 259 | blocks.append(block) |
| 260 | block.ops.extend(DecRef(reg, is_xdec=xdec) for reg, xdec in decs) |
| 261 | block.ops.extend(IncRef(reg) for reg in incs) |
| 262 | block.ops.append(Goto(label)) |
| 263 | cache[label, decs, incs] = block |
| 264 | return block |
| 265 | |
| 266 | |
| 267 | def make_value_ordering(ir: FuncIR) -> dict[Value, int]: |
no test coverage detected
searching dependent graphs…