mirror of
https://github.com/intel/llvm.git
synced 2026-02-07 07:39:11 +08:00
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. llvm-svn: 179650
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -76,6 +76,7 @@ IRForTarget::IRForTarget (lldb_private::ClangExpressionDeclMap *decl_map,
|
||||
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_module)
|
||||
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);
|
||||
|
||||
@@ -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::ClangExpressionVariableSP &result,
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user