[llvm-commits] [llvm] r88697 - in /llvm/trunk: lib/CodeGen/AsmPrinter/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPrinter/ lib/Target/Blackfin/AsmPrinter/ lib/Target/CellSPU/AsmPrinter/ lib/Target/MSP430/AsmPrinter/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/AsmPrinter/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/AsmPrinter/ lib/Target/SystemZ/AsmPrinter/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/AsmPrinter/ test/FrontendC++/
David Greene
greened at obbligato.org
Fri Nov 13 13:34:57 PST 2009
Author: greened
Date: Fri Nov 13 15:34:57 2009
New Revision: 88697
URL: http://llvm.org/viewvc/llvm-project?rev=88697&view=rev
Log:
Move DebugInfo checks into EmitComments and remove them from
target-specific AsmPrinters. Not all comments need DebugInfo.
Re-enable the line numbers comment test.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -18,6 +18,7 @@
#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"
@@ -35,6 +36,7 @@
#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"
@@ -1822,21 +1824,28 @@
/// 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;
+
+ 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;
+ }
- // 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;
}
/// PrintChildLoopComment - Print comments about child loops within
@@ -1867,8 +1876,7 @@
}
/// 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);
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -1086,7 +1086,7 @@
printInstruction(MI);
}
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*MI);
O << '\n';
processDebugLoc(MI, false);
Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -178,7 +178,7 @@
processDebugLoc(II, true);
printInstruction(II);
- if (VerboseAsm && !II->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*II);
O << '\n';
processDebugLoc(II, false);
Modified: llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -143,7 +143,7 @@
processDebugLoc(II, true);
printInstruction(II);
- if (VerboseAsm && !II->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*II);
O << '\n';
Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -406,7 +406,7 @@
++EmittedInsts;
processDebugLoc(MI, true);
printInstruction(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*MI);
processDebugLoc(MI, false);
O << '\n';
Modified: llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -239,7 +239,7 @@
printInstructionThroughMCStreamer(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*MI);
O << '\n';
Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -282,7 +282,7 @@
// Print the assembly for the instruction.
printInstruction(II);
- if (VerboseAsm && !II->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*II);
O << '\n';
Modified: llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -46,7 +46,7 @@
bool PIC16AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
processDebugLoc(MI, true);
printInstruction(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*MI);
O << '\n';
processDebugLoc(MI, false);
Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -594,7 +594,7 @@
printInstruction(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*MI);
O << '\n';
Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -126,7 +126,7 @@
processDebugLoc(II, true);
printInstruction(II);
- if (VerboseAsm && !II->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*II);
O << '\n';
processDebugLoc(II, false);
Modified: llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -155,7 +155,7 @@
// Call the autogenerated instruction printer routines.
printInstruction(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*MI);
O << '\n';
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -651,7 +651,7 @@
printInstructionThroughMCStreamer(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*MI);
O << '\n';
Modified: llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp Fri Nov 13 15:34:57 2009
@@ -361,7 +361,7 @@
return;
}
printInstruction(MI);
- if (VerboseAsm && !MI->getDebugLoc().isUnknown())
+ if (VerboseAsm)
EmitComments(*MI);
O << '\n';
Modified: llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2009-07-15-LineNumbers.cpp?rev=88697&r1=88696&r2=88697&view=diff
==============================================================================
--- llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp (original)
+++ llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp Fri Nov 13 15:34:57 2009
@@ -2,7 +2,6 @@
// 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}
-// XFAIL: *
#include <stdlib.h>
More information about the llvm-commits
mailing list