Is data-dependence analysis driven by self-defined pointer analysis or SVF?
Hi, author. I try to integrate dg into other project and when I use data-dependence analysis. I found not like llvm-cda-dump.cpp, in llvm-dda-dump, there seems to be no code for leveraging SVF pointer analysis. So is there support for SVF in data-dependence analysis?
DG can use SVF for points-to analysis and this then propagates to data dependence analysis. If you want to use the value-flow analysis from SVF, you must do that directly via SVF API.
To answer the question from the title: both, depends on the options you pass on the command line (and if you compile DG with SVF support).
data
DG can use SVF for points-to analysis and this then propagates to data dependence analysis. If you want to use the value-flow analysis from SVF, you must do that directly via SVF API.
So I just simply need to replace DGLLVMPointerAnalysis with SVFPointerAnalysis?
Yes, that should do the trick, check this code: https://github.com/mchalupa/dg/blob/master/tools/llvm-pta-dump.cpp#L816
Yes, that should do the trick, check this code: https://github.com/mchalupa/dg/blob/master/tools/llvm-pta-dump.cpp#L816
ok, and I want to map instructions in a bc file to the instructions they depend on. So the code for data dependence analysis is
LLVMDataDependenceAnalysis DDA(M.get(), &PTA, options.dgOptions.DDAOptions);
DDA.run();
auto *SSA = static_cast<MemorySSATransformation *>(
DDA->getDDA()->getImpl());
SSA->computeAllDefinitions();
right?
This part is important:
LLVMDataDependenceAnalysis DDA(M.get(), &PTA, options.dgOptions.DDAOptions);
DDA.run();
Then you can query directly the DDA object for the definitions.
This part is important:
LLVMDataDependenceAnalysis DDA(M.get(), &PTA, options.dgOptions.DDAOptions); DDA.run();Then you can query directly the
DDAobject for the definitions.
So, this part
auto *SSA = static_cast<MemorySSATransformation *>(
DDA->getDDA()->getImpl());
SSA->computeAllDefinitions();
is only optional? If I don't run SSA, would there be differences in the data dependence results?
SSA is run either way, but this code makes it to compute all the results immediately (otherwise they are computed on-demand upon querying DDA object) so that llvm-dda-dump can show dump all the results including some internal information obtained from the SSA object.
There should be no differences in the results if you omit this code.