summaryrefslogtreecommitdiff
path: root/docs/tutorial
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-07 06:34:39 +0000
committerChris Lattner <sabre@nondot.org>2007-11-07 06:34:39 +0000
commit1e46a6cc7b216413811f663e868e5a452fd90734 (patch)
tree89e9bca88a7bf5879f910746f23545f710e0c577 /docs/tutorial
parent3616a8a41581795ce9e0e3e23ffe08dddd676d32 (diff)
downloadllvm-1e46a6cc7b216413811f663e868e5a452fd90734.tar.gz
llvm-1e46a6cc7b216413811f663e868e5a452fd90734.tar.bz2
llvm-1e46a6cc7b216413811f663e868e5a452fd90734.tar.xz
chapter 7 edits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43811 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/tutorial')
-rw-r--r--docs/tutorial/LangImpl7.html19
1 files changed, 10 insertions, 9 deletions
diff --git a/docs/tutorial/LangImpl7.html b/docs/tutorial/LangImpl7.html
index 9aa65d3b6e..523d24fcde 100644
--- a/docs/tutorial/LangImpl7.html
+++ b/docs/tutorial/LangImpl7.html
@@ -172,7 +172,7 @@ declared with global variable definitions, they are declared with the
<div class="doc_code">
<pre>
-define i32 @test(i1 %Condition) {
+define i32 @example() {
entry:
%X = alloca i32 ; type of %X is i32*.
...
@@ -261,7 +261,7 @@ cond_next:
<p>The mem2reg pass implements the standard "iterated dominator frontier"
algorithm for constructing SSA form and has a number of optimizations that speed
-up very common degenerate cases. mem2reg really is the answer for dealing with
+up (very common) degenerate cases. mem2reg is the answer for dealing with
mutable variables, and we highly recommend that you depend on it. Note that
mem2reg only works on variables in certain circumstances:</p>
@@ -337,7 +337,7 @@ add two features:</p>
</ol>
<p>While the first item is really what this is about, we only have variables
-for incoming arguments and for induction variables, and redefining them only
+for incoming arguments and for induction variables, and redefining those only
goes so far :). Also, the ability to define new variables is a
useful thing regardless of whether you will be mutating them. Here's a
motivating example that shows how we could use these:</p>
@@ -358,7 +358,7 @@ def fib(x)
# Iterative fib.
def fibi(x)
<b>var a = 1, b = 1, c in</b>
- (for i = 3, i &;t; x in
+ (for i = 3, i &lt; x in
<b>c = a + b</b> :
<b>a = b</b> :
<b>b = c</b>) :
@@ -446,8 +446,8 @@ Value *VariableExprAST::Codegen() {
Value *V = NamedValues[Name];
if (V == 0) return ErrorV("Unknown variable name");
- // Load the value.
- return Builder.CreateLoad(V, Name.c_str());
+ <b>// Load the value.
+ return Builder.CreateLoad(V, Name.c_str());</b>
}
</pre>
</div>
@@ -688,7 +688,8 @@ Value *BinaryExprAST::Codegen() {
<p>Unlike the rest of the binary operators, our assignment operator doesn't
follow the "emit LHS, emit RHS, do computation" model. As such, it is handled
as a special case before the other binary operators are handled. The other
-strange thing about it is that it requires the LHS to be a variable directly.
+strange thing is that it requires the LHS to be a variable. It is invalid to
+have "(x+1) = expr" - only things like "x = expr" are allowed.
</p>
<div class="doc_code">
@@ -775,7 +776,7 @@ static int gettok() {
</div>
<p>The next step is to define the AST node that we will construct. For var/in,
-it will look like this:</p>
+it looks like this:</p>
<div class="doc_code">
<pre>
@@ -796,7 +797,7 @@ public:
<p>var/in allows a list of names to be defined all at once, and each name can
optionally have an initializer value. As such, we capture this information in
the VarNames vector. Also, var/in has a body, this body is allowed to access
-the variables defined by the let/in.</p>
+the variables defined by the var/in.</p>
<p>With this ready, we can define the parser pieces. First thing we do is add
it as a primary expression:</p>