1*0a6a1f1dSLionel Sambuc //===---------- RPCChannel.h - LLVM out-of-process JIT execution ----------===//
2*0a6a1f1dSLionel Sambuc //
3*0a6a1f1dSLionel Sambuc //                     The LLVM Compiler Infrastructure
4*0a6a1f1dSLionel Sambuc //
5*0a6a1f1dSLionel Sambuc // This file is distributed under the University of Illinois Open Source
6*0a6a1f1dSLionel Sambuc // License. See LICENSE.TXT for details.
7*0a6a1f1dSLionel Sambuc //
8*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
9*0a6a1f1dSLionel Sambuc //
10*0a6a1f1dSLionel Sambuc // Definition of the RemoteTargetExternal class which executes JITed code in a
11*0a6a1f1dSLionel Sambuc // separate process from where it was built.
12*0a6a1f1dSLionel Sambuc //
13*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
14*0a6a1f1dSLionel Sambuc 
15*0a6a1f1dSLionel Sambuc #ifndef LLVM_TOOLS_LLI_RPCCHANNEL_H
16*0a6a1f1dSLionel Sambuc #define LLVM_TOOLS_LLI_RPCCHANNEL_H
17*0a6a1f1dSLionel Sambuc 
18*0a6a1f1dSLionel Sambuc #include <stdlib.h>
19*0a6a1f1dSLionel Sambuc #include <string>
20*0a6a1f1dSLionel Sambuc 
21*0a6a1f1dSLionel Sambuc namespace llvm {
22*0a6a1f1dSLionel Sambuc 
23*0a6a1f1dSLionel Sambuc class RPCChannel {
24*0a6a1f1dSLionel Sambuc public:
25*0a6a1f1dSLionel Sambuc   std::string ChildName;
26*0a6a1f1dSLionel Sambuc 
RPCChannel()27*0a6a1f1dSLionel Sambuc   RPCChannel() {}
28*0a6a1f1dSLionel Sambuc   ~RPCChannel();
29*0a6a1f1dSLionel Sambuc 
30*0a6a1f1dSLionel Sambuc   /// Start the remote process.
31*0a6a1f1dSLionel Sambuc   ///
32*0a6a1f1dSLionel Sambuc   /// @returns True on success. On failure, ErrorMsg is updated with
33*0a6a1f1dSLionel Sambuc   ///          descriptive text of the encountered error.
34*0a6a1f1dSLionel Sambuc   bool createServer();
35*0a6a1f1dSLionel Sambuc 
36*0a6a1f1dSLionel Sambuc   bool createClient();
37*0a6a1f1dSLionel Sambuc 
38*0a6a1f1dSLionel Sambuc   // This will get filled in as a point to an OS-specific structure.
39*0a6a1f1dSLionel Sambuc   void *ConnectionData;
40*0a6a1f1dSLionel Sambuc 
41*0a6a1f1dSLionel Sambuc   bool WriteBytes(const void *Data, size_t Size);
42*0a6a1f1dSLionel Sambuc   bool ReadBytes(void *Data, size_t Size);
43*0a6a1f1dSLionel Sambuc 
44*0a6a1f1dSLionel Sambuc   void Wait();
45*0a6a1f1dSLionel Sambuc };
46*0a6a1f1dSLionel Sambuc 
47*0a6a1f1dSLionel Sambuc } // end namespace llvm
48*0a6a1f1dSLionel Sambuc 
49*0a6a1f1dSLionel Sambuc #endif
50