[Lldb-commits] [lldb] r185088 - Cleanup of IRForTarget. Removed some relics of
Sean Callanan
scallanan at apple.com
Thu Jun 27 11:08:03 PDT 2013
Author: spyffe
Date: Thu Jun 27 13:08:02 2013
New Revision: 185088
URL: http://llvm.org/viewvc/llvm-project?rev=185088&view=rev
Log:
Cleanup of IRForTarget. Removed some relics of
the time when the IRInterpreter ran inside
IRForTarget.
Modified:
lldb/trunk/include/lldb/Expression/IRForTarget.h
lldb/trunk/source/Expression/IRForTarget.cpp
Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRForTarget.h?rev=185088&r1=185087&r2=185088&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRForTarget.h (original)
+++ lldb/trunk/include/lldb/Expression/IRForTarget.h Thu Jun 27 13:08:02 2013
@@ -654,15 +654,13 @@ private:
lldb_private::ConstString m_result_name; ///< The name of the result variable ($0, $1, ...)
lldb_private::TypeFromParser m_result_type; ///< The type of the result variable.
llvm::Module *m_module; ///< The module being processed, or NULL if that has not been determined yet.
- std::unique_ptr<llvm::DataLayout> m_target_data; ///< The target data for the module being processed, or NULL if there is no module.
+ std::unique_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_private::Stream *m_error_stream; ///< If non-NULL, the stream on which errors should be printed
- bool m_has_side_effects; ///< True if the function's result cannot be simply determined statically
llvm::StoreInst *m_result_store; ///< If non-NULL, the store instruction that writes to the result variable. If m_has_side_effects is true, this is NULL.
bool m_result_is_pointer; ///< True if the function's result in the AST is a pointer (see comments in ASTResultSynthesizer::SynthesizeBodyResult)
Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=185088&r1=185087&r2=185088&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Thu Jun 27 13:08:02 2013
@@ -73,11 +73,9 @@ 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_error_stream(error_stream),
- m_has_side_effects(false),
m_result_store(NULL),
m_result_is_pointer(false),
m_reloc_placeholder(NULL)
@@ -128,67 +126,6 @@ IRForTarget::FixFunctionLinkage(llvm::Fu
}
bool
-IRForTarget::HasSideEffects (llvm::Function &llvm_function)
-{
- llvm::Function::iterator bbi;
- BasicBlock::iterator ii;
-
- for (bbi = llvm_function.begin();
- bbi != llvm_function.end();
- ++bbi)
- {
- BasicBlock &basic_block = *bbi;
-
- for (ii = basic_block.begin();
- ii != basic_block.end();
- ++ii)
- {
- switch (ii->getOpcode())
- {
- default:
- return true;
- case Instruction::Store:
- {
- StoreInst *store_inst = dyn_cast<StoreInst>(ii);
-
- Value *store_ptr = store_inst->getPointerOperand();
-
- std::string ptr_name;
-
- if (store_ptr->hasName())
- ptr_name = store_ptr->getName().str();
-
- if (isa <AllocaInst> (store_ptr))
- break;
-
- if (ptr_name.find("$__lldb_expr_result") != std::string::npos)
- {
- if (ptr_name.find("GV") == std::string::npos)
- m_result_store = store_inst;
- }
- else
- {
- return true;
- }
-
- break;
- }
- case Instruction::Load:
- case Instruction::Alloca:
- case Instruction::GetElementPtr:
- case Instruction::BitCast:
- case Instruction::Ret:
- case Instruction::ICmp:
- case Instruction::Br:
- break;
- }
- }
- }
-
- return false;
-}
-
-bool
IRForTarget::GetFunctionAddress (llvm::Function *fun,
uint64_t &fun_addr,
lldb_private::ConstString &name,
@@ -687,16 +624,6 @@ IRForTarget::CreateResultVariable (llvm:
Constant *initializer = result_global->getInitializer();
- // Here we write the initializer into a result variable assuming it
- // can be computed statically.
-
- if (!m_has_side_effects)
- {
- //MaybeSetConstantResult (initializer,
- // m_result_name,
- // m_result_type);
- }
-
StoreInst *synthesized_store = new StoreInst(initializer,
new_result_global,
first_entry_instruction);
@@ -706,11 +633,6 @@ IRForTarget::CreateResultVariable (llvm:
}
else
{
- if (!m_has_side_effects && lldb_private::ClangASTContext::IsPointerType (m_result_type.GetOpaqueQualType()))
- {
- //MaybeSetCastResult (m_result_type);
- }
-
result_global->replaceAllUsesWith(new_result_global);
}
@@ -2669,8 +2591,6 @@ IRForTarget::runOnModule (Module &llvm_m
Function::iterator bbi;
- m_has_side_effects = HasSideEffects(*function);
-
////////////////////////////////////////////////////////////
// Replace $__lldb_expr_result with a persistent variable
//
More information about the lldb-commits
mailing list