aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-09 23:14:36 +0000
committerChris Lattner <sabre@nondot.org>2009-09-09 23:14:36 +0000
commit32d4cc74e1075b6d9f77c75ff6099784ad4f15b2 (patch)
treea22608a7ab76b9f161d5fde04df21b5443afbe66 /lib/CodeGen
parentc53c4e5693d079829a7a78d662e691217aaf190f (diff)
downloadexternal_llvm-32d4cc74e1075b6d9f77c75ff6099784ad4f15b2.zip
external_llvm-32d4cc74e1075b6d9f77c75ff6099784ad4f15b2.tar.gz
external_llvm-32d4cc74e1075b6d9f77c75ff6099784ad4f15b2.tar.bz2
remove DebugLoc from MCInst and eliminate "Comment printing" from
the MCInst path of the asmprinter. Instead, pull comment printing out of the autogenerated asmprinter into each target that uses the autogenerated asmprinter. This causes code duplication into each target, but in a way that will be easier to clean up later when more asmprinter stuff is commonized into the base AsmPrinter class. This also fixes an xcore strangeness where it inserted two tabs before every instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp42
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp1
2 files changed, 11 insertions, 32 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index e4d8ef0..3e8c913 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1390,9 +1390,11 @@ void AsmPrinter::processDebugLoc(DebugLoc DL) {
if (!DL.isUnknown()) {
DebugLocTuple CurDLT = MF->getDebugLocTuple(DL);
- if (CurDLT.CompileUnit != 0 && PrevDLT != CurDLT)
+ if (CurDLT.CompileUnit != 0 && PrevDLT != CurDLT) {
printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,
DICompileUnit(CurDLT.CompileUnit)));
+ O << '\n';
+ }
PrevDLT = CurDLT;
}
@@ -1594,17 +1596,16 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
}
}
}
- O << "\n\t" << MAI->getCommentString() << MAI->getInlineAsmEnd() << '\n';
+ O << "\n\t" << MAI->getCommentString() << MAI->getInlineAsmEnd();
}
/// printImplicitDef - This method prints the specified machine instruction
/// that is an implicit def.
void AsmPrinter::printImplicitDef(const MachineInstr *MI) const {
- if (VerboseAsm) {
- O.PadToColumn(MAI->getCommentColumn());
- O << MAI->getCommentString() << " implicit-def: "
- << TRI->getAsmName(MI->getOperand(0).getReg()) << '\n';
- }
+ if (!VerboseAsm) return;
+ O.PadToColumn(MAI->getCommentColumn());
+ O << MAI->getCommentString() << " implicit-def: "
+ << TRI->getAsmName(MI->getOperand(0).getReg());
}
/// printLabel - This method prints a local label used by debug and
@@ -1614,7 +1615,7 @@ void AsmPrinter::printLabel(const MachineInstr *MI) const {
}
void AsmPrinter::printLabel(unsigned Id) const {
- O << MAI->getPrivateGlobalPrefix() << "label" << Id << ":\n";
+ O << MAI->getPrivateGlobalPrefix() << "label" << Id << ':';
}
/// PrintAsmOperand - Print the specified operand of MI, an INLINEASM
@@ -1780,9 +1781,7 @@ GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) {
/// EmitComments - Pretty-print comments for instructions
void AsmPrinter::EmitComments(const MachineInstr &MI) const {
- if (!VerboseAsm ||
- MI.getDebugLoc().isUnknown())
- return;
+ assert(VerboseAsm && !MI.getDebugLoc().isUnknown());
DebugLocTuple DLT = MF->getDebugLocTuple(MI.getDebugLoc());
@@ -1799,27 +1798,6 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const {
O << ":" << DLT.Col;
}
-/// EmitComments - Pretty-print comments for instructions
-void AsmPrinter::EmitComments(const MCInst &MI) const {
- if (!VerboseAsm ||
- MI.getDebugLoc().isUnknown())
- return;
-
- DebugLocTuple DLT = MF->getDebugLocTuple(MI.getDebugLoc());
-
- // Print source line info
- O.PadToColumn(MAI->getCommentColumn());
- O << MAI->getCommentString() << " SrcLine ";
- if (DLT.CompileUnit) {
- std::string Str;
- DICompileUnit CU(DLT.CompileUnit);
- O << CU.getFilename(Str) << " ";
- }
- O << DLT.Line;
- if (DLT.Col != 0)
- O << ":" << DLT.Col;
-}
-
/// PrintChildLoopComment - Print comments about child loops within
/// the loop for this basic block, with nesting.
///
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index bc4333d..29446a4 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1709,6 +1709,7 @@ void DwarfDebug::BeginFunction(MachineFunction *MF) {
unsigned LabelID = RecordSourceLine(DLT.Line, DLT.Col,
DICompileUnit(DLT.CompileUnit));
Asm->printLabel(LabelID);
+ O << '\n';
}
if (TimePassesIsEnabled)