llvm/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

//===-- IRForTarget.cpp ---------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "IRForTarget.h"

#include "ClangExpressionDeclMap.h"
#include "ClangUtil.h"

#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO.h"

#include "clang/AST/ASTContext.h"

#include "lldb/Core/dwarf.h"
#include "lldb/Expression/IRExecutionUnit.h"
#include "lldb/Expression/IRInterpreter.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Endian.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Scalar.h"
#include "lldb/Utility/StreamString.h"

#include <map>
#include <optional>

usingnamespacellvm;
LLDBLog;

InstrList;

IRForTarget::FunctionValueCache::FunctionValueCache(Maker const &maker)
    :{}

IRForTarget::FunctionValueCache::~FunctionValueCache() = default;

llvm::Value *
IRForTarget::FunctionValueCache::GetValue(llvm::Function *function) {}

static llvm::Value *FindEntryInstruction(llvm::Function *function) {}

IRForTarget::IRForTarget(lldb_private::ClangExpressionDeclMap *decl_map,
                         bool resolve_vars,
                         lldb_private::IRExecutionUnit &execution_unit,
                         lldb_private::Stream &error_stream,
                         const char *func_name)
    :{}

/* Handy utility functions used at several places in the code */

static std::string PrintValue(const Value *value, bool truncate = false) {}

static std::string PrintType(const llvm::Type *type, bool truncate = false) {}

bool IRForTarget::FixFunctionLinkage(llvm::Function &llvm_function) {}

clang::NamedDecl *IRForTarget::DeclForGlobal(const GlobalValue *global_val,
                                             Module *module) {}

clang::NamedDecl *IRForTarget::DeclForGlobal(GlobalValue *global_val) {}

/// Returns true iff the mangled symbol is for a static guard variable.
static bool isGuardVariableSymbol(llvm::StringRef mangled_symbol,
                                  bool check_ms_abi = true) {}

bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {}

bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str,
                                         llvm::GlobalVariable *cstr) {}

bool IRForTarget::RewriteObjCConstStrings() {}

static bool IsObjCSelectorRef(Value *value) {}

// This function does not report errors; its callers are responsible.
bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) {}

bool IRForTarget::RewriteObjCSelectors(BasicBlock &basic_block) {}

// This function does not report errors; its callers are responsible.
bool IRForTarget::RewritePersistentAlloc(llvm::Instruction *persistent_alloc) {}

bool IRForTarget::RewritePersistentAllocs(llvm::BasicBlock &basic_block) {}

// This function does not report errors; its callers are responsible.
bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) {}

// This function does not report errors; its callers are responsible.
bool IRForTarget::HandleSymbol(Value *symbol) {}

bool IRForTarget::MaybeHandleCallArguments(CallInst *Old) {}

bool IRForTarget::HandleObjCClass(Value *classlist_reference) {}

bool IRForTarget::RemoveCXAAtExit(BasicBlock &basic_block) {}

bool IRForTarget::ResolveCalls(BasicBlock &basic_block) {}

bool IRForTarget::ResolveExternals(Function &llvm_function) {}

static bool isGuardVariableRef(Value *V) {}

void IRForTarget::TurnGuardLoadIntoZero(llvm::Instruction *guard_load) {}

static void ExciseGuardStore(Instruction *guard_store) {}

bool IRForTarget::RemoveGuards(BasicBlock &basic_block) {}

// This function does not report errors; its callers are responsible.
bool IRForTarget::UnfoldConstant(Constant *old_constant,
                                 llvm::Function *llvm_function,
                                 FunctionValueCache &value_maker,
                                 FunctionValueCache &entry_instruction_finder,
                                 lldb_private::Stream &error_stream) {}

bool IRForTarget::ReplaceVariables(Function &llvm_function) {}

bool IRForTarget::runOnModule(Module &llvm_module) {}