forked from OSchip/llvm-project
Cleanup of IRForTarget. Removed some relics of
the time when the IRInterpreter ran inside IRForTarget. llvm-svn: 185088
This commit is contained in:
parent
f183082dc6
commit
7dcbe3d356
|
@ -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)
|
||||
|
||||
|
|
|
@ -73,11 +73,9 @@ 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_error_stream(error_stream),
|
||||
m_has_side_effects(false),
|
||||
m_result_store(NULL),
|
||||
m_result_is_pointer(false),
|
||||
m_reloc_placeholder(NULL)
|
||||
|
@ -127,67 +125,6 @@ IRForTarget::FixFunctionLinkage(llvm::Function &llvm_function)
|
|||
return true;
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -687,16 +624,6 @@ IRForTarget::CreateResultVariable (llvm::Function &llvm_function)
|
|||
|
||||
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::Function &llvm_function)
|
|||
}
|
||||
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_module)
|
|||
|
||||
Function::iterator bbi;
|
||||
|
||||
m_has_side_effects = HasSideEffects(*function);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Replace $__lldb_expr_result with a persistent variable
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue