Move DebugInfo checks into EmitComments and remove them from

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
This commit is contained in:
David Greene
2009-11-13 21:34:57 +00:00
parent c4c550c758
commit 1924aabf99
14 changed files with 35 additions and 28 deletions

View File

@ -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 @@ GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) {
/// 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
@ -1867,8 +1876,7 @@ static void PrintChildLoopComment(formatted_raw_ostream &O,
}
/// 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);