Mohannad Ismail via llvm-dev
2021-Feb-24 20:28 UTC
[llvm-dev] LLVM data structures between modules
Greetings everyone, I currently have a pass (Pass 2) that does some transformations. What I want to do is to have a pass (Pass 1) that runs before Pass 2, collects some IR information, stores it in a data structure and passes the data structure to Pass 2 so that I can use it for specific transformations. I think this can be done with getAnalysisUsage, but I'm not sure how. I would like to know how to do that exactly, if it's possible. Another thing, and this is the tricky part, is that I want Pass 1 to run on all the source files I have first before Pass 2 runs and pass a collective data structure to Pass 2. In other words, I want Pass 1 to run across all the modules and source files first, collect information, pass it to Pass 2 then Pass 2 runs. Is there a way to tell LLVM to do this type of "double compilation"? Hope I was able to explain this well enough. Please let me know if I wasn't clear or if you have any questions. Thank you very much! Best regards, Mohannad Ismail -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210224/2a7db428/attachment.html>
David Blaikie via llvm-dev
2021-Feb-24 21:01 UTC
[llvm-dev] LLVM data structures between modules
If you want to do cross-file optimization, you're looking for/want to use something like LTO or ThinLTO. (see, for instance, the whole program devirtualization work done with ThinLTO recently) On Wed, Feb 24, 2021 at 12:28 PM Mohannad Ismail via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Greetings everyone, > > I currently have a pass (Pass 2) that does some transformations. What I > want to do is to have a pass (Pass 1) that runs before Pass 2, collects > some IR information, stores it in a data structure and passes the data > structure to Pass 2 so that I can use it for specific transformations. I > think this can be done with getAnalysisUsage, but I'm not sure how. I would > like to know how to do that exactly, if it's possible. > > Another thing, and this is the tricky part, is that I want Pass 1 to run > on all the source files I have first before Pass 2 runs and pass a > collective data structure to Pass 2. In other words, I want Pass 1 to run > across all the modules and source files first, collect information, pass it > to Pass 2 then Pass 2 runs. Is there a way to tell LLVM to do this type of > "double compilation"? > > Hope I was able to explain this well enough. Please let me know if I > wasn't clear or if you have any questions. Thank you very much! > > Best regards, > Mohannad Ismail > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210224/e3572f66/attachment.html>