case class CFG(graph: GraphType, labels: Map[Int, Command]) extends Product with Serializable
Describes a control flow graph
Contains a graph with integer labels and labeled directed edges
Each node corresponds to an AST stored in a
Map[Int, AST.Command]
- graph
the scala graph containing integers
- labels
map from int label to AST
- Alphabetic
- By Inheritance
- CFG
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
Type Members
-
class
CFGTraverser extends Traversable[scalax.collection.Graph.NodeT]
An easy way to traverse a cfg execution and apply Traversable methods
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
backwardPathBuilderAux[P](label: Int, path: Vector[Int], i: Int, loopStates: Map[Int, Int], param: P, lambda: (Int, P, Vector[Int]) ⇒ (Option[Set[Vector[Int]]], P)): Set[Vector[Int]]
Recursive function used to build paths from a source in the backward direction
Recursive function used to build paths from a source in the backward direction
Automatically returns the full path when arriving to graph start (note: place a skip as first instruction if you don't want some criterion to fail) Automatically returns no path when the maximum number of loops is exceeded
- P
lambda parameter and return type
- label
the current / start node
- path
the path built from source to current node
- i
the maximum loop execution number
- loopStates
loop states (for each loop node id, the number of times we already went through the loop)
- param
a generic parameter to give to lambda
- lambda
the stop condition (to implement a given condition. Must return Some(path) if the path is finished, None if we let the exploration continue and the next generic parameter to use for next step
- returns
a set of all the paths found matching stop condition
if you want to stop the graph exploration when you find a ref node for a variable A
def lambda(node, A, path) = if(cfg.getAST(node).isDef(A)) Some((path, A)) else None backwardPathBuilderAux(0, Vector(0), 1, cfg.emptyLoopStates, AST.A.Variable("X"), lambda)
here the generic type can be IVF.Model.AST.A.Expression.Variable
Example: -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
emptyLoopStates: Map[Int, Int]
Provides valid starting loop states required in IVF.Model.CFG.forwardPathBuilderAux and IVF.Model.CFG.backwardPathBuilderAux
Provides valid starting loop states required in IVF.Model.CFG.forwardPathBuilderAux and IVF.Model.CFG.backwardPathBuilderAux
- returns
initial loop states
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
exec(label: Int, state: State): CFGTraverser
Shorthand for IVF.Model.CFG.CFGTraverser
Shorthand for IVF.Model.CFG.CFGTraverser
- label
label to start the execution at
- state
state used at the beginning of the execution
-
def
extend(cfg2: CFG): CFG
Returns a new CFG made of this extended with a new CFG
Returns a new CFG made of this extended with a new CFG
- cfg2
the CFG to merge
-
def
extend(graph2: GraphType, labels2: Map[Int, Command]): CFG
Returns a new CFG made of this extended with a new graph and some new labels
Returns a new CFG made of this extended with a new graph and some new labels
- graph2
the graph to merge
- labels2
the labels to merge
-
def
fillPathUp(path: Vector[Int], maxLoopExec: Int): Vector[Vector[Int]]
Offers all possible paths from a source to a subpath
Offers all possible paths from a source to a subpath
- path
the subpath to fulfill up
- maxLoopExec
the maximum execution number of each loop during computation
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
forwardPathBuilderAux[P](label: Int, path: Vector[Int], i: Int, loopStates: Map[Int, Int], param: P, lambda: (Int, P, Vector[Int]) ⇒ (Option[Set[Vector[Int]]], P)): Set[Vector[Int]]
Recursive function used to build paths from a source in the forward direction
Recursive function used to build paths from a source in the forward direction
Automatically returns the full path when arriving to graph end Automatically returns no path when the maximum number of loops is exceeded
- P
lambda parameter and return type
- label
the current / start node
- path
the path built from source to current node
- i
the maximum loop execution number
- loopStates
loop states (for each loop node id, the number of times we already went through the loop)
- param
a generic parameter to give to lambda
- lambda
the stop condition (to implement a given condition. Must return Some(path) if the path is finished, None if we let the exploration continue and the next generic parameter to use for next step
- returns
a set of all the paths found matching stop condition
if you want to stop the graph exploration when you find a ref node for a variable A
def lambda(node, A, path) = if(cfg.getAST(node).isDef(A)) Some((path, A)) else None forwardPathBuilderAux(0, Vector(0), 1, cfg.emptyLoopStates, AST.A.Variable("X"), lambda)
here the generic type can be IVF.Model.AST.A.Expression.Variable
Example: -
def
getAST(label: Int): AST
Returns the AST located at a given label
Returns the AST located at a given label
- label
label
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val graph: GraphType
-
def
graphOp(op: (GraphType) ⇒ GraphType): CFG
Returns a new CFG whose graph is changed by the lambda given
Returns a new CFG whose graph is changed by the lambda given
- op
transforms the graph
-
def
isAssign(label: Int): Boolean
Checks if a node is an Assign AST
Checks if a node is an Assign AST
- label
node
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isWhile(label: Int): Boolean
Checks if a node is a While AST
Checks if a node is a While AST
- label
node
- val labels: Map[Int, Command]
-
def
mapOp(op: (Map[Int, Command]) ⇒ Map[Int, Command]): CFG
Returns a new CFG whose labels are changed by the lambda given
Returns a new CFG whose labels are changed by the lambda given
- op
transforms the labels
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
next(source: Int, path: String): Option[Int]
Finds the next step in graph execution
Finds the next step in graph execution
- source
the current node
- path
if several paths are available, then this is necessary to choose the path ("" or "true" or "false")
- returns
Some(Int) if a path is found None else
-
def
nodeToString(i: Int): String
Get the first line of an AST for graph display
Get the first line of an AST for graph display
- i
label
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )