addRequired vs addRequiredTransitive

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

addRequired vs addRequiredTransitive

Ryan M. Lefever
I am having a hard time figuring out the difference between addRequired
and addRequiredTransitive.  Could someone please clarify the difference?
  Let's say I have a function pass P1 that relies on a function pass P2.
P1 computes some sort of analysis on a function F and P2 uses that
analysis when it processes F.  Does that mean that I should use
addRequiredTransitive?

Thanks,
Ryan


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: addRequired vs addRequiredTransitive

Chris Lattner
On Sat, 21 Oct 2006, Ryan M. Lefever wrote:
> I am having a hard time figuring out the difference between addRequired
> and addRequiredTransitive.  Could someone please clarify the difference?
>  Let's say I have a function pass P1 that relies on a function pass P2.
> P1 computes some sort of analysis on a function F and P2 uses that
> analysis when it processes F.  Does that mean that I should use
> addRequiredTransitive?

An analysis pass has two interesting stages:

1. When it's runOnFunction (or whatever) method is called.  Call this the
    'computation' phase of an analysis.
2. After its computation phase when some other pass is using it.

If you are writing some analysis A that needs analysis B, you use one of
these two methods.  Use addRequired if A uses B in phase #1.  Use
addRequiredTransitive if A uses B in phase #1 or phase #2.

If this helps, I'd appreciate it if you would create a doc patch to
improve the how-to-write-a-pass document with something that would have
helped you to understand the situation better.

-Chris

--
http://nondot.org/sabre/
http://llvm.org/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev