Add utility routine to collect variable debug info. This is not yet used.
authorDevang Patel <dpatel@apple.com>
Tue, 6 Oct 2009 01:26:37 +0000 (01:26 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 6 Oct 2009 01:26:37 +0000 (01:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83355 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h

index 149da048108bd9a5aa87ae3f7a7f1738bf919c52..89995afcd6d9f092cd2379f25a4cfbd4d4bcdd08 100644 (file)
@@ -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) {
index 2947d76d703a9efcd8a2608caa877816311b9731..1bb6906ed3a830c3de4e29b9f0a62f3c045094f3 100644 (file)
@@ -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);
 };