This commit integrates support for the LLVM MCJIT
into the mainline LLDB codebase.  MCJIT introduces
API improvements and better architectural support.

This commit adds a new subsystem, the
ProcessDataAllocator, which is responsible for
performing static data allocations on behalf of the
IR transformer.  MCJIT currently does not support
the relocations required to store the constant pool
in the same allocation as the function body, so we
allocate a heap region separately and redirect
static data references from the expression to that
heap region in a new IR modification pass.

This patch also fixes bugs in the IR
transformations that were exposed by the transition
to the MCJIT.  Finally, the patch also pulls in a
more recent revision of LLVM so that the MCJIT is
available for use.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131923 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ProcessDataAllocator.cpp b/source/Expression/ProcessDataAllocator.cpp
new file mode 100644
index 0000000..8b826df
--- /dev/null
+++ b/source/Expression/ProcessDataAllocator.cpp
@@ -0,0 +1,43 @@
+//===-- ProcessDataAllocator.cpp --------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Core/DataBufferHeap.h"
+#include "lldb/Core/DataExtractor.h"
+#include "lldb/Expression/ProcessDataAllocator.h"
+
+using namespace lldb_private;
+
+void
+ProcessDataAllocator::Dump(Stream &stream)
+{
+    size_t data_size = m_stream_string.GetSize();
+    
+    if (!m_allocation)
+        return;
+    
+    lldb::DataBufferSP data(new DataBufferHeap(data_size, 0));    
+    
+    Error error;
+    if (m_process.ReadMemory (m_allocation, data->GetBytes(), data_size, error) != data_size)
+        return;
+    
+    DataExtractor extractor(data, m_process.GetByteOrder(), m_process.GetAddressByteSize());
+    
+    extractor.Dump(&stream,                         // stream
+                   0,                               // offset
+                   lldb::eFormatBytesWithASCII,     // format
+                   1,                               // byte size of individual entries
+                   data_size,                       // number of entries
+                   16,                              // entries per line
+                   m_allocation,                    // address to print
+                   0,                               // bit size (bitfields only; 0 means ignore)
+                   0);                              // bit alignment (bitfields only; 0 means ignore)
+    
+    stream.PutChar('\n');
+}
\ No newline at end of file