Merge pull request #507 from owen-mc/cache-tcontrolflownode

Cache TControlFlowNode
This commit is contained in:
Chris Smowton
2021-03-16 14:45:35 +00:00
committed by GitHub
2 changed files with 5 additions and 4 deletions

View File

@@ -61,6 +61,7 @@ private predicate isCond(Expr e) {
* respectively, of the execution of the function and the loading of the file;
* - Skip nodes that are semantic no-ops, but make CFG construction easier.
*/
cached
newtype TControlFlowNode =
/**
* A control-flow node that represents the evaluation of an expression.

View File

@@ -654,15 +654,15 @@ module IR {
}
/** Holds if this extracts the `idx`th value of the result of `base`. */
predicate extractsElement(Instruction base, int idx) { base = getBase() and idx = i }
predicate extractsElement(Instruction base, int idx) { base = this.getBase() and idx = i }
override Type getResultType() {
exists(CallExpr c | getBase() = evalExprInstruction(c) |
exists(CallExpr c | this.getBase() = evalExprInstruction(c) |
result = c.getTarget().getResultType(i)
)
or
exists(TypeAssertExpr tae | getBase() = evalExprInstruction(tae) |
result = tae.getType().(TupleType).getComponentType(i)
exists(TypeAssertExpr tae | this.getBase() = evalExprInstruction(tae) |
result = tae.getType().(TupleType).getComponentType(pragma[only_bind_into](i))
)
or
exists(Type rangeType | rangeType = s.(RangeStmt).getDomain().getType().getUnderlyingType() |