summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-07-22 20:33:26 +0000
committerDavid Greene <greened@obbligato.org>2009-07-22 20:33:26 +0000
commit6e2eda1c8d67d6eb4193b37365354cb1cd654c0a (patch)
tree89a54ee1815ccfc430e6b1d03a1678c106b8ae04 /llvm/lib
parent2729132ec35ca19ac5957179266e09bfb28d2fa3 (diff)
downloadbcm5719-llvm-6e2eda1c8d67d6eb4193b37365354cb1cd654c0a.tar.gz
bcm5719-llvm-6e2eda1c8d67d6eb4193b37365354cb1cd654c0a.zip
Put comment printing under asm-verbose.
llvm-svn: 76780
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp49
1 files changed, 36 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index e31a39c7a39..fe037058116 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -27,7 +27,6 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Mangler.h"
-#include "llvm/Support/FormattedStream.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLowering.h"
@@ -1712,23 +1711,47 @@ GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) {
/// EmitComments - Pretty-print comments for instructions
void AsmPrinter::EmitComments(const MachineInstr &MI) const
{
- 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;
+ if (VerboseAsm) {
+ if (!MI.getDebugLoc().isUnknown()) {
+ DebugLocTuple DLT = MF->getDebugLocTuple(MI.getDebugLoc());
+
+ // Print source line info
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString() << " SrcLine ";
+ if (DLT.CompileUnit->hasInitializer()) {
+ Constant *Name = DLT.CompileUnit->getInitializer();
+ if (ConstantArray *NameString = dyn_cast<ConstantArray>(Name))
+ if (NameString->isString()) {
+ O << NameString->getAsString() << " ";
+ }
+ }
+ O << DLT.Line;
+ if (DLT.Col != 0)
+ O << ":" << DLT.Col;
+ }
}
}
/// EmitComments - Pretty-print comments for instructions
void AsmPrinter::EmitComments(const MCInst &MI) const
{
- 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;
+ if (VerboseAsm) {
+ if (!MI.getDebugLoc().isUnknown()) {
+ DebugLocTuple DLT = MF->getDebugLocTuple(MI.getDebugLoc());
+
+ // Print source line info
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString() << " SrcLine ";
+ if (DLT.CompileUnit->hasInitializer()) {
+ Constant *Name = DLT.CompileUnit->getInitializer();
+ if (ConstantArray *NameString = dyn_cast<ConstantArray>(Name))
+ if (NameString->isString()) {
+ O << NameString->getAsString() << " ";
+ }
+ }
+ O << DLT.Line;
+ if (DLT.Col != 0)
+ O << ":" << DLT.Col;
+ }
}
}
OpenPOWER on IntegriCloud