25 Constant *ZeroOffset = ConstantInt::get(Int64Ty, 0);
36 Function *
F = getDeclarationIfExists(&M, Intrinsic::dbg_value);
44 {FT->getParamType(0), Int64Ty, FT->getParamType(1), FT->getParamType(2)},
50 for (
User *U :
F->users())
68 M.getContext(), Lang,
CU->getFile(),
CU->getProducer(),
69 CU->isOptimized(),
CU->getFlags(),
CU->getRuntimeVersion(),
70 CU->getSplitDebugFilename(),
CU->getEmissionKind(),
71 CU->getEnumTypes(),
CU->getRetainedTypes(),
CU->getGlobalVariables(),
72 CU->getImportedEntities(),
CU->getMacros(),
CU->getDWOId(),
73 CU->getSplitDebugInlining(),
CU->getDebugInfoForProfiling(),
74 CU->getNameTableKind(),
CU->getRangesBaseAddress(),
CU->getSysRoot(),
80 std::vector<std::pair<const DICompileUnit *, const Metadata *>> CUSubprograms;
92 static constexpr auto SupportedDIFlags =
94 static constexpr auto SupportedDISPFlags =
96 if (SP->isDistinct() || SP->getFlags() & ~SupportedDIFlags ||
97 SP->getSPFlags() & ~SupportedDISPFlags) {
99 M.getContext(), SP->getScope(), SP->getName(), SP->getLinkageName(),
100 SP->getFile(), SP->getLine(), SP->getType(), SP->getScopeLine(),
101 SP->getContainingType(), SP->getVirtualIndex(),
102 SP->getThisAdjustment(), SP->getFlags() & SupportedDIFlags,
103 SP->getSPFlags() & SupportedDISPFlags, SP->getUnit(),
104 SP->getTemplateParams(), SP->getDeclaration(), SP->getRetainedNodes(),
105 SP->getThrownTypes(), SP->getAnnotations(), SP->getTargetFuncName(),
106 SP->getKeyInstructionsEnabled());
110 const Metadata *FunctionMD = It->second;
117 CUSubprograms.push_back({SP->getUnit(), SP});
121 CUSubprograms.begin(), CUSubprograms.end(), [](
auto &&
A,
auto &&
B) {
122 return std::less<const DICompileUnit *>()(A.first, B.first);
124 for (
auto It = CUSubprograms.begin(), End = CUSubprograms.end(); It != End;) {
131 }
while (++It != End && It->first ==
CU);
132 const auto *SubprogramsMD =
MDTuple::get(M.getContext(), Subprograms);
138 GV.getDebugInfo(GVEs);
140 if (GVE->getExpression()->getNumElements())
146 It->second =
nullptr;
155 const Metadata *Scope = CB->getScope();
166 SR->getName(), SR->getSizeInBits(),
167 SR->getAlignInBits(), dwarf::DW_ATE_unsigned,
168 SR->getNumExtraInhabitants(),
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static void replaceDbgVariableIntr(DbgVariableIntrinsic *DVI, Function *NewF, DXILDebugInfoMap &Res)
static void replaceDbgValue(Module &M, DXILDebugInfoMap &Res)
This file contains constants used for implementing Dwarf debug support.
Module.h This file contains the declarations for the Module class.
This class represents a function call, abstracting a target machine's calling convention.
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
void setTailCall(bool IsTc=true)
This is an important base class in LLVM.
A pair of DIGlobalVariable and DIExpression.
Base class for scope-like contexts.
Wrapper structure that holds source language identity metadata that includes language name,...
uint32_t getVersion() const
Returns language version. Only valid for versioned language names.
bool hasVersionedName() const
uint16_t getName() const
Returns a versioned or unversioned language name.
Subprogram description. Uses SubclassData1.
DISPFlags
Debug info subprogram flags.
This is the common base class for debug info intrinsics for variables.
Utility to find all debug info in a module.
LLVM_ABI void processModule(const Module &M)
Process entire module and collect debug info anchors.
iterator_range< global_variable_expression_iterator > global_variables() const
iterator_range< subprogram_iterator > subprograms() const
iterator_range< type_iterator > types() const
iterator_range< scope_iterator > scopes() const
iterator_range< compile_unit_iterator > compile_units() const
iterator find(const_arg_type_t< KeyT > Val)
bool erase(const KeyT &Val)
ValueT lookup_or(const_arg_type_t< KeyT > Val, U &&Default) const
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
FunctionType * getFunctionType() const
Returns the FunctionType for me.
void copyAttributesFrom(const Function *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a Function) from the ...
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
A Module instance is used to store all the information related to an LLVM module.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
Value * getOperand(unsigned i) const
LLVM Value Representation.
LLVMContext & getContext() const
All values hold a context through their type.
InstMap InstReplace
Completely replace one instruction with another in ValueEnumerator.
MDMap MDExtra
Enumerate extra metadata when Key is encountered in ValueEnumerator.
FuncMap FuncReplace
Completely replace one function with another in ValueEnumerator.
MDMap MDReplace
Completely replace one metadata with another in ValueEnumerator.
std::optional< SourceLanguage > toDW_LANG(SourceLanguageName name, uint32_t version)
Convert a DWARF 6 pair of language name and version to a DWARF 5 DW_LANG.
DXILDebugInfoMap collectDXILDebugInfo(Module &M)
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.