llvm-project/llvm/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp
Lang Hames 4d0a5a9ec6 [Orc] Add support for remote JITing to the ORC API.
This patch adds utilities to ORC for managing a remote JIT target. It consists
of:

1. A very primitive RPC system for making calls over a byte-stream.  See
RPCChannel.h, RPCUtils.h.

2. An RPC API defined in the above system for managing memory, looking up
symbols, creating stubs, etc. on a remote target. See OrcRemoteTargetRPCAPI.h.

3. An interface for creating high-level JIT components (memory managers,
callback managers, stub managers, etc.) that operate over the RPC API. See
OrcRemoteTargetClient.h.

4. A helper class for building servers that can handle the RPC calls. See
OrcRemoteTargetServer.h.

The system is designed to work neatly with the existing ORC components and
functionality. In particular, the ORC callback API (and consequently the
CompileOnDemandLayer) is supported, enabling lazy compilation of remote code.

Assuming this doesn't trigger any builder failures, a follow-up patch will be
committed which tests these utilities by using them to replace LLI's existing
remote-JITing demo code.

llvm-svn: 257305
2016-01-11 01:40:11 +00:00

84 lines
2.3 KiB
C++

//===------- OrcRemoteTargetRPCAPI.cpp - ORC Remote API utilities ---------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h"
namespace llvm {
namespace orc {
namespace remote {
const char *OrcRemoteTargetRPCAPI::getJITProcIdName(JITProcId Id) {
switch (Id) {
case InvalidId:
return "*** Invalid JITProcId ***";
case CallIntVoidId:
return "CallIntVoid";
case CallIntVoidResponseId:
return "CallIntVoidResponse";
case CallMainId:
return "CallMain";
case CallMainResponseId:
return "CallMainResponse";
case CallVoidVoidId:
return "CallVoidVoid";
case CallVoidVoidResponseId:
return "CallVoidVoidResponse";
case CreateRemoteAllocatorId:
return "CreateRemoteAllocator";
case CreateIndirectStubsOwnerId:
return "CreateIndirectStubsOwner";
case DestroyRemoteAllocatorId:
return "DestroyRemoteAllocator";
case DestroyIndirectStubsOwnerId:
return "DestroyIndirectStubsOwner";
case EmitIndirectStubsId:
return "EmitIndirectStubs";
case EmitIndirectStubsResponseId:
return "EmitIndirectStubsResponse";
case EmitResolverBlockId:
return "EmitResolverBlock";
case EmitTrampolineBlockId:
return "EmitTrampolineBlock";
case EmitTrampolineBlockResponseId:
return "EmitTrampolineBlockResponse";
case GetSymbolAddressId:
return "GetSymbolAddress";
case GetSymbolAddressResponseId:
return "GetSymbolAddressResponse";
case GetRemoteInfoId:
return "GetRemoteInfo";
case GetRemoteInfoResponseId:
return "GetRemoteInfoResponse";
case ReadMemId:
return "ReadMem";
case ReadMemResponseId:
return "ReadMemResponse";
case ReserveMemId:
return "ReserveMem";
case ReserveMemResponseId:
return "ReserveMemResponse";
case RequestCompileId:
return "RequestCompile";
case RequestCompileResponseId:
return "RequestCompileResponse";
case SetProtectionsId:
return "SetProtections";
case TerminateSessionId:
return "TerminateSession";
case WriteMemId:
return "WriteMem";
case WritePtrId:
return "WritePtr";
};
return nullptr;
}
}
}
}