Sameer D. Sahasrabuddhe
2005-Apr-02 10:40 UTC
[LLVMdev] newbie question - selecting the write kind of pass
I want to create a simple map from a Value to the instruction that defines it. Such a map is present inside SchedGraph, but I need it in a much simpler context. If I got it right, I create a new AnalysisGroup, and write a pass that implements it. What kind of pass should I derive it from? The mapping only makes sense within a function, so FunctionPass seems to be the right choice ... is that correct? The documentation says that "a FunctionPass is not allowed to retain state across functions. What does that imply for an Analysis pass derived from FunctionPass? Since all passes will act on one function at a time, the life of the analysis will be handled correctly, right? Sameer. -- Research Scholar, KReSIT, IIT Bombay http://www.it.iitb.ac.in/~sameerds/
Chris Lattner
2005-Apr-02 17:35 UTC
[LLVMdev] newbie question - selecting the write kind of pass
On Sat, 2 Apr 2005, Sameer D. Sahasrabuddhe wrote:> I want to create a simple map from a Value to the instruction that > defines it. Such a map is present inside SchedGraph, but I need it in > a much simpler context.Is this in the context of the code generator?> If I got it right, I create a new AnalysisGroup, and write a pass that > implements it. What kind of pass should I derive it from? The mapping > only makes sense within a function, so FunctionPass seems to be the > right choice ... is that correct?Yes.> The documentation says that "a FunctionPass is not allowed to retain > state across functions. What does that imply for an Analysis pass > derived from FunctionPass?Yes.> Since all passes will act on one function > at a time, the life of the analysis will be handled correctly, right?Yup! -Chris -- http://nondot.org/sabre/ http://llvm.cs.uiuc.edu/
Sameer D. Sahasrabuddhe
2005-Apr-03 03:28 UTC
[LLVMdev] newbie question - selecting the write kind of pass
On Sat, Apr 02, 2005 at 11:35:30AM -0600, Chris Lattner wrote:> On Sat, 2 Apr 2005, Sameer D. Sahasrabuddhe wrote: > > I want to create a simple map from a Value to the instruction that > > defines it. Such a map is present inside SchedGraph, but I need it in > > a much simpler context. > > Is this in the context of the code generator?No ... I am just trying to feel the waters ... simply trying to create a "data flow graph" from the SSA form. I meant "context" in a very loose, plain-English way.> > The documentation says that "a FunctionPass is not allowed to retain > > state across functions. What does that imply for an Analysis pass > > derived from FunctionPass? > > Yes.Ummm ... let me rephrase my question :) An analysis pass derived from a FunctionPass is not expected to retain state across functions. What exactly does that mean when the passes are being run on the program? I assume that analysis will be instantiated only once, and used everywhere. If that is so, as the pass writer, do I have to "flush" all data-structures from the previous run, in runOnFunction? Sameer. -- Research Scholar, KReSIT, IIT Bombay http://www.it.iitb.ac.in/~sameerds/