class documentation

class Program: (source)

View In Hierarchy

Program instances describe program entities. This class ties together the CFG, the data flow graph (variables + bindings) as well as methods. We use this for issuing IDs: We need every CFG node to have a unique ID, and this class does the corresponding counting. Attributes: entrypoint: Entrypoint of the program, if it has one. (None otherwise) cfg_nodes: CFG nodes in use. Will be used for assigning node IDs. next_binding_id: The next id to assign to a Binding. Accessed through NextBindingId(). next_variable_id: The next id to assign to a variable. solver: the active Solver instance. default_data: Default value for data. variables: Variables in use. Will be used for assigning variable IDs.

Method __init__ Initialize a new (initially empty) program.
Method calculate_metrics Undocumented
Method CreateSolver Undocumented
Method InvalidateSolver Undocumented
Method is_reachable Whether a path exists (going forward) from node src to node dst.
Method MakeBindingId Undocumented
Method NewCFGNode Start a new CFG node.
Method NewVariable Create a new Variable.
Instance Variable cfg_nodes Undocumented
Instance Variable default_data Undocumented
Instance Variable entrypoint Undocumented
Instance Variable next_binding_id Undocumented
Instance Variable next_variable_id Undocumented
Instance Variable solver Undocumented
Property variables Undocumented
def __init__(self): (source)

Initialize a new (initially empty) program.

def calculate_metrics(self): (source)

Undocumented

def CreateSolver(self): (source)

Undocumented

def InvalidateSolver(self): (source)

Undocumented

def is_reachable(self, src, dst): (source)

Whether a path exists (going forward) from node src to node dst.

def MakeBindingId(self): (source)

Undocumented

def NewCFGNode(self, name=None, condition=None): (source)

Start a new CFG node.

def NewVariable(self, bindings=None, source_set=None, where=None): (source)

Create a new Variable. A Variable typically models a "union type", i.e., a disjunction of different possible types. This constructor assumes that all the bindings in this Variable have the same origin(s). If that's not the case, construct a variable with bindings=[] and origins=[] and then call AddBinding() to add the different bindings. Arguments: bindings: Optionally, a sequence of possible data items this variable can have. source_set: If we have bindings, the source_set they *all* depend on. An instance of SourceSet. where: If we have bindings, where in the CFG they're assigned. Returns: A Variable instance.

cfg_nodes: list = (source)

Undocumented

default_data = (source)

Undocumented

entrypoint = (source)

Undocumented

next_binding_id: int = (source)

Undocumented

next_variable_id: int = (source)

Undocumented

Undocumented

Undocumented