Skip to content

Commit 631cbb2

Browse files
committed
Migrated MCJIT.cpp to the new LLVMTargetMachine code emission API.
1 parent d9fcf48 commit 631cbb2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "MCJIT.h"
1010
#include "llvm/ADT/STLExtras.h"
11+
#include "llvm/CodeGen/MachineModuleInfo.h"
1112
#include "llvm/ExecutionEngine/GenericValue.h"
1213
#include "llvm/ExecutionEngine/JITEventListener.h"
1314
#include "llvm/ExecutionEngine/MCJIT.h"
@@ -157,14 +158,17 @@ std::unique_ptr<MemoryBuffer> MCJIT::emitObject(Module *M) {
157158
// generateCodeForModule.
158159

159160
legacy::PassManager PM;
161+
auto * LLVMTM = static_cast<LLVMTargetMachine*>(TM.get());
162+
MachineModuleInfo MMI(LLVMTM);
163+
Ctx = &MMI.getContext();
160164

161165
// The RuntimeDyld will take ownership of this shortly
162166
SmallVector<char, 4096> ObjBufferSV;
163167
raw_svector_ostream ObjStream(ObjBufferSV);
164168

165169
// Turn the machine code intermediate representation into bytes in memory
166170
// that may be executed.
167-
if (TM->addPassesToEmitMC(PM, Ctx, ObjStream, !getVerifyModules()))
171+
if (LLVMTM->addPassesToEmitMC(PM, MMI, ObjStream, !getVerifyModules()))
168172
report_fatal_error("Target does not support MC emission!");
169173

170174
// Initialize passes.

0 commit comments

Comments
 (0)