[Lldb-commits] [lldb] r179650 - Modified the IRInterpreter to take an IRMemoryMap.

Sean Callanan scallanan at apple.com
Tue Apr 16 16:49:09 PDT 2013


Author: spyffe
Date: Tue Apr 16 18:49:09 2013
New Revision: 179650

URL: http://llvm.org/viewvc/llvm-project?rev=179650&view=rev
Log:
Modified the IRInterpreter to take an IRMemoryMap.
It doesn't use it yet; the next step is to make it
use the IRMemoryMap instead of its own conjured-up
Memory class.

Modified:
    lldb/trunk/include/lldb/Expression/IRForTarget.h
    lldb/trunk/include/lldb/Expression/IRInterpreter.h
    lldb/trunk/source/Expression/IRForTarget.cpp
    lldb/trunk/source/Expression/IRInterpreter.cpp

Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRForTarget.h?rev=179650&r1=179649&r2=179650&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRForTarget.h (original)
+++ lldb/trunk/include/lldb/Expression/IRForTarget.h Tue Apr 16 18:49:09 2013
@@ -37,6 +37,7 @@ namespace llvm {
 namespace lldb_private {
     class ClangExpressionDeclMap;
     class IRExecutionUnit;
+    class IRMemoryMap;
 }
 
 //----------------------------------------------------------------------
@@ -672,6 +673,7 @@ private:
     std::auto_ptr<llvm::DataLayout>         m_target_data;              ///< The target data for the module being processed, or NULL if there is no module.
     lldb_private::ClangExpressionDeclMap   *m_decl_map;                 ///< The DeclMap containing the Decls 
     StaticDataAllocator                     m_data_allocator;           ///< The allocator to use for constant strings
+    lldb_private::IRMemoryMap              &m_memory_map;               ///< The memory map to pass to the IR interpreter
     llvm::Constant                         *m_CFStringCreateWithBytes;  ///< The address of the function CFStringCreateWithBytes, cast to the appropriate function pointer type
     llvm::Constant                         *m_sel_registerName;         ///< The address of the function sel_registerName, cast to the appropriate function pointer type
     lldb::ClangExpressionVariableSP        &m_const_result;             ///< This value should be set to the return value of the expression if it is constant and the expression has no side effects

Modified: lldb/trunk/include/lldb/Expression/IRInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRInterpreter.h?rev=179650&r1=179649&r2=179650&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRInterpreter.h (original)
+++ lldb/trunk/include/lldb/Expression/IRInterpreter.h Tue Apr 16 18:49:09 2013
@@ -24,6 +24,7 @@ namespace llvm {
 namespace lldb_private {
 
 class ClangExpressionDeclMap;
+class IRMemoryMap;
     
 }
 
@@ -51,6 +52,7 @@ public:
     ///     If non-NULL, a stream on which errors can be printed.
     //------------------------------------------------------------------
     IRInterpreter(lldb_private::ClangExpressionDeclMap &decl_map,
+                  lldb_private::IRMemoryMap &memory_map,
                   lldb_private::Stream *error_stream);
     
     //------------------------------------------------------------------
@@ -93,8 +95,8 @@ public:
                         llvm::Module &llvm_module,
                         lldb_private::Error &err);
 private:
-    /// Flags
-    lldb_private::ClangExpressionDeclMap &m_decl_map;       ///< The DeclMap containing the Decls 
+    lldb_private::ClangExpressionDeclMap   &m_decl_map;     ///< The DeclMap containing the Decls
+    lldb_private::IRMemoryMap              &m_memory_map;   ///< The IRMemoryMap to use when accessing memory
     
     bool
     supportsFunction (llvm::Function &llvm_function,

Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=179650&r1=179649&r2=179650&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Tue Apr 16 18:49:09 2013
@@ -76,6 +76,7 @@ IRForTarget::IRForTarget (lldb_private::
     m_module(NULL),
     m_decl_map(decl_map),
     m_data_allocator(execution_unit),
+    m_memory_map(execution_unit),
     m_CFStringCreateWithBytes(NULL),
     m_sel_registerName(NULL),
     m_const_result(const_result),
@@ -2806,6 +2807,7 @@ IRForTarget::runOnModule (Module &llvm_m
     if (m_decl_map && m_execution_policy != lldb_private::eExecutionPolicyAlways)
     {
         IRInterpreter interpreter (*m_decl_map,
+                                   m_memory_map,
                                    m_error_stream);
 
         interpreter.maybeRunOnFunction(m_const_result, m_result_name, m_result_type, *function, llvm_module, m_interpreter_error);

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=179650&r1=179649&r2=179650&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Tue Apr 16 18:49:09 2013
@@ -27,8 +27,10 @@
 using namespace llvm;
 
 IRInterpreter::IRInterpreter(lldb_private::ClangExpressionDeclMap &decl_map,
-                                           lldb_private::Stream *error_stream) :
-    m_decl_map(decl_map)
+                             lldb_private::IRMemoryMap &memory_map,
+                             lldb_private::Stream *error_stream) :
+    m_decl_map(decl_map),
+    m_memory_map(memory_map)
 {
     
 }
@@ -409,6 +411,7 @@ public:
     Memory                                 &m_memory;
     DataLayout                             &m_target_data;
     lldb_private::ClangExpressionDeclMap   &m_decl_map;
+    lldb_private::IRMemoryMap              &m_memory_map;
     const BasicBlock                       *m_bb;
     BasicBlock::const_iterator              m_ii;
     BasicBlock::const_iterator              m_ie;
@@ -418,10 +421,12 @@ public:
     
     InterpreterStackFrame (DataLayout &target_data,
                            Memory &memory,
-                           lldb_private::ClangExpressionDeclMap &decl_map) :
+                           lldb_private::ClangExpressionDeclMap &decl_map,
+                           lldb_private::IRMemoryMap &memory_map) :
         m_memory (memory),
         m_target_data (target_data),
-        m_decl_map (decl_map)
+        m_decl_map (decl_map),
+        m_memory_map (memory_map)
     {
         m_byte_order = (target_data.isLittleEndian() ? lldb::eByteOrderLittle : lldb::eByteOrderBig);
         m_addr_byte_size = (target_data.getPointerSize(0));
@@ -1125,7 +1130,7 @@ IRInterpreter::runOnFunction (lldb::Clan
     }
     
     Memory memory(target_data, m_decl_map, alloc_min, alloc_max);
-    InterpreterStackFrame frame(target_data, memory, m_decl_map);
+    InterpreterStackFrame frame(target_data, memory, m_decl_map, m_memory_map);
 
     uint32_t num_insts = 0;
     





More information about the lldb-commits mailing list