Print out a new label only if the debug location *tuple* is different. The debug

locations may change, but the tuples may be the same.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65039 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2009-02-19 09:16:38 +00:00
parent 249e1e4e27
commit 4dd82f6aaa
2 changed files with 16 additions and 6 deletions

View File

@ -27,6 +27,13 @@ namespace llvm {
DebugLocTuple(unsigned s, unsigned l, unsigned c) DebugLocTuple(unsigned s, unsigned l, unsigned c)
: Src(s), Line(l), Col(c) {}; : Src(s), Line(l), Col(c) {};
bool operator==(const DebugLocTuple &DLT) const {
return Src == DLT.Src && Line == DLT.Line && Col == DLT.Col;
}
bool operator!=(const DebugLocTuple &DLT) const {
return !(*this == DLT);
}
}; };
/// DebugLoc - Debug location id. This is carried by SDNode and MachineInstr /// DebugLoc - Debug location id. This is carried by SDNode and MachineInstr

View File

@ -642,13 +642,16 @@ void AsmWriterEmitter::run(std::ostream &O) {
O << " if (TAI->doesSupportDebugInformation()) {\n" O << " if (TAI->doesSupportDebugInformation()) {\n"
<< " const MachineFunction *MF = MI->getParent()->getParent();\n" << " const MachineFunction *MF = MI->getParent()->getParent();\n"
<< " static DebugLoc PrevDL = DebugLoc::getUnknownLoc();\n"
<< " DebugLoc CurDL = MI->getDebugLoc();\n\n" << " DebugLoc CurDL = MI->getDebugLoc();\n\n"
<< " if (!CurDL.isUnknown() && PrevDL != CurDL) {\n" << " if (!CurDL.isUnknown()) {\n"
<< " DebugLocTuple DLT = MF->getDebugLocTuple(CurDL);\n" << " static DebugLocTuple PrevDLT(~0U, ~0U, ~0U);\n"
<< " printLabel(DW->RecordSourceLine(DLT.Line, DLT.Col, DLT.Src));\n" << " DebugLocTuple CurDLT = MF->getDebugLocTuple(CurDL);\n\n"
<< " }\n\n" << " if (PrevDLT != CurDLT) {\n"
<< " PrevDL = CurDL;\n" << " printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,\n"
<< " CurDLT.Src));\n"
<< " PrevDLT = CurDLT;\n"
<< " }\n"
<< " }\n"
<< " }\n\n"; << " }\n\n";
O << " if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {\n" O << " if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {\n"