14#ifndef LLVM_IR_DEBUGLOC_H
15#define LLVM_IR_DEBUGLOC_H
17#include "llvm/Config/llvm-config.h"
29#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
30#if LLVM_ENABLE_DEBUGLOC_TRACKING_ORIGIN
32 static constexpr unsigned long MaxDepth = 16;
34 SmallVector<std::pair<int, std::array<void *, MaxDepth>>, 0>;
35 StackTracesTy StackTraces;
36 DbgLocOrigin(
bool ShouldCollectTrace);
38 const StackTracesTy &getOriginStackTraces()
const {
return StackTraces; };
49 enum class DebugLocKind :
uint8_t {
84 DILocAndCoverageTracking()
88 DILocAndCoverageTracking(
const MDNode *Loc)
91 LLVM_ABI DILocAndCoverageTracking(
const DILocation *Loc);
93 DILocAndCoverageTracking(DebugLocKind Kind)
97 template <>
struct simplify_type<DILocAndCoverageTracking> {
104 template <>
struct simplify_type<
const DILocAndCoverageTracking> {
142#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
143 DebugLoc(DebugLocKind Kind) : Loc(Kind) {}
144 DebugLocKind getKind()
const {
return Loc.Kind; }
147#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
149 return DebugLoc(DebugLocKind::Temporary);
152 return DebugLoc(DebugLocKind::Unknown);
155 return DebugLoc(DebugLocKind::CompilerGenerated);
158 return DebugLoc(DebugLocKind::Dropped);
199#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
202 if (getKind() != DebugLocKind::Normal)
204 if (
Other.getKind() != DebugLocKind::Normal)
212#if LLVM_ENABLE_DEBUGLOC_TRACKING_ORIGIN
213 const DbgLocOrigin::StackTracesTy &getOriginStackTraces()
const {
214 return Loc.getOriginStackTraces();
218 NewDL.Loc.addTrace();
241 explicit operator bool()
const {
return Loc; }
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Subprogram description. Uses SubclassData1.
LLVM_ABI void setImplicitCode(bool ImplicitCode)
DILocation & operator*() const
bool isSameSourceLocation(const DebugLoc &Other) const
Return true if the source locations match, ignoring isImplicitCode and source atom info.
static DebugLoc getCompilerGenerated()
bool operator==(const DebugLoc &DL) const
LLVM_ABI unsigned getLine() const
DebugLoc orElse(DebugLoc Other) const
If this DebugLoc is non-empty, returns this DebugLoc; otherwise, selects Other.
LLVM_ABI DebugLoc getFnDebugLoc() const
Find the debug info location for the start of the function.
LLVM_ABI DILocation * get() const
Get the underlying DILocation.
LLVM_ABI MDNode * getScope() const
DebugLoc getCopied() const
static LLVM_ABI DebugLoc appendInlinedAt(const DebugLoc &DL, DILocation *InlinedAt, LLVMContext &Ctx, DenseMap< const MDNode *, MDNode * > &Cache)
Rebuild the entire inlined-at chain for this instruction so that the top of the chain now is inlined-...
DILocation * operator->() const
bool hasTrivialDestructor() const
Check whether this has a trivial destructor.
static DebugLoc getTemporary()
static LLVM_ABI DebugLoc getMergedLocation(DebugLoc LocA, DebugLoc LocB)
When two instructions are combined into a single instruction we also need to combine the original loc...
LLVM_ABI void print(raw_ostream &OS) const
prints source location /path/to/file.exe:line:col @[inlined at]
static LLVM_ABI DebugLoc getMergedLocations(ArrayRef< DebugLoc > Locs)
Try to combine the vector of locations passed as input in a single one.
MDNode * getAsMDNode() const
Return this as a bar MDNode.
LLVM_ABI unsigned getCol() const
static LLVM_ABI DebugLoc replaceInlinedAtSubprogram(const DebugLoc &DL, DISubprogram &NewSP, LLVMContext &Ctx, DenseMap< const MDNode *, MDNode * > &Cache)
Rebuild the entire inline-at chain by replacing the subprogram at the end of the chain with NewSP.
LLVM_ABI bool isImplicitCode() const
Check if the DebugLoc corresponds to an implicit code.
LLVM_ABI void dump() const
static DebugLoc getUnknown()
LLVM_ABI DILocation * getInlinedAt() const
static DebugLoc getDropped()
bool operator!=(const DebugLoc &DL) const
LLVM_ABI MDNode * getInlinedAtScope() const
Get the fully inlined-at scope for a DebugLoc.
This is an important class for using LLVM in a threaded context.
bool hasTrivialDestructor() const
Check whether this has a trivial destructor.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
TypedTrackingMDRef< MDNode > TrackingMDNodeRef
TrackingMDNodeRef DebugLocTrackingRef
static SimpleType & getSimplifiedValue(From &Val)