From b7e6b1ab7029b45f0be81f3026e571f9977dc5c3 Mon Sep 17 00:00:00 2001
From: Chris Lattner
Have fun - try doing something crazy and unusual. Building a language like
-everyone else always has is much less fun than trying something a little crazy
-and off the wall and seeing how it turns out. If you get stuck or want to talk
+everyone else always has, is much less fun than trying something a little crazy
+or off the wall and seeing how it turns out. If you get stuck or want to talk
about it, feel free to email the llvmdev mailing
list: it has lots of people who are interested in languages and are often
willing to help out.
Before we end, I want to talk about some "tips and tricks" for generating
+ Before we end this tutorial, I want to talk about some "tips and tricks" for generating
LLVM IR. These are some of the more subtle things that may not be obvious, but
are very useful if you want to take advantage of LLVM's capabilities. While it is possible to engineer more and more complex solutions to problems
-like this, it cannot be solved in full generality in a way better than shipping
+like this, it cannot be solved in full generality in a way that is better than shipping
the actual source code. That said, there are interesting subsets of C that can be made portable. If
@@ -263,7 +263,7 @@ few observations:
Third, it is possible and easy to add language-specific +
Third, it is possible and easy to add language-specific optimizations, and you have a number of choices in how to do it. As one trivial example, it is easy to add language-specific optimization passes that "know" things about code compiled for a language. In the case of the C family, @@ -291,7 +291,7 @@ function does.
other language-specific information into the LLVM IR. If you have a specific need and run into a wall, please bring the topic up on the llvmdev list. At the very worst, you can always treat LLVM as if it were a "dumb code generator" and -implement the high-level optimizations you desire in your front-end on the +implement the high-level optimizations you desire in your front-end, on the language-specific AST. @@ -316,8 +316,8 @@ offsetof/sizeofOne interesting thing that comes up if you are trying to keep the code -generated by your compiler "target independent" is that you often need to know +
One interesting thing that comes up, if you are trying to keep the code +generated by your compiler "target independent", is that you often need to know the size of some LLVM type or the offset of some field in an llvm structure. For example, you might need to pass the size of a type into a function that allocates memory.
@@ -342,10 +342,10 @@ they are garbage collected or to allow easy implementation of closures. There are often better ways to implement these features than explicit stack frames, but LLVM -does support them if you want. It requires your front-end to convert the +does support them, if you want. It requires your front-end to convert the code into Continuation -Passing Style and use of tail calls (which LLVM also supports). +Passing Style and the use of tail calls (which LLVM also supports).