[LLVMdev] getAnalysis()
Scott Mikula
mikula at uiuc.edu
Sun Nov 3 17:00:02 PST 2002
Chris Lattner wrote:
> On Sun, 3 Nov 2002, Scott Mikula wrote:
> > I'm having trouble with using getAnalysis() to access the results of one
> > pass from within another. I require the pass to be previously executed
> > as follows:
> >
> > void MyPass::getAnalysisUsage(AnalysisUsage &Info) const {
> > Info.addRequired<TDDataStructures>();
> > }
>
> Is that the only line you have? There may be some trouble if you also
> include a pass that invalidates TDDS before your pass can get to it.
> Unfortunately we don't have good diagnostics for this case yet.
>
> > Then I try to use it as follows:
> > bool MyPass::doInitialization(Module &M) {
> > TDDataStructures &dsgraph = getAnalysis<TDDataStructures>();
> > return false;
> > }
>
> Hrm, with these two lines I don't see anything that could be wrong. If
> you're using doInitialization, I assume that you're using a FunctionPass.
> Although FunctionPass's should be able to require interprocedural Pass's,
> maybe it's causing a problem here. Try changing your pass to subclass
> Pass directly (and use run), and see if you can still reproduce it.
Using a normal Pass instead of a FunctionPass seems to solve the problem.
Should I just go ahead and implement my pass that way, or is there likely to
be a solution to make it work with a FunctionPass?
Scott Mikula
More information about the llvm-dev
mailing list