[PM] Remove the old 'PassManager.h' header file at the top level of
[oota-llvm.git] / examples / Kaleidoscope / Orc / initial / toy.cpp
index 1b772259a19ef8f384e644e0fa81f6d761b68d4c..c10f99bccc83d2f46c1abd2ae75ff577e125aca8 100644 (file)
@@ -8,9 +8,9 @@
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Verifier.h"
-#include "llvm/PassManager.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Transforms/Scalar.h"
 #include <cctype>
@@ -1149,8 +1149,8 @@ public:
     // new module. Create one that resolves symbols by looking back into the JIT.
     auto MM = createLookasideRTDyldMM<SectionMemoryManager>(
                 [&](const std::string &S) {
-                  return getMangledSymbolAddress(S);
-                }, 
+                  return findMangledSymbol(S).getAddress();
+                },
                 [](const std::string &S) { return 0; } );
 
     return CompileLayer.addModuleSet(std::move(S), std::move(MM));
@@ -1158,17 +1158,17 @@ public:
 
   void removeModule(ModuleHandleT H) { CompileLayer.removeModuleSet(H); }
 
-  uint64_t getMangledSymbolAddress(const std::string &Name) {
-    return CompileLayer.getSymbolAddress(Name, false);
+  JITSymbol findMangledSymbol(const std::string &Name) {
+    return CompileLayer.findSymbol(Name, false);
   }
 
-  uint64_t getSymbolAddress(const std::string Name) {
+  JITSymbol findSymbol(const std::string Name) {
     std::string MangledName;
     {
       raw_string_ostream MangledNameStream(MangledName);
       Mang.getNameWithPrefix(MangledNameStream, Name);
     }
-    return getMangledSymbolAddress(MangledName);
+    return findMangledSymbol(MangledName);
   }
 
 private:
@@ -1180,8 +1180,8 @@ private:
   CompileLayerT CompileLayer;
 };
 
-static std::unique_ptr<llvm::Module>
-IRGen(KaleidoscopeJIT &J, SessionContext &S, const FunctionAST &F) {
+static std::unique_ptr<llvm::Module> IRGen(SessionContext &S,
+                                           const FunctionAST &F) {
   IRGenContext C(S);
   auto LF = F.IRGen(C);
   if (!LF)
@@ -1195,7 +1195,7 @@ IRGen(KaleidoscopeJIT &J, SessionContext &S, const FunctionAST &F) {
 
 static void HandleDefinition(SessionContext &S, KaleidoscopeJIT &J) {
   if (auto F = ParseDefinition()) {
-    if (auto M = IRGen(J, S, *F)) {
+    if (auto M = IRGen(S, *F)) {
       S.addPrototypeAST(llvm::make_unique<PrototypeAST>(*F->Proto));
       J.addModule(std::move(M));
     }
@@ -1228,11 +1228,11 @@ static void HandleTopLevelExpression(SessionContext &S, KaleidoscopeJIT &J) {
       auto H = J.addModule(C.takeM());
 
       // Get the address of the JIT'd function in memory.
-      uint64_t ExprFuncAddr = J.getSymbolAddress("__anon_expr");
+      auto ExprSymbol = J.findSymbol("__anon_expr");
       
       // Cast it to the right type (takes no arguments, returns a double) so we
       // can call it as a native function.
-      double (*FP)() = (double (*)())(intptr_t)ExprFuncAddr;
+      double (*FP)() = (double (*)())(intptr_t)ExprSymbol.getAddress();
 #ifdef MINIMAL_STDERR_OUTPUT
       FP();
 #else