pyquil.control_flow_graph module¶
Classes that represent the control flow graph of a Quil program.
- class pyquil.control_flow_graph.BasicBlock(cls, /, instance)[source]¶
Bases:
BasicBlock
Represents a basic block in the Program.
Most functionality is implemented by the quil package. See the quil BasicBlock documentation for documentation and available methods.
- instructions() list[AbstractInstruction] [source]¶
- terminator() AbstractInstruction | None [source]¶
- class pyquil.control_flow_graph.ControlFlowGraph(cls, /, instance)[source]¶
Bases:
ControlFlowGraph
Representation of a control flow graph (CFG) for a Quil program.
The CFG is a directed graph where each node is a basic block and each edge is a control flow transition between two basic blocks.
- This class should not be initialized directly. Use :py:meth:~pyquil.quil.Program.control
flow_graph` to get a CFG for a program.
Most functionality is implemented by the quil package. See the quil ControlFlowGraph documentation for available methods.
- basic_blocks() list[BasicBlock] [source]¶
Return a list of all the basic blocks in the control flow graph, in order of definition.