Constructors and operators for anonymous aggregates does not names. Do not force...
[oota-llvm.git] / examples / Fibonacci / fibonacci.cpp
index b1a4691a9f6ccc2cf43112ee25ea0e2505430e72..353e17380c6c5c9d0a951b47f0e0f77116b4c751 100644 (file)
 #include "llvm/DerivedTypes.h"
 #include "llvm/Constants.h"
 #include "llvm/Instructions.h"
-#include "llvm/ModuleProvider.h"
 #include "llvm/Analysis/Verifier.h"
 #include "llvm/ExecutionEngine/JIT.h"
 #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 +92,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 +102,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)) {