[llvm-commits] CVS: llvm-www/releases/2.6/docs/tutorial/LangImpl4.html LangImpl5.html LangImpl6.html LangImpl7.html
Tanya Lattner
tonic at nondot.org
Thu Feb 11 14:57:27 PST 2010
Changes in directory llvm-www/releases/2.6/docs/tutorial:
LangImpl4.html updated: 1.2 -> 1.3
LangImpl5.html updated: 1.2 -> 1.3
LangImpl6.html updated: 1.2 -> 1.3
LangImpl7.html updated: 1.2 -> 1.3
---
Log message:
Correcting the tutorial. Patch by Jeffrey Yasskin.
---
Diffs of the changes: (+82 -32)
LangImpl4.html | 35 ++++++++++++++++++++++++++---------
LangImpl5.html | 29 ++++++++++++++++++++---------
LangImpl6.html | 25 ++++++++++++++++++-------
LangImpl7.html | 25 ++++++++++++++++++-------
4 files changed, 82 insertions(+), 32 deletions(-)
Index: llvm-www/releases/2.6/docs/tutorial/LangImpl4.html
diff -u llvm-www/releases/2.6/docs/tutorial/LangImpl4.html:1.2 llvm-www/releases/2.6/docs/tutorial/LangImpl4.html:1.3
--- llvm-www/releases/2.6/docs/tutorial/LangImpl4.html:1.2 Fri Oct 23 23:13:19 2009
+++ llvm-www/releases/2.6/docs/tutorial/LangImpl4.html Thu Feb 11 16:55:00 2010
@@ -299,7 +299,13 @@
int main() {
..
<b>// Create the JIT.
- TheExecutionEngine = EngineBuilder(TheModule).create();</b>
+ std::string ErrStr;
+ TheExecutionEngine =
+ EngineBuilder(OurModuleProvider).setErrorStr(&ErrStr).create();
+ if (!TheExecutionEngine) {
+ fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
+ exit(1);
+ }</b>
..
}
</pre>
@@ -512,12 +518,14 @@
<pre>
#include "llvm/DerivedTypes.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/ExecutionEngine/JIT.h"
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetSelect.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/IRBuilder.h"
#include <cstdio>
@@ -1022,7 +1030,7 @@
// Cast it to the right type (takes no arguments, returns a double) so we
// can call it as a native function.
- double (*FP)() = (double (*)())FPtr;
+ double (*FP)() = (double (*)())(intptr_t)FPtr;
fprintf(stderr, "Evaluated to %f\n", FP());
}
} else {
@@ -1063,6 +1071,8 @@
//===----------------------------------------------------------------------===//
int main() {
+ InitializeNativeTarget();
+
// Install standard binary operators.
// 1 is lowest precedence.
BinopPrecedence['<'] = 10;
@@ -1076,13 +1086,20 @@
// Make the module, which holds all the code.
TheModule = new Module("my cool jit", getGlobalContext());
-
+ ExistingModuleProvider *OurModuleProvider =
+ new ExistingModuleProvider(TheModule);
+
// Create the JIT.
- TheExecutionEngine = EngineBuilder(TheModule).create();
+ std::string ErrStr;
+ TheExecutionEngine =
+ EngineBuilder(OurModuleProvider).setErrorStr(&ErrStr).create();
+ if (!TheExecutionEngine) {
+ fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
+ exit(1);
+ }
{
- ExistingModuleProvider OurModuleProvider(TheModule);
- FunctionPassManager OurFPM(&OurModuleProvider);
+ FunctionPassManager OurFPM(OurModuleProvider);
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
@@ -1106,8 +1123,8 @@
// Print out all of the generated code.
TheModule->dump();
- } // Free module provider (and thus the module) and pass manager.
-
+ } // Free pass manager.
+
return 0;
}
</pre>
@@ -1126,7 +1143,7 @@
<a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
- Last modified: $Date: 2009/10/24 04:13:19 $
+ Last modified: $Date: 2010/02/11 22:55:00 $
</address>
</body>
</html>
Index: llvm-www/releases/2.6/docs/tutorial/LangImpl5.html
diff -u llvm-www/releases/2.6/docs/tutorial/LangImpl5.html:1.2 llvm-www/releases/2.6/docs/tutorial/LangImpl5.html:1.3
--- llvm-www/releases/2.6/docs/tutorial/LangImpl5.html:1.2 Fri Oct 23 23:13:19 2009
+++ llvm-www/releases/2.6/docs/tutorial/LangImpl5.html Thu Feb 11 16:55:01 2010
@@ -901,12 +901,14 @@
<pre>
#include "llvm/DerivedTypes.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/ExecutionEngine/JIT.h"
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetSelect.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/IRBuilder.h"
#include <cstdio>
@@ -1545,7 +1547,7 @@
// for expr always returns 0.0.
- return getGlobalContext().getNullValue(Type::getDoubleTy(getGlobalContext()));
+ return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
}
Function *PrototypeAST::Codegen() {
@@ -1656,7 +1658,7 @@
// Cast it to the right type (takes no arguments, returns a double) so we
// can call it as a native function.
- double (*FP)() = (double (*)())FPtr;
+ double (*FP)() = (double (*)())(intptr_t)FPtr;
fprintf(stderr, "Evaluated to %f\n", FP());
}
} else {
@@ -1697,6 +1699,8 @@
//===----------------------------------------------------------------------===//
int main() {
+ InitializeNativeTarget();
+
// Install standard binary operators.
// 1 is lowest precedence.
BinopPrecedence['<'] = 10;
@@ -1710,13 +1714,20 @@
// Make the module, which holds all the code.
TheModule = new Module("my cool jit", getGlobalContext());
-
+ ExistingModuleProvider *OurModuleProvider =
+ new ExistingModuleProvider(TheModule);
+
// Create the JIT.
- TheExecutionEngine = EngineBuilder(TheModule).create();
+ std::string ErrStr;
+ TheExecutionEngine =
+ EngineBuilder(OurModuleProvider).setErrorStr(&ErrStr).create();
+ if (!TheExecutionEngine) {
+ fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
+ exit(1);
+ }
{
- ExistingModuleProvider OurModuleProvider(TheModule);
- FunctionPassManager OurFPM(&OurModuleProvider);
+ FunctionPassManager OurFPM(OurModuleProvider);
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
@@ -1739,8 +1750,8 @@
// Print out all of the generated code.
TheModule->dump();
- } // Free module provider (and thus the module) and pass manager.
-
+ } // Free pass manager.
+
return 0;
}
</pre>
@@ -1759,7 +1770,7 @@
<a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
- Last modified: $Date: 2009/10/24 04:13:19 $
+ Last modified: $Date: 2010/02/11 22:55:01 $
</address>
</body>
</html>
Index: llvm-www/releases/2.6/docs/tutorial/LangImpl6.html
diff -u llvm-www/releases/2.6/docs/tutorial/LangImpl6.html:1.2 llvm-www/releases/2.6/docs/tutorial/LangImpl6.html:1.3
--- llvm-www/releases/2.6/docs/tutorial/LangImpl6.html:1.2 Fri Oct 23 23:13:19 2009
+++ llvm-www/releases/2.6/docs/tutorial/LangImpl6.html Thu Feb 11 16:55:01 2010
@@ -821,12 +821,14 @@
<pre>
#include "llvm/DerivedTypes.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/ExecutionEngine/JIT.h"
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetSelect.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/IRBuilder.h"
#include <cstdio>
@@ -1688,7 +1690,7 @@
// Cast it to the right type (takes no arguments, returns a double) so we
// can call it as a native function.
- double (*FP)() = (double (*)())FPtr;
+ double (*FP)() = (double (*)())(intptr_t)FPtr;
fprintf(stderr, "Evaluated to %f\n", FP());
}
} else {
@@ -1736,6 +1738,8 @@
//===----------------------------------------------------------------------===//
int main() {
+ InitializeNativeTarget();
+
// Install standard binary operators.
// 1 is lowest precedence.
BinopPrecedence['<'] = 10;
@@ -1749,13 +1753,20 @@
// Make the module, which holds all the code.
TheModule = new Module("my cool jit", getGlobalContext());
-
+ ExistingModuleProvider *OurModuleProvider =
+ new ExistingModuleProvider(TheModule);
+
// Create the JIT.
- TheExecutionEngine = EngineBuilder(TheModule).create();
+ std::string ErrStr;
+ TheExecutionEngine =
+ EngineBuilder(OurModuleProvider).setErrorStr(&ErrStr).create();
+ if (!TheExecutionEngine) {
+ fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
+ exit(1);
+ }
{
- ExistingModuleProvider OurModuleProvider(TheModule);
- FunctionPassManager OurFPM(&OurModuleProvider);
+ FunctionPassManager OurFPM(OurModuleProvider);
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
@@ -1778,7 +1789,7 @@
// Print out all of the generated code.
TheModule->dump();
- } // Free module provider (and thus the module) and pass manager.
+ } // Free pass manager.
return 0;
}
@@ -1798,7 +1809,7 @@
<a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
- Last modified: $Date: 2009/10/24 04:13:19 $
+ Last modified: $Date: 2010/02/11 22:55:01 $
</address>
</body>
</html>
Index: llvm-www/releases/2.6/docs/tutorial/LangImpl7.html
diff -u llvm-www/releases/2.6/docs/tutorial/LangImpl7.html:1.2 llvm-www/releases/2.6/docs/tutorial/LangImpl7.html:1.3
--- llvm-www/releases/2.6/docs/tutorial/LangImpl7.html:1.2 Fri Oct 23 23:13:19 2009
+++ llvm-www/releases/2.6/docs/tutorial/LangImpl7.html Thu Feb 11 16:55:01 2010
@@ -1003,12 +1003,14 @@
<pre>
#include "llvm/DerivedTypes.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/ExecutionEngine/JIT.h"
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetSelect.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/IRBuilder.h"
#include <cstdio>
@@ -2039,7 +2041,7 @@
// Cast it to the right type (takes no arguments, returns a double) so we
// can call it as a native function.
- double (*FP)() = (double (*)())FPtr;
+ double (*FP)() = (double (*)())(intptr_t)FPtr;
fprintf(stderr, "Evaluated to %f\n", FP());
}
} else {
@@ -2087,6 +2089,8 @@
//===----------------------------------------------------------------------===//
int main() {
+ InitializeNativeTarget();
+
// Install standard binary operators.
// 1 is lowest precedence.
BinopPrecedence['='] = 2;
@@ -2101,13 +2105,20 @@
// Make the module, which holds all the code.
TheModule = new Module("my cool jit", getGlobalContext());
-
+ ExistingModuleProvider *OurModuleProvider =
+ new ExistingModuleProvider(TheModule);
+
// Create the JIT.
- TheExecutionEngine = EngineBuilder(TheModule).create();
+ std::string ErrStr;
+ TheExecutionEngine =
+ EngineBuilder(OurModuleProvider).setErrorStr(&ErrStr).create();
+ if (!TheExecutionEngine) {
+ fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
+ exit(1);
+ }
{
- ExistingModuleProvider OurModuleProvider(TheModule);
- FunctionPassManager OurFPM(&OurModuleProvider);
+ FunctionPassManager OurFPM(OurModuleProvider);
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
@@ -2134,7 +2145,7 @@
// Print out all of the generated code.
TheModule->dump();
- } // Free module provider (and thus the module) and pass manager.
+ } // Free pass manager.
return 0;
}
@@ -2154,7 +2165,7 @@
<a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
- Last modified: $Date: 2009/10/24 04:13:19 $
+ Last modified: $Date: 2010/02/11 22:55:01 $
</address>
</body>
</html>
More information about the llvm-commits
mailing list