[DF] defined analysis producing wrong output.
Opened this issue · 1 comments
Example
# bril2json < p.bril | python3 ../../df.py defined
@main(awesome_integer: int) {
.entry:
print awesome_integer;
}
Actual:
entry:
in: ∅
out: ∅
Expected
awesome_integer
should be defined in .entry
.
entry:
in: awesome_integer
out: awesome_integer
I think the issue here is two-fold.
-
There's no simple way to pass in arguments to the analyses. Here, we pass in an analysis with a defaulted (empty) data structure. However, for an analysis such as reaching definitions or defined analysis, we want to pass in the function arguments to the first block.
Lines 82 to 92 in dbbd8e8
-
Even if we do pass in the correct function arguments,
Lines 48 to 49 in dbbd8e8
inval = analysis.merge(out[n] for n in in_edges[node]) # in_edges[.entry] == []
So, even though in_[.entry]
is initialized correctly, it is over-written afterward.
As usual, let me know if I'm off-target.
Yeah, I wrote the DF analysis examples before function parameters existed. The right thing to do is to still use empty sets as the initial values but essentially hallucinate an entry block that defines the parameters.