[LLVMdev] Writing pass for llc

Sanjiv Gupta sanjiv.gupta at microchip.com
Tue Jul 14 19:47:45 PDT 2009


Devang Patel wrote:
> 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.
>
> -
> Devang
>
>   
One related question.
Can we write CallGraphSCCPass in llc?

- Sanjiv




More information about the llvm-dev mailing list