<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi Vivek,</div><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 18, 2016, at 1:12 PM, vivek pandya <<a href="mailto:vivekvpandya@gmail.com" class="">vivekvpandya@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><i class=""><font size="2" face="monospace, monospace" class=""><b class="">Vivek Pandya</b></font></i><div class=""><br class=""></div></div></div></div></div></div>
<br class=""><div class="gmail_quote">On Sat, Mar 19, 2016 at 1:30 AM, Quentin Colombet <span dir="ltr" class=""><<a href="mailto:qcolombet@apple.com" target="_blank" class="">qcolombet@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Mar 18, 2016, at 12:38 PM, vivek pandya <<a href="mailto:vivekvpandya@gmail.com" target="_blank" class="">vivekvpandya@gmail.com</a>> wrote:</div><br class=""><div class=""><br class=""><br clear="all" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><i class=""><font size="2" face="monospace, monospace" class=""><b class="">Vivek Pandya</b></font></i><div class=""><br class=""></div></div></div></div></div></div><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Fri, Mar 18, 2016 at 10:03 PM, Quentin Colombet<span class=""> </span><span dir="ltr" class=""><<a href="mailto:qcolombet@apple.com" target="_blank" class="">qcolombet@apple.com</a>></span><span class=""> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi Vivek,<div class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Mar 16, 2016, at 1:00 PM, vivek pandya via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Hello,<div class=""><br class=""></div><div class="">Probably this may be too late to start thinking about this project but I think this is particularly useful feature for LLVM.<span class=""> </span></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">+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.</div><div class="">In other words, the MachineModule/MachineFunctions should contain enough information such that we do not have to keep the LLVM IR around.</div><div class=""><br class=""></div><div class="">One of the main challenge is about alias analysis information that are tight with LLVM IR, but may be used in MachineFunctionPass.</div><span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">A quick use I can think of this is Implementing Inter-procedural Register Allocation ( for Research purpose ).</div><div class=""><br class=""></div><div class="">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)</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">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.</div><span class=""><br class=""></span></div></div></div></blockquote><div class="">Looking at the current implementation of the Module class, it seems that Module 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. </div><div class=""><br class=""></div><div class="">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. </div><div class="">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. </div><div class=""><br class=""></div><div class="">I think I need to look at how LLVM IR is lowered to MachineIR to understand this better. </div></div></div></blockquote><div class=""><br class=""></div></span><div class="">This part is the job of instruction selection. The machine instruction after ISel are pretty much standalone modulo some back link to the llvm ir for the memory addresses and such. Those same back links are used to query the alias analysis.</div><div class="">The link to the Function from the MachineFunction is here to provide an access to Function attributes and other utilities. I believe we could transfer the ownership of those things as par of the lowering.</div></div></div></blockquote><div class=""><br class=""></div><div class="">I found some great blog post on this topic <a href="http://eli.thegreenplace.net/2012/11/24/life-of-an-instruction-in-llvm" class="">http://eli.thegreenplace.net/2012/11/24/life-of-an-instruction-in-llvm</a></div><div class="">Quentin Do you think the above mentioned plan is reasonable and it would work ?</div></div></div></div></div></blockquote><div><br class=""></div><div>From a high level point of view, that looks reasonable.</div><div><br class=""></div><div>Cheers,</div><div>-Quentin</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><span class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="">Please provide some more info or analysis so that I can build a reasonable and promising work plan for this.</div><div class=""><br class=""></div><div class="">Sincerely,</div><div class="">Vivek</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><span class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">After that I think next step is to extend the ModulePass and let ModulePass execute optimization provide enough information.</div></div></div></blockquote><div class=""><br class=""></div></span>+1</div><div class=""><span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Am I going in correct direction?</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Yes, at least, it makes sense to me.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Please provide some pointers.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Other than gathering feedback on what is needed and trying, I unfortunately cannot offer anything else.</div><div class=""><br class=""></div>Cheers,</div><div class="">-Quentin<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Sincerely,<br clear="all" class=""><div class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><i class=""><font size="2" face="monospace, monospace" class=""><b class="">Vivek Pandya</b></font></i><div class=""><br class=""></div></div></div></div></div></div></div></div>_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></div></blockquote></div></div></div></blockquote></div></div></blockquote></span></div><br class=""></div></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>