Christian Convey
2015-Jun-26 19:18 UTC
[LLVMdev] For AA imlpementations: same pointers for runOnModule(...) and alias(...)?
Hi all, I'm writing an AA pass that overrides the *runOnModule( Module & M )* and *alias( const Value* V1, ...)* methods. I'm trying to understand my options for relating per-*Value* information computed during *runOnModule*, to the *Value* objects passed into my alias method. Is attaching metadata to those objects during *runOnModule*, and reading it during *alias(...)*, pretty much the only decent way to match up a given IR Value across those two methods' invocations? Thanks, Christian P.S. Apologies if this email is too close to a duplicate post. I've seen a few variations on this question lately on IRC and this email list, but I haven't seen any clear answer. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150626/9e7d04c1/attachment.html>
Hal Finkel
2015-Jul-02 17:00 UTC
[LLVMdev] For AA imlpementations: same pointers for runOnModule(...) and alias(...)?
----- Original Message -----> From: "Christian Convey" <christian.convey at gmail.com> > To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> > Sent: Friday, June 26, 2015 2:18:48 PM > Subject: [LLVMdev] For AA imlpementations: same pointers for runOnModule(...) and alias(...)? > > > > Hi all, > > > I'm writing an AA pass that overrides the runOnModule( Module & M ) > and alias( const Value* V1, ...) methods. I'm trying to understand > my options for relating per- Value information computed during > runOnModule , to the Value objects passed into my alias method. > > > Is attaching metadata to those objects during runOnModule , and > reading it during alias(...) , pretty much the only decent way to > match up a given IR Value across those two methods' invocations? >There are two ways of doing this: 1. Add metadata (as you've suggested) 2. Maintain a cache in your pass (either by making your pass invariant or by marking other passes as preserving it). This cache can make use of TrackingVH (value handles) or WeakVH (weak value handles), see include/llvm/IR/ValueHandle.h, as appropriate on both functions and values. If this gives you sufficient guarantees, it likely easier and more efficient. -Hal> > Thanks, Christian > > > P.S. Apologies if this email is too close to a duplicate post. I've > seen a few variations on this question lately on IRC and this email > list, but I haven't seen any clear answer. > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory