[LLVMdev] About adding a pass into llvm

Qingan Li ww345ww at gmail.com
Tue Jan 11 21:30:48 PST 2011


I have seen
INITIALIZE_PASS(LiveVariables, "livevars", "Live Variable Analysis", false,
false);
in the llvm/lib/codegen/LiveVariables.cpp, where LiveVariables is a subclass
of MachineFunctionPass, and
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis) \
  static RegisterPass<passName> passName ## _info(arg, name, cfg, analysis)
in PassSupport.h

Is this code used to register and initialize a pass? This kind of
registration is just the way illustrated in the hello example at
http://llvm.org/docs/WritingAnLLVMPass.html#registration.


My problem is:
I wrote a pass (Mypass), also a subclass of MachineFunctionPass. And I wrote
the similar statement:
INITIALIZE_PASS(Mypass, "mypass", "Access Analysis", false, false);
aiming to register and initialize this new pass. I rebuilt the llvm with the
newly added pass, but when I used llc -help-hidden, I could not found the
"-mypass" option. How could I enable the new pass and the related option?
-- 
Best regards,

Li Qingan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110112/476f0d9b/attachment.html>


More information about the llvm-dev mailing list