xref: /openbsd-src/gnu/llvm/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.h (revision d415bd752c734aee168c4ee86ff32e8cc249eb16)
173471bf0Spatrick //===-- RemoteJITUtils.h - Utilities for remote-JITing ----------*- C++ -*-===//
273471bf0Spatrick //
373471bf0Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
473471bf0Spatrick // See https://llvm.org/LICENSE.txt for license information.
573471bf0Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
673471bf0Spatrick //
773471bf0Spatrick //===----------------------------------------------------------------------===//
873471bf0Spatrick //
973471bf0Spatrick // Utilities for ExecutorProcessControl-based remote JITing with Orc and
1073471bf0Spatrick // JITLink.
1173471bf0Spatrick //
1273471bf0Spatrick //===----------------------------------------------------------------------===//
1373471bf0Spatrick 
1473471bf0Spatrick #ifndef LLVM_EXAMPLES_ORCV2EXAMPLES_LLJITWITHREMOTEDEBUGGING_REMOTEJITUTILS_H
1573471bf0Spatrick #define LLVM_EXAMPLES_ORCV2EXAMPLES_LLJITWITHREMOTEDEBUGGING_REMOTEJITUTILS_H
1673471bf0Spatrick 
1773471bf0Spatrick #include "llvm/ADT/StringRef.h"
1873471bf0Spatrick #include "llvm/ExecutionEngine/Orc/Core.h"
1973471bf0Spatrick #include "llvm/ExecutionEngine/Orc/Layer.h"
20*d415bd75Srobert #include "llvm/ExecutionEngine/Orc/SimpleRemoteEPC.h"
2173471bf0Spatrick #include "llvm/Support/Error.h"
2273471bf0Spatrick 
23*d415bd75Srobert #include <cstdint>
2473471bf0Spatrick #include <memory>
2573471bf0Spatrick #include <string>
2673471bf0Spatrick 
2773471bf0Spatrick /// Find the default exectuable on disk and create a JITLinkExecutor for it.
28*d415bd75Srobert std::string findLocalExecutor(const char *HostArgv0);
29*d415bd75Srobert 
30*d415bd75Srobert llvm::Expected<std::pair<std::unique_ptr<llvm::orc::SimpleRemoteEPC>, uint64_t>>
31*d415bd75Srobert launchLocalExecutor(llvm::StringRef ExecutablePath);
3273471bf0Spatrick 
3373471bf0Spatrick /// Create a JITLinkExecutor that connects to the given network address
3473471bf0Spatrick /// through a TCP socket. A valid NetworkAddress provides hostname and port,
3573471bf0Spatrick /// e.g. localhost:20000.
36*d415bd75Srobert llvm::Expected<std::unique_ptr<llvm::orc::SimpleRemoteEPC>>
37*d415bd75Srobert connectTCPSocket(llvm::StringRef NetworkAddress);
3873471bf0Spatrick 
39*d415bd75Srobert llvm::Error addDebugSupport(llvm::orc::ObjectLayer &ObjLayer);
4073471bf0Spatrick 
41*d415bd75Srobert llvm::Expected<std::unique_ptr<llvm::orc::DefinitionGenerator>>
42*d415bd75Srobert loadDylib(llvm::orc::ExecutionSession &ES, llvm::StringRef RemotePath);
4373471bf0Spatrick 
4473471bf0Spatrick #endif
45