From 4c5e43da7792f75567b693105cc53e3f1992ad98 Mon Sep 17 00:00:00 2001 From: Pirama Arumuga Nainar Date: Wed, 8 Apr 2015 08:55:49 -0700 Subject: Update aosp/master llvm for rebase to r233350 Change-Id: I07d935f8793ee8ec6b7da003f6483046594bca49 --- examples/Kaleidoscope/Orc/fully_lazy/toy.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'examples/Kaleidoscope/Orc/fully_lazy') diff --git a/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp b/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp index 2e65756..3b5dcd0 100644 --- a/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp +++ b/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp @@ -716,7 +716,7 @@ public: M(new Module(GenerateUniqueName("jit_module_"), Session.getLLVMContext())), Builder(Session.getLLVMContext()) { - M->setDataLayout(Session.getTarget().getDataLayout()); + M->setDataLayout(*Session.getTarget().getDataLayout()); } SessionContext& getSession() { return Session; } @@ -1185,7 +1185,8 @@ public: return MangledName; } - void addFunctionDefinition(std::unique_ptr FnAST) { + void addFunctionAST(std::unique_ptr FnAST) { + std::cerr << "Adding AST: " << FnAST->Proto->Name << "\n"; FunctionDefs[mangle(FnAST->Proto->Name)] = std::move(FnAST); } @@ -1201,7 +1202,7 @@ public: // If we don't already have a definition of 'Name' then search // the ASTs. - return searchUncompiledASTs(Name); + return searchFunctionASTs(Name); }, [](const std::string &S) { return 0; } ); @@ -1231,20 +1232,18 @@ private: // This method searches the FunctionDefs map for a definition of 'Name'. If it // finds one it generates a stub for it and returns the address of the stub. - TargetAddress searchUncompiledASTs(const std::string &Name) { + TargetAddress searchFunctionASTs(const std::string &Name) { auto DefI = FunctionDefs.find(Name); if (DefI == FunctionDefs.end()) return 0; - // We have AST for 'Name'. IRGen a stub for it and add it to the JIT. - // FIXME: What happens if IRGen fails? - auto H = irGenStub(std::move(DefI->second)); - - // Remove the function definition's AST now that we're - // finished with it. + // Return the address of the stub. + // Take the FunctionAST out of the map. + auto FnAST = std::move(DefI->second); FunctionDefs.erase(DefI); - // Return the address of the stub. + // IRGen the AST, add it to the JIT, and return the address for it. + auto H = irGenStub(std::move(FnAST)); return findSymbolIn(H, Name).getAddress(); } @@ -1291,7 +1290,7 @@ private: return findUnmangledSymbolIn(H, Fn->Proto->Name).getAddress(); }); CallbackInfo.setUpdateAction( - CompileCallbacks.getLocalFPUpdater(H, mangle(BodyPtrName))); + getLocalFPUpdater(LazyEmitLayer, H, mangle(BodyPtrName))); return H; } @@ -1310,7 +1309,7 @@ private: static void HandleDefinition(SessionContext &S, KaleidoscopeJIT &J) { if (auto F = ParseDefinition()) { S.addPrototypeAST(llvm::make_unique(*F->Proto)); - J.addFunctionDefinition(std::move(F)); + J.addFunctionAST(std::move(F)); } else { // Skip token for error recovery. getNextToken(); -- cgit v1.1