[Lldb-commits] [lldb] r111323 - in /lldb/trunk/include/lldb/Expression: IRForTarget.h IRToDWARF.h
Sean Callanan
scallanan at apple.com
Tue Aug 17 16:18:59 PDT 2010
Author: spyffe
Date: Tue Aug 17 18:18:59 2010
New Revision: 111323
URL: http://llvm.org/viewvc/llvm-project?rev=111323&view=rev
Log:
Documented IRToDWARF, and added return value
documentation to IRForTarget.
Modified:
lldb/trunk/include/lldb/Expression/IRForTarget.h
lldb/trunk/include/lldb/Expression/IRToDWARF.h
Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRForTarget.h?rev=111323&r1=111322&r2=111323&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRForTarget.h (original)
+++ lldb/trunk/include/lldb/Expression/IRForTarget.h Tue Aug 17 18:18:59 2010
@@ -77,6 +77,9 @@
/// The module to run on. This module is searched for the function
/// ___clang_expr, and that function is passed to the passes one by
/// one.
+ ///
+ /// @return
+ /// True on success; false otherwise
//------------------------------------------------------------------
bool runOnModule(llvm::Module &M);
@@ -105,6 +108,9 @@
///
/// @param[in] F
/// The function currently being processed.
+ ///
+ /// @return
+ /// True on success; false otherwise
//------------------------------------------------------------------
bool createResultVariable(llvm::Module &M,
llvm::Function &F);
@@ -128,6 +134,9 @@
///
/// @param[in] BB
/// The basic block currently being processed.
+ ///
+ /// @return
+ /// True on success; false otherwise
//------------------------------------------------------------------
bool RewriteObjCSelector(llvm::Instruction* selector_load,
llvm::Module &M);
@@ -140,6 +149,9 @@
///
/// @param[in] BB
/// The basic block currently being processed.
+ ///
+ /// @return
+ /// True on success; false otherwise
//------------------------------------------------------------------
bool rewriteObjCSelectors(llvm::Module &M,
llvm::BasicBlock &BB);
@@ -163,6 +175,9 @@
///
/// @param[in] M
/// The module currently being processed.
+ ///
+ /// @return
+ /// True on success; false otherwise
//------------------------------------------------------------------
bool RewritePersistentAlloc(llvm::Instruction *persistent_alloc,
llvm::Module &M);
@@ -198,6 +213,9 @@
///
/// @param[in] Store
/// True if the access is a store.
+ ///
+ /// @return
+ /// True on success; false otherwise
//------------------------------------------------------------------
bool MaybeHandleVariable(llvm::Module &M,
llvm::Value *V,
@@ -211,6 +229,9 @@
///
/// @param[in] C
/// The call instruction.
+ ///
+ /// @return
+ /// True on success; false otherwise
//------------------------------------------------------------------
bool MaybeHandleCall(llvm::Module &M,
llvm::CallInst *C);
@@ -223,6 +244,9 @@
///
/// @param[in] BB
/// The basic block currently being processed.
+ ///
+ /// @return
+ /// True on success; false otherwise
//------------------------------------------------------------------
bool resolveExternals(llvm::Module &M,
llvm::BasicBlock &BB);
@@ -242,6 +266,9 @@
///
/// @param[in] BB
/// The basic block currently being processed.
+ ///
+ /// @return
+ /// True on success; false otherwise
//------------------------------------------------------------------
bool removeGuards(llvm::Module &M,
llvm::BasicBlock &BB);
@@ -261,6 +288,9 @@
///
/// @param[in] F
/// The function currently being processed.
+ ///
+ /// @return
+ /// True on success; false otherwise
//------------------------------------------------------------------
bool replaceVariables(llvm::Module &M,
llvm::Function &F);
Modified: lldb/trunk/include/lldb/Expression/IRToDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRToDWARF.h?rev=111323&r1=111322&r2=111323&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRToDWARF.h (original)
+++ lldb/trunk/include/lldb/Expression/IRToDWARF.h Tue Aug 17 18:18:59 2010
@@ -26,24 +26,96 @@
class Relocator;
+//----------------------------------------------------------------------
+/// @class IRToDWARF IRToDWARF.h "lldb/Expression/IRToDWARF.h"
+/// @brief Transforms the IR for a function into a DWARF location expression
+///
+/// Once an expression has been parsed and converted to IR, it can run
+/// in two contexts: interpreted by LLDB as a DWARF location expression,
+/// or compiled by the JIT and inserted into the target process for
+/// execution.
+///
+/// IRToDWARF makes the first possible, by traversing the control flow
+/// graph and writing the code for each basic block out as location
+/// expression bytecode. To ensure that the links between the basic blocks
+/// remain intact, it uses a relocator that records the location of every
+/// location expression instruction that has a relocatable operand, the
+/// target of that operand (as a basic block), and the mapping of each basic
+/// block to an actual location. After all code has been written out, the
+/// relocator post-processes it and performs all necessary relocations.
+//----------------------------------------------------------------------
class IRToDWARF : public llvm::ModulePass
{
public:
+ //------------------------------------------------------------------
+ /// Constructor
+ ///
+ /// @param[in] pid
+ /// A unique identifier for this pass. I'm not sure what this does;
+ /// it just gets passed down to ModulePass's constructor.
+ ///
+ /// @param[in] variable_list
+ /// A list of variables to populate with the local variables this
+ /// expression uses.
+ ///
+ /// @param[in] decl_map
+ /// The list of externally-referenced variables for the expression,
+ /// for use in looking up globals.
+ ///
+ /// @param[in] stream
+ /// The stream to dump DWARF bytecode onto.
+ //------------------------------------------------------------------
IRToDWARF(const void *pid,
lldb_private::ClangExpressionVariableList &variable_list,
lldb_private::ClangExpressionDeclMap *decl_map,
lldb_private::StreamString &strm);
+
+ //------------------------------------------------------------------
+ /// Destructor
+ //------------------------------------------------------------------
~IRToDWARF();
+
+ //------------------------------------------------------------------
+ /// Run this IR transformer on a single module
+ ///
+ /// @param[in] M
+ /// The module to run on. This module is searched for the function
+ /// ___clang_expr, and that function is converted to a location
+ /// expression.
+ ///
+ /// @return
+ /// True on success; false otherwise
+ //------------------------------------------------------------------
bool runOnModule(llvm::Module &M);
+
+ //------------------------------------------------------------------
+ /// Interface stub
+ //------------------------------------------------------------------
void assignPassManager(llvm::PMStack &PMS,
llvm::PassManagerType T = llvm::PMT_ModulePassManager);
+
+ //------------------------------------------------------------------
+ /// Returns PMT_ModulePassManager
+ //------------------------------------------------------------------
llvm::PassManagerType getPotentialPassManagerType() const;
private:
+ //------------------------------------------------------------------
+ /// Run this IR transformer on a single basic block
+ ///
+ /// @param[in] BB
+ /// The basic block to transform.
+ ///
+ /// @param[in] Relocator
+ /// The relocator to use when registering branches.
+ ///
+ /// @return
+ /// True on success; false otherwise
+ //------------------------------------------------------------------
bool runOnBasicBlock(llvm::BasicBlock &BB, Relocator &Relocator);
- lldb_private::ClangExpressionVariableList &m_variable_list;
- lldb_private::ClangExpressionDeclMap *m_decl_map;
- lldb_private::StreamString &m_strm;
+ lldb_private::ClangExpressionVariableList &m_variable_list; ///< The list of local variables to populate while transforming
+ lldb_private::ClangExpressionDeclMap *m_decl_map; ///< The list of external variables
+ lldb_private::StreamString &m_strm; ///< The stream to write bytecode to
};
#endif
\ No newline at end of file
More information about the lldb-commits
mailing list