Theory IRTreeEval
section ‹Data-flow Semantics›
theory IRTreeEval
imports
Graph.Stamp
begin
text ‹
We define a tree representation of data-flow nodes, as an abstraction of the graph view.
Data-flow trees are evaluated in the context of a method state
(currently called MapState in the theories for historical reasons).
The method state consists of the values for each method parameter, references to
method parameters use an index of the parameter within the parameter list, as such
we store a list of parameter values which are looked up at parameter references.
The method state also stores a mapping of node ids to values. The contents of this
mapping is calculates during the traversal of the control flow graph.
As a concrete example, as the @{term SignedDivNode} can have side-effects
(during division by zero), it is treated as part of the control-flow, since
the data-flow phase is specified to be side-effect free.
As a result, the control-flow semantics for @{term SignedDivNode} calculates the
value of a node and maps the node identifier to the value within the method state.
The data-flow semantics then just reads the value stored in the method state for the node.
›
type_synonym ID = nat
type_synonym MapState = "ID ⇒ Value"
type_synonym Params = "Value list"
definition new_map_state :: "MapState" where
"new_map_state = (λx. UndefVal)"
subsection ‹Data-flow Tree Representation›