From 475d32a987538df6f128a5c19372dcd8d9649c23 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Tue, 6 Oct 2009 01:26:37 +0000 Subject: Add utility routine to collect variable debug info. This is not yet used. llvm-svn: 83355 --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 14 ++++++++++++++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 3 +++ 2 files changed, 17 insertions(+) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 149da048108..89995afcd6d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1782,6 +1782,20 @@ void DwarfDebug::EndModule() { DebugTimer->stopTimer(); } +/// CollectVariableInfo - Populate DbgScope entries with variables' info. +void DwarfDebug::CollectVariableInfo() { + if (!MMI) return; + MachineModuleInfo::VariableDbgInfoMapTy &VMap = MMI->getVariableDbgInfo(); + for (MachineModuleInfo::VariableDbgInfoMapTy::iterator VI = VMap.begin(), + VE = VMap.end(); VI != VE; ++VI) { + MDNode *Var = VI->first; + DILocation VLoc(VI->second.first); + unsigned VSlot = VI->second.second; + DbgScope *Scope = getDbgScope(VLoc.getScope().getNode(), NULL); + Scope->AddVariable(new DbgVariable(DIVariable(Var), VSlot, false)); + } +} + /// ExtractScopeInformation - Scan machine instructions in this function /// and collect DbgScopes. Return true, if atleast one scope was found. bool DwarfDebug::ExtractScopeInformation(MachineFunction *MF) { diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index 2947d76d703..1bb6906ed3a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -560,6 +560,9 @@ public: /// and collect DbgScopes. Return true, if atleast one scope was found. bool ExtractScopeInformation(MachineFunction *MF); + /// CollectVariableInfo - Populate DbgScope entries with variables' info. + void CollectVariableInfo(); + void SetDbgScopeLabels(const MachineInstr *MI, unsigned Label); }; -- cgit v1.2.3