diff options
author | David Greene <greened@obbligato.org> | 2009-07-16 22:24:20 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2009-07-16 22:24:20 +0000 |
commit | 3ac1ab835caacdeebbd0d7b4d69160f283928d21 (patch) | |
tree | 216cc9545f5ee1e4eced9d606b59747324b2be5c /lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | aad3fb7362aff151e97ad457005ea3f2872fe868 (diff) |
Emit line numbers in asm comments when available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76117 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 8c6ed504d0..7a5d24c761 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -22,6 +22,7 @@ #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/Analysis/DebugInfo.h" +#include "llvm/MC/MCInst.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" @@ -1731,11 +1732,23 @@ GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) { /// EmitComments - Pretty-print comments for instructions void AsmPrinter::EmitComments(const MachineInstr &MI) const { - // No comments in MachineInstr yet + if (!MI.getDebugLoc().isUnknown()) { + DebugLocTuple DLT = MF->getDebugLocTuple(MI.getDebugLoc()); + + // Print source line info + O.PadToColumn(TAI->getCommentColumn(), 1); + O << TAI->getCommentString() << " SrcLine " << DLT.Line << ":" << DLT.Col; + } } /// EmitComments - Pretty-print comments for instructions void AsmPrinter::EmitComments(const MCInst &MI) const { - // No comments in MCInst yet + if (!MI.getDebugLoc().isUnknown()) { + DebugLocTuple DLT = MF->getDebugLocTuple(MI.getDebugLoc()); + + // Print source line info + O.PadToColumn(TAI->getCommentColumn(), 1); + O << TAI->getCommentString() << " SrcLine " << DLT.Line << ":" << DLT.Col; + } } |