diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2015-04-08 08:55:49 -0700 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2015-04-09 15:04:38 -0700 |
commit | 4c5e43da7792f75567b693105cc53e3f1992ad98 (patch) | |
tree | 1b2c9792582e12f5af0b1512e3094425f0dc0df9 /examples/Kaleidoscope/Orc | |
parent | c75239e6119d0f9a74c57099d91cbc9bde56bf33 (diff) | |
download | external_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.zip external_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.tar.gz external_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.tar.bz2 |
Update aosp/master llvm for rebase to r233350
Change-Id: I07d935f8793ee8ec6b7da003f6483046594bca49
Diffstat (limited to 'examples/Kaleidoscope/Orc')
-rw-r--r-- | examples/Kaleidoscope/Orc/fully_lazy/toy.cpp | 25 | ||||
-rw-r--r-- | examples/Kaleidoscope/Orc/initial/toy.cpp | 2 | ||||
-rw-r--r-- | examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp | 2 | ||||
-rw-r--r-- | examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp | 23 |
4 files changed, 24 insertions, 28 deletions
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<FunctionAST> FnAST) { + void addFunctionAST(std::unique_ptr<FunctionAST> 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<PrototypeAST>(*F->Proto)); - J.addFunctionDefinition(std::move(F)); + J.addFunctionAST(std::move(F)); } else { // Skip token for error recovery. getNextToken(); diff --git a/examples/Kaleidoscope/Orc/initial/toy.cpp b/examples/Kaleidoscope/Orc/initial/toy.cpp index 1b65e8c..cc6fb8e 100644 --- a/examples/Kaleidoscope/Orc/initial/toy.cpp +++ b/examples/Kaleidoscope/Orc/initial/toy.cpp @@ -715,7 +715,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; } diff --git a/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp b/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp index 1ed267d..6e2ec27 100644 --- a/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp +++ b/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp @@ -715,7 +715,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; } diff --git a/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp b/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp index d7744ec..19801e1 100644 --- a/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp +++ b/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp @@ -715,7 +715,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; } @@ -1174,7 +1174,8 @@ public: return MangledName; } - void addFunctionDefinition(std::unique_ptr<FunctionAST> FnAST) { + void addFunctionAST(std::unique_ptr<FunctionAST> FnAST) { + std::cerr << "Adding AST: " << FnAST->Proto->Name << "\n"; FunctionDefs[mangle(FnAST->Proto->Name)] = std::move(FnAST); } @@ -1190,7 +1191,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; } ); @@ -1216,21 +1217,17 @@ 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 it, add it to the JIT, and - // return the address for it. - // FIXME: What happens if IRGen fails? - auto H = addModule(IRGen(Session, *DefI->second)); - - // Remove the function definition's AST now that we're - // finished with it. + // Take the FunctionAST out of the map. + auto FnAST = std::move(DefI->second); FunctionDefs.erase(DefI); - // Return the address of the function. + // IRGen the AST, add it to the JIT, and return the address for it. + auto H = addModule(IRGen(Session, *FnAST)); return findSymbolIn(H, Name).getAddress(); } @@ -1246,7 +1243,7 @@ private: static void HandleDefinition(SessionContext &S, KaleidoscopeJIT &J) { if (auto F = ParseDefinition()) { S.addPrototypeAST(llvm::make_unique<PrototypeAST>(*F->Proto)); - J.addFunctionDefinition(std::move(F)); + J.addFunctionAST(std::move(F)); } else { // Skip token for error recovery. getNextToken(); |