summaryrefslogtreecommitdiff
path: root/tools/lli/RemoteTarget.cpp
diff options
context:
space:
mode:
authorAndrew Kaylor <andrew.kaylor@intel.com>2013-10-02 17:12:36 +0000
committerAndrew Kaylor <andrew.kaylor@intel.com>2013-10-02 17:12:36 +0000
commit0ab5c6c16b1b09d76c3ba2d70443b10bcc26169c (patch)
treeaf098f261c3db5f9da3efd5aa5ab1ca9e05046e0 /tools/lli/RemoteTarget.cpp
parentaf7ae9d6890ce5fae27e38ccebb5da09288c49e0 (diff)
Adding out-of-process execution support to lli.
At this time only Unix-based systems are supported. Windows has stubs and should re-route to the simulated mode. Thanks to Sriram Murali for contributions to this patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191843 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lli/RemoteTarget.cpp')
-rw-r--r--tools/lli/RemoteTarget.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/lli/RemoteTarget.cpp b/tools/lli/RemoteTarget.cpp
index 212bdfda1cd..5c74e6e7a04 100644
--- a/tools/lli/RemoteTarget.cpp
+++ b/tools/lli/RemoteTarget.cpp
@@ -13,13 +13,44 @@
//===----------------------------------------------------------------------===//
#include "RemoteTarget.h"
+#include "RemoteTargetExternal.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Memory.h"
#include <stdlib.h>
#include <string>
+
using namespace llvm;
+// Static methods
+RemoteTarget *RemoteTarget::createRemoteTarget() {
+ return new RemoteTarget;
+}
+
+RemoteTarget *RemoteTarget::createExternalRemoteTarget(std::string &ChildName) {
+#ifdef LLVM_ON_UNIX
+ return new RemoteTargetExternal(ChildName);
+#else
+ return 0;
+#endif
+}
+
+bool RemoteTarget::hostSupportsExternalRemoteTarget() {
+#ifdef LLVM_ON_UNIX
+ return true;
+#else
+ return false;
+#endif
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Simulated remote execution
+//
+// This implementation will simply move generated code and data to a new memory
+// location in the current executable and let it run from there.
+////////////////////////////////////////////////////////////////////////////////
+
bool RemoteTarget::allocateSpace(size_t Size, unsigned Alignment,
uint64_t &Address) {
sys::MemoryBlock *Prev = Allocations.size() ? &Allocations.back() : NULL;