Skip to content

Commit

Permalink
[CodeGen] Add a way to SkipDebugLoc in MachineInstr::print(). NFC.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296007 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
ahmedbougacha committed Feb 23, 2017
1 parent 33f4d46 commit 9628c84
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion include/llvm/CodeGen/MachineInstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1149,9 +1149,10 @@ class MachineInstr
//
// Debugging support
//
void print(raw_ostream &OS, bool SkipOpers = false,
void print(raw_ostream &OS, bool SkipOpers = false, bool SkipDebugLoc = false,
const TargetInstrInfo *TII = nullptr) const;
void print(raw_ostream &OS, ModuleSlotTracker &MST, bool SkipOpers = false,
bool SkipDebugLoc = false,
const TargetInstrInfo *TII = nullptr) const;
void dump() const;

Expand Down
9 changes: 5 additions & 4 deletions lib/CodeGen/MachineInstr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1699,19 +1699,20 @@ LLVM_DUMP_METHOD void MachineInstr::dump() const {
}
#endif

void MachineInstr::print(raw_ostream &OS, bool SkipOpers,
void MachineInstr::print(raw_ostream &OS, bool SkipOpers, bool SkipDebugLoc,
const TargetInstrInfo *TII) const {
const Module *M = nullptr;
if (const MachineBasicBlock *MBB = getParent())
if (const MachineFunction *MF = MBB->getParent())
M = MF->getFunction()->getParent();

ModuleSlotTracker MST(M);
print(OS, MST, SkipOpers, TII);
print(OS, MST, SkipOpers, SkipDebugLoc, TII);
}

void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
bool SkipOpers, const TargetInstrInfo *TII) const {
bool SkipOpers, bool SkipDebugLoc,
const TargetInstrInfo *TII) const {
// We can be a bit tidier if we know the MachineFunction.
const MachineFunction *MF = nullptr;
const TargetRegisterInfo *TRI = nullptr;
Expand Down Expand Up @@ -1987,7 +1988,7 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
}
if (isIndirectDebugValue())
OS << " indirect";
} else if (debugLoc && MF) {
} else if (debugLoc && MF && !SkipDebugLoc) {
if (!HaveSemi)
OS << ";";
OS << " dbg:";
Expand Down

0 comments on commit 9628c84

Please sign in to comment.