public final class CfgUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static ru.ispras.fortress.expression.Node |
getExpression(CfgCaseStatement caseNode,
CfgSwitchStatement switchNode)
Constructs an expression from the expression of the specified switch
CfgSwitchStatement node and it's possible values
in the specified case CfgCaseStatement node. |
static ru.ispras.fortress.expression.Node |
getPostCondition(CfgBlockStatement... blocks)
Returns the post-condition for the specified sequence of block statements.
|
static Statement |
getStatement(Statement statement,
java.lang.String id)
Returns sub-statement with the specified identifier.
|
static ru.ispras.fortress.expression.Node |
getStrongestPostCondition(ru.ispras.fortress.expression.Node pre,
ru.ispras.fortress.expression.Node post,
CfgBlockStatement... blocks)
Creates strongest post-condition for the specified conditions and the specified list
of block nodes.
|
static ru.ispras.fortress.expression.Node |
getWeakestPreCondition(ru.ispras.fortress.expression.Node postCond,
CfgBlockStatement block)
Creates the weakest pre-condition for the specified post-condition and the specified
basic block.
|
static java.util.List<Statement> |
substitute(java.util.List<Statement> list,
java.lang.String name,
ru.ispras.fortress.expression.Node node)
Substitutes usages of variable with the specified name
by the specified expression in all the elements of the specified collection.
|
public static Statement getStatement(Statement statement, java.lang.String id)
id
- Statement identifier.java.util.NoSuchElementException
- when there is no such sub-statement with the specified
identifier.public static java.util.List<Statement> substitute(java.util.List<Statement> list, java.lang.String name, ru.ispras.fortress.expression.Node node)
Substitutes usages of variable with the specified String
name
by the specified Node
expression
in all the elements of the specified collection. The resulting collection
consists of node copies of the specified collection. In which node the every
usage of the variable with the specified name will be substituted by the
specified expression.
list
- collection which nodes will be copied and transformedname
- variable namenode
- expressionpublic static ru.ispras.fortress.expression.Node getExpression(CfgCaseStatement caseNode, CfgSwitchStatement switchNode)
CfgSwitchStatement
node and it's possible values
in the specified case CfgCaseStatement
node.caseNode
- case nodeswitchNode
- switch nodepublic static ru.ispras.fortress.expression.Node getWeakestPreCondition(ru.ispras.fortress.expression.Node postCond, CfgBlockStatement block)
postCond
- The expression that is formed after the specified block.block
- The basic block.public static ru.ispras.fortress.expression.Node getPostCondition(CfgBlockStatement... blocks)
blocks
- The sequence of block statements.public static ru.ispras.fortress.expression.Node getStrongestPostCondition(ru.ispras.fortress.expression.Node pre, ru.ispras.fortress.expression.Node post, CfgBlockStatement... blocks)
IMPORTANT NOTE: all the block assignments should be range-free.
pre
- Expression that is formed before all the specified blocks (pre-condition).post
- Expression that is formed after all the specified blocks (post-condition).blocks
- The sequence of basic blocks.