Hello everyone, I have been interested in compilers, especially in the optimization aspects from quite some time now. I don't know if I have a decent background to brag about, but all I can say is that I have tried very small things related to building a compiler [0]. However I admit that I am still new to a lot of things. Like many others who are interested in compilers, I am interested in the Register Allocation problem too. I have been thinking about implementing an interprocedural register allocator from quite a while now. But I thought instead of trying it out on a toy compiler, why not just get my hands dirty in the real world. I was seeing if I could implement it on LLVM and incidentally, I noticed that the open projects page lists interprocedural register allocation as one of the open projects [1]. However, I was reading the DeveloperPolicy page and the policy for making major changes asks the developers to discuss the work here before proceeding. So, I am writing this mail to kickoff a discussion. I would really like to contribute to LLVM and I think this is a good place for me to start. Is there something specific like a paper that you guys would want me to read before diving in? I understand that register allocation itself is a tricky problem and doing an interprocedural allocation is extremely hard. But I would like to try, at least try and fail if worst comes to worst than not doing anything at all. At least by attempting to implement that, I will have a better understanding of LLVM code base which may come in handy to contribute to other parts of LLVM. [0] https://github.com/madhusudancs/PL241-MCS-Compiler [1] http://llvm.org/OpenProjects.html#codegen -- Thanks and regards, Madhusudan.C.S -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121004/ebade806/attachment.html>
On Oct 4, 2012, at 2:47 AM, Madhusudan C.S <madhusudancs at gmail.com> wrote:> However, I was reading the DeveloperPolicy page and the policy for making major > changes asks the developers to discuss the work here before proceeding. So, I am > writing this mail to kickoff a discussion. I would really like to contribute to LLVM and > I think this is a good place for me to start. Is there something specific like a paper > that you guys would want me to read before diving in? > > I understand that register allocation itself is a tricky problem and doing an interprocedural > allocation is extremely hard. But I would like to try, at least try and fail if worst comes > to worst than not doing anything at all. At least by attempting to implement that, I will > have a better understanding of LLVM code base which may come in handy to contribute > to other parts of LLVM.Interprocedural register allocation means different things to different people. The approach that is described on the open projects page is quite simple; it still runs the register allocator on one function at a time. I am not aware of any papers describing this simple idea. Basically, the PrologEpilogInsertion pass will add a bit mask to MachineModuleInfo describing which registers are clobbered by the function being compiled. Later, when compiling the callers, that bit mask is used to initialize the regmask operands on call instructions. See also TargetRegisterInfo::getCallPreservedMask(). /jakob -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121004/a85ddfd7/attachment.html>
Hi Jakob, On Thu, Oct 4, 2012 at 1:31 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk>wrote:> > On Oct 4, 2012, at 2:47 AM, Madhusudan C.S <madhusudancs at gmail.com> wrote: > > However, I was reading the DeveloperPolicy page and the policy for making > major > changes asks the developers to discuss the work here before proceeding. > So, I am > writing this mail to kickoff a discussion. I would really like to > contribute to LLVM and > I think this is a good place for me to start. Is there something specific > like a paper > that you guys would want me to read before diving in? > > I understand that register allocation itself is a tricky problem and doing > an interprocedural > allocation is extremely hard. But I would like to try, at least try and > fail if worst comes > to worst than not doing anything at all. At least by attempting to > implement that, I will > have a better understanding of LLVM code base which may come in handy to > contribute > to other parts of LLVM. > > > Interprocedural register allocation means different things to different > people. The approach that is described on the open projects page is quite > simple; it still runs the register allocator on one function at a time. > > I am not aware of any papers describing this simple idea. > > Basically, the PrologEpilogInsertion pass will add a bit mask to > MachineModuleInfo describing which registers are clobbered by the function > being compiled. Later, when compiling the callers, that bit mask is used to > initialize the regmask operands on call instructions. >So the idea is to sidestep from the calling convention a bit if we already know that the called function will not be using all the registers required by the convention and instead use those registers in the caller? If I am understanding this correctly, is this something desirable for LLVM, even if it is not high priority? Would you guys be Ok if I try to implement this without disturbing the project priorities but with a little help/guidance? Something that interests me to get started with LLVM.> > See also TargetRegisterInfo::getCallPreservedMask(). > > /jakob > >-- Thanks and regards, Madhusudan.C.S -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121004/a5de8fff/attachment.html>