[LLVMdev] llvm passes

Ryan M. Lefever lefever at crhc.uiuc.edu
Fri Sep 22 11:11:09 PDT 2006


In the instructions for writing LLVM passes, it says "[c]urrently it is 
illegal for a ModulePass to require a FunctionPass. This is because 
there is only one instance of the FunctionPass object ever created, thus 
nowhere to store information for all of the functions in the program at 
the same time."

I'm a little confused by that.  It was my understanding that if pass X 
required pass Y, then pass Y would have to fully run and build up its 
internal data structures before pass X ran.  Then, when pass X was run, 
X would call getAnalysis<Y> and get a reference to the pass Y object, 
which it could query for information stored during pass Y's execution. 
So, I'm wondering why the types of the passes matter.  The statement 
that there would be "nowhere to store information for all of the 
functions in the program," confuses me.  I assumed that information for 
all of the functions processed by pass Y would be retained in internal 
data structures specific to Y.

Can someone please help me figure out where I'm going wrong?

Thanks,
Ryan



More information about the llvm-dev mailing list