1*0b57cec5SDimitry Andric //===-- MCJIT.h - Class definition for the MCJIT ----------------*- C++ -*-===// 2*0b57cec5SDimitry Andric // 3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric // 7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric 9*0b57cec5SDimitry Andric #ifndef LLVM_LIB_EXECUTIONENGINE_MCJIT_MCJIT_H 10*0b57cec5SDimitry Andric #define LLVM_LIB_EXECUTIONENGINE_MCJIT_MCJIT_H 11*0b57cec5SDimitry Andric 12*0b57cec5SDimitry Andric #include "llvm/ADT/SmallPtrSet.h" 13*0b57cec5SDimitry Andric #include "llvm/ADT/SmallVector.h" 14*0b57cec5SDimitry Andric #include "llvm/ExecutionEngine/ExecutionEngine.h" 15*0b57cec5SDimitry Andric #include "llvm/ExecutionEngine/ObjectCache.h" 16*0b57cec5SDimitry Andric #include "llvm/ExecutionEngine/RTDyldMemoryManager.h" 17*0b57cec5SDimitry Andric #include "llvm/ExecutionEngine/RuntimeDyld.h" 18*0b57cec5SDimitry Andric #include "llvm/IR/Module.h" 19*0b57cec5SDimitry Andric #include "llvm/Support/SmallVectorMemoryBuffer.h" 20*0b57cec5SDimitry Andric 21*0b57cec5SDimitry Andric namespace llvm { 22*0b57cec5SDimitry Andric class MCJIT; 23*0b57cec5SDimitry Andric 24*0b57cec5SDimitry Andric // This is a helper class that the MCJIT execution engine uses for linking 25*0b57cec5SDimitry Andric // functions across modules that it owns. It aggregates the memory manager 26*0b57cec5SDimitry Andric // that is passed in to the MCJIT constructor and defers most functionality 27*0b57cec5SDimitry Andric // to that object. 28*0b57cec5SDimitry Andric class LinkingSymbolResolver : public LegacyJITSymbolResolver { 29*0b57cec5SDimitry Andric public: 30*0b57cec5SDimitry Andric LinkingSymbolResolver(MCJIT &Parent, 31*0b57cec5SDimitry Andric std::shared_ptr<LegacyJITSymbolResolver> Resolver) 32*0b57cec5SDimitry Andric : ParentEngine(Parent), ClientResolver(std::move(Resolver)) {} 33*0b57cec5SDimitry Andric 34*0b57cec5SDimitry Andric JITSymbol findSymbol(const std::string &Name) override; 35*0b57cec5SDimitry Andric 36*0b57cec5SDimitry Andric // MCJIT doesn't support logical dylibs. 37*0b57cec5SDimitry Andric JITSymbol findSymbolInLogicalDylib(const std::string &Name) override { 38*0b57cec5SDimitry Andric return nullptr; 39*0b57cec5SDimitry Andric } 40*0b57cec5SDimitry Andric 41*0b57cec5SDimitry Andric private: 42*0b57cec5SDimitry Andric MCJIT &ParentEngine; 43*0b57cec5SDimitry Andric std::shared_ptr<LegacyJITSymbolResolver> ClientResolver; 44*0b57cec5SDimitry Andric void anchor() override; 45*0b57cec5SDimitry Andric }; 46*0b57cec5SDimitry Andric 47*0b57cec5SDimitry Andric // About Module states: added->loaded->finalized. 48*0b57cec5SDimitry Andric // 49*0b57cec5SDimitry Andric // The purpose of the "added" state is having modules in standby. (added=known 50*0b57cec5SDimitry Andric // but not compiled). The idea is that you can add a module to provide function 51*0b57cec5SDimitry Andric // definitions but if nothing in that module is referenced by a module in which 52*0b57cec5SDimitry Andric // a function is executed (note the wording here because it's not exactly the 53*0b57cec5SDimitry Andric // ideal case) then the module never gets compiled. This is sort of lazy 54*0b57cec5SDimitry Andric // compilation. 55*0b57cec5SDimitry Andric // 56*0b57cec5SDimitry Andric // The purpose of the "loaded" state (loaded=compiled and required sections 57*0b57cec5SDimitry Andric // copied into local memory but not yet ready for execution) is to have an 58*0b57cec5SDimitry Andric // intermediate state wherein clients can remap the addresses of sections, using 59*0b57cec5SDimitry Andric // MCJIT::mapSectionAddress, (in preparation for later copying to a new location 60*0b57cec5SDimitry Andric // or an external process) before relocations and page permissions are applied. 61*0b57cec5SDimitry Andric // 62*0b57cec5SDimitry Andric // It might not be obvious at first glance, but the "remote-mcjit" case in the 63*0b57cec5SDimitry Andric // lli tool does this. In that case, the intermediate action is taken by the 64*0b57cec5SDimitry Andric // RemoteMemoryManager in response to the notifyObjectLoaded function being 65*0b57cec5SDimitry Andric // called. 66*0b57cec5SDimitry Andric 67*0b57cec5SDimitry Andric class MCJIT : public ExecutionEngine { 68*0b57cec5SDimitry Andric MCJIT(std::unique_ptr<Module> M, std::unique_ptr<TargetMachine> tm, 69*0b57cec5SDimitry Andric std::shared_ptr<MCJITMemoryManager> MemMgr, 70*0b57cec5SDimitry Andric std::shared_ptr<LegacyJITSymbolResolver> Resolver); 71*0b57cec5SDimitry Andric 72*0b57cec5SDimitry Andric typedef llvm::SmallPtrSet<Module *, 4> ModulePtrSet; 73*0b57cec5SDimitry Andric 74*0b57cec5SDimitry Andric class OwningModuleContainer { 75*0b57cec5SDimitry Andric public: 76*0b57cec5SDimitry Andric OwningModuleContainer() { 77*0b57cec5SDimitry Andric } 78*0b57cec5SDimitry Andric ~OwningModuleContainer() { 79*0b57cec5SDimitry Andric freeModulePtrSet(AddedModules); 80*0b57cec5SDimitry Andric freeModulePtrSet(LoadedModules); 81*0b57cec5SDimitry Andric freeModulePtrSet(FinalizedModules); 82*0b57cec5SDimitry Andric } 83*0b57cec5SDimitry Andric 84*0b57cec5SDimitry Andric ModulePtrSet::iterator begin_added() { return AddedModules.begin(); } 85*0b57cec5SDimitry Andric ModulePtrSet::iterator end_added() { return AddedModules.end(); } 86*0b57cec5SDimitry Andric iterator_range<ModulePtrSet::iterator> added() { 87*0b57cec5SDimitry Andric return make_range(begin_added(), end_added()); 88*0b57cec5SDimitry Andric } 89*0b57cec5SDimitry Andric 90*0b57cec5SDimitry Andric ModulePtrSet::iterator begin_loaded() { return LoadedModules.begin(); } 91*0b57cec5SDimitry Andric ModulePtrSet::iterator end_loaded() { return LoadedModules.end(); } 92*0b57cec5SDimitry Andric 93*0b57cec5SDimitry Andric ModulePtrSet::iterator begin_finalized() { return FinalizedModules.begin(); } 94*0b57cec5SDimitry Andric ModulePtrSet::iterator end_finalized() { return FinalizedModules.end(); } 95*0b57cec5SDimitry Andric 96*0b57cec5SDimitry Andric void addModule(std::unique_ptr<Module> M) { 97*0b57cec5SDimitry Andric AddedModules.insert(M.release()); 98*0b57cec5SDimitry Andric } 99*0b57cec5SDimitry Andric 100*0b57cec5SDimitry Andric bool removeModule(Module *M) { 101*0b57cec5SDimitry Andric return AddedModules.erase(M) || LoadedModules.erase(M) || 102*0b57cec5SDimitry Andric FinalizedModules.erase(M); 103*0b57cec5SDimitry Andric } 104*0b57cec5SDimitry Andric 105*0b57cec5SDimitry Andric bool hasModuleBeenAddedButNotLoaded(Module *M) { 106*0b57cec5SDimitry Andric return AddedModules.count(M) != 0; 107*0b57cec5SDimitry Andric } 108*0b57cec5SDimitry Andric 109*0b57cec5SDimitry Andric bool hasModuleBeenLoaded(Module *M) { 110*0b57cec5SDimitry Andric // If the module is in either the "loaded" or "finalized" sections it 111*0b57cec5SDimitry Andric // has been loaded. 112*0b57cec5SDimitry Andric return (LoadedModules.count(M) != 0 ) || (FinalizedModules.count(M) != 0); 113*0b57cec5SDimitry Andric } 114*0b57cec5SDimitry Andric 115*0b57cec5SDimitry Andric bool hasModuleBeenFinalized(Module *M) { 116*0b57cec5SDimitry Andric return FinalizedModules.count(M) != 0; 117*0b57cec5SDimitry Andric } 118*0b57cec5SDimitry Andric 119*0b57cec5SDimitry Andric bool ownsModule(Module* M) { 120*0b57cec5SDimitry Andric return (AddedModules.count(M) != 0) || (LoadedModules.count(M) != 0) || 121*0b57cec5SDimitry Andric (FinalizedModules.count(M) != 0); 122*0b57cec5SDimitry Andric } 123*0b57cec5SDimitry Andric 124*0b57cec5SDimitry Andric void markModuleAsLoaded(Module *M) { 125*0b57cec5SDimitry Andric // This checks against logic errors in the MCJIT implementation. 126*0b57cec5SDimitry Andric // This function should never be called with either a Module that MCJIT 127*0b57cec5SDimitry Andric // does not own or a Module that has already been loaded and/or finalized. 128*0b57cec5SDimitry Andric assert(AddedModules.count(M) && 129*0b57cec5SDimitry Andric "markModuleAsLoaded: Module not found in AddedModules"); 130*0b57cec5SDimitry Andric 131*0b57cec5SDimitry Andric // Remove the module from the "Added" set. 132*0b57cec5SDimitry Andric AddedModules.erase(M); 133*0b57cec5SDimitry Andric 134*0b57cec5SDimitry Andric // Add the Module to the "Loaded" set. 135*0b57cec5SDimitry Andric LoadedModules.insert(M); 136*0b57cec5SDimitry Andric } 137*0b57cec5SDimitry Andric 138*0b57cec5SDimitry Andric void markModuleAsFinalized(Module *M) { 139*0b57cec5SDimitry Andric // This checks against logic errors in the MCJIT implementation. 140*0b57cec5SDimitry Andric // This function should never be called with either a Module that MCJIT 141*0b57cec5SDimitry Andric // does not own, a Module that has not been loaded or a Module that has 142*0b57cec5SDimitry Andric // already been finalized. 143*0b57cec5SDimitry Andric assert(LoadedModules.count(M) && 144*0b57cec5SDimitry Andric "markModuleAsFinalized: Module not found in LoadedModules"); 145*0b57cec5SDimitry Andric 146*0b57cec5SDimitry Andric // Remove the module from the "Loaded" section of the list. 147*0b57cec5SDimitry Andric LoadedModules.erase(M); 148*0b57cec5SDimitry Andric 149*0b57cec5SDimitry Andric // Add the Module to the "Finalized" section of the list by inserting it 150*0b57cec5SDimitry Andric // before the 'end' iterator. 151*0b57cec5SDimitry Andric FinalizedModules.insert(M); 152*0b57cec5SDimitry Andric } 153*0b57cec5SDimitry Andric 154*0b57cec5SDimitry Andric void markAllLoadedModulesAsFinalized() { 155*0b57cec5SDimitry Andric for (ModulePtrSet::iterator I = LoadedModules.begin(), 156*0b57cec5SDimitry Andric E = LoadedModules.end(); 157*0b57cec5SDimitry Andric I != E; ++I) { 158*0b57cec5SDimitry Andric Module *M = *I; 159*0b57cec5SDimitry Andric FinalizedModules.insert(M); 160*0b57cec5SDimitry Andric } 161*0b57cec5SDimitry Andric LoadedModules.clear(); 162*0b57cec5SDimitry Andric } 163*0b57cec5SDimitry Andric 164*0b57cec5SDimitry Andric private: 165*0b57cec5SDimitry Andric ModulePtrSet AddedModules; 166*0b57cec5SDimitry Andric ModulePtrSet LoadedModules; 167*0b57cec5SDimitry Andric ModulePtrSet FinalizedModules; 168*0b57cec5SDimitry Andric 169*0b57cec5SDimitry Andric void freeModulePtrSet(ModulePtrSet& MPS) { 170*0b57cec5SDimitry Andric // Go through the module set and delete everything. 171*0b57cec5SDimitry Andric for (ModulePtrSet::iterator I = MPS.begin(), E = MPS.end(); I != E; ++I) { 172*0b57cec5SDimitry Andric Module *M = *I; 173*0b57cec5SDimitry Andric delete M; 174*0b57cec5SDimitry Andric } 175*0b57cec5SDimitry Andric MPS.clear(); 176*0b57cec5SDimitry Andric } 177*0b57cec5SDimitry Andric }; 178*0b57cec5SDimitry Andric 179*0b57cec5SDimitry Andric std::unique_ptr<TargetMachine> TM; 180*0b57cec5SDimitry Andric MCContext *Ctx; 181*0b57cec5SDimitry Andric std::shared_ptr<MCJITMemoryManager> MemMgr; 182*0b57cec5SDimitry Andric LinkingSymbolResolver Resolver; 183*0b57cec5SDimitry Andric RuntimeDyld Dyld; 184*0b57cec5SDimitry Andric std::vector<JITEventListener*> EventListeners; 185*0b57cec5SDimitry Andric 186*0b57cec5SDimitry Andric OwningModuleContainer OwnedModules; 187*0b57cec5SDimitry Andric 188*0b57cec5SDimitry Andric SmallVector<object::OwningBinary<object::Archive>, 2> Archives; 189*0b57cec5SDimitry Andric SmallVector<std::unique_ptr<MemoryBuffer>, 2> Buffers; 190*0b57cec5SDimitry Andric 191*0b57cec5SDimitry Andric SmallVector<std::unique_ptr<object::ObjectFile>, 2> LoadedObjects; 192*0b57cec5SDimitry Andric 193*0b57cec5SDimitry Andric // An optional ObjectCache to be notified of compiled objects and used to 194*0b57cec5SDimitry Andric // perform lookup of pre-compiled code to avoid re-compilation. 195*0b57cec5SDimitry Andric ObjectCache *ObjCache; 196*0b57cec5SDimitry Andric 197*0b57cec5SDimitry Andric Function *FindFunctionNamedInModulePtrSet(StringRef FnName, 198*0b57cec5SDimitry Andric ModulePtrSet::iterator I, 199*0b57cec5SDimitry Andric ModulePtrSet::iterator E); 200*0b57cec5SDimitry Andric 201*0b57cec5SDimitry Andric GlobalVariable *FindGlobalVariableNamedInModulePtrSet(StringRef Name, 202*0b57cec5SDimitry Andric bool AllowInternal, 203*0b57cec5SDimitry Andric ModulePtrSet::iterator I, 204*0b57cec5SDimitry Andric ModulePtrSet::iterator E); 205*0b57cec5SDimitry Andric 206*0b57cec5SDimitry Andric void runStaticConstructorsDestructorsInModulePtrSet(bool isDtors, 207*0b57cec5SDimitry Andric ModulePtrSet::iterator I, 208*0b57cec5SDimitry Andric ModulePtrSet::iterator E); 209*0b57cec5SDimitry Andric 210*0b57cec5SDimitry Andric public: 211*0b57cec5SDimitry Andric ~MCJIT() override; 212*0b57cec5SDimitry Andric 213*0b57cec5SDimitry Andric /// @name ExecutionEngine interface implementation 214*0b57cec5SDimitry Andric /// @{ 215*0b57cec5SDimitry Andric void addModule(std::unique_ptr<Module> M) override; 216*0b57cec5SDimitry Andric void addObjectFile(std::unique_ptr<object::ObjectFile> O) override; 217*0b57cec5SDimitry Andric void addObjectFile(object::OwningBinary<object::ObjectFile> O) override; 218*0b57cec5SDimitry Andric void addArchive(object::OwningBinary<object::Archive> O) override; 219*0b57cec5SDimitry Andric bool removeModule(Module *M) override; 220*0b57cec5SDimitry Andric 221*0b57cec5SDimitry Andric /// FindFunctionNamed - Search all of the active modules to find the function that 222*0b57cec5SDimitry Andric /// defines FnName. This is very slow operation and shouldn't be used for 223*0b57cec5SDimitry Andric /// general code. 224*0b57cec5SDimitry Andric Function *FindFunctionNamed(StringRef FnName) override; 225*0b57cec5SDimitry Andric 226*0b57cec5SDimitry Andric /// FindGlobalVariableNamed - Search all of the active modules to find the 227*0b57cec5SDimitry Andric /// global variable that defines Name. This is very slow operation and 228*0b57cec5SDimitry Andric /// shouldn't be used for general code. 229*0b57cec5SDimitry Andric GlobalVariable *FindGlobalVariableNamed(StringRef Name, 230*0b57cec5SDimitry Andric bool AllowInternal = false) override; 231*0b57cec5SDimitry Andric 232*0b57cec5SDimitry Andric /// Sets the object manager that MCJIT should use to avoid compilation. 233*0b57cec5SDimitry Andric void setObjectCache(ObjectCache *manager) override; 234*0b57cec5SDimitry Andric 235*0b57cec5SDimitry Andric void setProcessAllSections(bool ProcessAllSections) override { 236*0b57cec5SDimitry Andric Dyld.setProcessAllSections(ProcessAllSections); 237*0b57cec5SDimitry Andric } 238*0b57cec5SDimitry Andric 239*0b57cec5SDimitry Andric void generateCodeForModule(Module *M) override; 240*0b57cec5SDimitry Andric 241*0b57cec5SDimitry Andric /// finalizeObject - ensure the module is fully processed and is usable. 242*0b57cec5SDimitry Andric /// 243*0b57cec5SDimitry Andric /// It is the user-level function for completing the process of making the 244*0b57cec5SDimitry Andric /// object usable for execution. It should be called after sections within an 245*0b57cec5SDimitry Andric /// object have been relocated using mapSectionAddress. When this method is 246*0b57cec5SDimitry Andric /// called the MCJIT execution engine will reapply relocations for a loaded 247*0b57cec5SDimitry Andric /// object. 248*0b57cec5SDimitry Andric /// Is it OK to finalize a set of modules, add modules and finalize again. 249*0b57cec5SDimitry Andric // FIXME: Do we really need both of these? 250*0b57cec5SDimitry Andric void finalizeObject() override; 251*0b57cec5SDimitry Andric virtual void finalizeModule(Module *); 252*0b57cec5SDimitry Andric void finalizeLoadedModules(); 253*0b57cec5SDimitry Andric 254*0b57cec5SDimitry Andric /// runStaticConstructorsDestructors - This method is used to execute all of 255*0b57cec5SDimitry Andric /// the static constructors or destructors for a program. 256*0b57cec5SDimitry Andric /// 257*0b57cec5SDimitry Andric /// \param isDtors - Run the destructors instead of constructors. 258*0b57cec5SDimitry Andric void runStaticConstructorsDestructors(bool isDtors) override; 259*0b57cec5SDimitry Andric 260*0b57cec5SDimitry Andric void *getPointerToFunction(Function *F) override; 261*0b57cec5SDimitry Andric 262*0b57cec5SDimitry Andric GenericValue runFunction(Function *F, 263*0b57cec5SDimitry Andric ArrayRef<GenericValue> ArgValues) override; 264*0b57cec5SDimitry Andric 265*0b57cec5SDimitry Andric /// getPointerToNamedFunction - This method returns the address of the 266*0b57cec5SDimitry Andric /// specified function by using the dlsym function call. As such it is only 267*0b57cec5SDimitry Andric /// useful for resolving library symbols, not code generated symbols. 268*0b57cec5SDimitry Andric /// 269*0b57cec5SDimitry Andric /// If AbortOnFailure is false and no function with the given name is 270*0b57cec5SDimitry Andric /// found, this function silently returns a null pointer. Otherwise, 271*0b57cec5SDimitry Andric /// it prints a message to stderr and aborts. 272*0b57cec5SDimitry Andric /// 273*0b57cec5SDimitry Andric void *getPointerToNamedFunction(StringRef Name, 274*0b57cec5SDimitry Andric bool AbortOnFailure = true) override; 275*0b57cec5SDimitry Andric 276*0b57cec5SDimitry Andric /// mapSectionAddress - map a section to its target address space value. 277*0b57cec5SDimitry Andric /// Map the address of a JIT section as returned from the memory manager 278*0b57cec5SDimitry Andric /// to the address in the target process as the running code will see it. 279*0b57cec5SDimitry Andric /// This is the address which will be used for relocation resolution. 280*0b57cec5SDimitry Andric void mapSectionAddress(const void *LocalAddress, 281*0b57cec5SDimitry Andric uint64_t TargetAddress) override { 282*0b57cec5SDimitry Andric Dyld.mapSectionAddress(LocalAddress, TargetAddress); 283*0b57cec5SDimitry Andric } 284*0b57cec5SDimitry Andric void RegisterJITEventListener(JITEventListener *L) override; 285*0b57cec5SDimitry Andric void UnregisterJITEventListener(JITEventListener *L) override; 286*0b57cec5SDimitry Andric 287*0b57cec5SDimitry Andric // If successful, these function will implicitly finalize all loaded objects. 288*0b57cec5SDimitry Andric // To get a function address within MCJIT without causing a finalize, use 289*0b57cec5SDimitry Andric // getSymbolAddress. 290*0b57cec5SDimitry Andric uint64_t getGlobalValueAddress(const std::string &Name) override; 291*0b57cec5SDimitry Andric uint64_t getFunctionAddress(const std::string &Name) override; 292*0b57cec5SDimitry Andric 293*0b57cec5SDimitry Andric TargetMachine *getTargetMachine() override { return TM.get(); } 294*0b57cec5SDimitry Andric 295*0b57cec5SDimitry Andric /// @} 296*0b57cec5SDimitry Andric /// @name (Private) Registration Interfaces 297*0b57cec5SDimitry Andric /// @{ 298*0b57cec5SDimitry Andric 299*0b57cec5SDimitry Andric static void Register() { 300*0b57cec5SDimitry Andric MCJITCtor = createJIT; 301*0b57cec5SDimitry Andric } 302*0b57cec5SDimitry Andric 303*0b57cec5SDimitry Andric static ExecutionEngine * 304*0b57cec5SDimitry Andric createJIT(std::unique_ptr<Module> M, std::string *ErrorStr, 305*0b57cec5SDimitry Andric std::shared_ptr<MCJITMemoryManager> MemMgr, 306*0b57cec5SDimitry Andric std::shared_ptr<LegacyJITSymbolResolver> Resolver, 307*0b57cec5SDimitry Andric std::unique_ptr<TargetMachine> TM); 308*0b57cec5SDimitry Andric 309*0b57cec5SDimitry Andric // @} 310*0b57cec5SDimitry Andric 311*0b57cec5SDimitry Andric // Takes a mangled name and returns the corresponding JITSymbol (if a 312*0b57cec5SDimitry Andric // definition of that mangled name has been added to the JIT). 313*0b57cec5SDimitry Andric JITSymbol findSymbol(const std::string &Name, bool CheckFunctionsOnly); 314*0b57cec5SDimitry Andric 315*0b57cec5SDimitry Andric // DEPRECATED - Please use findSymbol instead. 316*0b57cec5SDimitry Andric // 317*0b57cec5SDimitry Andric // This is not directly exposed via the ExecutionEngine API, but it is 318*0b57cec5SDimitry Andric // used by the LinkingMemoryManager. 319*0b57cec5SDimitry Andric // 320*0b57cec5SDimitry Andric // getSymbolAddress takes an unmangled name and returns the corresponding 321*0b57cec5SDimitry Andric // JITSymbol if a definition of the name has been added to the JIT. 322*0b57cec5SDimitry Andric uint64_t getSymbolAddress(const std::string &Name, 323*0b57cec5SDimitry Andric bool CheckFunctionsOnly); 324*0b57cec5SDimitry Andric 325*0b57cec5SDimitry Andric protected: 326*0b57cec5SDimitry Andric /// emitObject -- Generate a JITed object in memory from the specified module 327*0b57cec5SDimitry Andric /// Currently, MCJIT only supports a single module and the module passed to 328*0b57cec5SDimitry Andric /// this function call is expected to be the contained module. The module 329*0b57cec5SDimitry Andric /// is passed as a parameter here to prepare for multiple module support in 330*0b57cec5SDimitry Andric /// the future. 331*0b57cec5SDimitry Andric std::unique_ptr<MemoryBuffer> emitObject(Module *M); 332*0b57cec5SDimitry Andric 333*0b57cec5SDimitry Andric void notifyObjectLoaded(const object::ObjectFile &Obj, 334*0b57cec5SDimitry Andric const RuntimeDyld::LoadedObjectInfo &L); 335*0b57cec5SDimitry Andric void notifyFreeingObject(const object::ObjectFile &Obj); 336*0b57cec5SDimitry Andric 337*0b57cec5SDimitry Andric JITSymbol findExistingSymbol(const std::string &Name); 338*0b57cec5SDimitry Andric Module *findModuleForSymbol(const std::string &Name, bool CheckFunctionsOnly); 339*0b57cec5SDimitry Andric }; 340*0b57cec5SDimitry Andric 341*0b57cec5SDimitry Andric } // end llvm namespace 342*0b57cec5SDimitry Andric 343*0b57cec5SDimitry Andric #endif // LLVM_LIB_EXECUTIONENGINE_MCJIT_MCJIT_H 344