1 //===-- MCJITMemoryManager.h - Definition for the Memory Manager ---C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_EXECUTIONENGINE_MCJITMEMORYMANAGER_H
11 #define LLVM_LIB_EXECUTIONENGINE_MCJITMEMORYMANAGER_H
13 #include "llvm/Module.h"
14 #include "llvm/ExecutionEngine/JITMemoryManager.h"
15 #include "llvm/ExecutionEngine/RuntimeDyld.h"
20 // The MCJIT memory manager is a layer between the standard JITMemoryManager
21 // and the RuntimeDyld interface that maps objects, by name, onto their
22 // matching LLVM IR counterparts in the module(s) being compiled.
23 class MCJITMemoryManager : public RTDyldMemoryManager {
24 virtual void anchor();
25 OwningPtr<JITMemoryManager> JMM;
28 MCJITMemoryManager(JITMemoryManager *jmm) :
29 JMM(jmm?jmm:JITMemoryManager::CreateDefaultMemManager()) {}
31 uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
33 return JMM->allocateDataSection(Size, Alignment, SectionID);
36 uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
38 return JMM->allocateCodeSection(Size, Alignment, SectionID);
41 virtual void *getPointerToNamedFunction(const std::string &Name,
42 bool AbortOnFailure = true) {
43 return JMM->getPointerToNamedFunction(Name, AbortOnFailure);
48 } // End llvm namespace