diff options
author | Devang Patel <dpatel@apple.com> | 2010-03-28 18:57:09 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-03-28 18:57:09 +0000 |
commit | c7eae5ca4a5c9fd760ec3c38e1e46cd9fda113aa (patch) | |
tree | 429bef6dd2565445c1345a7b00ce7bf5919e66b8 /lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | dc7500bbaf8b0c0689714c35f14f9d6132be6276 (diff) |
Refactoring. Push DILocation processing in to DwarfDebug from AsmPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99772 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index e2421eb070..8861699f4b 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -296,7 +296,7 @@ DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T) : DwarfPrinter(OS, A, T), ModuleCU(0), AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(), DIEValues(), SectionSourceLines(), didInitial(false), shouldEmit(false), - CurrentFnDbgScope(0), DebugTimer(0) { + CurrentFnDbgScope(0), PrevDILoc(0), DebugTimer(0) { NextStringPoolNumber = 0; if (TimePassesIsEnabled) DebugTimer = new Timer("Dwarf Debug Writer"); @@ -2036,19 +2036,49 @@ void DwarfDebug::collectVariableInfo() { } } -/// beginScope - Process beginning of a scope starting at Label. -void DwarfDebug::beginScope(const MachineInstr *MI, MCSymbol *Label) { +/// beginScope - Process beginning of a scope. +void DwarfDebug::beginScope(const MachineInstr *MI) { + if (MI->getOpcode() == TargetOpcode::DBG_VALUE) + return; + + DebugLoc DL = MI->getDebugLoc(); + if (DL.isUnknown()) + return; + DILocation DILoc = MF->getDILocation(DL); + if (!DILoc.getScope().Verify()) + return; + + if(DILoc.getNode() == PrevDILoc) + return; + InsnToDbgScopeMapTy::iterator I = DbgScopeBeginMap.find(MI); if (I == DbgScopeBeginMap.end()) return; + + MCSymbol *Label = recordSourceLine(DILoc.getLineNumber(), + DILoc.getColumnNumber(), + DILoc.getScope().getNode()); + ScopeVector &SD = I->second; for (ScopeVector::iterator SDI = SD.begin(), SDE = SD.end(); SDI != SDE; ++SDI) (*SDI)->setStartLabel(Label); + + PrevDILoc = DILoc.getNode(); } /// endScope - Process end of a scope. void DwarfDebug::endScope(const MachineInstr *MI) { + if (MI->getOpcode() == TargetOpcode::DBG_VALUE) + return; + + DebugLoc DL = MI->getDebugLoc(); + if (DL.isUnknown()) + return; + DILocation DILoc = MF->getDILocation(DL); + if (!DILoc.getScope().Verify()) + return; + InsnToDbgScopeMapTy::iterator I = DbgScopeEndMap.find(MI); if (I == DbgScopeEndMap.end()) return; |