Skip to content

Commit

Permalink
[examples] Fix Tapir Kaleidoscope example to use new pass manager and…
Browse files Browse the repository at this point in the history
… updated OrcJIT interface.
  • Loading branch information
neboat committed Jan 13, 2024
1 parent 13eab3e commit 258b8d2
Show file tree
Hide file tree
Showing 2 changed files with 204 additions and 96 deletions.
7 changes: 4 additions & 3 deletions llvm/examples/Kaleidoscope/Tapir/KaleidoscopeJIT.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
#include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h"
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/IRBuilder.h"
Expand Down Expand Up @@ -181,20 +182,20 @@ class KaleidoscopeJIT {
return LookupResult.takeError();

// Collect the addresses of those symbols.
std::vector<JITTargetAddress> Initializers;
std::vector<ExecutorAddr> Initializers;
auto InitsItr = LookupResult->find(&MainJD);
for (auto &KV : InitsItr->second)
Initializers.push_back(KV.second.getAddress());

// Run all initializer functions.
for (auto InitFnAddr : Initializers) {
auto *InitFn = jitTargetAddressToFunction<void (*)()>(InitFnAddr);
auto *InitFn = InitFnAddr.toPtr<void (*)()>();
InitFn();
}
return Error::success();
}

Expected<JITEvaluatedSymbol> lookup(StringRef Name) {
Expected<ExecutorSymbolDef> lookup(StringRef Name) {
return ES->lookup({&MainJD}, Mangle(Name.str()));
}
};
Expand Down
Loading

0 comments on commit 258b8d2

Please sign in to comment.