R.Omar
R.Omar

Reputation: 655

Modify CFG in LLVM

Could I modify the CFG in LLVM and these modifications be written in IR file? I made an LLVM pass to modify basic block and edges sequence and I ran the pass by lli -load to emit the IR, but nothing happened I think I should use some commands to manipulate the original CFG with the required one. I read in the llvmdev that the CFG is manipulated by changing the basic block terminator.However, my main point to change the edges too.

Upvotes: 1

Views: 500

Answers (1)

Eli Bendersky
Eli Bendersky

Reputation: 273716

Look at the transformation passes in lib/Transforms. Most of them modify the IR. To run a pass that modifies IR and spit the modified IR back, use the opt tool.

Upvotes: 4

Related Questions