Help with pass registration

Dear guys,

    I have updated my LLVM to the top of CVS, and now I am getting
errors like this one below when I write new passes:

"llc: PassManagerT.h:387: void
llvm::PassManagerT<Trait>::markPassUsed(const llvm::PassInfo*,
llvm::Pass*) [with Trait = llvm::FTraits]: Assertion
`getAnalysisOrNullUp(P) &&
dynamic_cast<ImmutablePass*>(getAnalysisOrNullUp(P)) && "Pass available
but not found! " "Perhaps this is a module pass requiring a function
pass?"' failed."

Could someone give me pointers to know more about this type of errors? I
think I am not registering my new passes properly in the new llvm
distribution,
because I am getting this even if I try to write a very simple machine
function pass that only returns false and preserves all the other passes.

Thanks a lot,

Fernando

   I have updated my LLVM to the top of CVS, and now I am getting
errors like this one below when I write new passes:

What does your getAnalysisUsage method look like?

-Chris

"llc: PassManagerT.h:387: void
llvm::PassManagerT<Trait>::markPassUsed(const llvm::PassInfo*,
llvm::Pass*) [with Trait = llvm::FTraits]: Assertion
`getAnalysisOrNullUp(P) &&
dynamic_cast<ImmutablePass*>(getAnalysisOrNullUp(P)) && "Pass available
but not found! " "Perhaps this is a module pass requiring a function
pass?"' failed."

Could someone give me pointers to know more about this type of errors? I
think I am not registering my new passes properly in the new llvm
distribution,
because I am getting this even if I try to write a very simple machine
function pass that only returns false and preserves all the other passes.

Thanks a lot,

Fernando
_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-Chris

> I have updated my LLVM to the top of CVS, and now I am getting
> errors like this one below when I write new passes:

What does your getAnalysisUsage method look like?

Chris,

    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?

Thanks a lot,

Fernando

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).

-Chris