diff options
author | Orlando Cazalet-Hyams <orlando.hyams@sony.com> | 2025-05-01 15:40:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-01 15:40:39 +0100 |
commit | 0c7c82af230bd525bb96a54ca9480797b5fa2a42 (patch) | |
tree | f986b112498efb86a70b06fe6f982899e9e48bc2 /llvm/lib/IR/DebugInfoMetadata.cpp | |
parent | d33c6764680ed78ffe824a83b6a33c0b609bafce (diff) | |
download | llvm-0c7c82af230bd525bb96a54ca9480797b5fa2a42.zip llvm-0c7c82af230bd525bb96a54ca9480797b5fa2a42.tar.gz llvm-0c7c82af230bd525bb96a54ca9480797b5fa2a42.tar.bz2 |
[KeyInstr] Add fields to DILocation behind compile time flag (#133477)
Add AtomGroup and AtomRank to DILocation behind compile time flag
EXPERIMENTAL_KEY_INSTRUCTIONS which is controlled by cmake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONS.
Add IR read-write roundtrip test in a directory that is unsupported unless the
CMake flag is enabled.
RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
Diffstat (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfoMetadata.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 4f1b9e8..bfe956d 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -63,12 +63,19 @@ DebugVariableAggregate::DebugVariableAggregate(const DbgVariableIntrinsic *DVI) DVI->getDebugLoc()->getInlinedAt()) {} DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line, - unsigned Column, ArrayRef<Metadata *> MDs, - bool ImplicitCode) - : MDNode(C, DILocationKind, Storage, MDs) { + unsigned Column, uint64_t AtomGroup, uint8_t AtomRank, + ArrayRef<Metadata *> MDs, bool ImplicitCode) + : MDNode(C, DILocationKind, Storage, MDs) +#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS + , + AtomGroup(AtomGroup), AtomRank(AtomRank) +#endif +{ +#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS + assert(AtomRank <= 7 && "AtomRank number should fit in 3 bits"); +#endif assert((MDs.size() == 1 || MDs.size() == 2) && "Expected a scope and optional inlined-at"); - // Set line and column. assert(Column < (1u << 16) && "Expected 16-bit column"); @@ -87,6 +94,7 @@ static void adjustColumn(unsigned &Column) { DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line, unsigned Column, Metadata *Scope, Metadata *InlinedAt, bool ImplicitCode, + uint64_t AtomGroup, uint8_t AtomRank, StorageType Storage, bool ShouldCreate) { // Fixup column. adjustColumn(Column); @@ -94,7 +102,8 @@ DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line, if (Storage == Uniqued) { if (auto *N = getUniqued(Context.pImpl->DILocations, DILocationInfo::KeyTy(Line, Column, Scope, - InlinedAt, ImplicitCode))) + InlinedAt, ImplicitCode, + AtomGroup, AtomRank))) return N; if (!ShouldCreate) return nullptr; @@ -106,8 +115,9 @@ DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line, Ops.push_back(Scope); if (InlinedAt) Ops.push_back(InlinedAt); - return storeImpl(new (Ops.size(), Storage) DILocation( - Context, Storage, Line, Column, Ops, ImplicitCode), + return storeImpl(new (Ops.size(), Storage) + DILocation(Context, Storage, Line, Column, AtomGroup, + AtomRank, Ops, ImplicitCode), Storage, Context.pImpl->DILocations); } |