aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-07-16 22:24:20 +0000
committerDavid Greene <greened@obbligato.org>2009-07-16 22:24:20 +0000
commit4a37a69ef65bf725dd9a434b070d6f3b45fed42d (patch)
tree216cc9545f5ee1e4eced9d606b59747324b2be5c /lib/CodeGen
parentfb673735323c41ff1d7f71a7864596be570b2c07 (diff)
downloadexternal_llvm-4a37a69ef65bf725dd9a434b070d6f3b45fed42d.zip
external_llvm-4a37a69ef65bf725dd9a434b070d6f3b45fed42d.tar.gz
external_llvm-4a37a69ef65bf725dd9a434b070d6f3b45fed42d.tar.bz2
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')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 8c6ed50..7a5d24c 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;
+ }
}