JS: Use the LHS as the location for SsaExplicitDefinition

This commit is contained in:
Asger F
2025-08-28 11:35:15 +02:00
parent 4a687a1222
commit d117c52d2f
2 changed files with 19 additions and 10 deletions

View File

@@ -67,11 +67,12 @@ private module Cached {
}
cached
predicate defAt(BasicBlock bb, int i, Variable v, VarDef d) {
exists(VarRef lhs |
predicate defAt(BasicBlock bb, int i, Variable v, VarDef d, VarRef lhs) {
(
lhs = d.getTarget().(BindingPattern).getABindingVarRef() and
v = lhs.getVariable()
|
) and
(
lhs = d.getTarget() and
bbIndex(bb, d, i)
or
@@ -148,7 +149,10 @@ module Public {
predicate useAt(int i, Variable v, VarUse u) { useAt(this, i, v, u) }
/** Holds if this basic block defines variable `v` in its `i`th node `d`. */
predicate defAt(int i, Variable v, VarDef d) { defAt(this, i, v, d) }
predicate defAt(int i, Variable v, VarDef d) { defAt(this, i, v, d, _) }
/** Holds if this basic block defines variable `v` in its `i`th node `d`, and `lhs` is the corresponding variable reference. */
predicate defAt(int i, Variable v, VarDef d, VarRef lhs) { defAt(this, i, v, d, lhs) }
/**
* Holds if `v` is live at entry to this basic block and `u` is a use of `v`