aboutsummaryrefslogtreecommitdiff
path: root/docs/tutorial/LangImpl5.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorial/LangImpl5.html')
-rw-r--r--docs/tutorial/LangImpl5.html73
1 files changed, 37 insertions, 36 deletions
diff --git a/docs/tutorial/LangImpl5.html b/docs/tutorial/LangImpl5.html
index 4fc23a149429..95144dcc4167 100644
--- a/docs/tutorial/LangImpl5.html
+++ b/docs/tutorial/LangImpl5.html
@@ -259,20 +259,20 @@ declare double @bar()
define double @baz(double %x) {
entry:
- %ifcond = fcmp one double %x, 0.000000e+00
- br i1 %ifcond, label %then, label %else
+ %ifcond = fcmp one double %x, 0.000000e+00
+ br i1 %ifcond, label %then, label %else
then: ; preds = %entry
- %calltmp = call double @foo()
- br label %ifcont
+ %calltmp = call double @foo()
+ br label %ifcont
else: ; preds = %entry
- %calltmp1 = call double @bar()
- br label %ifcont
+ %calltmp1 = call double @bar()
+ br label %ifcont
ifcont: ; preds = %else, %then
- %iftmp = phi double [ %calltmp, %then ], [ %calltmp1, %else ]
- ret double %iftmp
+ %iftmp = phi double [ %calltmp, %then ], [ %calltmp1, %else ]
+ ret double %iftmp
}
</pre>
</div>
@@ -660,25 +660,25 @@ declare double @putchard(double)
define double @printstar(double %n) {
entry:
- ; initial value = 1.0 (inlined into phi)
- br label %loop
+ ; initial value = 1.0 (inlined into phi)
+ br label %loop
loop: ; preds = %loop, %entry
- %i = phi double [ 1.000000e+00, %entry ], [ %nextvar, %loop ]
- ; body
- %calltmp = call double @putchard(double 4.200000e+01)
- ; increment
- %nextvar = fadd double %i, 1.000000e+00
-
- ; termination test
- %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
+ %i = phi double [ 1.000000e+00, %entry ], [ %nextvar, %loop ]
+ ; body
+ %calltmp = call double @putchard(double 4.200000e+01)
+ ; increment
+ %nextvar = fadd double %i, 1.000000e+00
+
+ ; termination test
+ %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
afterloop: ; preds = %loop
- ; loop always returns 0.0
- ret double 0.000000e+00
+ ; loop always returns 0.0
+ ret double 0.000000e+00
}
</pre>
</div>
@@ -829,10 +829,11 @@ statement.</p>
</div>
<p>With the code for the body of the loop complete, we just need to finish up
-the control flow for it. This code remembers the end block (for the phi node), then creates the block for the loop exit ("afterloop"). Based on the value of the
-exit condition, it creates a conditional branch that chooses between executing
-the loop again and exiting the loop. Any future code is emitted in the
-"afterloop" block, so it sets the insertion position to it.</p>
+the control flow for it. This code remembers the end block (for the phi node),
+then creates the block for the loop exit ("afterloop"). Based on the value of
+the exit condition, it creates a conditional branch that chooses between
+executing the loop again and exiting the loop. Any future code is emitted in
+the "afterloop" block, so it sets the insertion position to it.</p>
<div class="doc_code">
<pre>
@@ -880,10 +881,10 @@ if/then/else and for expressions.. To build this example, use:
<div class="doc_code">
<pre>
- # Compile
- g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
- # Run
- ./toy
+# Compile
+clang++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
+# Run
+./toy
</pre>
</div>
@@ -900,9 +901,9 @@ if/then/else and for expressions.. To build this example, use:
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetSelect.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/IRBuilder.h"
+#include "llvm/Support/TargetSelect.h"
#include &lt;cstdio&gt;
#include &lt;string&gt;
#include &lt;map&gt;
@@ -1397,7 +1398,7 @@ Value *CallExprAST::Codegen() {
if (ArgsV.back() == 0) return 0;
}
- return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp");
+ return Builder.CreateCall(CalleeF, ArgsV, "calltmp");
}
Value *IfExprAST::Codegen() {
@@ -1546,8 +1547,8 @@ Value *ForExprAST::Codegen() {
Function *PrototypeAST::Codegen() {
// Make the function type: double(double,double) etc.
- std::vector&lt;const Type*&gt; Doubles(Args.size(),
- Type::getDoubleTy(getGlobalContext()));
+ std::vector&lt;Type*&gt; Doubles(Args.size(),
+ Type::getDoubleTy(getGlobalContext()));
FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
Doubles, false);
@@ -1765,7 +1766,7 @@ int main() {
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a><br>
- Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
+ Last modified: $Date: 2011-10-16 10:07:38 +0200 (Sun, 16 Oct 2011) $
</address>
</body>
</html>