[cfe-dev] Enhancing the DataFlowSolver in clang
Simone Pellegrini
spellegrini at dps.uibk.ac.at
Thu Feb 11 23:40:11 PST 2010
Hi all,
I am currently trying to implement few simple dataflow analysis, namely
dominators and reaching definitions with the purpose to actually
understand how the clang's DataFlowSolver works.
I got stuck with the dominator tree:
http://en.wikipedia.org/wiki/Dominator_(graph_theory)
The theory it's quite simple, but when I tried to implement it on the
solver I started to have some problems.
The issue is that I need to set an initial state for each of the CFG
blocks, and more important I need to specify a different initial state
for each of the blocks (actually only the root node needs to have a
different initialization)
For what I understand by reverse engineering the code, the method void
setTopValue(DominatorGraph::ValTy& V) should be used to set the initial
state of a dataflow problem.
However, in the dominators analysis I need to initialize the bitvectors
for each of the blocks with different values and in order to be able to
do that I need a different signature for the method which would be
something like:
void SetTopValue(DominatorGraph::ValTy& V, clang::CFGBlock const& B){ }
This modification requires only small changes in the DataFlowSolver and
implementation of dominators gets simpler.
Is there any other way to have this kind of behaviour or it is really
missing? If you all agree with this change I can provide the patch!
regards, S. Pellegrini
More information about the cfe-dev
mailing list