diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2010-02-11 19:15:20 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2010-02-11 19:15:20 +0000 |
commit | 42fc5586241ddc5948ffff67eefe8cb2690534a8 (patch) | |
tree | dc3abc48e8f27927157bb70c7975a83435274aeb /examples | |
parent | bbe99362e54a310b337c905ddc2e62a641bdb293 (diff) |
Make Kaleidoscope not link against the interpreter, since that didn't
work anyway (Interpreter::getPointerToFunction doesn't return a
callable pointer), and improve the error message when an
ExecutionEngine can't be created.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95896 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Kaleidoscope/Chapter4/Makefile | 2 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter4/toy.cpp | 8 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter5/Makefile | 2 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter5/toy.cpp | 8 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter6/Makefile | 2 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter6/toy.cpp | 8 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter7/Makefile | 2 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter7/toy.cpp | 8 |
8 files changed, 28 insertions, 12 deletions
diff --git a/examples/Kaleidoscope/Chapter4/Makefile b/examples/Kaleidoscope/Chapter4/Makefile index 7bc742fb1e..30162d94bc 100644 --- a/examples/Kaleidoscope/Chapter4/Makefile +++ b/examples/Kaleidoscope/Chapter4/Makefile @@ -10,6 +10,6 @@ LEVEL = ../../.. TOOLNAME = Kaleidoscope-Ch4 EXAMPLE_TOOL = 1 -LINK_COMPONENTS := core jit interpreter native +LINK_COMPONENTS := core jit native include $(LEVEL)/Makefile.common diff --git a/examples/Kaleidoscope/Chapter4/toy.cpp b/examples/Kaleidoscope/Chapter4/toy.cpp index cdc9d74dde..a2ddda2e91 100644 --- a/examples/Kaleidoscope/Chapter4/toy.cpp +++ b/examples/Kaleidoscope/Chapter4/toy.cpp @@ -1,6 +1,5 @@ #include "llvm/DerivedTypes.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" -#include "llvm/ExecutionEngine/Interpreter.h" #include "llvm/ExecutionEngine/JIT.h" #include "llvm/LLVMContext.h" #include "llvm/Module.h" @@ -573,7 +572,12 @@ int main() { TheModule = new Module("my cool jit", Context); // Create the JIT. This takes ownership of the module. - TheExecutionEngine = EngineBuilder(TheModule).create(); + std::string ErrStr; + TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create(); + if (!TheExecutionEngine) { + fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str()); + exit(1); + } FunctionPassManager OurFPM(TheModule); diff --git a/examples/Kaleidoscope/Chapter5/Makefile b/examples/Kaleidoscope/Chapter5/Makefile index 5a8355d315..d1f5e2035b 100644 --- a/examples/Kaleidoscope/Chapter5/Makefile +++ b/examples/Kaleidoscope/Chapter5/Makefile @@ -10,6 +10,6 @@ LEVEL = ../../.. TOOLNAME = Kaleidoscope-Ch5 EXAMPLE_TOOL = 1 -LINK_COMPONENTS := core jit interpreter native +LINK_COMPONENTS := core jit native include $(LEVEL)/Makefile.common diff --git a/examples/Kaleidoscope/Chapter5/toy.cpp b/examples/Kaleidoscope/Chapter5/toy.cpp index 24f551f3a6..da64b7eb52 100644 --- a/examples/Kaleidoscope/Chapter5/toy.cpp +++ b/examples/Kaleidoscope/Chapter5/toy.cpp @@ -1,6 +1,5 @@ #include "llvm/DerivedTypes.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" -#include "llvm/ExecutionEngine/Interpreter.h" #include "llvm/ExecutionEngine/JIT.h" #include "llvm/LLVMContext.h" #include "llvm/Module.h" @@ -818,7 +817,12 @@ int main() { TheModule = new Module("my cool jit", Context); // Create the JIT. This takes ownership of the module. - TheExecutionEngine = EngineBuilder(TheModule).create(); + std::string ErrStr; + TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create(); + if (!TheExecutionEngine) { + fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str()); + exit(1); + } FunctionPassManager OurFPM(TheModule); diff --git a/examples/Kaleidoscope/Chapter6/Makefile b/examples/Kaleidoscope/Chapter6/Makefile index de2d758728..a5fbcbdf9b 100644 --- a/examples/Kaleidoscope/Chapter6/Makefile +++ b/examples/Kaleidoscope/Chapter6/Makefile @@ -10,6 +10,6 @@ LEVEL = ../../.. TOOLNAME = Kaleidoscope-Ch6 EXAMPLE_TOOL = 1 -LINK_COMPONENTS := core jit interpreter native +LINK_COMPONENTS := core jit native include $(LEVEL)/Makefile.common diff --git a/examples/Kaleidoscope/Chapter6/toy.cpp b/examples/Kaleidoscope/Chapter6/toy.cpp index f4b5b8cd38..4e719e3481 100644 --- a/examples/Kaleidoscope/Chapter6/toy.cpp +++ b/examples/Kaleidoscope/Chapter6/toy.cpp @@ -1,6 +1,5 @@ #include "llvm/DerivedTypes.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" -#include "llvm/ExecutionEngine/Interpreter.h" #include "llvm/ExecutionEngine/JIT.h" #include "llvm/LLVMContext.h" #include "llvm/Module.h" @@ -936,7 +935,12 @@ int main() { TheModule = new Module("my cool jit", Context); // Create the JIT. This takes ownership of the module. - TheExecutionEngine = EngineBuilder(TheModule).create(); + std::string ErrStr; + TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create(); + if (!TheExecutionEngine) { + fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str()); + exit(1); + } FunctionPassManager OurFPM(TheModule); diff --git a/examples/Kaleidoscope/Chapter7/Makefile b/examples/Kaleidoscope/Chapter7/Makefile index 8911d52560..6cec323efd 100644 --- a/examples/Kaleidoscope/Chapter7/Makefile +++ b/examples/Kaleidoscope/Chapter7/Makefile @@ -11,6 +11,6 @@ TOOLNAME = Kaleidoscope-Ch7 EXAMPLE_TOOL = 1 REQUIRES_RTTI := 1 -LINK_COMPONENTS := core jit interpreter native +LINK_COMPONENTS := core jit native include $(LEVEL)/Makefile.common diff --git a/examples/Kaleidoscope/Chapter7/toy.cpp b/examples/Kaleidoscope/Chapter7/toy.cpp index 951dfd8e63..7dd9eae3e2 100644 --- a/examples/Kaleidoscope/Chapter7/toy.cpp +++ b/examples/Kaleidoscope/Chapter7/toy.cpp @@ -1,6 +1,5 @@ #include "llvm/DerivedTypes.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" -#include "llvm/ExecutionEngine/Interpreter.h" #include "llvm/ExecutionEngine/JIT.h" #include "llvm/LLVMContext.h" #include "llvm/Module.h" @@ -1100,7 +1099,12 @@ int main() { TheModule = new Module("my cool jit", Context); // Create the JIT. This takes ownership of the module. - TheExecutionEngine = EngineBuilder(TheModule).create(); + std::string ErrStr; + TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create(); + if (!TheExecutionEngine) { + fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str()); + exit(1); + } FunctionPassManager OurFPM(TheModule); |