summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/BPF
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/BPF')
-rw-r--r--llvm/lib/Target/BPF/BTFDebug.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp
index 6e4ee039ca0..3f5531357a9 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -658,12 +658,12 @@ void BTFDebug::beginFunctionImpl(const MachineFunction *MF) {
std::unordered_map<uint32_t, StringRef> FuncArgNames;
for (const DINode *DN : SP->getRetainedNodes()) {
if (const auto *DV = dyn_cast<DILocalVariable>(DN)) {
+ visitTypeEntry(DV->getType().resolve());
+
// Collect function arguments for subprogram func type.
uint32_t Arg = DV->getArg();
- if (Arg) {
- visitTypeEntry(DV->getType().resolve());
+ if (Arg)
FuncArgNames[Arg] = DV->getName();
- }
}
}
@@ -749,15 +749,10 @@ void BTFDebug::beginInstruction(const MachineInstr *MI) {
void BTFDebug::endModule() {
// Collect all types referenced by globals.
const Module *M = MMI->getModule();
- for (const GlobalVariable &Global : M->globals()) {
- // Ignore external globals for now.
- if (!Global.getInitializer())
- continue;
-
- SmallVector<DIGlobalVariableExpression *, 1> GVs;
- Global.getDebugInfo(GVs);
- for (auto *GVE : GVs) {
- visitTypeEntry(GVE->getVariable()->getType().resolve());
+ for (const DICompileUnit *CUNode : M->debug_compile_units()) {
+ for (const auto *GVE : CUNode->getGlobalVariables()) {
+ DIGlobalVariable *GV = GVE->getVariable();
+ visitTypeEntry(GV->getType().resolve());
}
}
OpenPOWER on IntegriCloud