[examples] Update LLJITWithJITLink example for change in c0143f37da.

This commit is contained in:
Lang Hames 2019-12-15 20:24:17 -08:00
parent d28c6d51d1
commit 073df421e0
1 changed files with 9 additions and 11 deletions

View File

@ -38,22 +38,20 @@ int main(int argc, char *argv[]) {
cl::ParseCommandLineOptions(argc, argv, "HowToUseLLJIT");
ExitOnErr.setBanner(std::string(argv[0]) + ": ");
// Define an in-process JITLink memory manager.
jitlink::InProcessMemoryManager MemMgr;
// Detect the host and set code model to small.
auto JTMB = ExitOnErr(JITTargetMachineBuilder::detectHost());
JTMB.setCodeModel(CodeModel::Small);
// Create an LLJIT instance with an ObjectLinkingLayer as the base layer.
auto J =
ExitOnErr(LLJITBuilder()
.setJITTargetMachineBuilder(std::move(JTMB))
.setObjectLinkingLayerCreator([&](ExecutionSession &ES,
const Triple &TT) {
return std::make_unique<ObjectLinkingLayer>(ES, MemMgr);
})
.create());
auto J = ExitOnErr(
LLJITBuilder()
.setJITTargetMachineBuilder(std::move(JTMB))
.setObjectLinkingLayerCreator(
[&](ExecutionSession &ES, const Triple &TT) {
return std::make_unique<ObjectLinkingLayer>(
ES, std::make_unique<jitlink::InProcessMemoryManager>());
})
.create());
auto M = ExitOnErr(parseExampleModule(Add1Example, "add1"));