class documentation

class SSA: (source)

Constructor: SSA()

View In Hierarchy

Build SSA graph from a given AST node based on the CFG.

Method __init__ No summary
Method compute_DF Compute dominating frontiers for each of blocks
Method compute_idom Compute immediate dominators for each of blocks
Method compute_SSA Compute single static assignment form representations for a given CFG. During the computing, constant value and alias pairs are generated. The following steps are used to compute SSA representations: step 1a: compute the dominance frontier step 1b: use dominance frontier to place phi node if node X contains assignment to a, put phi node for an in dominance frontier of X adding phi function may require introducing additional phi function start from the entry node step2: rename variables so only one definition per name...
Method get_attribute_stmts Undocumented
Method get_identifiers Extract all identifiers from the given AST node.
Method get_stmt_idents_ctx Extract the contextual information of each of identifiers. For assignment statements, the assigned values for each of variables will be stored. In addition, the del_set will store all deleted variables.
Method print_block Undocumented
Method to_json Undocumented
Instance Variable block_ident_gen Undocumented
Instance Variable block_ident_use Undocumented
Instance Variable dom Undocumented
Instance Variable error_paths Undocumented
Instance Variable global_live_idents Undocumented
Instance Variable global_names Undocumented
Instance Variable numbering Undocumented
Instance Variable reachable_table Undocumented
Instance Variable ssa_blocks Undocumented
Instance Variable undefined_names_from Undocumented
Instance Variable unreachable_names Undocumented
Instance Variable var_values Undocumented
def __init__(self): (source)
Parameters
srcthe source code as input.
def compute_DF(self, ssa_blocks): (source)

Compute dominating frontiers for each of blocks

Parameters
ssa_blocksblocks from a control flow graph.
def compute_idom(self, ssa_blocks): (source)

Compute immediate dominators for each of blocks

Parameters
ssa_blocksblocks from a control flow graph.
def compute_SSA(self, cfg): (source)

Compute single static assignment form representations for a given CFG. During the computing, constant value and alias pairs are generated. The following steps are used to compute SSA representations: step 1a: compute the dominance frontier step 1b: use dominance frontier to place phi node if node X contains assignment to a, put phi node for an in dominance frontier of X adding phi function may require introducing additional phi function start from the entry node step2: rename variables so only one definition per name

Parameters
cfga control flow graph.
def get_attribute_stmts(self, stmts): (source)

Undocumented

def get_identifiers(self, ast_node): (source)

Extract all identifiers from the given AST node.

Parameters
ast_nodeAST node.
def get_stmt_idents_ctx(self, stmt, del_set=[], const_dict={}): (source)

Extract the contextual information of each of identifiers. For assignment statements, the assigned values for each of variables will be stored. In addition, the del_set will store all deleted variables.

Parameters
stmtstatement from AST trees.
del_setdeleted identifiers
const_dicta mapping relationship between variables and their assigned values in this statement
def print_block(self, block): (source)

Undocumented

def to_json(self): (source)

Undocumented

block_ident_gen: dict = (source)

Undocumented

block_ident_use: dict = (source)

Undocumented

Undocumented

error_paths: dict = (source)

Undocumented

global_live_idents: list = (source)

Undocumented

global_names: list = (source)

Undocumented

numbering: dict = (source)

Undocumented

reachable_table: dict = (source)

Undocumented

ssa_blocks: list = (source)

Undocumented

undefined_names_from: dict = (source)

Undocumented

unreachable_names: dict = (source)

Undocumented

var_values: dict = (source)

Undocumented