fix PR5649 by making fib use the JIT instead of the interpreter, patch by Perry Lorier!

llvm-svn: 90186
This commit is contained in:
Chris Lattner 2009-12-01 01:56:27 +00:00
parent 03f90ab0a9
commit 4ba8e5d14f
1 changed files with 9 additions and 1 deletions

View File

@ -34,6 +34,7 @@
#include "llvm/ExecutionEngine/Interpreter.h" #include "llvm/ExecutionEngine/Interpreter.h"
#include "llvm/ExecutionEngine/GenericValue.h" #include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetSelect.h"
using namespace llvm; using namespace llvm;
static Function *CreateFibFunction(Module *M, LLVMContext &Context) { 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 main(int argc, char **argv) {
int n = argc > 1 ? atol(argv[1]) : 24; int n = argc > 1 ? atol(argv[1]) : 24;
InitializeNativeTarget();
LLVMContext Context; LLVMContext Context;
// Create some module to put our function into it. // Create some module to put our function into it.
@ -101,7 +103,13 @@ int main(int argc, char **argv) {
Function *FibF = CreateFibFunction(M, Context); Function *FibF = CreateFibFunction(M, Context);
// Now we going to create JIT // 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... "; errs() << "verifying... ";
if (verifyModule(*M)) { if (verifyModule(*M)) {