[LLVMdev] RegisterPass isAnalysis parameter

David A. Greene greened at obbligato.org
Thu Feb 25 17:45:20 PST 2010

On Thursday 25 February 2010 19:24:30 Trevor Harmon wrote:
> Hi,
> I'm confused about the is_analysis parameter of the RegisterPass
> constructor (defined in PassSupport.h). The only explanation I can
> find is that is_analysis should be set to true if the pass is "an
> analysis pass, for example dominator tree pass". Can someone please
> clarify what is meant by "analysis pass"?

I don't have the sources at my fingertips but my expectation
is that if is_analysis is true, LLVM assumes the pass does not modify
the IR. 

> Also -- and this is more of a C++ question than an LLVM question --
> the Hello pass (in lib/Transforms/Hello/Hello.cpp) puts its class
> inside an anonymous namespace. But I thought an anonymous namespace
> limits the scope of anything in that namespace to the file level (so
> you can't call the functions in that namespace from outside the file).
> If so, how is it possible for LLVM to access the Hello pass?

The RegisterPass template takes care of notifying the PassManager
that the pass exists.  One of the advantages of PassManager is
that it decouples pass execution from the rest of the infrastructure
so the class need not be visible to anything outside the implementation
of the pass itself.



More information about the llvm-dev mailing list