diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-01 01:56:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-01 01:56:27 +0000 |
commit | 4ba8e5d14f2956f403c6e64f28c361fc2a564da1 (patch) | |
tree | 7c095d4913c5abed994a8e89695bba65ea7bf842 /llvm/examples | |
parent | 03f90ab0a9922c695a472945531dc8d5beb6cf77 (diff) | |
download | bcm5719-llvm-4ba8e5d14f2956f403c6e64f28c361fc2a564da1.tar.gz bcm5719-llvm-4ba8e5d14f2956f403c6e64f28c361fc2a564da1.zip |
fix PR5649 by making fib use the JIT instead of the interpreter, patch by Perry Lorier!
llvm-svn: 90186
Diffstat (limited to 'llvm/examples')
-rw-r--r-- | llvm/examples/Fibonacci/fibonacci.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/examples/Fibonacci/fibonacci.cpp b/llvm/examples/Fibonacci/fibonacci.cpp index b1a4691a9f6..077cdd0f5d6 100644 --- a/llvm/examples/Fibonacci/fibonacci.cpp +++ b/llvm/examples/Fibonacci/fibonacci.cpp @@ -34,6 +34,7 @@ #include "llvm/ExecutionEngine/Interpreter.h" #include "llvm/ExecutionEngine/GenericValue.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Target/TargetSelect.h" using namespace llvm; static Function *CreateFibFunction(Module *M, LLVMContext &Context) { @@ -92,6 +93,7 @@ static Function *CreateFibFunction(Module *M, LLVMContext &Context) { int main(int argc, char **argv) { int n = argc > 1 ? atol(argv[1]) : 24; + InitializeNativeTarget(); LLVMContext Context; // Create some module to put our function into it. @@ -101,7 +103,13 @@ int main(int argc, char **argv) { Function *FibF = CreateFibFunction(M, Context); // Now we going to create JIT - ExecutionEngine *EE = EngineBuilder(M).create(); + std::string errStr; + ExecutionEngine *EE = EngineBuilder(M).setErrorStr(&errStr).setEngineKind(EngineKind::JIT).create(); + + if (!EE) { + errs() << argv[0] << ": Failed to construct ExecutionEngine: " << errStr << "\n"; + return 1; + } errs() << "verifying... "; if (verifyModule(*M)) { |