diff options
author | Devang Patel <dpatel@apple.com> | 2010-04-01 17:32:01 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-04-01 17:32:01 +0000 |
commit | 58c7aa61d49f155a1d36b9c14273de5a630de8e1 (patch) | |
tree | a4b306e3ab2b3c0f83d4b7f393a2e11c24f84f1e /lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | 8935d90a9095edf5643ef4a362a64df706ea97be (diff) |
Skip instructions until new scope is seen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100117 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 8f8c7f8bfe..45c8dadfba 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2146,6 +2146,8 @@ bool DwarfDebug::extractScopeInformation() { DenseMap<const MachineInstr *, unsigned> MIIndexMap; unsigned MIIndex = 0; + MDNode *PrevScope = NULL; + MDNode *PrevInlinedAt = NULL; // Scan each instruction and create scopes. First build working set of scopes. for (MachineFunction::const_iterator I = MF->begin(), E = MF->end(); I != E; ++I) { @@ -2159,17 +2161,23 @@ bool DwarfDebug::extractScopeInformation() { if (DL.isUnknown()) continue; DILocation DLT = MF->getDILocation(DL); DIScope DLTScope = DLT.getScope(); - if (!DLTScope.getNode()) continue; + MDNode *NewScope = DLTScope.getNode(); + if (!NewScope) continue; // There is no need to create another DIE for compile unit. For all // other scopes, create one DbgScope now. This will be translated // into a scope DIE at the end. if (DLTScope.isCompileUnit()) continue; - createDbgScope(DLTScope.getNode(), DLT.getOrigLocation().getNode()); + MDNode *NewInlinedAt = DLT.getOrigLocation().getNode(); + if (NewScope == PrevScope && NewInlinedAt == PrevInlinedAt) continue; + createDbgScope(NewScope, NewInlinedAt); + PrevScope = NewScope; + PrevInlinedAt = NewInlinedAt; } } - // Build scope hierarchy using working set of scopes. + PrevScope = NULL; + PrevInlinedAt = NULL; for (MachineFunction::const_iterator I = MF->begin(), E = MF->end(); I != E; ++I) { for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end(); @@ -2181,14 +2189,18 @@ bool DwarfDebug::extractScopeInformation() { if (DL.isUnknown()) continue; DILocation DLT = MF->getDILocation(DL); DIScope DLTScope = DLT.getScope(); - if (!DLTScope.getNode()) continue; + MDNode *NewScope = DLTScope.getNode(); + if (!NewScope) continue; // There is no need to create another DIE for compile unit. For all // other scopes, create one DbgScope now. This will be translated // into a scope DIE at the end. if (DLTScope.isCompileUnit()) continue; - DbgScope *Scope = getUpdatedDbgScope(DLTScope.getNode(), MInsn, - DLT.getOrigLocation().getNode()); + MDNode *NewInlinedAt = DLT.getOrigLocation().getNode(); + if (NewScope == PrevScope && NewInlinedAt == PrevInlinedAt) continue; + DbgScope *Scope = getUpdatedDbgScope(NewScope, MInsn, NewInlinedAt); Scope->setLastInsn(MInsn); + PrevScope = NewScope; + PrevInlinedAt = NewInlinedAt; } } |