xref: /llvm-project/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.h (revision b7d5b0d0eeda9bc0c7e8c4a6ee2d4ab6b48eb736)
1258f055eSStefan Gränitz //===-- RemoteJITUtils.h - Utilities for remote-JITing ----------*- C++ -*-===//
2258f055eSStefan Gränitz //
3258f055eSStefan Gränitz // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4258f055eSStefan Gränitz // See https://llvm.org/LICENSE.txt for license information.
5258f055eSStefan Gränitz // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6258f055eSStefan Gränitz //
7258f055eSStefan Gränitz //===----------------------------------------------------------------------===//
8258f055eSStefan Gränitz //
9662c5544SLang Hames // Utilities for ExecutorProcessControl-based remote JITing with Orc and
10662c5544SLang Hames // JITLink.
11258f055eSStefan Gränitz //
12258f055eSStefan Gränitz //===----------------------------------------------------------------------===//
13258f055eSStefan Gränitz 
14258f055eSStefan Gränitz #ifndef LLVM_EXAMPLES_ORCV2EXAMPLES_LLJITWITHREMOTEDEBUGGING_REMOTEJITUTILS_H
15258f055eSStefan Gränitz #define LLVM_EXAMPLES_ORCV2EXAMPLES_LLJITWITHREMOTEDEBUGGING_REMOTEJITUTILS_H
16258f055eSStefan Gränitz 
17258f055eSStefan Gränitz #include "llvm/ADT/StringRef.h"
18258f055eSStefan Gränitz #include "llvm/ExecutionEngine/Orc/Core.h"
19258f055eSStefan Gränitz #include "llvm/ExecutionEngine/Orc/Layer.h"
20*ac2daacbSStefan Gränitz #include "llvm/ExecutionEngine/Orc/SimpleRemoteEPC.h"
21258f055eSStefan Gränitz #include "llvm/Support/Error.h"
22258f055eSStefan Gränitz 
23*ac2daacbSStefan Gränitz #include <cstdint>
24258f055eSStefan Gränitz #include <memory>
25258f055eSStefan Gränitz #include <string>
26258f055eSStefan Gränitz 
27258f055eSStefan Gränitz /// Find the default exectuable on disk and create a JITLinkExecutor for it.
28*ac2daacbSStefan Gränitz std::string findLocalExecutor(const char *HostArgv0);
29*ac2daacbSStefan Gränitz 
30*ac2daacbSStefan Gränitz llvm::Expected<std::pair<std::unique_ptr<llvm::orc::SimpleRemoteEPC>, uint64_t>>
31*ac2daacbSStefan Gränitz launchLocalExecutor(llvm::StringRef ExecutablePath);
32258f055eSStefan Gränitz 
33258f055eSStefan Gränitz /// Create a JITLinkExecutor that connects to the given network address
34258f055eSStefan Gränitz /// through a TCP socket. A valid NetworkAddress provides hostname and port,
35258f055eSStefan Gränitz /// e.g. localhost:20000.
36*ac2daacbSStefan Gränitz llvm::Expected<std::unique_ptr<llvm::orc::SimpleRemoteEPC>>
37*ac2daacbSStefan Gränitz connectTCPSocket(llvm::StringRef NetworkAddress);
38258f055eSStefan Gränitz 
39*ac2daacbSStefan Gränitz llvm::Expected<std::unique_ptr<llvm::orc::DefinitionGenerator>>
40*ac2daacbSStefan Gränitz loadDylib(llvm::orc::ExecutionSession &ES, llvm::StringRef RemotePath);
41258f055eSStefan Gränitz 
42258f055eSStefan Gränitz #endif
43