Restructure DwarfDebug::beginInstruction(). [NFC]

Will help a pending patch.

Differential Revision: http://reviews.llvm.org/D26982

llvm-svn: 287686
This commit is contained in:
Paul Robinson 2016-11-22 19:46:51 +00:00
parent 9b3baaa74a
commit f428c9b298
1 changed files with 25 additions and 20 deletions

View File

@ -1007,29 +1007,34 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
assert(CurMI); assert(CurMI);
// Check if source location changes, but ignore DBG_VALUE locations. // Check if source location changes, but ignore DBG_VALUE locations.
if (!MI->isDebugValue()) { if (MI->isDebugValue())
const DebugLoc &DL = MI->getDebugLoc(); return;
if (DL != PrevInstLoc) { const DebugLoc &DL = MI->getDebugLoc();
if (DL) { if (DL == PrevInstLoc)
unsigned Flags = 0; return;
PrevInstLoc = DL;
if (DL == PrologEndLoc) {
Flags |= DWARF2_FLAG_PROLOGUE_END;
PrologEndLoc = DebugLoc();
Flags |= DWARF2_FLAG_IS_STMT;
}
if (DL.getLine() !=
Asm->OutStreamer->getContext().getCurrentDwarfLoc().getLine())
Flags |= DWARF2_FLAG_IS_STMT;
const MDNode *Scope = DL.getScope(); if (!DL) {
recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags); // We have an unspecified location, which might want to be line 0.
} else if (UnknownLocations) { if (UnknownLocations) {
PrevInstLoc = DL; PrevInstLoc = DL;
recordSourceLine(0, 0, nullptr, 0); recordSourceLine(0, 0, nullptr, 0);
}
} }
return;
} }
// We have a new, explicit location.
unsigned Flags = 0;
PrevInstLoc = DL;
if (DL == PrologEndLoc) {
Flags |= DWARF2_FLAG_PROLOGUE_END | DWARF2_FLAG_IS_STMT;
PrologEndLoc = DebugLoc();
}
if (DL.getLine() !=
Asm->OutStreamer->getContext().getCurrentDwarfLoc().getLine())
Flags |= DWARF2_FLAG_IS_STMT;
const MDNode *Scope = DL.getScope();
recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags);
} }
static DebugLoc findPrologueEndLoc(const MachineFunction *MF) { static DebugLoc findPrologueEndLoc(const MachineFunction *MF) {