-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[LLVM][DWARF] Refactor code for generating DWARF V5 .debug_names acce… #82264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1994,6 +1994,10 @@ auto unique(Range &&R, Predicate P) { | |
return std::unique(adl_begin(R), adl_end(R), P); | ||
} | ||
|
||
template <typename Range> auto unique(Range &&R) { | ||
return std::unique(adl_begin(R), adl_end(R)); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand this is just moved code, but all functions in STLExtras have to be documented, even if they just defer to the stl documentation; see an example on the function just below this one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, in the new PR (requested by dwblaikie): #82312 |
||
|
||
/// Wrapper function around std::equal to detect if pair-wise elements between | ||
/// two ranges are the same. | ||
template <typename L, typename R> bool equal(L &&LRange, R &&RRange) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -613,6 +613,24 @@ enum AcceleratorTable { | |
DW_hash_function_djb = 0u | ||
}; | ||
|
||
// Uniquify the string hashes and calculate the bucket count for the | ||
// DWARF v5 Accelerator Table. | ||
inline uint32_t | ||
ComputeDebugNamesUniqueHashes(SmallVector<uint32_t, 0> &hashes) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We avoid putting the SmallSize of SmallVectors in the interface, using SmallVectorImpl instead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New functions should use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoops, you're right! I've having a bit of trouble with my git push right now :-( -- git is rejecting the push: "Updates were rejected because the remote contains work that you do not have locally..." I tried a 'git merge' but that didn't fix the issue. I hope I don't have to abandon this branch & PR and create a new one. If you know how to fix this, please let me know! Otherwise, I'll keep you posted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you show me the output of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $ git status
... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've given up and created a new pull request - it's simpler than fighting with git. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you try to merge with the other branch where you did the ADT work? My guess is that the two branches had different bases, and if you merged without rebasing, your commits ended up buried in other commits from |
||
uint32_t BucketCount = 0; | ||
|
||
llvm::sort(hashes); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAICT we are already inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed, thanks. |
||
uint32_t uniqueHashCount = llvm::unique(hashes) - hashes.begin(); | ||
if (uniqueHashCount > 1024) | ||
BucketCount = uniqueHashCount / 4; | ||
else if (uniqueHashCount > 16) | ||
BucketCount = uniqueHashCount / 2; | ||
else | ||
BucketCount = std::max<uint32_t>(uniqueHashCount, 1); | ||
|
||
return BucketCount; | ||
} | ||
|
||
// Constants for the GNU pubnames/pubtypes extensions supporting gdb index. | ||
enum GDBIndexEntryKind { | ||
GIEK_NONE, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this change (moving
unique(Range&&)
to STLExtras, and adding unit test coverage) in a separate commit (per https://llvm.org/docs/DeveloperPolicy.html#incremental-development )There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: #82312