| 130 | |
| 131 | @dataclasses.dataclass(eq=False) |
| 132 | class _Block: |
| 133 | label: str | None = None |
| 134 | # Non-instruction lines like labels, directives, and comments: |
| 135 | noninstructions: list[str] = dataclasses.field(default_factory=list) |
| 136 | # Instruction lines: |
| 137 | instructions: list[Instruction] = dataclasses.field(default_factory=list) |
| 138 | # If this block ends in a jump, where to? |
| 139 | target: typing.Self | None = None |
| 140 | # The next block in the linked list: |
| 141 | link: typing.Self | None = None |
| 142 | # Whether control flow can fall through to the linked block above: |
| 143 | fallthrough: bool = True |
| 144 | # Whether this block can eventually reach the next uop (_JIT_CONTINUE): |
| 145 | hot: bool = False |
| 146 | |
| 147 | def resolve(self) -> typing.Self: |
| 148 | """Find the first non-empty block reachable from this one.""" |
| 149 | block = self |
| 150 | while block.link and not block.instructions: |
| 151 | block = block.link |
| 152 | return block |
| 153 | |
| 154 | |
| 155 | @dataclasses.dataclass |
no test coverage detected
searching dependent graphs…