[LLVMdev] How to obtain CFG using llvm-gcc?

Daniel Liew daniel.liew at imperial.ac.uk
Fri Nov 22 03:47:02 PST 2013


Hi,

llvm-gcc is deprecated. It would be wise to avoid using it unless you have to!

You don't say what form you want the control flow graphs in. AFAIK you
can think of LLVM bitcode modules (emitted by using -emit-llvm flag)
as a collection of global variables and functions. Each function is
essentially a control flow graph. You can quickly take a look at a CFG
by doing something like...

clang -emit-llvm -c hello.c -o hello.bc
opt -analyze -view-cfg hello.bc


Hope that helps,

Thanks,
Dan Liew.

On 22 November 2013 02:33, 李永超 <lyc364 at gmail.com> wrote:
> Hi,
> How can I obtain CFGs using llvm-gcc? After reading the documentation at
> LLVM`s homepage, I didn`t found anything related to this.
> Thanks.




More information about the llvm-dev mailing list