[LLVMdev] Writing pass for llc

Devang Patel devang.patel at gmail.com
Tue Jul 14 11:06:28 PDT 2009

On Sun, Jul 12, 2009 at 2:09 PM, shu<shuguang.feng at gmail.com> wrote:
> Is there a beginner's tutorial/documentation on how to write passes
> for the llc tool?  I've managed to write some simple analysis passes
> for the opt tool but can't figure out how to do the same for llc.
> What is the proper way to integrate a new MachineFunction pass with
> llc?  Is there a way to register passes and selectively enable them on
> the command line (as with opt) or do I need to hard code it into
> llc.cpp?
> I would like to be able to write a pass that looks at MachineFunctions
> and inserts instructions right before register allocation (but after
> all other optimization/instruction selection passes).  Any direction/
> advice would be of great help.  Thanks!

llc uses Target.addPassesToEmit* interface to add passes. You can
insert your pass at appropriate place here.


More information about the llvm-dev mailing list