Added the skeleton of an IR transformer that will
prepare IR for execution in the target. Wired the
expression command to use this IR transformer when
conversion to DWARF fails, and wired conversion to
DWARF to always fail (well, we don't generate any
DWARF...)
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107559 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpression.cpp b/source/Expression/ClangExpression.cpp
index 6922ac4..a3a58b6 100644
--- a/source/Expression/ClangExpression.cpp
+++ b/source/Expression/ClangExpression.cpp
@@ -58,6 +58,7 @@
#include "lldb/Expression/ClangASTSource.h"
#include "lldb/Expression/ClangResultSynthesizer.h"
#include "lldb/Expression/ClangStmtVisitor.h"
+#include "lldb/Expression/IRForTarget.h"
#include "lldb/Expression/IRToDWARF.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Expression/RecordingMemoryManager.h"
@@ -474,7 +475,7 @@
return 0;
}
-unsigned
+bool
ClangExpression::ConvertIRToDWARF (ClangExpressionVariableList &expr_local_variable_list,
StreamString &dwarf_opcode_strm)
{
@@ -496,6 +497,26 @@
}
bool
+ClangExpression::PrepareIRForTarget (ClangExpressionVariableList &expr_local_variable_list)
+{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+
+ llvm::Module *module = m_code_generator_ptr->GetModule();
+
+ if (!module)
+ {
+ if (log)
+ log->Printf("IR doesn't contain a module");
+
+ return 1;
+ }
+
+ IRForTarget ir_for_target("IR for target", m_decl_map);
+
+ return ir_for_target.runOnModule(*module);
+}
+
+bool
ClangExpression::JITFunction (const ExecutionContext &exc_context, const char *name)
{