![]() |
Class ControlFlowGraph
A control flow graph (CFG).
Aliases:
- Class
tfp.experimental.auto_batching.frontend.instructions.ControlFlowGraph
- Class
tfp.experimental.auto_batching.frontend.st.inst.ControlFlowGraph
- Class
tfp.experimental.auto_batching.frontend.stack.inst.ControlFlowGraph
- Class
tfp.experimental.auto_batching.stack_optimization.inst.ControlFlowGraph
- Class
tfp.experimental.auto_batching.stackless.inst.ControlFlowGraph
__init__
__init__(blocks)
A control flow graph (CFG).
A CFG is a set of basic Block
s available in a program. In this
system, the Block
s are ordered and indexed to support VM
instruction selection, so the CFG also keeps the reverse map from
Block
s to their indexes.
Args:
blocks
: Python list ofBlock
objects, the content of the CFG. Any terminator instructions of saidBlock
objects should refer to otherBlock
s in the same CFG. Otherwise, downstream passes or staging may fail.
Properties
blocks
Methods
block
block(index)
Returns the Block
given by the input index
.
Args:
index
: A Pythonint
.
Returns:
block
: TheBlock
at that location in the block list.
block_index
block_index(block)
Returns the int
index of the given Block
.
Args:
block
: The block to look up. IfNone
, returns the exit index.
Returns:
index
: Pythonint
, the index of the requested block.
enter_block
enter_block()
Returns the entry Block
.
exit_index
exit_index()
Returns the int
index denoting "exit this CFG".