//
//===----------------------------------------------------------------------===//
-#ifndef JIT_H
-#define JIT_H
+#ifndef LLVM_LIB_EXECUTIONENGINE_JIT_JIT_H
+#define LLVM_LIB_EXECUTIONENGINE_JIT_JIT_H
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/IR/ValueHandle.h"
public:
explicit JITState(Module *M) : PM(M), M(M) {}
- FunctionPassManager &getPM(const MutexGuard &L) {
+ FunctionPassManager &getPM() {
return PM;
}
Module *getModule() const { return M; }
- std::vector<AssertingVH<Function> > &getPendingFunctions(const MutexGuard &L){
+ std::vector<AssertingVH<Function> > &getPendingFunctions() {
return PendingFunctions;
}
};
BasicBlockAddressMapTy BasicBlockAddressMap;
- JIT(Module *M, TargetMachine &tm, TargetJITInfo &tji,
+ JIT(std::unique_ptr<Module> M, TargetMachine &tm, TargetJITInfo &tji,
JITMemoryManager *JMM, bool AllocateGVsWithCode);
public:
~JIT();
///
TargetJITInfo &getJITInfo() const { return TJI; }
- /// create - Create an return a new JIT compiler if there is one available
- /// for the current target. Otherwise, return null.
- ///
- static ExecutionEngine *create(Module *M,
- std::string *Err,
- JITMemoryManager *JMM,
- CodeGenOpt::Level OptLevel =
- CodeGenOpt::Default,
- bool GVsWithCode = true,
- Reloc::Model RM = Reloc::Default,
- CodeModel::Model CMM = CodeModel::JITDefault) {
- return ExecutionEngine::createJIT(M, Err, JMM, OptLevel, GVsWithCode,
- RM, CMM);
- }
-
- void addModule(Module *M) override;
+ void addModule(std::unique_ptr<Module> M) override;
/// removeModule - Remove a Module from the list of modules. Returns true if
/// M is found.
///
JITCodeEmitter *getCodeEmitter() const { return JCE; }
- static ExecutionEngine *createJIT(Module *M,
+ static ExecutionEngine *createJIT(std::unique_ptr<Module> M,
std::string *ErrorStr,
JITMemoryManager *JMM,
bool GVsWithCode,
void NotifyFreeingMachineCode(void *OldPtr);
BasicBlockAddressMapTy &
- getBasicBlockAddressMap(const MutexGuard &) {
+ getBasicBlockAddressMap() {
return BasicBlockAddressMap;
}
private:
static JITCodeEmitter *createEmitter(JIT &J, JITMemoryManager *JMM,
TargetMachine &tm);
- void runJITOnFunctionUnlocked(Function *F, const MutexGuard &locked);
- void updateFunctionStub(Function *F);
- void jitTheFunction(Function *F, const MutexGuard &locked);
+ void runJITOnFunctionUnlocked(Function *F);
+ void updateFunctionStubUnlocked(Function *F);
+ void jitTheFunctionUnlocked(Function *F);
protected: