[llvm-commits] [llvm] r43747 - in /llvm/trunk/docs/tutorial: LangImpl1.html LangImpl2.html LangImpl3.html LangImpl4.html LangImpl5.html LangImpl6.html LangImpl7.html
Chris Lattner
sabre at nondot.org
Mon Nov 5 17:39:13 PST 2007
Author: lattner
Date: Mon Nov 5 19:39:12 2007
New Revision: 43747
URL: http://llvm.org/viewvc/llvm-project?rev=43747&view=rev
Log:
fixes from Ryan Brown.
Modified:
llvm/trunk/docs/tutorial/LangImpl1.html
llvm/trunk/docs/tutorial/LangImpl2.html
llvm/trunk/docs/tutorial/LangImpl3.html
llvm/trunk/docs/tutorial/LangImpl4.html
llvm/trunk/docs/tutorial/LangImpl5.html
llvm/trunk/docs/tutorial/LangImpl6.html
llvm/trunk/docs/tutorial/LangImpl7.html
Modified: llvm/trunk/docs/tutorial/LangImpl1.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl1.html?rev=43747&r1=43746&r2=43747&view=diff
==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl1.html (original)
+++ llvm/trunk/docs/tutorial/LangImpl1.html Mon Nov 5 19:39:12 2007
@@ -232,7 +232,7 @@
</pre>
</div>
-<p>We handle comments by skipping to the end of the line and then returning the
+<p>We handle comments by skipping to the end of the line and then return the
next comment. Finally, if the input doesn't match one of the above cases, it is
either an operator character like '+' or the end of the file. These are handled with
this code:</p>
Modified: llvm/trunk/docs/tutorial/LangImpl2.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl2.html?rev=43747&r1=43746&r2=43747&view=diff
==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl2.html (original)
+++ llvm/trunk/docs/tutorial/LangImpl2.html Mon Nov 5 19:39:12 2007
@@ -325,16 +325,18 @@
// Call.
getNextToken(); // eat (
std::vector<ExprAST*> Args;
- while (1) {
- ExprAST *Arg = ParseExpression();
- if (!Arg) return 0;
- Args.push_back(Arg);
-
- if (CurTok == ')') break;
-
- if (CurTok != ',')
- return Error("Expected ')'");
- getNextToken();
+ if (CurTok != ')') {
+ while (1) {
+ ExprAST *Arg = ParseExpression();
+ if (!Arg) return 0;
+ Args.push_back(Arg);
+
+ if (CurTok == ')') break;
+
+ if (CurTok != ',')
+ return Error("Expected ')'");
+ getNextToken();
+ }
}
// Eat the ')'.
@@ -985,16 +987,18 @@
// Call.
getNextToken(); // eat (
std::vector<ExprAST*> Args;
- while (1) {
- ExprAST *Arg = ParseExpression();
- if (!Arg) return 0;
- Args.push_back(Arg);
-
- if (CurTok == ')') break;
-
- if (CurTok != ',')
- return Error("Expected ')'");
- getNextToken();
+ if (CurTok != ')') {
+ while (1) {
+ ExprAST *Arg = ParseExpression();
+ if (!Arg) return 0;
+ Args.push_back(Arg);
+
+ if (CurTok == ')') break;
+
+ if (CurTok != ',')
+ return Error("Expected ')'");
+ getNextToken();
+ }
}
// Eat the ')'.
Modified: llvm/trunk/docs/tutorial/LangImpl3.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl3.html?rev=43747&r1=43746&r2=43747&view=diff
==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl3.html (original)
+++ llvm/trunk/docs/tutorial/LangImpl3.html Mon Nov 5 19:39:12 2007
@@ -192,7 +192,7 @@
case '-': return Builder.CreateSub(L, R, "subtmp");
case '*': return Builder.CreateMul(L, R, "multmp");
case '<':
- L = Builder.CreateFCmpULT(L, R, "multmp");
+ L = Builder.CreateFCmpULT(L, R, "cmptmp");
// Convert bool 0/1 to double 0.0 or 1.0
return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp");
default: return ErrorV("invalid binary operator");
@@ -860,16 +860,18 @@
// Call.
getNextToken(); // eat (
std::vector<ExprAST*> Args;
- while (1) {
- ExprAST *Arg = ParseExpression();
- if (!Arg) return 0;
- Args.push_back(Arg);
+ if (CurTok != ')') {
+ while (1) {
+ ExprAST *Arg = ParseExpression();
+ if (!Arg) return 0;
+ Args.push_back(Arg);
- if (CurTok == ')') break;
+ if (CurTok == ')') break;
- if (CurTok != ',')
- return Error("Expected ')'");
- getNextToken();
+ if (CurTok != ',')
+ return Error("Expected ')'");
+ getNextToken();
+ }
}
// Eat the ')'.
@@ -1034,7 +1036,7 @@
case '-': return Builder.CreateSub(L, R, "subtmp");
case '*': return Builder.CreateMul(L, R, "multmp");
case '<':
- L = Builder.CreateFCmpULT(L, R, "multmp");
+ L = Builder.CreateFCmpULT(L, R, "cmptmp");
// Convert bool 0/1 to double 0.0 or 1.0
return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp");
default: return ErrorV("invalid binary operator");
Modified: llvm/trunk/docs/tutorial/LangImpl4.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl4.html?rev=43747&r1=43746&r2=43747&view=diff
==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl4.html (original)
+++ llvm/trunk/docs/tutorial/LangImpl4.html Mon Nov 5 19:39:12 2007
@@ -715,16 +715,18 @@
// Call.
getNextToken(); // eat (
std::vector<ExprAST*> Args;
- while (1) {
- ExprAST *Arg = ParseExpression();
- if (!Arg) return 0;
- Args.push_back(Arg);
-
- if (CurTok == ')') break;
-
- if (CurTok != ',')
- return Error("Expected ')'");
- getNextToken();
+ if (CurTok != ')') {
+ while (1) {
+ ExprAST *Arg = ParseExpression();
+ if (!Arg) return 0;
+ Args.push_back(Arg);
+
+ if (CurTok == ')') break;
+
+ if (CurTok != ',')
+ return Error("Expected ')'");
+ getNextToken();
+ }
}
// Eat the ')'.
@@ -890,7 +892,7 @@
case '-': return Builder.CreateSub(L, R, "subtmp");
case '*': return Builder.CreateMul(L, R, "multmp");
case '<':
- L = Builder.CreateFCmpULT(L, R, "multmp");
+ L = Builder.CreateFCmpULT(L, R, "cmptmp");
// Convert bool 0/1 to double 0.0 or 1.0
return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp");
default: return ErrorV("invalid binary operator");
Modified: llvm/trunk/docs/tutorial/LangImpl5.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl5.html?rev=43747&r1=43746&r2=43747&view=diff
==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl5.html (original)
+++ llvm/trunk/docs/tutorial/LangImpl5.html Mon Nov 5 19:39:12 2007
@@ -319,7 +319,7 @@
value of "calltmp". If control comes from the "else" block, it gets the value
of "calltmp1".</p>
-<p>At this point, you are probably starting to think "on no! this means my
+<p>At this point, you are probably starting to think "oh no! this means my
simple and elegant front-end will have to start generating SSA form in order to
use LLVM!". Fortunately, this is not the case, and we strongly advise
<em>not</em> implementing an SSA construction algorithm in your front-end
@@ -679,8 +679,8 @@
%nextvar = add double %i, 1.000000e+00
; termination test
- %multmp = fcmp ult double %i, %n
- %booltmp = uitofp i1 %multmp to double
+ %cmptmp = fcmp ult double %i, %n
+ %booltmp = uitofp i1 %cmptmp to double
%loopcond = fcmp one double %booltmp, 0.000000e+00
br i1 %loopcond, label %loop, label %afterloop
@@ -871,7 +871,8 @@
the tutorial. We added two control flow constructs, and used them to motivate
a couple of aspects of the LLVM IR that are important for front-end implementors
to know. In the next chapter of our saga, we will get a bit crazier and add
-operator overloading to our poor innocent language.</p>
+<a href="LangImpl6.html">user-defined operators</a> to our poor innocent
+language.</p>
</div>
@@ -1378,7 +1379,7 @@
case '-': return Builder.CreateSub(L, R, "subtmp");
case '*': return Builder.CreateMul(L, R, "multmp");
case '<':
- L = Builder.CreateFCmpULT(L, R, "multmp");
+ L = Builder.CreateFCmpULT(L, R, "cmptmp");
// Convert bool 0/1 to double 0.0 or 1.0
return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp");
default: return ErrorV("invalid binary operator");
Modified: llvm/trunk/docs/tutorial/LangImpl6.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl6.html?rev=43747&r1=43746&r2=43747&view=diff
==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl6.html (original)
+++ llvm/trunk/docs/tutorial/LangImpl6.html Mon Nov 5 19:39:12 2007
@@ -280,7 +280,7 @@
case '-': return Builder.CreateSub(L, R, "subtmp");
case '*': return Builder.CreateMul(L, R, "multmp");
case '<':
- L = Builder.CreateFCmpULT(L, R, "multmp");
+ L = Builder.CreateFCmpULT(L, R, "cmptmp");
// Convert bool 0/1 to double 0.0 or 1.0
return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp");
<b>default: break;</b>
@@ -1396,7 +1396,7 @@
case '-': return Builder.CreateSub(L, R, "subtmp");
case '*': return Builder.CreateMul(L, R, "multmp");
case '<':
- L = Builder.CreateFCmpULT(L, R, "multmp");
+ L = Builder.CreateFCmpULT(L, R, "cmptmp");
// Convert bool 0/1 to double 0.0 or 1.0
return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp");
default: break;
Modified: llvm/trunk/docs/tutorial/LangImpl7.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl7.html?rev=43747&r1=43746&r2=43747&view=diff
==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl7.html (original)
+++ llvm/trunk/docs/tutorial/LangImpl7.html Mon Nov 5 19:39:12 2007
@@ -546,8 +546,8 @@
<b>%x1 = alloca double
store double %x, double* %x1
%x2 = load double* %x1</b>
- %multmp = fcmp ult double %x2, 3.000000e+00
- %booltmp = uitofp i1 %multmp to double
+ %cmptmp = fcmp ult double %x2, 3.000000e+00
+ %booltmp = uitofp i1 %cmptmp to double
%ifcond = fcmp one double %booltmp, 0.000000e+00
br i1 %ifcond, label %then, label %else
@@ -585,8 +585,8 @@
<pre>
define double @fib(double %x) {
entry:
- %multmp = fcmp ult double <b>%x</b>, 3.000000e+00
- %booltmp = uitofp i1 %multmp to double
+ %cmptmp = fcmp ult double <b>%x</b>, 3.000000e+00
+ %booltmp = uitofp i1 %cmptmp to double
%ifcond = fcmp one double %booltmp, 0.000000e+00
br i1 %ifcond, label %then, label %else
@@ -618,8 +618,8 @@
<pre>
define double @fib(double %x) {
entry:
- %multmp = fcmp ult double %x, 3.000000e+00
- %booltmp = uitofp i1 %multmp to double
+ %cmptmp = fcmp ult double %x, 3.000000e+00
+ %booltmp = uitofp i1 %cmptmp to double
%ifcond = fcmp ueq double %booltmp, 0.000000e+00
br i1 %ifcond, label %else, label %ifcont
@@ -1674,7 +1674,7 @@
case '-': return Builder.CreateSub(L, R, "subtmp");
case '*': return Builder.CreateMul(L, R, "multmp");
case '<':
- L = Builder.CreateFCmpULT(L, R, "multmp");
+ L = Builder.CreateFCmpULT(L, R, "cmptmp");
// Convert bool 0/1 to double 0.0 or 1.0
return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp");
default: break;
More information about the llvm-commits
mailing list