#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"
/// 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;
+ }
}
}