[PATCH] D145816: [BPF] Improve pruning to avoid generate more types in BTF
Eduard Zingerman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 12 14:28:52 PDT 2023
eddyz87 added inline comments.
================
Comment at: llvm/lib/Target/BPF/BTFDebug.cpp:897
} else {
+ if (CheckPointer && DTy->getTag() == dwarf::DW_TAG_pointer_type) {
+ SeenPointer = true;
----------------
Looks reasonable.
To be honest, I find the logic with `CheckPointer` / `SeenPointer` a bit confusing. As far as I understand the main thing is the following code:
```
void BTFDebug::visitDerivedType(...) {
if (CheckPointer && !SeenPointer) {
SeenPointer = Tag == dwarf::DW_TAG_pointer_type;
}
if (CheckPointer && SeenPointer) {
// generate forward declaration
return;
}
...
if (Tag == dwarf::DW_TAG_member)
visitTypeEntry(DTy->getBaseType(), TempTypeId, true /* !! */, false);
else
...
}
```
And setting `CheckPointer` to `true` means that visitor should generate forward declarations when possible. Adding a comment describing behavior of these parameters somewhere would be really helpful.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145816/new/
https://reviews.llvm.org/D145816
More information about the llvm-commits
mailing list