qat.experimental.dialect.common.cfg module

Control-flow analysis over block CFGs.

The algorithms here traverse a region’s blocks through their terminators without knowing any concrete operation type. A terminator advertises its outgoing edges through the SuccessorOperandsTrait, the local counterpart to MLIR’s BranchOpInterface. xDSL tracks a block’s successors but not the operand group forwarded along each edge, so the trait supplies that missing half and lets reachability and predecessor analysis stay dialect-neutral.

class SuccessorOperandsTrait

Bases: OpTrait, ABC

Trait exposing a terminator’s successor edges.

Each edge pairs a successor block with the operand group forwarded to its block arguments. A terminator that ends a path, a halt or return, does not carry the trait and is treated as having no successors.

abstract classmethod successor_edges(op)

Return the (successor, forwarded operands) edges of op.

Return type:

list[tuple[Block, list[SSAValue]]]

block_predecessors(ordered)

Map each block to the (predecessor, forwarded operands) edges into it.

Every block in ordered is keyed, so a block with no predecessor maps to an empty list.

Return type:

dict[Block, list[tuple[Block, list[SSAValue]]]]

reachable_blocks(entry)

Return the set of blocks reachable from entry along successor edges.

Return type:

set[Block]

successor_edges(terminator)

Return the (successor, forwarded operands) edges of terminator.

A terminator that does not carry SuccessorOperandsTrait ends a path and reports no successors.

Return type:

list[tuple[Block, list[SSAValue]]]