Yingtong Liu via llvm-dev
2018-Mar-13 05:03 UTC
[llvm-dev] Passes interaction running on two different IRs
Hi all, I am trying to run two llvm passes on two different IRs to finish my analysis. These two passes need to exchange information during their excecution. I am doing so because I can't link the two IRs I want to analyze together as a big IR and run my llvm pass on it. What I want to do specifically is: The first IR will call the functions in the second IR. Whenver there is a function call in the first IR to the second IR, the first pass will evoke the second pass on the second IR and give it some information as input. When the second pass is finished analysing its IR, it will return some information to the first pass. Basically, I want to do the same analysis for two IRs just like they were linked together. Since I can't actually link them togther, I need to manage the communication between two passes running on two IRs by myself. I feel like to do so, I need to write another program to control these two passes, pretty like what the opt program does. But I am not sure if it is durable and feel overwhemled to start. Anyone can give me any suggestions about this? Thank you very much. Best, Ying -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180312/1ad9995e/attachment.html>
Nemanja Ivanovic via llvm-dev
2018-Mar-13 17:21 UTC
[llvm-dev] Passes interaction running on two different IRs
Your use case seems to be somewhat similar to what LTO does, so it may be possible to hack something up in LTO. Perhaps you'd need to have a custom pass pipeline that would accomplish what you need. Since you say you can't link the two files, I imagine you'd need to make sure you don't emit code from one of them in the LTO link step or something along those lines. In any case, I'm not very familiar with LTO or ThinLTO, but it just seems like a good fit for what you're after. On Tue, Mar 13, 2018 at 1:03 AM, Yingtong Liu via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi all, > > I am trying to run two llvm passes on two different IRs to finish my > analysis. These two passes need to exchange information during their > excecution. I am doing so because I can't link the two IRs I want to > analyze together as a big IR and run my llvm pass on it. > > What I want to do specifically is: > > The first IR will call the functions in the second IR. Whenver there is a > function call in the first IR to the second IR, the first pass will evoke > the second pass on the second IR and give it some information as input. > When the second pass is finished analysing its IR, it will return some > information to the first pass. > > Basically, I want to do the same analysis for two IRs just like they were > linked together. Since I can't actually link them togther, I need to manage > the communication between two passes running on two IRs by myself. > > I feel like to do so, I need to write another program to control these two > passes, pretty like what the opt program does. But I am not sure if it is > durable and feel overwhemled to start. Anyone can give me any suggestions > about this? Thank you very much. > > Best, > Ying > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://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/20180313/22e3dfe3/attachment.html>
Yingtong Liu via llvm-dev
2018-Mar-20 16:27 UTC
[llvm-dev] Passes interaction running on two different IRs
Hi Nemanja, Thank you so much for your suggestion. I guess either looking at LTO or customizing my own opt will work. Either way, I need more information to actually relate my two bitcode together so that I can analyze them as a whole. Then I can use LTO or customized opt to do that. Thanks! Best, On Tue, Mar 13, 2018 at 10:21 AM, Nemanja Ivanovic <nemanja.i.ibm at gmail.com> wrote:> Your use case seems to be somewhat similar to what LTO does, so it may be > possible to hack something up in LTO. Perhaps you'd need to have a custom > pass pipeline that would accomplish what you need. Since you say you can't > link the two files, I imagine you'd need to make sure you don't emit code > from one of them in the LTO link step or something along those lines. In > any case, I'm not very familiar with LTO or ThinLTO, but it just seems like > a good fit for what you're after. > > > > On Tue, Mar 13, 2018 at 1:03 AM, Yingtong Liu via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hi all, >> >> I am trying to run two llvm passes on two different IRs to finish my >> analysis. These two passes need to exchange information during their >> excecution. I am doing so because I can't link the two IRs I want to >> analyze together as a big IR and run my llvm pass on it. >> >> What I want to do specifically is: >> >> The first IR will call the functions in the second IR. Whenver there is a >> function call in the first IR to the second IR, the first pass will evoke >> the second pass on the second IR and give it some information as input. >> When the second pass is finished analysing its IR, it will return some >> information to the first pass. >> >> Basically, I want to do the same analysis for two IRs just like they were >> linked together. Since I can't actually link them togther, I need to manage >> the communication between two passes running on two IRs by myself. >> >> I feel like to do so, I need to write another program to control these >> two passes, pretty like what the opt program does. But I am not sure if it >> is durable and feel overwhemled to start. Anyone can give me any >> suggestions about this? Thank you very much. >> >> Best, >> Ying >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://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/20180320/57a8e514/attachment.html>