[LLVMdev] CFG Manipulation is LLVM

Duncan Sands baldrick at free.fr
Thu Mar 18 01:54:22 PDT 2010


Hi Rohith,

>     Is there any API within llvm that provides methods to access the CFG
> and do some manipulations on the CFG.

the CFG is built into the LLVM IR: given a basic block (i.e. a node of the
CFG) you can iterate over its successors and predecessors using the methods
in include/llvm/Support/CFG.h.  To modify the CFG you have to modify the
basic blocks, usually by changing the basic block terminator.

Ciao,

Duncan.



More information about the llvm-dev mailing list