Python speed up calculation of ControlFlowNode.getAChild()

This commit is contained in:
Mark Shannon
2019-06-27 11:39:32 +01:00
parent fad37bd6c9
commit 775214e467

View File

@@ -401,13 +401,18 @@ class ControlFlowNode extends @py_flow_node {
py_true_successors(this, _) or py_false_successors(this, _)
}
/* Gets a CFG node that corresponds to a child of the AST node for this node */
pragma [noinline]
ControlFlowNode getAChild() {
this.getNode().getAChildNode() = result.getNode() and
result = this.getExprChild() and
result.getBasicBlock().dominates(this.getBasicBlock())
}
/* join-ordering helper for `getAChild() */
pragma [noinline]
private ControlFlowNode getExprChild() {
this.getNode().(Expr).getAChildNode() = result.getNode() and
not this instanceof UnaryExprNode
}
}
@@ -1058,7 +1063,7 @@ class BasicBlock extends @py_flow_node {
this.strictlyDominates(other)
}
BasicBlock getImmediateDominator() {
cached BasicBlock getImmediateDominator() {
this.getAPart().getImmediateDominator() = result.getAPart()
}