xref: /freebsd/contrib/llvm-project/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h (revision 5ffd83dbcc34f10e07f6d3e968ae6365869615f4)
10b57cec5SDimitry Andric //===-- MCJIT.h - Class definition for the MCJIT ----------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #ifndef LLVM_LIB_EXECUTIONENGINE_MCJIT_MCJIT_H
100b57cec5SDimitry Andric #define LLVM_LIB_EXECUTIONENGINE_MCJIT_MCJIT_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "llvm/ADT/SmallPtrSet.h"
130b57cec5SDimitry Andric #include "llvm/ADT/SmallVector.h"
140b57cec5SDimitry Andric #include "llvm/ExecutionEngine/ExecutionEngine.h"
150b57cec5SDimitry Andric #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
160b57cec5SDimitry Andric #include "llvm/ExecutionEngine/RuntimeDyld.h"
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric namespace llvm {
190b57cec5SDimitry Andric class MCJIT;
20*5ffd83dbSDimitry Andric class Module;
21*5ffd83dbSDimitry Andric class ObjectCache;
220b57cec5SDimitry Andric 
230b57cec5SDimitry Andric // This is a helper class that the MCJIT execution engine uses for linking
240b57cec5SDimitry Andric // functions across modules that it owns.  It aggregates the memory manager
250b57cec5SDimitry Andric // that is passed in to the MCJIT constructor and defers most functionality
260b57cec5SDimitry Andric // to that object.
270b57cec5SDimitry Andric class LinkingSymbolResolver : public LegacyJITSymbolResolver {
280b57cec5SDimitry Andric public:
290b57cec5SDimitry Andric   LinkingSymbolResolver(MCJIT &Parent,
300b57cec5SDimitry Andric                         std::shared_ptr<LegacyJITSymbolResolver> Resolver)
310b57cec5SDimitry Andric       : ParentEngine(Parent), ClientResolver(std::move(Resolver)) {}
320b57cec5SDimitry Andric 
330b57cec5SDimitry Andric   JITSymbol findSymbol(const std::string &Name) override;
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric   // MCJIT doesn't support logical dylibs.
360b57cec5SDimitry Andric   JITSymbol findSymbolInLogicalDylib(const std::string &Name) override {
370b57cec5SDimitry Andric     return nullptr;
380b57cec5SDimitry Andric   }
390b57cec5SDimitry Andric 
400b57cec5SDimitry Andric private:
410b57cec5SDimitry Andric   MCJIT &ParentEngine;
420b57cec5SDimitry Andric   std::shared_ptr<LegacyJITSymbolResolver> ClientResolver;
430b57cec5SDimitry Andric   void anchor() override;
440b57cec5SDimitry Andric };
450b57cec5SDimitry Andric 
460b57cec5SDimitry Andric // About Module states: added->loaded->finalized.
470b57cec5SDimitry Andric //
480b57cec5SDimitry Andric // The purpose of the "added" state is having modules in standby. (added=known
490b57cec5SDimitry Andric // but not compiled). The idea is that you can add a module to provide function
500b57cec5SDimitry Andric // definitions but if nothing in that module is referenced by a module in which
510b57cec5SDimitry Andric // a function is executed (note the wording here because it's not exactly the
520b57cec5SDimitry Andric // ideal case) then the module never gets compiled. This is sort of lazy
530b57cec5SDimitry Andric // compilation.
540b57cec5SDimitry Andric //
550b57cec5SDimitry Andric // The purpose of the "loaded" state (loaded=compiled and required sections
560b57cec5SDimitry Andric // copied into local memory but not yet ready for execution) is to have an
570b57cec5SDimitry Andric // intermediate state wherein clients can remap the addresses of sections, using
580b57cec5SDimitry Andric // MCJIT::mapSectionAddress, (in preparation for later copying to a new location
590b57cec5SDimitry Andric // or an external process) before relocations and page permissions are applied.
600b57cec5SDimitry Andric //
610b57cec5SDimitry Andric // It might not be obvious at first glance, but the "remote-mcjit" case in the
620b57cec5SDimitry Andric // lli tool does this.  In that case, the intermediate action is taken by the
630b57cec5SDimitry Andric // RemoteMemoryManager in response to the notifyObjectLoaded function being
640b57cec5SDimitry Andric // called.
650b57cec5SDimitry Andric 
660b57cec5SDimitry Andric class MCJIT : public ExecutionEngine {
670b57cec5SDimitry Andric   MCJIT(std::unique_ptr<Module> M, std::unique_ptr<TargetMachine> tm,
680b57cec5SDimitry Andric         std::shared_ptr<MCJITMemoryManager> MemMgr,
690b57cec5SDimitry Andric         std::shared_ptr<LegacyJITSymbolResolver> Resolver);
700b57cec5SDimitry Andric 
710b57cec5SDimitry Andric   typedef llvm::SmallPtrSet<Module *, 4> ModulePtrSet;
720b57cec5SDimitry Andric 
730b57cec5SDimitry Andric   class OwningModuleContainer {
740b57cec5SDimitry Andric   public:
750b57cec5SDimitry Andric     OwningModuleContainer() {
760b57cec5SDimitry Andric     }
770b57cec5SDimitry Andric     ~OwningModuleContainer() {
780b57cec5SDimitry Andric       freeModulePtrSet(AddedModules);
790b57cec5SDimitry Andric       freeModulePtrSet(LoadedModules);
800b57cec5SDimitry Andric       freeModulePtrSet(FinalizedModules);
810b57cec5SDimitry Andric     }
820b57cec5SDimitry Andric 
830b57cec5SDimitry Andric     ModulePtrSet::iterator begin_added() { return AddedModules.begin(); }
840b57cec5SDimitry Andric     ModulePtrSet::iterator end_added() { return AddedModules.end(); }
850b57cec5SDimitry Andric     iterator_range<ModulePtrSet::iterator> added() {
860b57cec5SDimitry Andric       return make_range(begin_added(), end_added());
870b57cec5SDimitry Andric     }
880b57cec5SDimitry Andric 
890b57cec5SDimitry Andric     ModulePtrSet::iterator begin_loaded() { return LoadedModules.begin(); }
900b57cec5SDimitry Andric     ModulePtrSet::iterator end_loaded() { return LoadedModules.end(); }
910b57cec5SDimitry Andric 
920b57cec5SDimitry Andric     ModulePtrSet::iterator begin_finalized() { return FinalizedModules.begin(); }
930b57cec5SDimitry Andric     ModulePtrSet::iterator end_finalized() { return FinalizedModules.end(); }
940b57cec5SDimitry Andric 
950b57cec5SDimitry Andric     void addModule(std::unique_ptr<Module> M) {
960b57cec5SDimitry Andric       AddedModules.insert(M.release());
970b57cec5SDimitry Andric     }
980b57cec5SDimitry Andric 
990b57cec5SDimitry Andric     bool removeModule(Module *M) {
1000b57cec5SDimitry Andric       return AddedModules.erase(M) || LoadedModules.erase(M) ||
1010b57cec5SDimitry Andric              FinalizedModules.erase(M);
1020b57cec5SDimitry Andric     }
1030b57cec5SDimitry Andric 
1040b57cec5SDimitry Andric     bool hasModuleBeenAddedButNotLoaded(Module *M) {
1050b57cec5SDimitry Andric       return AddedModules.count(M) != 0;
1060b57cec5SDimitry Andric     }
1070b57cec5SDimitry Andric 
1080b57cec5SDimitry Andric     bool hasModuleBeenLoaded(Module *M) {
1090b57cec5SDimitry Andric       // If the module is in either the "loaded" or "finalized" sections it
1100b57cec5SDimitry Andric       // has been loaded.
1110b57cec5SDimitry Andric       return (LoadedModules.count(M) != 0 ) || (FinalizedModules.count(M) != 0);
1120b57cec5SDimitry Andric     }
1130b57cec5SDimitry Andric 
1140b57cec5SDimitry Andric     bool hasModuleBeenFinalized(Module *M) {
1150b57cec5SDimitry Andric       return FinalizedModules.count(M) != 0;
1160b57cec5SDimitry Andric     }
1170b57cec5SDimitry Andric 
1180b57cec5SDimitry Andric     bool ownsModule(Module* M) {
1190b57cec5SDimitry Andric       return (AddedModules.count(M) != 0) || (LoadedModules.count(M) != 0) ||
1200b57cec5SDimitry Andric              (FinalizedModules.count(M) != 0);
1210b57cec5SDimitry Andric     }
1220b57cec5SDimitry Andric 
1230b57cec5SDimitry Andric     void markModuleAsLoaded(Module *M) {
1240b57cec5SDimitry Andric       // This checks against logic errors in the MCJIT implementation.
1250b57cec5SDimitry Andric       // This function should never be called with either a Module that MCJIT
1260b57cec5SDimitry Andric       // does not own or a Module that has already been loaded and/or finalized.
1270b57cec5SDimitry Andric       assert(AddedModules.count(M) &&
1280b57cec5SDimitry Andric              "markModuleAsLoaded: Module not found in AddedModules");
1290b57cec5SDimitry Andric 
1300b57cec5SDimitry Andric       // Remove the module from the "Added" set.
1310b57cec5SDimitry Andric       AddedModules.erase(M);
1320b57cec5SDimitry Andric 
1330b57cec5SDimitry Andric       // Add the Module to the "Loaded" set.
1340b57cec5SDimitry Andric       LoadedModules.insert(M);
1350b57cec5SDimitry Andric     }
1360b57cec5SDimitry Andric 
1370b57cec5SDimitry Andric     void markModuleAsFinalized(Module *M) {
1380b57cec5SDimitry Andric       // This checks against logic errors in the MCJIT implementation.
1390b57cec5SDimitry Andric       // This function should never be called with either a Module that MCJIT
1400b57cec5SDimitry Andric       // does not own, a Module that has not been loaded or a Module that has
1410b57cec5SDimitry Andric       // already been finalized.
1420b57cec5SDimitry Andric       assert(LoadedModules.count(M) &&
1430b57cec5SDimitry Andric              "markModuleAsFinalized: Module not found in LoadedModules");
1440b57cec5SDimitry Andric 
1450b57cec5SDimitry Andric       // Remove the module from the "Loaded" section of the list.
1460b57cec5SDimitry Andric       LoadedModules.erase(M);
1470b57cec5SDimitry Andric 
1480b57cec5SDimitry Andric       // Add the Module to the "Finalized" section of the list by inserting it
1490b57cec5SDimitry Andric       // before the 'end' iterator.
1500b57cec5SDimitry Andric       FinalizedModules.insert(M);
1510b57cec5SDimitry Andric     }
1520b57cec5SDimitry Andric 
1530b57cec5SDimitry Andric     void markAllLoadedModulesAsFinalized() {
1540b57cec5SDimitry Andric       for (ModulePtrSet::iterator I = LoadedModules.begin(),
1550b57cec5SDimitry Andric                                   E = LoadedModules.end();
1560b57cec5SDimitry Andric            I != E; ++I) {
1570b57cec5SDimitry Andric         Module *M = *I;
1580b57cec5SDimitry Andric         FinalizedModules.insert(M);
1590b57cec5SDimitry Andric       }
1600b57cec5SDimitry Andric       LoadedModules.clear();
1610b57cec5SDimitry Andric     }
1620b57cec5SDimitry Andric 
1630b57cec5SDimitry Andric   private:
1640b57cec5SDimitry Andric     ModulePtrSet AddedModules;
1650b57cec5SDimitry Andric     ModulePtrSet LoadedModules;
1660b57cec5SDimitry Andric     ModulePtrSet FinalizedModules;
1670b57cec5SDimitry Andric 
1680b57cec5SDimitry Andric     void freeModulePtrSet(ModulePtrSet& MPS) {
1690b57cec5SDimitry Andric       // Go through the module set and delete everything.
1700b57cec5SDimitry Andric       for (ModulePtrSet::iterator I = MPS.begin(), E = MPS.end(); I != E; ++I) {
1710b57cec5SDimitry Andric         Module *M = *I;
1720b57cec5SDimitry Andric         delete M;
1730b57cec5SDimitry Andric       }
1740b57cec5SDimitry Andric       MPS.clear();
1750b57cec5SDimitry Andric     }
1760b57cec5SDimitry Andric   };
1770b57cec5SDimitry Andric 
1780b57cec5SDimitry Andric   std::unique_ptr<TargetMachine> TM;
1790b57cec5SDimitry Andric   MCContext *Ctx;
1800b57cec5SDimitry Andric   std::shared_ptr<MCJITMemoryManager> MemMgr;
1810b57cec5SDimitry Andric   LinkingSymbolResolver Resolver;
1820b57cec5SDimitry Andric   RuntimeDyld Dyld;
1830b57cec5SDimitry Andric   std::vector<JITEventListener*> EventListeners;
1840b57cec5SDimitry Andric 
1850b57cec5SDimitry Andric   OwningModuleContainer OwnedModules;
1860b57cec5SDimitry Andric 
1870b57cec5SDimitry Andric   SmallVector<object::OwningBinary<object::Archive>, 2> Archives;
1880b57cec5SDimitry Andric   SmallVector<std::unique_ptr<MemoryBuffer>, 2> Buffers;
1890b57cec5SDimitry Andric 
1900b57cec5SDimitry Andric   SmallVector<std::unique_ptr<object::ObjectFile>, 2> LoadedObjects;
1910b57cec5SDimitry Andric 
1920b57cec5SDimitry Andric   // An optional ObjectCache to be notified of compiled objects and used to
1930b57cec5SDimitry Andric   // perform lookup of pre-compiled code to avoid re-compilation.
1940b57cec5SDimitry Andric   ObjectCache *ObjCache;
1950b57cec5SDimitry Andric 
1960b57cec5SDimitry Andric   Function *FindFunctionNamedInModulePtrSet(StringRef FnName,
1970b57cec5SDimitry Andric                                             ModulePtrSet::iterator I,
1980b57cec5SDimitry Andric                                             ModulePtrSet::iterator E);
1990b57cec5SDimitry Andric 
2000b57cec5SDimitry Andric   GlobalVariable *FindGlobalVariableNamedInModulePtrSet(StringRef Name,
2010b57cec5SDimitry Andric                                                         bool AllowInternal,
2020b57cec5SDimitry Andric                                                         ModulePtrSet::iterator I,
2030b57cec5SDimitry Andric                                                         ModulePtrSet::iterator E);
2040b57cec5SDimitry Andric 
2050b57cec5SDimitry Andric   void runStaticConstructorsDestructorsInModulePtrSet(bool isDtors,
2060b57cec5SDimitry Andric                                                       ModulePtrSet::iterator I,
2070b57cec5SDimitry Andric                                                       ModulePtrSet::iterator E);
2080b57cec5SDimitry Andric 
2090b57cec5SDimitry Andric public:
2100b57cec5SDimitry Andric   ~MCJIT() override;
2110b57cec5SDimitry Andric 
2120b57cec5SDimitry Andric   /// @name ExecutionEngine interface implementation
2130b57cec5SDimitry Andric   /// @{
2140b57cec5SDimitry Andric   void addModule(std::unique_ptr<Module> M) override;
2150b57cec5SDimitry Andric   void addObjectFile(std::unique_ptr<object::ObjectFile> O) override;
2160b57cec5SDimitry Andric   void addObjectFile(object::OwningBinary<object::ObjectFile> O) override;
2170b57cec5SDimitry Andric   void addArchive(object::OwningBinary<object::Archive> O) override;
2180b57cec5SDimitry Andric   bool removeModule(Module *M) override;
2190b57cec5SDimitry Andric 
2200b57cec5SDimitry Andric   /// FindFunctionNamed - Search all of the active modules to find the function that
2210b57cec5SDimitry Andric   /// defines FnName.  This is very slow operation and shouldn't be used for
2220b57cec5SDimitry Andric   /// general code.
2230b57cec5SDimitry Andric   Function *FindFunctionNamed(StringRef FnName) override;
2240b57cec5SDimitry Andric 
2250b57cec5SDimitry Andric   /// FindGlobalVariableNamed - Search all of the active modules to find the
2260b57cec5SDimitry Andric   /// global variable that defines Name.  This is very slow operation and
2270b57cec5SDimitry Andric   /// shouldn't be used for general code.
2280b57cec5SDimitry Andric   GlobalVariable *FindGlobalVariableNamed(StringRef Name,
2290b57cec5SDimitry Andric                                           bool AllowInternal = false) override;
2300b57cec5SDimitry Andric 
2310b57cec5SDimitry Andric   /// Sets the object manager that MCJIT should use to avoid compilation.
2320b57cec5SDimitry Andric   void setObjectCache(ObjectCache *manager) override;
2330b57cec5SDimitry Andric 
2340b57cec5SDimitry Andric   void setProcessAllSections(bool ProcessAllSections) override {
2350b57cec5SDimitry Andric     Dyld.setProcessAllSections(ProcessAllSections);
2360b57cec5SDimitry Andric   }
2370b57cec5SDimitry Andric 
2380b57cec5SDimitry Andric   void generateCodeForModule(Module *M) override;
2390b57cec5SDimitry Andric 
2400b57cec5SDimitry Andric   /// finalizeObject - ensure the module is fully processed and is usable.
2410b57cec5SDimitry Andric   ///
2420b57cec5SDimitry Andric   /// It is the user-level function for completing the process of making the
2430b57cec5SDimitry Andric   /// object usable for execution. It should be called after sections within an
2440b57cec5SDimitry Andric   /// object have been relocated using mapSectionAddress.  When this method is
2450b57cec5SDimitry Andric   /// called the MCJIT execution engine will reapply relocations for a loaded
2460b57cec5SDimitry Andric   /// object.
2470b57cec5SDimitry Andric   /// Is it OK to finalize a set of modules, add modules and finalize again.
2480b57cec5SDimitry Andric   // FIXME: Do we really need both of these?
2490b57cec5SDimitry Andric   void finalizeObject() override;
2500b57cec5SDimitry Andric   virtual void finalizeModule(Module *);
2510b57cec5SDimitry Andric   void finalizeLoadedModules();
2520b57cec5SDimitry Andric 
2530b57cec5SDimitry Andric   /// runStaticConstructorsDestructors - This method is used to execute all of
2540b57cec5SDimitry Andric   /// the static constructors or destructors for a program.
2550b57cec5SDimitry Andric   ///
2560b57cec5SDimitry Andric   /// \param isDtors - Run the destructors instead of constructors.
2570b57cec5SDimitry Andric   void runStaticConstructorsDestructors(bool isDtors) override;
2580b57cec5SDimitry Andric 
2590b57cec5SDimitry Andric   void *getPointerToFunction(Function *F) override;
2600b57cec5SDimitry Andric 
2610b57cec5SDimitry Andric   GenericValue runFunction(Function *F,
2620b57cec5SDimitry Andric                            ArrayRef<GenericValue> ArgValues) override;
2630b57cec5SDimitry Andric 
2640b57cec5SDimitry Andric   /// getPointerToNamedFunction - This method returns the address of the
2650b57cec5SDimitry Andric   /// specified function by using the dlsym function call.  As such it is only
2660b57cec5SDimitry Andric   /// useful for resolving library symbols, not code generated symbols.
2670b57cec5SDimitry Andric   ///
2680b57cec5SDimitry Andric   /// If AbortOnFailure is false and no function with the given name is
2690b57cec5SDimitry Andric   /// found, this function silently returns a null pointer. Otherwise,
2700b57cec5SDimitry Andric   /// it prints a message to stderr and aborts.
2710b57cec5SDimitry Andric   ///
2720b57cec5SDimitry Andric   void *getPointerToNamedFunction(StringRef Name,
2730b57cec5SDimitry Andric                                   bool AbortOnFailure = true) override;
2740b57cec5SDimitry Andric 
2750b57cec5SDimitry Andric   /// mapSectionAddress - map a section to its target address space value.
2760b57cec5SDimitry Andric   /// Map the address of a JIT section as returned from the memory manager
2770b57cec5SDimitry Andric   /// to the address in the target process as the running code will see it.
2780b57cec5SDimitry Andric   /// This is the address which will be used for relocation resolution.
2790b57cec5SDimitry Andric   void mapSectionAddress(const void *LocalAddress,
2800b57cec5SDimitry Andric                          uint64_t TargetAddress) override {
2810b57cec5SDimitry Andric     Dyld.mapSectionAddress(LocalAddress, TargetAddress);
2820b57cec5SDimitry Andric   }
2830b57cec5SDimitry Andric   void RegisterJITEventListener(JITEventListener *L) override;
2840b57cec5SDimitry Andric   void UnregisterJITEventListener(JITEventListener *L) override;
2850b57cec5SDimitry Andric 
2860b57cec5SDimitry Andric   // If successful, these function will implicitly finalize all loaded objects.
2870b57cec5SDimitry Andric   // To get a function address within MCJIT without causing a finalize, use
2880b57cec5SDimitry Andric   // getSymbolAddress.
2890b57cec5SDimitry Andric   uint64_t getGlobalValueAddress(const std::string &Name) override;
2900b57cec5SDimitry Andric   uint64_t getFunctionAddress(const std::string &Name) override;
2910b57cec5SDimitry Andric 
2920b57cec5SDimitry Andric   TargetMachine *getTargetMachine() override { return TM.get(); }
2930b57cec5SDimitry Andric 
2940b57cec5SDimitry Andric   /// @}
2950b57cec5SDimitry Andric   /// @name (Private) Registration Interfaces
2960b57cec5SDimitry Andric   /// @{
2970b57cec5SDimitry Andric 
2980b57cec5SDimitry Andric   static void Register() {
2990b57cec5SDimitry Andric     MCJITCtor = createJIT;
3000b57cec5SDimitry Andric   }
3010b57cec5SDimitry Andric 
3020b57cec5SDimitry Andric   static ExecutionEngine *
3030b57cec5SDimitry Andric   createJIT(std::unique_ptr<Module> M, std::string *ErrorStr,
3040b57cec5SDimitry Andric             std::shared_ptr<MCJITMemoryManager> MemMgr,
3050b57cec5SDimitry Andric             std::shared_ptr<LegacyJITSymbolResolver> Resolver,
3060b57cec5SDimitry Andric             std::unique_ptr<TargetMachine> TM);
3070b57cec5SDimitry Andric 
3080b57cec5SDimitry Andric   // @}
3090b57cec5SDimitry Andric 
3100b57cec5SDimitry Andric   // Takes a mangled name and returns the corresponding JITSymbol (if a
3110b57cec5SDimitry Andric   // definition of that mangled name has been added to the JIT).
3120b57cec5SDimitry Andric   JITSymbol findSymbol(const std::string &Name, bool CheckFunctionsOnly);
3130b57cec5SDimitry Andric 
3140b57cec5SDimitry Andric   // DEPRECATED - Please use findSymbol instead.
3150b57cec5SDimitry Andric   //
3160b57cec5SDimitry Andric   // This is not directly exposed via the ExecutionEngine API, but it is
3170b57cec5SDimitry Andric   // used by the LinkingMemoryManager.
3180b57cec5SDimitry Andric   //
3190b57cec5SDimitry Andric   // getSymbolAddress takes an unmangled name and returns the corresponding
3200b57cec5SDimitry Andric   // JITSymbol if a definition of the name has been added to the JIT.
3210b57cec5SDimitry Andric   uint64_t getSymbolAddress(const std::string &Name,
3220b57cec5SDimitry Andric                             bool CheckFunctionsOnly);
3230b57cec5SDimitry Andric 
3240b57cec5SDimitry Andric protected:
3250b57cec5SDimitry Andric   /// emitObject -- Generate a JITed object in memory from the specified module
3260b57cec5SDimitry Andric   /// Currently, MCJIT only supports a single module and the module passed to
3270b57cec5SDimitry Andric   /// this function call is expected to be the contained module.  The module
3280b57cec5SDimitry Andric   /// is passed as a parameter here to prepare for multiple module support in
3290b57cec5SDimitry Andric   /// the future.
3300b57cec5SDimitry Andric   std::unique_ptr<MemoryBuffer> emitObject(Module *M);
3310b57cec5SDimitry Andric 
3320b57cec5SDimitry Andric   void notifyObjectLoaded(const object::ObjectFile &Obj,
3330b57cec5SDimitry Andric                           const RuntimeDyld::LoadedObjectInfo &L);
3340b57cec5SDimitry Andric   void notifyFreeingObject(const object::ObjectFile &Obj);
3350b57cec5SDimitry Andric 
3360b57cec5SDimitry Andric   JITSymbol findExistingSymbol(const std::string &Name);
3370b57cec5SDimitry Andric   Module *findModuleForSymbol(const std::string &Name, bool CheckFunctionsOnly);
3380b57cec5SDimitry Andric };
3390b57cec5SDimitry Andric 
3400b57cec5SDimitry Andric } // end llvm namespace
3410b57cec5SDimitry Andric 
3420b57cec5SDimitry Andric #endif // LLVM_LIB_EXECUTIONENGINE_MCJIT_MCJIT_H
343