public class BasicBlock extends CfgNode implements AssignmentContainer, UseDef
Basic blocks can be either of concurrent (non-blocking) type or of sequential (blocking) type. The concurrent type means that all the assignments should be executed simultaneously in such a concurrent mode. The sequential type means that all the assignments should be executed sequentially in the same order they have in it's collection.
childNode, parentNode
Constructor and Description |
---|
BasicBlock(Assignment assignment)
Constructs object with the specified assignment and of non-concurrent type.
|
BasicBlock(Assignment assignment,
boolean concurrent)
Constructs object with the specified assignment and the flag type.
|
BasicBlock(boolean concurrent)
Constructs object of the specified type flag.
|
BasicBlock(java.util.List<Assignment> assignments)
Constructs object with the specified collection of assignments.
|
BasicBlock(java.util.List<Assignment> assignments,
boolean concurrent)
Constructs object with the specified assignments and the type flag.
|
BasicBlock(ru.ispras.fortress.expression.NodeVariable target,
ru.ispras.fortress.expression.Node value)
Constructs object that contains one assignment with the specified target and value.
|
BasicBlock(RangedVariable target,
ru.ispras.fortress.expression.Node value)
Constructs object that contains one assignment with the specified target and value.
|
Modifier and Type | Method and Description |
---|---|
void |
addAssignment(Assignment stmt)
Adds assignment statement.
|
void |
addAssignments(java.util.List<Assignment> statements)
Appends assignments list to the last assignment of basic block.
|
CfgModelNode |
deepCopy()
Returns a copy of this node.
|
java.util.List<Assignment> |
getAssignments()
Returns all block assignments.
|
java.util.Set<ru.ispras.fortress.expression.NodeVariable> |
getDefines()
Returns a set of defined variables.
|
java.lang.String |
getDescription(ru.ispras.fortress.expression.printer.ExprTreePrinter printer)
Returns node string description in the format of the specified printer.
|
CfgModelNode |
getOnlyChild()
Returns the only child node.
|
CfgModelNode |
getOnlyParent()
Returns the only parent node.
|
CfgNodeType |
getType()
Returns node type.
|
java.util.Set<ru.ispras.fortress.expression.NodeVariable> |
getUses()
Returns a set of used variables.
|
boolean |
hasOnlyChild()
Checks rather node has exactly one child node.
|
boolean |
hasOnlyParent()
Checks rather node has exactly one parent node.
|
boolean |
isConcurrent()
Checks rather object contains only concurrent assignments.
|
void |
removeAssignments()
Removes all block assignments.
|
void |
setConcurrent(boolean concurrent)
Sets the concurrent flag to the specified value.
|
addChild, addParent, equals, getChildren, getId, getParents, hasChildren, hashCode, hasParents, removeChild, removeParent
addMetaInfo, addMetaInfo, addMetaInfo, addMetaInfo, getMetaInfo, getMetaInfo, getMetaInfo, hasMetaInfo, hasMetaInfo, removeMetaInfo
public BasicBlock(boolean concurrent)
concurrent
- block type flagpublic BasicBlock(java.util.List<Assignment> assignments, boolean concurrent)
assignments
- assignmentsconcurrent
- block type flagjava.lang.IllegalArgumentException
- when first argument is null
.public BasicBlock(java.util.List<Assignment> assignments)
The default value of concurrent flag is false
assignments
- assignmentsjava.lang.IllegalArgumentException
- when argument is null
.public BasicBlock(Assignment assignment, boolean concurrent)
assignment
- assignmentconcurrent
- block type flagjava.lang.IllegalArgumentException
- when argument is null
.public BasicBlock(Assignment assignment)
assignment
- assignmentpublic BasicBlock(RangedVariable target, ru.ispras.fortress.expression.Node value)
target
- target variablevalue
- expression valueAssignment
public BasicBlock(ru.ispras.fortress.expression.NodeVariable target, ru.ispras.fortress.expression.Node value)
target
- target variablevalue
- expression valueAssignment
public void addAssignment(Assignment stmt)
Assignment will be added with on 1 greater number than other assignments have.
addAssignment
in interface AssignmentContainer
stmt
- assignment to be addedjava.lang.IllegalArgumentException
- when argument is null
.public void addAssignments(java.util.List<Assignment> statements)
addAssignments
in interface AssignmentContainer
statements
- list of concurrent assignmentsjava.lang.IllegalArgumentException
- when argument is null
.public java.util.List<Assignment> getAssignments()
getAssignments
in interface AssignmentContainer
public void removeAssignments()
removeAssignments
in interface AssignmentContainer
public boolean isConcurrent()
true
if contains only concurrent assignments,
false
otherwise.public void setConcurrent(boolean concurrent)
concurrent
- concurrent flagpublic CfgModelNode deepCopy()
CfgModelNode
The copy does not keep the same links to parent or child nodes as this has.
deepCopy
in interface CfgModelNode
public java.lang.String getDescription(ru.ispras.fortress.expression.printer.ExprTreePrinter printer)
CfgModelNode
getDescription
in interface CfgModelNode
getDescription
in class CfgNode
printer
- printerpublic CfgNodeType getType()
CfgModelNode
By default, node has CfgNodeType.UNKNOWN
type.
getType
in interface CfgModelNode
public boolean hasOnlyParent()
CfgModelNode
hasOnlyParent
in interface CfgModelNode
true
if node has exactly one parent at the moment, false
otherwise.public boolean hasOnlyChild()
CfgModelNode
hasOnlyChild
in interface CfgModelNode
true
if node has exactly one child at the moment, false
otherwise.public CfgModelNode getOnlyParent()
CfgModelNode
getOnlyParent
in interface CfgModelNode
public CfgModelNode getOnlyChild()
CfgModelNode
getOnlyChild
in interface CfgModelNode
public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getUses()
UseDef
public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getDefines()
UseDef
getDefines
in interface UseDef