Patrick Alexander Simmons
2010-Mar-16 21:46 UTC
[LLVMdev] Getting the DSNode from a Pool Descriptor?
I figure (hopefully correctly) that I can iterate over all pool descriptors in a program by iterating over all users of poolinit and looking at the first argument. However, once I have a pool descriptor, I need to get its corresponding DSNode in the function in which it is complete (or in the global graph if it is a global). How do I do this? Thanks, --Patrick
Harmen van der Spek
2010-Mar-17 09:01 UTC
[LLVMdev] Getting the DSNode from a Pool Descriptor?
You might want to have a look at PoolAllocate.h. Per function, a PA::FuncInfo structure keeps track of all DSNodes that should be pool allocated. ArgNodes contains pool arguments, NodesToPA contains nodes that are locally pool allocated and thus initialized using poolinit. PoolDescriptors contains a mapping from DSNodes to pool descriptors, and you could easily invert this mapping. Finding a corresponding DSNode which is complete is not uniquely determined. For example, if a function F uses a pool, but its DSNode is incomplete, it might be called from two different function G and H, which both have a complete DSNode that maps to the DSNode in F. You can assume that if a function is cloned, so that its DSNodes are pool allocated, those DSNodes originate from a complete DSNode somewhere higher in the call chain. Per function, a pool-allocated version can be generated. After that, function calls are rewritten to call the pool allocated version. This is done in TransformFunctionBody.cpp. by calling TransformBody from PoolAllocate.cpp. Harmen Patrick Alexander Simmons wrote:> I figure (hopefully correctly) that I can iterate over all pool > descriptors in a program by iterating over all users of poolinit and > looking at the first argument. However, once I have a pool descriptor, > I need to get its corresponding DSNode in the function in which it is > complete (or in the global graph if it is a global). How do I do this? > > Thanks, > --Patrick
Andrew Lenharth
2010-Mar-17 12:45 UTC
[LLVMdev] Getting the DSNode from a Pool Descriptor?
On Tue, Mar 16, 2010 at 3:46 PM, Patrick Alexander Simmons <simmon12 at cs.uiuc.edu> wrote:> I figure (hopefully correctly) that I can iterate over all pool > descriptors in a program by iterating over all users of poolinit and > looking at the first argument. However, once I have a pool descriptor, > I need to get its corresponding DSNode in the function in which it is > complete (or in the global graph if it is a global). How do I do this?How is different than the function in which the poolinit appears (or main if it is global)? Andrew
Harmen van der Spek
2010-Mar-17 13:17 UTC
[LLVMdev] Getting the DSNode from a Pool Descriptor?
Depending on the value of dsa_pass_to_use, either EquivBUDataStructures or EQTDDataStructures is used. In the case that the top-down DSA is used, information is pushed down to nodes in callees. However, if bottom-up DSA is used, information has only been merged upwards and the nodes are not necessarily equivalent. Harmen Andrew Lenharth wrote:> On Tue, Mar 16, 2010 at 3:46 PM, Patrick Alexander Simmons > <simmon12 at cs.uiuc.edu> wrote: >> I figure (hopefully correctly) that I can iterate over all pool >> descriptors in a program by iterating over all users of poolinit and >> looking at the first argument. However, once I have a pool descriptor, >> I need to get its corresponding DSNode in the function in which it is >> complete (or in the global graph if it is a global). How do I do this? > > How is different than the function in which the poolinit appears (or > main if it is global)? > > Andrew
Patrick Alexander Simmons
2010-Mar-19 08:14 UTC
[LLVMdev] Getting the DSNode from a Pool Descriptor?
Harmen, your suggestion of inverting the mapping almost worked (and Andrew was correct that the function I need is the same as the one in which poolinit appears). Unfortunately, it appears that this mapping only considers the original function and not any of its clones. Since the pool descriptor in question may very well only exist in a clone, I can't use this. Is there another way? Thanks, --Patrick Harmen van der Spek wrote:> You might want to have a look at PoolAllocate.h. > > Per function, a PA::FuncInfo structure keeps track of all DSNodes that > should be pool allocated. ArgNodes contains pool arguments, NodesToPA > contains nodes that are locally pool allocated and thus initialized > using poolinit. > > PoolDescriptors contains a mapping from DSNodes to pool descriptors, and > you could easily invert this mapping. > > Finding a corresponding DSNode which is complete is not uniquely > determined. For example, if a function F uses a pool, but its DSNode > is incomplete, it might be called from two different function G and H, > which both have a complete DSNode that maps to the DSNode in F. > > You can assume that if a function is cloned, so that its DSNodes > are pool allocated, those DSNodes originate from a complete DSNode > somewhere higher in the call chain. > > Per function, a pool-allocated version can be generated. After that, > function calls are rewritten to call the pool allocated version. This is > done in TransformFunctionBody.cpp. by calling TransformBody from > PoolAllocate.cpp. > > > > Harmen > > > > Patrick Alexander Simmons wrote: > >> I figure (hopefully correctly) that I can iterate over all pool >> descriptors in a program by iterating over all users of poolinit and >> looking at the first argument. However, once I have a pool descriptor, >> I need to get its corresponding DSNode in the function in which it is >> complete (or in the global graph if it is a global). How do I do this? >> >> Thanks, >> --Patrick >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Apparently Analagous Threads
- [LLVMdev] Getting the DSNode from a Pool Descriptor?
- [LLVMdev] Getting the DSNode from a Pool Descriptor?
- [LLVMdev] Getting the DSNode from a Pool Descriptor?
- [LLVMdev] Getting the DSNode from a Pool Descriptor?
- [LLVMdev] Getting the DSNode from a Pool Descriptor?