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 | de9cd44ed800072a9fee1648f89c4962be9c3128 (patch) | |
tree | e1c72eba52d3f13efe3b03f1de2737fba2b196ef /llvm/lib/CodeGen | |
parent | 69ab416d66fbf62e2f5b91b0814f4b7eab436c3d (diff) | |
download | bcm5719-llvm-de9cd44ed800072a9fee1648f89c4962be9c3128.tar.gz bcm5719-llvm-de9cd44ed800072a9fee1648f89c4962be9c3128.zip |
Emit line numbers in asm comments when available.
llvm-svn: 76117
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 8c6ed504d0d..7a5d24c761e 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/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; + } } |