[llvm-dev] Accessing an out-of-tree custom AA in LLVM

Stephan Diestelhorst via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 10 04:33:00 PDT 2021


Hi,

I am still wondering how to access the results of my custom, out-of-tree AA in other (out-of-tree) passes; using the LLVM provided mechanisms for AA "enrichment", and using opt as the top-level.  I have attached some code which works (on LLVM 8, still) for me, but some questions remain:

(1) What is the correct way to hook my call-back into the ExternalAAWrapperPass?  The code I can find uses createExternalAAWrapper pass with an appropriate CB, but in my case I don't have a pass manager lying around I can hook the resulting ImmutablePass into.  Instead, my approach is to rely on the ExternalAAWrapperPass to be there, and then (in my custom_aa_pass::runOnFunction !) manually hook in the CB.  That feels wrong, but seems to work.  Previously, I experimented with subclassing ExternalAAWrapperPass, but that was fragile.

(2) Using the LegacyAARGetter in a ModulePass works (after adding https://reviews.llvm.org/D71348 ), but I manually need to instantiate the custom_aa_pass via a command line argument to opt; it is somehow not picked up from AA.addRequired<custom_aa_pass>(), and also manually nudging it with an additional getAnalysis<custom-aa-pass>(F) in runOnModule does not make it appear.  Is that intentional?

Overall, the entire (legacy) pass manager code feels like black magic to me, and it is not quite clear whether what I have come up with is sensible.  Any comments (other than code style, please; I know it is different ^^) on the attached would be much appreciated!

Thanks,
  Stephan
--
Stephan Diestelhorst
System Architect
Xilinx - Data Center Group
Cambridge, UK

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: aa_tie_in.cpp
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210910/a29e6ed2/attachment.ksh>


More information about the llvm-dev mailing list