.. code-block:: c++
- ThreadSafeModule optimizeModule(ThreadSafeModule M,
- const MaterializationResponsibility &R) {
+ static Expected<ThreadSafeModule>
+ optimizeModule(ThreadSafeModule M, const MaterializationResponsibility &R) {
// Create a function pass manager.
auto FPM = llvm::make_unique<legacy::FunctionPassManager>(M.get());
static std::unique_ptr<FunctionAST> ParseTopLevelExpr(unsigned ExprCount) {
if (auto E = ParseExpression()) {
// Make an anonymous proto.
- auto Proto = llvm::make_unique<PrototypeAST>(("__anon_expr" +
- Twine(ExprCount)).str(),
- std::vector<std::string>());
+ auto Proto = llvm::make_unique<PrototypeAST>
+ ("__anon_expr" + Twine(ExprCount)).str(), std::vector<std::string>());
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
}
return nullptr;
// Get the anonymous expression's JITSymbol.
auto Sym =
- ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));
+ ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));
auto *FP = (double (*)())(intptr_t)Sym.getAddress();
assert(FP && "Failed to codegen function");
ThreadSafeContext Ctx;
public:
-
KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
: ObjectLayer(ES,
[]() { return llvm::make_unique<SectionMemoryManager>(); }),
}
private:
-
static Expected<ThreadSafeModule>
- optimizeModule(ThreadSafeModule TSM,
- const MaterializationResponsibility &R) {
+ optimizeModule(ThreadSafeModule TSM, const MaterializationResponsibility &R) {
// Create a function pass manager.
auto FPM = llvm::make_unique<legacy::FunctionPassManager>(TSM.getModule());
static std::unique_ptr<FunctionAST> ParseTopLevelExpr(unsigned ExprCount) {
if (auto E = ParseExpression()) {
// Make an anonymous proto.
- auto Proto = llvm::make_unique<PrototypeAST>(("__anon_expr" +
- Twine(ExprCount)).str(),
- std::vector<std::string>());
+ auto Proto = llvm::make_unique<PrototypeAST>
+ ("__anon_expr" + Twine(ExprCount)).str(), std::vector<std::string>());
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
}
return nullptr;
// Get the anonymous expression's JITSymbol.
auto Sym =
- ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));
+ ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));
auto *FP = (double (*)())(intptr_t)Sym.getAddress();
assert(FP && "Failed to codegen function");