[LLVMdev] Help with pass registration

Chris Lattner sabre at nondot.org
Mon Sep 11 10:02:50 PDT 2006

On Sat, 9 Sep 2006, Fernando Magno Quintao Pereira wrote:
>    I think I've figured the problem out. I have a very basic question
> though. What is the difference between addRequired, and addRequiredID?
> For instance, in RegAllocLocal.cpp, you have both:
> AU.addRequired<LiveVariables>();
> AU.addRequiredID(PHIEliminationID);
>    When should I use one, and when the other should be used?

They do the same thing.  addRequired is used when there is a public 
interface for the pass you want.  This most often is the case with 
analyses, where you want to get information out of the analysis by using 
public methods on the pass class.  getRequiredID is most useful when there 
is no public interface, the pass just modifies the code coming in (it 
provides a property of the code, not an interface to be queried).



More information about the llvm-dev mailing list