LLVM 22.0.0git
|
A debug info location. More...
#include "llvm/IR/DebugLoc.h"
Public Types | |
enum | { ReplaceLastInlinedAt = true } |
Static Public Member Functions | |
static DebugLoc | getTemporary () |
static DebugLoc | getUnknown () |
static DebugLoc | getCompilerGenerated () |
static DebugLoc | getDropped () |
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 locations into a single location. | |
static LLVM_ABI DebugLoc | getMergedLocations (ArrayRef< DebugLoc > Locs) |
Try to combine the vector of locations passed as input in a single one. | |
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-at the new call site. | |
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. | |
A debug info location.
This class is a wrapper around a tracking reference to an DILocation pointer.
To avoid extra includes, DebugLoc doubles the DILocation API with a one based on relatively opaque MDNode pointers.
Definition at line 124 of file DebugLoc.h.
anonymous enum |
Enumerator | |
---|---|
ReplaceLastInlinedAt |
Definition at line 246 of file DebugLoc.h.
|
default |
Referenced by getCompilerGenerated(), getDropped(), getFnDebugLoc(), getMergedLocations(), getTemporary(), and getUnknown().
DebugLoc::DebugLoc | ( | const DILocation * | L | ) |
Construct from an DILocation.
Definition at line 47 of file DebugLoc.cpp.
Construct from an MDNode.
Note: if N
is not an DILocation, a verifier check will fail, and accessors will crash. However, construction from other nodes is supported in order to handle forward references when reading textual IR.
Definition at line 48 of file DebugLoc.cpp.
|
static |
Rebuild the entire inlined-at chain for this instruction so that the top of the chain now is inlined-at the new call site.
InlinedAt | The new outermost inlined-at in the chain. |
Definition at line 140 of file DebugLoc.cpp.
References DL, llvm::MDNode::getDistinct(), llvm::Last, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::reverse().
Referenced by inlineDebugLoc().
LLVM_DUMP_METHOD void DebugLoc::dump | ( | ) | const |
Definition at line 192 of file DebugLoc.cpp.
References llvm::dbgs(), and print().
DILocation * DebugLoc::get | ( | ) | const |
Get the underlying DILocation.
isa<DILocation>(getAsMDNode())
. Definition at line 50 of file DebugLoc.cpp.
References llvm::TypedTrackingMDRef< T >::get().
Referenced by llvm::addLocationToRemarks(), llvm::ConvertDebugDeclareToDebugValue(), fixupLineNumbers(), llvm::formatCallSiteLocation(), getCol(), getInlinedAt(), getLine(), getScope(), insertDbgValueOrDbgVariableRecord(), isImplicitCode(), isSameSourceLocation(), operator DILocation *(), operator*(), operator->(), llvm::DebugInfoFinder::processDbgRecord(), and setImplicitCode().
|
inline |
Return this
as a bar MDNode.
Definition at line 291 of file DebugLoc.h.
Referenced by llvm::Instruction::eraseMetadataIf(), and llvm::Instruction::getMetadata().
unsigned DebugLoc::getCol | ( | ) | const |
Definition at line 59 of file DebugLoc.cpp.
References assert(), and get().
Referenced by llvm::DwarfDebug::beginInstruction(), inlineDebugLoc(), isSameSourceLocation(), print(), and llvm::MachineBasicBlock::SplitCriticalEdge().
|
inlinestatic |
Definition at line 163 of file DebugLoc.h.
References DebugLoc().
Referenced by llvm::VPlanTransforms::addExplicitVectorLength(), buildPartialInvariantUnswitchConditionalBranch(), buildPartialUnswitchConditionalBranch(), HandleByValArgument(), llvm::VPlanTransforms::materializeBackedgeTakenCount(), llvm::VPlanTransforms::materializeVectorTripCount(), and processInternalGlobal().
|
inline |
Definition at line 222 of file DebugLoc.h.
Referenced by llvm::Instruction::setDebugLoc().
|
inlinestatic |
Definition at line 164 of file DebugLoc.h.
References DebugLoc().
Referenced by cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), llvm::Instruction::dropLocation(), llvm::InstCombinerImpl::foldPHIArgZextsIntoPHI(), hoistBOAssociation(), hoistMulAddAssociation(), moveFunctionData(), llvm::promoteLoopAccessesToScalars(), replaceArgumentUses(), and unswitchNontrivialInvariants().
DebugLoc DebugLoc::getFnDebugLoc | ( | ) | const |
Find the debug info location for the start of the function.
Walk up the scope chain of given debug loc and find line number info for the function.
FIXME: Remove this. Users should use DILocation/DILocalScope API to find the subprogram, and then DILocation::get().
Definition at line 78 of file DebugLoc.cpp.
References DebugLoc(), llvm::MDNode::get(), llvm::getDISubprogram(), and getInlinedAtScope().
DILocation * DebugLoc::getInlinedAt | ( | ) | const |
Definition at line 69 of file DebugLoc.cpp.
References assert(), and get().
Referenced by findVarsWithStackSlot(), fixupDebugInfoPostExtraction(), getAggregateVariable(), llvm::getDebugValueLoc(), llvm::SelectionDAGBuilder::handleDebugValue(), isSameSourceLocation(), llvm::DroppedVariableStats::populateVarIDSetAndInlinedMap(), and print().
MDNode * DebugLoc::getInlinedAtScope | ( | ) | const |
Get the fully inlined-at scope for a DebugLoc.
Gets the inlined-at scope for a DebugLoc.
Definition at line 74 of file DebugLoc.cpp.
Referenced by getFnDebugLoc().
unsigned DebugLoc::getLine | ( | ) | const |
Definition at line 54 of file DebugLoc.cpp.
References assert(), and get().
Referenced by llvm::DwarfDebug::beginInstruction(), functionHasLines(), llvm::SampleProfileLoaderBaseImpl< FT >::getInstWeightImpl(), inlineDebugLoc(), isSameSourceLocation(), print(), and llvm::MachineBasicBlock::SplitCriticalEdge().
When two instructions are combined into a single instruction we also need to combine the original locations into a single location.
When the locations are the same we can use either location. When they differ, we need a third location which is distinct from either. If they share a common scope, use this scope and compare the line/column pair of the locations with the common scope:
LocA
LocB:
The locations to be merged.
Definition at line 183 of file DebugLoc.cpp.
References llvm::DILocation::getMergedLocation().
Referenced by llvm::Instruction::applyMergedLocation(), llvm::MachineBasicBlock::findBranchDebugLoc(), getMergedLocations(), mergeDebugLocs(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), performBlockTailMerging(), performSink(), and llvm::LegalizationArtifactCombiner::tryCombineAnyExt().
Try to combine the vector of locations passed as input in a single one.
This function applies getMergedLocation() repeatedly left-to-right.
Locs:
The locations to be merged.
Definition at line 170 of file DebugLoc.cpp.
References DebugLoc(), DL, llvm::drop_begin(), llvm::ArrayRef< T >::empty(), getMergedLocation(), and llvm::ArrayRef< T >::size().
Referenced by llvm::promoteLoopAccessesToScalars().
MDNode * DebugLoc::getScope | ( | ) | const |
Definition at line 64 of file DebugLoc.cpp.
References assert(), and get().
Referenced by llvm::DwarfDebug::beginInstruction(), llvm::getDebugValueLoc(), inlineDebugLoc(), isSameSourceLocation(), and print().
|
inlinestatic |
Definition at line 161 of file DebugLoc.h.
References DebugLoc().
Referenced by createUnreachableSwitchDefault(), llvm::InlineFunctionImpl(), markAliveBlocks(), mergeCompatibleInvokesImpl(), processSwitch(), llvm::SCCPSolver::removeNonFeasibleEdges(), and llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB().
|
inlinestatic |
Definition at line 162 of file DebugLoc.h.
References DebugLoc().
Referenced by llvm::VPlanTransforms::addMinimumIterationCheck(), llvm::checkDebugInfoMetadata(), llvm::SSAUpdaterTraits< SSAUpdater >::CreateEmptyPHI(), llvm::VPBuilder::createNaryOp(), findDebugLoc(), getDebugLocFromInstOrOperands(), getDebugLocFromPHI(), and llvm::InlineFunctionImpl().
|
inline |
Check whether this has a trivial destructor.
Definition at line 244 of file DebugLoc.h.
References llvm::TypedTrackingMDRef< T >::hasTrivialDestructor().
Referenced by llvm::SDNode::SDNode().
bool DebugLoc::isImplicitCode | ( | ) | const |
Check if the DebugLoc corresponds to an implicit code.
Definition at line 87 of file DebugLoc.cpp.
References get().
Referenced by inlineDebugLoc().
Return true if the source locations match, ignoring isImplicitCode and source atom info.
Definition at line 256 of file DebugLoc.h.
References get(), getCol(), getInlinedAt(), getLine(), getScope(), and llvm::Other.
Referenced by cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses().
|
inlineexplicit |
Check for null.
Check for null in a way that is safe with broken debug info. Unlike the conversion to DILocation
, this doesn't require that Loc
is of the right type. Important for cases like llvm::StripDebugInfo() and Instruction::hasMetadata().
Definition at line 241 of file DebugLoc.h.
|
inline |
Definition at line 230 of file DebugLoc.h.
References get().
Definition at line 298 of file DebugLoc.h.
References DL.
|
inline |
Definition at line 232 of file DebugLoc.h.
References get().
|
inline |
Definition at line 231 of file DebugLoc.h.
References get().
Definition at line 297 of file DebugLoc.h.
References DL.
If this DebugLoc is non-empty, returns this DebugLoc; otherwise, selects Other
.
In coverage-tracking builds, this also accounts for whether this or Other
have an annotative DebugLocKind applied, such that if both are empty but exactly one has an annotation, we prefer that annotated location.
Definition at line 196 of file DebugLoc.h.
References llvm::Other.
Referenced by llvm::IRBuilderBase::SetInstDebugLocation().
void DebugLoc::print | ( | raw_ostream & | OS | ) | const |
prints source location /path/to/file.exe:line:col @[inlined at]
Definition at line 195 of file DebugLoc.cpp.
References getCol(), getInlinedAt(), getLine(), getScope(), and OS.
Referenced by dump().
|
static |
Rebuild the entire inline-at chain by replacing the subprogram at the end of the chain with NewSP.
Definition at line 100 of file DebugLoc.cpp.
References llvm::DILocalScope::cloneScopeForSubprogram(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::MDNode::get(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::reverse().
Referenced by fixupDebugInfoPostExtraction().
void DebugLoc::setImplicitCode | ( | bool | ImplicitCode | ) |
Definition at line 94 of file DebugLoc.cpp.
References get().