Pool Allocation Questions

Hi,

I've been trying to get up to speed on LLVM in general and the pool allocation pass in particular because I need to write a transformation which piggybacks off of pool allocation. I was what the external API to pool allocation is, and how would I go about querying it for things like "give me the set of pointers to the pools this Value* might be in" from my pass after pool allocation is run. Could someone who knows about pool allocation help me with this? I was also wondering if the technique described in the Programmer's Manual for indicating that one pass must be run after another applies for pool allocation even though it's in a separate tree from LLVM itself.

Thanks,
--Patrick

Patrick Alexander Simmons wrote:

Hi,

I've been trying to get up to speed on LLVM in general and the pool
allocation pass in particular because I need to write a transformation
which piggybacks off of pool allocation. I was what the external API to
pool allocation is, and how would I go about querying it for things like
"give me the set of pointers to the pools this Value* might be in" from
  

I believe there is a getPoolHandle() method in the pool allocation
passes that will, given a Value *, return the Value * of the pool in
which the value is found.

my pass after pool allocation is run. Could someone who knows about
pool allocation help me with this? I was also wondering if the
technique described in the Programmer's Manual for indicating that one
pass must be run after another applies for pool allocation even though
it's in a separate tree from LLVM itself.
  

Pool Allocation is a strange beast; it has the odd property of being
both a transform pass *and* an analysis pass (this is because other
passes, such as yours, want to query it about what it has done). [1]

My suggestion is to schedule the pool allocation pass manually in a
special too (see pa.cpp for an example). In your pass, you should still
add it as a prerequisite analysis pass like any other pass that you pass
depends upon. Just keep in mind that if there are multiple passes that
need to query the Pool Allocation pass, every pass in-between must
preserve the pool allocation pass results; otherwise, the pool
allocation pass will be run a second time by the Pass Manager, which
will yield incorrect results.

-- John T.

[1] Note that the duel analysis/transform pass property is not a
desirable property, but that's how pool allocation is currently written.