hi, i am reading LLVM code, focusing on the code generation (backend) part. however, it is still rather tough to understand all the code, so i think i need to improve my background on compiler backend first. any recommendation on good books that introduces all the related techniques used by LLVM: DAG lowering, DAG legalization,instruction selection, scheduling, register allocation, etc... i looked at the Dragon book, but it seems outdated, and didnt introduce all the above concepts. many thanks, Jun -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130222/25aa49e5/attachment.html>
I don't think you need any special books. There is nothing complicated going on that is not in a basic compiler book. Mostly you have to understand how they implemented basic things in this framework. Knowing modern C++ (i.e. templates, overloading, etc...) and STL pretty well is more important than knowing about compiler theory in order to understand things. The documentation online just needs to be read many times and you need to do your own port or try and understand one for an architecture that you already know pretty well. http://llvm.org/docs/ProgrammersManual.html http://llvm.org/docs/ You need to know what a phi node is. That is about the only thing that is mostly something you could not just learn from reading the code because it's a special term. http://en.wikipedia.org/wiki/Static_single_assignment_form Reed On 02/21/2013 11:48 PM, Jun Koi wrote:> hi, > > i am reading LLVM code, focusing on the code generation (backend) part. > however, it is still rather tough to understand all the code, so i think > i need to improve my background on compiler backend first. > > any recommendation on good books that introduces all the related > techniques used by LLVM: DAG lowering, DAG legalization,instruction > selection, scheduling, register allocation, etc... > > i looked at the Dragon book, but it seems outdated, and didnt introduce > all the above concepts. > > many thanks, > Jun > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
For me it was helpful to use the debugger (gdb) to step through things too. On 02/22/2013 02:32 AM, Reed Kotler wrote:> I don't think you need any special books. > > There is nothing complicated going on that is not in a basic compiler > book. Mostly you have to understand how they implemented basic things in > this framework. > > Knowing modern C++ (i.e. templates, overloading, etc...) and STL pretty > well is more important than knowing about compiler theory in order to > understand things. > > The documentation online just needs to be read many times and you need > to do your own port or try and understand one for an architecture that > you already know pretty well. > > http://llvm.org/docs/ProgrammersManual.html > http://llvm.org/docs/ > > You need to know what a phi node is. That is about the only thing that > is mostly something you could not just learn from reading the code > because it's a special term. > > http://en.wikipedia.org/wiki/Static_single_assignment_form > > Reed > > > On 02/21/2013 11:48 PM, Jun Koi wrote: >> hi, >> >> i am reading LLVM code, focusing on the code generation (backend) part. >> however, it is still rather tough to understand all the code, so i think >> i need to improve my background on compiler backend first. >> >> any recommendation on good books that introduces all the related >> techniques used by LLVM: DAG lowering, DAG legalization,instruction >> selection, scheduling, register allocation, etc... >> >> i looked at the Dragon book, but it seems outdated, and didnt introduce >> all the above concepts. >> >> many thanks, >> Jun >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>
If you wanted to write a new register allocator, that would be a different story. Then you would do well to read the literature to try and understand about various schemes that have already been invented. No need to reinvent the wheel. Most people doing a port can figure things out by just using their brain and the documentation already at the LLVM web site; but like I said, a good solid knowledge of modern C++ and STL is necessary; otherwise you may struggle with code that is really very simple but is hard to understand because of the language issues. Reed On 02/22/2013 02:32 AM, Reed Kotler wrote:> I don't think you need any special books. > > There is nothing complicated going on that is not in a basic compiler > book. Mostly you have to understand how they implemented basic things in > this framework. > > Knowing modern C++ (i.e. templates, overloading, etc...) and STL pretty > well is more important than knowing about compiler theory in order to > understand things. > > The documentation online just needs to be read many times and you need > to do your own port or try and understand one for an architecture that > you already know pretty well. > > http://llvm.org/docs/ProgrammersManual.html > http://llvm.org/docs/ > > You need to know what a phi node is. That is about the only thing that > is mostly something you could not just learn from reading the code > because it's a special term. > > http://en.wikipedia.org/wiki/Static_single_assignment_form > > Reed > > > On 02/21/2013 11:48 PM, Jun Koi wrote: >> hi, >> >> i am reading LLVM code, focusing on the code generation (backend) part. >> however, it is still rather tough to understand all the code, so i think >> i need to improve my background on compiler backend first. >> >> any recommendation on good books that introduces all the related >> techniques used by LLVM: DAG lowering, DAG legalization,instruction >> selection, scheduling, register allocation, etc... >> >> i looked at the Dragon book, but it seems outdated, and didnt introduce >> all the above concepts. >> >> many thanks, >> Jun >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>