public final class CfgLoopBackend extends CfgDefaultVisitor
The loops that this class is able to detect and transform MUST contain nodes with meta-information of the following values:
MetaInfoValue.LOOP_INIT
- BasicBlock
node
that contains loop counter variable initialization;
MetaInfoValue.LOOP_ENTRY
- Merge
node
that has loop first and last nodes as child and parent nodes respectively
(this node is a parent for the BasicBlock
node
with MetaInfoValue.LOOP_INIT
meta-information value);
MetaInfoValue.LOOP_COND
- Switch
node
that contains the condition on loop counter variable;
MetaInfoValue.LOOP_INC
- optional BasicBlock
node
that contains Assignment
that increments loop counter variable
(this node does not appear at the infinite loops);
MetaInfoValue.LOOP_FIN
- CfgNode
node
that is a parent for Merge
node with
MetaInfoValue.LOOP_ENTRY
meta information value.
When the loop counter condition is true
, the counter-incrementing BasicBlock
node is absent, because all the loop-body-sub-graph will be executed in the dependant separate
process. Otherwise the loop is transformed to the sequence of loop-body-sub-graphs. The amount
of the sequence is calculated as how many times the expression-upon-counter will stay
satisfiable when counter will be incremented on calling the increment-function again and again.
CfgVisitor.Status
Constructor and Description |
---|
CfgLoopBackend()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
onMergeBegin(Merge merge)
Starts visiting
Merge node. |
void |
onModuleBegin(Module module)
Starts visiting
Module node. |
void |
onModuleEnd(Module module)
Finishes visiting
Module node. |
void |
onProcessBegin(Process process)
Starts visiting
Process node. |
getStatus, onBasicBlockBegin, onBasicBlockEnd, onCaseBegin, onCaseEnd, onCfgModelBegin, onCfgModelEnd, onMergeEnd, onProcessEnd, onRootBegin, onRootEnd, onSink, onSrcBegin, onSrcEnd, onSwitchBegin, onSwitchEnd, onWaitBegin, onWaitEnd
public void onModuleBegin(Module module)
CfgVisitor
Module
node.onModuleBegin
in interface CfgVisitor
onModuleBegin
in class CfgDefaultVisitor
module
- Module
nodepublic void onModuleEnd(Module module)
CfgVisitor
Module
node.onModuleEnd
in interface CfgVisitor
onModuleEnd
in class CfgDefaultVisitor
module
- Module
nodepublic void onProcessBegin(Process process)
CfgVisitor
Process
node.onProcessBegin
in interface CfgVisitor
onProcessBegin
in class CfgDefaultVisitor
process
- Process
nodepublic void onMergeBegin(Merge merge)
CfgVisitor
Merge
node.onMergeBegin
in interface CfgVisitor
onMergeBegin
in class CfgDefaultVisitor
merge
- merge node