vivek pandya via llvm-dev
2016-Mar-16 20:00 UTC
[llvm-dev] [GSoC 2016] Need more info on Add a MachineModulePass
Hello, Probably this may be too late to start thinking about this project but I think this is particularly useful feature for LLVM. A quick use I can think of this is Implementing Inter-procedural Register Allocation ( for Research purpose ). I have start looking at the code for MachineFunctionPass, I think currently MachineModule class is not available ( the project work will include that ) but trying to find out required details to first create a MachineModule class which holds references to required information. I am also trying to figure out what are the things should compose MachineModule class ( some sort of analogy with Module class used for IR passes) After that I think next step is to extend the ModulePass and let ModulePass execute optimization provide enough information. Am I going in correct direction? Please provide some pointers. Sincerely, *Vivek Pandya* -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160317/58204ef3/attachment.html>
Quentin Colombet via llvm-dev
2016-Mar-18 16:33 UTC
[llvm-dev] [GSoC 2016] Need more info on Add a MachineModulePass
Hi Vivek,> On Mar 16, 2016, at 1:00 PM, vivek pandya via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hello, > > Probably this may be too late to start thinking about this project but I think this is particularly useful feature for LLVM.+1. I’d like to use something this feature in GlobalISel. The idea is that has as soon as we lowered the LLVM IR of the whole module to MachineInstr, the LLVM IR should be deallocable. In other words, the MachineModule/MachineFunctions should contain enough information such that we do not have to keep the LLVM IR around. One of the main challenge is about alias analysis information that are tight with LLVM IR, but may be used in MachineFunctionPass.> A quick use I can think of this is Implementing Inter-procedural Register Allocation ( for Research purpose ). > > I have start looking at the code for MachineFunctionPass, I think currently MachineModule class is not available ( the project work will include that ) but trying to find out required details to first create a MachineModule class which holds references to required information. I am also trying to figure out what are the things should compose MachineModule class ( some sort of analogy with Module class used for IR passes)At least for GlobalISel, we would need a way to create and get the global variables of a Module, but lowered to MachineInstr (or MC) level.> > After that I think next step is to extend the ModulePass and let ModulePass execute optimization provide enough information.+1> > Am I going in correct direction?Yes, at least, it makes sense to me.> Please provide some pointers.Other than gathering feedback on what is needed and trying, I unfortunately cannot offer anything else. Cheers, -Quentin> > Sincerely, > Vivek Pandya > > _______________________________________________ > 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/20160318/06987c16/attachment-0001.html>
vivek pandya via llvm-dev
2016-Mar-18 19:38 UTC
[llvm-dev] [GSoC 2016] Need more info on Add a MachineModulePass
*Vivek Pandya* On Fri, Mar 18, 2016 at 10:03 PM, Quentin Colombet <qcolombet at apple.com> wrote:> Hi Vivek, > > On Mar 16, 2016, at 1:00 PM, vivek pandya via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > Hello, > > Probably this may be too late to start thinking about this project but I > think this is particularly useful feature for LLVM. > > > +1. I’d like to use something this feature in GlobalISel. The idea is that > has as soon as we lowered the LLVM IR of the whole module to MachineInstr, > the LLVM IR should be deallocable. > In other words, the MachineModule/MachineFunctions should contain enough > information such that we do not have to keep the LLVM IR around. > > One of the main challenge is about alias analysis information that are > tight with LLVM IR, but may be used in MachineFunctionPass. > > A quick use I can think of this is Implementing Inter-procedural Register > Allocation ( for Research purpose ). > > I have start looking at the code for MachineFunctionPass, I think > currently MachineModule class is not available ( the project work will > include that ) but trying to find out required details to first create a > MachineModule class which holds references to required information. I am > also trying to figure out what are the things should compose MachineModule > class ( some sort of analogy with Module class used for IR passes) > > > At least for GlobalISel, we would need a way to create and get the global > variables of a Module, but lowered to MachineInstr (or MC) level. > > Looking at the current implementation of the Module class, it seems thatModule class maintains Linked List to GlobalVariables, Functions, GlobalAliasis ... and meta informations about the Module like file name , Module ID , Target Triple DataLayout etc. And currently for MachineFunction pass MachineFunctionAnalysis creates object of MachineFunction. The MachineFunction constructor takes Function, TargetMachine etc as arguments and creates MachineBasicBlocks and thus provides access to MachineInstr. Now I have very rough idea to inherit the Module Pass and use the information available in Module class to create MachineModule class. MachineModule class should use MachineFunctionAnalysis to create MachineFunction for each Function F in Module class MachineModule class should create links between all these MachineFunction object as per the original linked list of Function objects. Similarly we need to get MC lowered representation for each features of Module class when it is possible and we should also preserve some IR Analysis that are useful at later stage. Then we provide various method to use this information (access GlobalVariable etc) as similar to Module class. Once we have MachineModule class ready we can use this to execute user specific operation on each function or provide user iterators for MachineFunction list. I think I need to look at how LLVM IR is lowered to MachineIR to understand this better. Please provide some more info or analysis so that I can build a reasonable and promising work plan for this. Sincerely, Vivek> > After that I think next step is to extend the ModulePass and let > ModulePass execute optimization provide enough information. > > > +1 > > > Am I going in correct direction? > > > Yes, at least, it makes sense to me. > > Please provide some pointers. > > > Other than gathering feedback on what is needed and trying, I > unfortunately cannot offer anything else. > > Cheers, > -Quentin > > > Sincerely, > *Vivek Pandya* > > _______________________________________________ > 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/20160319/fb3d58ef/attachment.html>
John Criswell via llvm-dev
2016-Mar-20 19:53 UTC
[llvm-dev] [GSoC 2016] Need more info on Add a MachineModulePass
On 3/18/16 12:33 PM, Quentin Colombet via llvm-dev wrote:> Hi Vivek, > >> On Mar 16, 2016, at 1:00 PM, vivek pandya via llvm-dev >> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >> >> Hello, >> >> Probably this may be too late to start thinking about this project >> but I think this is particularly useful feature for LLVM. > > +1. I’d like to use something this feature in GlobalISel. The idea is > that has as soon as we lowered the LLVM IR of the whole module to > MachineInstr, the LLVM IR should be deallocable. > In other words, the MachineModule/MachineFunctions should contain > enough information such that we do not have to keep the LLVM IR around.I think this is a separate issue from having a MachineModulePass. My goal in having a MachineModulePass is to be able to do inter-procedural analysis and transformation on a program after its code has been generated. Examples of such applications include inter-procedural register allocation, inter-procedural instruction selection, inter-procedural code layout optimization (I have a colleague working on this using reference affinity theory), and inter-procedural analysis of machine code for measuring the efficacy of compiler transformations for security. Whether one keeps the LLVM IR around or not is orthogonal. What is needed is a way of being able to examine the whole program without having to worry about another transformation running in parallel (if you use a MachineFunctionPass, as I understand it, the pass should not be analyzing/transforming other MachineFunction's).> > One of the main challenge is about alias analysis information that are > tight with LLVM IR, but may be used in MachineFunctionPass.One of the other projects I proposed is to encode this information within the MachineInstr IR. This would be very useful for one of my projects, and it might solve this problem as well (once the information is encoded in the MachineInstr IR, you don't need the LLVM IR around anymore). Regards, John Criswell -- John Criswell Assistant Professor Department of Computer Science, University of Rochester http://www.cs.rochester.edu/u/criswell -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160320/03c807b2/attachment.html>
Reasonably Related Threads
- [GSoC 2016] Need more info on Add a MachineModulePass
- [GSoC 2016] Need more info on Add a MachineModulePass
- [GlobalISel][RFC] Thoughts on MachineModulePass
- [GSoC 2016] Interprocedural Register Allocation - Introduction and Feedback
- [GlobalISel][RFC] Thoughts on MachineModulePass