diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2018-04-24 11:00:46 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2018-04-24 11:00:46 +0000 |
commit | 8ed0f741ae3c35bc95c724d867c769934df8373f (patch) | |
tree | e12f23f0d7adfe266b169ba30fb9149f07155982 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | fdfeefd6c29b2f26b69c63bd0a90a9915b94d956 (diff) | |
download | bcm5719-llvm-8ed0f741ae3c35bc95c724d867c769934df8373f.tar.gz bcm5719-llvm-8ed0f741ae3c35bc95c724d867c769934df8373f.zip |
[CodeGen] Print user-friendly debug locations as MI comments
If available, print the file, line and column of the DebugLoc attached
to the MachineInstr:
MOV16mr $rbp, 1, $noreg, -112, $noreg, killed renamable $ax, debug-location !56 :: (store 2 into %ir.._value12); stepping.swift:10:17
renamable $edx = MOVZX32rm16 $rbp, 1, $noreg, -112, $noreg, debug-location !62 :: (dereferenceable load 2 from %ir.._value13); stepping.swift:10:17
Differential Revision: https://reviews.llvm.org/D45992
llvm-svn: 330709
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index d3a09f06ebd..6ca8ead1c77 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1469,10 +1469,23 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST, return; bool HaveSemi = false; + // Print debug location information. + if (const DebugLoc &DL = getDebugLoc()) { + if (!HaveSemi) { + OS << ';'; + HaveSemi = true; + } + OS << ' '; + DL.print(OS); + } + + // Print extra comments for DEBUG_VALUE. if (isDebugValue() && getOperand(e - 2).isMetadata()) { - if (!HaveSemi) + if (!HaveSemi) { OS << ";"; + HaveSemi = true; + } auto *DV = cast<DILocalVariable>(getOperand(e - 2).getMetadata()); OS << " line no:" << DV->getLine(); if (auto *InlinedAt = debugLoc->getInlinedAt()) { |