[LLVMdev] getAnalysis()

Chris Lattner sabre at nondot.org
Sun Nov 3 14:59:00 PST 2002


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.

> Any idea what I am doing wrong?  Thanks,

As far as I can tell, you aren't doing anything wrong.  If the above
doesn't help, please email me (privately) your pass code (whatever state
it is in) so I can debug the situation.

Thanks!

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list