<div dir="ltr"><div dir="ltr">On Tue, May 19, 2020 at 11:11 AM Allyn Shell via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif">Greetings, my name is Allyn Shell I am the instructor of the Compiler Design with LLVM course at Johns Hopkins University Engineering for Professionals in the CS Department. (I have included
 my short bio as an introduction at the end of this email.)</span></p></div></div></blockquote><div><br>Welcome to the LLVM community!<br> <br>(for context I mostly work on LLVM's Debug Info (DWARF) support - so I won't know everything about what you need to know, but I'll try to give some rough ideas, at least)<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif"><u></u> </span><span style="font-family:"Times New Roman",serif;font-size:12pt">I spent the last two years updating the Compiler Design course to include LLVM</span></p></div></div></blockquote><div><br>Sounds great!<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:"Times New Roman",serif">which required me to learn “everything” about the LLVM Project. There are several difficult steps that I could
 not overcome in two years of studying LLVM. I am writing to request help from the community to fill in these missing points which basically involve using clang to create a compiler for an imperative C like language (for teaching students how to do this).</span></p></div></div></blockquote><div><br>Is Clang the right foundation for this, rather than LLVM? Clang is pretty complicated by the needs of a production-focussed C++ compiler, and might not be the best place to go tinkering to add new language support.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:"Times New Roman",serif"> It
 is easy to create a scanner and a parser using public domain tools, but when I reached the codegen to LLVM’s IR I quickly ran out of good guidance. The biggest help came from the LLVM Tutorials, but they are a little shallow and a little hard to follow at
 times due to what appears to be generations of updates.</span></p></div></div></blockquote><div><br>Yep, documentation's rarely kept up to date or revisited wholesale to give it consistent polish, etc.<br><br>If there's any particular bits you think might be improved - patches for the documentation are most appreciated so the next person might have an easier time than you did.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif"><u></u> </span><span style="font-family:"Times New Roman",serif;font-size:12pt">Are there LLVM based tools available to make the transition from AST to IR, and where do I find them?</span></p></div></div></blockquote><div><br>Generic tools for custom AST to IR? Nothing I know of. The closest to "tooling" that exists, certainly inside the LLVM project itself, is IRBuilder - a helper API for building LLVM IR.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif"><u></u> </span><span style="font-family:"Times New Roman",serif;font-size:12pt">Is the transition between AST and IR mapped in a way that is compatible with the mappings used for debug and the IR to Machine Specific Object Code? </span></p></div></div></blockquote><div><br></div><div>I'm not sure I understand the question, could you rephrase it? Myself and Eric Christopher presented a tutorial at the LLVM developers meeting several years ago about how to generate LLVM IR that includes debug information that is then used by LLVM's middle (IR optimizations) and backend (Machine Specific Object Code generation) to create DWARF (or Windows CodeView) debug information, usable by a debugger like gdb, etc.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:"Times New Roman",serif;font-size:12pt">Where can I find that information?</span></p></div></div></blockquote><div><br>The written version of that tutorial is here: <a href="https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl09.html">https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl09.html</a> <br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif"><u></u> <u></u></span></p>
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif">Is there an LLVM specific scanner/parser pair that integrates with the AST to IR mapping?</span></p></div></div></blockquote><div><br></div><div>Nope - LLVM doesn't really offer anything above the IR. Some utilities (like IRBuilder and DIBuilder) to help create it - but what you use to create it is entirely up to you.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:"Times New Roman",serif"> Where do I find information about them?</span></p>
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif"><u></u> <u></u></span></p>
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif"><span> </span>- - - - - - - - - - - - - - - -</span></p>
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif">Bio for Allyn Shell:</span></p>
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif">I am the son of Dr. Donald L. Shell (author of the Shellsort). I am a Computer Scientist (semi-retired) and an Educator. I worked (indirectly) for NASA for 25 years building ground stations
 and simulators. I worked in missile defense for 10 years building simulators. Within industry I have taught seminars and short courses on a variety of topics including: Introductory Ada, Introductory C++, Advanced C++, Object Oriented Software Development,
 Introduction to Java, and Management of Ada Software Development. I am the author of the NASA/GSFC Standard Ada Pretty Printer (NASA/GSFC DSTL-88-003, May 1988) and is the co-author of the Ada Style Guide (NASA/GSFC SEL-87-002, May 1987). Recently, I authored
 the paper, “RISC Hardware and Simplified Software, Part 1: the Hardware.” and am currently writing “RISC Hardware and Simplified Software, Part 2: the Software.” I have four U.S. patents, as well as an EPO (European patent application) for a Multi-Level Marketing
 Computer Network Server (US Patents #6134533, 6415265, 6408281, 6691093 and EPO Patent Application # 97119108.5). I have a bachelor’s degree from Michigan Technical University in Applied Physics and a master’s degree in Computer Science from Johns Hopkins
 University. I am currently teaching the Foundations of Computer Architecture course and the Compiler Design with LLVM course.</span></p>
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif"><u></u> <u></u></span></p>
<p style="margin:0in 0in 0.0001pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">
<span style="font-size:12pt;font-family:"Times New Roman",serif">Allyn Shell</span><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(51,51,51)"></span></p>
<br>
</div>
</div>

_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>