xref: /llvm-project/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.h (revision b7d5b0d0eeda9bc0c7e8c4a6ee2d4ab6b48eb736)
1 //===-- RemoteJITUtils.h - Utilities for remote-JITing ----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Utilities for ExecutorProcessControl-based remote JITing with Orc and
10 // JITLink.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_EXAMPLES_ORCV2EXAMPLES_LLJITWITHREMOTEDEBUGGING_REMOTEJITUTILS_H
15 #define LLVM_EXAMPLES_ORCV2EXAMPLES_LLJITWITHREMOTEDEBUGGING_REMOTEJITUTILS_H
16 
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/ExecutionEngine/Orc/Core.h"
19 #include "llvm/ExecutionEngine/Orc/Layer.h"
20 #include "llvm/ExecutionEngine/Orc/SimpleRemoteEPC.h"
21 #include "llvm/Support/Error.h"
22 
23 #include <cstdint>
24 #include <memory>
25 #include <string>
26 
27 /// Find the default exectuable on disk and create a JITLinkExecutor for it.
28 std::string findLocalExecutor(const char *HostArgv0);
29 
30 llvm::Expected<std::pair<std::unique_ptr<llvm::orc::SimpleRemoteEPC>, uint64_t>>
31 launchLocalExecutor(llvm::StringRef ExecutablePath);
32 
33 /// Create a JITLinkExecutor that connects to the given network address
34 /// through a TCP socket. A valid NetworkAddress provides hostname and port,
35 /// e.g. localhost:20000.
36 llvm::Expected<std::unique_ptr<llvm::orc::SimpleRemoteEPC>>
37 connectTCPSocket(llvm::StringRef NetworkAddress);
38 
39 llvm::Expected<std::unique_ptr<llvm::orc::DefinitionGenerator>>
40 loadDylib(llvm::orc::ExecutionSession &ES, llvm::StringRef RemotePath);
41 
42 #endif
43