mchalupa / dg

[LLVM Static Slicer] Various program analyses, construction of dependence graphs and program slicing of LLVM bitcode.
MIT License
483 stars 135 forks source link

Is there some method to check if tow nodes are conneced in a directed graph in DG? #308

Open Marvinmw opened 4 years ago

Marvinmw commented 4 years ago

Is there some method to check if tow nodes are conneced in a directed graph in DG?

mchalupa commented 4 years ago

Which graph? The best what you can do is to do some kind of BFS/DFS. DG has some predefined templates for that.

Marvinmw commented 4 years ago

Which graph? The best what you can do is to do some kind of BFS/DFS. DG has some predefined templates for that.

It is a LLVMDependGraph. Is it possible to build SCC using LLVMNode?

Marvinmw commented 4 years ago

Which graph? The best what you can do is to do some kind of BFS/DFS. DG has some predefined templates for that.

The essential question is that I want to map the instruction in LLVM bitcode to LLVMNode in LLVMDependGraph. But I find that my current solution is wrong. I store llvm::Value * and use findNode , but findNode return nullptr.

mchalupa commented 4 years ago

The API of LLVMDependenceGraph is now... well, not nice. I'm working on better one. However, you need to get the right dependence graph and search for the instruction there: https://github.com/mchalupa/dg/blob/master/include/dg/llvm/LLVMDependenceGraph.h#L229 (you can use https://github.com/mchalupa/dg/blob/master/include/dg/llvm/LLVMDependenceGraph.h#L233)

Marvinmw commented 4 years ago

The API of LLVMDependenceGraph is now... well, not nice. I'm working on better one. However, you need to get the right dependence graph and search for the instruction there: https://github.com/mchalupa/dg/blob/master/include/dg/llvm/LLVMDependenceGraph.h#L229 (you can use https://github.com/mchalupa/dg/blob/master/include/dg/llvm/LLVMDependenceGraph.h#L233)

Hi, thanks. I find that there is another easy solution. I want to use the dependentable dot file from llvm-dump. Is ti that the node identifier is the pointer address of llvm::Value *?

mchalupa commented 4 years ago

No, the node identifier is the address of the node.

Marvinmw commented 4 years ago

No, the node identifier is the address of the node.

Thanks a lot.