Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the interprocedural Control Flow Graph of one program and do data flow analysis on it using llvm?

In llvm, I know the CFG(Control flow graph) of every function has been constructed and CFG is represented by relationships among basic blocks of funciton. BUt I want to traverse the global CFG of one program which include many functions in llvm. How do I get the interprocedural CFG of one program and then do data flow analysis on it ?

like image 671
breeze Avatar asked Nov 11 '22 18:11

breeze


1 Answers

According to http://clang.llvm.org/doxygen/classclang_1_1CFG.html the CFG in clang/LLVM exists only as an intra-procedural CFG.

However, one can run the opt tool to LLVM IR code and extract a textual CFG of functions, and then build a dedicated parser (FLEX/BISON for example) to interleave it into one inter-procedural CFG.

like image 153
OrenIshShalom Avatar answered Jan 04 '23 02:01

OrenIshShalom