[LLVMdev] Pass is not automatically registered

Reid Spencer reid at x10sys.com
Mon Sep 5 12:01:34 PDT 2005


Tzu-Chien,

The static construction of the RegisterAnalysis objects occurs very early in 
the process' life (before main is entered). If you're not using VC++ (as Morten 
mentioned), then you should be able to see the static object constructed very 
early in the debugging session.

Reid.

Tzu-Chien Chiu wrote:

> I am not sure if my problem is similar to:
>   http://lists.cs.uiuc.edu/pipermail/llvmdev/2003-December/000715.html
> 
> It seems that the constructor of the static global pass object isn't called:
> 
> lib/CodeGen/DependenceAnalyzer.cpp:
> 
> static RegisterAnalysis<DependenceAnalyzer> X("depana", "Dependence Analysis");
> 
> I traced into struct RegisterAnalysis ctor, but my pass doesn't
> appear. I put it in an anonymous namespace, it doesn't work too.
> 
> 
> The class definitions:
> 
> class DependenceAnalyzer : public MachineFunctionPass {
>   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
>     AU.setPreservesAll();
>     AU.addRequired<LiveIntervals>();
>     AU.addRequired<LiveVariables>();    
>     MachineFunctionPass::getAnalysisUsage(AU);
>   }
> 
> class RegAllocMultibank : public MachineFunctionPass {
>     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
>       AU.addRequired<LiveIntervals>();
>       AU.addRequired<DependenceAnalyzer>();
>       MachineFunctionPass::getAnalysisUsage(AU);
>     }
> };
> 




More information about the llvm-dev mailing list