target-specific AsmPrinters. Not all comments need DebugInfo.
Re-enable the line numbers comment test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88697
91177308-0d34-0410-b5e6-
96231b3b80d8
14 files changed:
#include "llvm/Module.h"
#include "llvm/CodeGen/GCMetadataPrinter.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/Module.h"
#include "llvm/CodeGen/GCMetadataPrinter.h"
#include "llvm/CodeGen/MachineConstantPool.h"
+#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/Support/Mangler.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/Mangler.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetOptions.h"
/// EmitComments - Pretty-print comments for instructions
void AsmPrinter::EmitComments(const MachineInstr &MI) const {
/// EmitComments - Pretty-print comments for instructions
void AsmPrinter::EmitComments(const MachineInstr &MI) const {
- assert(VerboseAsm && !MI.getDebugLoc().isUnknown());
-
- DebugLocTuple DLT = MF->getDebugLocTuple(MI.getDebugLoc());
+ if (!VerboseAsm)
+ return;
- // Print source line info.
- O.PadToColumn(MAI->getCommentColumn());
- O << MAI->getCommentString() << " SrcLine ";
- if (DLT.Scope) {
- DICompileUnit CU(DLT.Scope);
- if (!CU.isNull())
- O << CU.getFilename() << " ";
+ bool Newline = false;
+
+ if (!MI.getDebugLoc().isUnknown()) {
+ DebugLocTuple DLT = MF->getDebugLocTuple(MI.getDebugLoc());
+
+ // Print source line info.
+ O.PadToColumn(MAI->getCommentColumn());
+ O << MAI->getCommentString() << " SrcLine ";
+ if (DLT.Scope) {
+ DICompileUnit CU(DLT.Scope);
+ if (!CU.isNull())
+ O << CU.getFilename() << " ";
+ }
+ O << DLT.Line;
+ if (DLT.Col != 0)
+ O << ":" << DLT.Col;
+ Newline = true;
- O << DLT.Line;
- if (DLT.Col != 0)
- O << ":" << DLT.Col;
}
/// PrintChildLoopComment - Print comments about child loops within
}
/// PrintChildLoopComment - Print comments about child loops within
}
/// EmitComments - Pretty-print comments for basic blocks
}
/// EmitComments - Pretty-print comments for basic blocks
-void AsmPrinter::EmitComments(const MachineBasicBlock &MBB) const
-{
+void AsmPrinter::EmitComments(const MachineBasicBlock &MBB) const {
if (VerboseAsm) {
// Add loop depth information
const MachineLoop *loop = LI->getLoopFor(&MBB);
if (VerboseAsm) {
// Add loop depth information
const MachineLoop *loop = LI->getLoopFor(&MBB);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
EmitComments(*MI);
O << '\n';
processDebugLoc(MI, false);
EmitComments(*MI);
O << '\n';
processDebugLoc(MI, false);
processDebugLoc(II, true);
printInstruction(II);
processDebugLoc(II, true);
printInstruction(II);
- if (VerboseAsm && !II->getDebugLoc().isUnknown())
EmitComments(*II);
O << '\n';
processDebugLoc(II, false);
EmitComments(*II);
O << '\n';
processDebugLoc(II, false);
processDebugLoc(II, true);
printInstruction(II);
processDebugLoc(II, true);
printInstruction(II);
- if (VerboseAsm && !II->getDebugLoc().isUnknown())
EmitComments(*II);
O << '\n';
EmitComments(*II);
O << '\n';
++EmittedInsts;
processDebugLoc(MI, true);
printInstruction(MI);
++EmittedInsts;
processDebugLoc(MI, true);
printInstruction(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
EmitComments(*MI);
processDebugLoc(MI, false);
O << '\n';
EmitComments(*MI);
processDebugLoc(MI, false);
O << '\n';
printInstructionThroughMCStreamer(MI);
printInstructionThroughMCStreamer(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
EmitComments(*MI);
O << '\n';
EmitComments(*MI);
O << '\n';
// Print the assembly for the instruction.
printInstruction(II);
// Print the assembly for the instruction.
printInstruction(II);
- if (VerboseAsm && !II->getDebugLoc().isUnknown())
EmitComments(*II);
O << '\n';
EmitComments(*II);
O << '\n';
bool PIC16AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
processDebugLoc(MI, true);
printInstruction(MI);
bool PIC16AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
processDebugLoc(MI, true);
printInstruction(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
EmitComments(*MI);
O << '\n';
processDebugLoc(MI, false);
EmitComments(*MI);
O << '\n';
processDebugLoc(MI, false);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
EmitComments(*MI);
O << '\n';
EmitComments(*MI);
O << '\n';
processDebugLoc(II, true);
printInstruction(II);
processDebugLoc(II, true);
printInstruction(II);
- if (VerboseAsm && !II->getDebugLoc().isUnknown())
EmitComments(*II);
O << '\n';
processDebugLoc(II, false);
EmitComments(*II);
O << '\n';
processDebugLoc(II, false);
// Call the autogenerated instruction printer routines.
printInstruction(MI);
// Call the autogenerated instruction printer routines.
printInstruction(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
EmitComments(*MI);
O << '\n';
EmitComments(*MI);
O << '\n';
printInstructionThroughMCStreamer(MI);
printInstructionThroughMCStreamer(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
EmitComments(*MI);
O << '\n';
EmitComments(*MI);
O << '\n';
return;
}
printInstruction(MI);
return;
}
printInstruction(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
EmitComments(*MI);
O << '\n';
EmitComments(*MI);
O << '\n';
// print line numbers in asm.
// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \
// RUN: llc --disable-fp-elim -O0 -relocation-model=pic | grep {# SrcLine 25}
// print line numbers in asm.
// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \
// RUN: llc --disable-fp-elim -O0 -relocation-model=pic | grep {# SrcLine 25}