equip.analysis package¶
Subpackages¶
Submodules¶
equip.analysis.block¶
Basic block for the bytecode.
copyright: |
|
---|---|
license: | Apache 2, see LICENSE for more details. |
equip.analysis.flow¶
Extract the control flow graphs from the bytecode.
copyright: |
|
---|---|
license: | Apache 2, see LICENSE for more details. |
-
class
equip.analysis.flow.
ControlFlow
(decl)[source]¶ Bases:
object
Performs the control-flow analysis on a
Declaration
object. It iterates over its bytecode and builds the basic block. The final representation leverages theDiGraph
structure, and contains an instance of theDominatorTree
.-
BLOCK_NODE_KIND
= {1: 'ENTRY', 2: 'IMPLICIT_RETURN', 3: 'UNKNOWN', 4: 'LOOP', 5: 'IF', 6: 'EXCEPT'}¶
-
CFG_TMP_BREAK
= -2¶
-
CFG_TMP_RAISE
= -3¶
-
CFG_TMP_RETURN
= -1¶
-
E_COND
= 'COND'¶
-
E_END_LOOP
= 'END_LOOP'¶
-
E_EXCEPT
= 'EXCEPT'¶
-
E_FALSE
= 'FALSE'¶
-
E_FINALLY
= 'FINALLY'¶
-
E_RAISE
= 'RAISE'¶
-
E_RETURN
= 'RETURN'¶
-
E_TRUE
= 'TRUE'¶
-
E_UNCOND
= 'UNCOND'¶
-
N_CONDITION
= 'CONDITION'¶
-
N_ENTRY
= 'ENTRY'¶
-
N_EXCEPT
= 'EXCEPT'¶
-
N_IF
= 'IF'¶
-
N_IMPLICIT_RETURN
= 'IMPLICIT_RETURN'¶
-
N_LOOP
= 'LOOP'¶
-
N_UNKNOWN
= 'UNKNOWN'¶
-
block_indices_dict
¶ Returns the mapping of a bytecode indices and a basic blocks.
-
block_nodes_dict
¶ Returns the mapping of a basic bocks and CFG nodes.
-
blocks
¶ Returns the basic blocks created during the control flow analysis.
-
decl
¶
-
dominators
¶ - Returns the
DominatorTree
that contains: - Dominator tree (dict of IDom)
- Post dominator tree (doc of PIDom)
- Dominance frontier (dict of CFG node -> set CFG nodes)
- Returns the
-
entry
¶
-
entry_node
¶
-
exit
¶
-
exit_node
¶
-
frames
¶
-
graph
¶ Returns the underlying graph that holds the CFG.
-
static
make_blocks
(decl, bytecode)[source]¶ Returns the set of
BasicBlock
that are encountered in the current bytecode. Each block is annotated with its qualified jump targets (if any).Parameters: - decl – The current declaration object.
- bytecode – The bytecode associated with the declaration object.
-