From: Argyrios Kyrtzidis Date: Thu, 7 May 2009 13:55:51 +0000 (+0000) Subject: Move the tablegen-produced DebugLoc handling into a AsmWriter::processDebugLoc function. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cd76240f3d0f6c5f8c80e4762a8fe3a4de22e059;p=oota-llvm.git Move the tablegen-produced DebugLoc handling into a AsmWriter::processDebugLoc function. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71156 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 89ea72fca3f..a004632c7dd 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -18,7 +18,6 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/CodeGen/MachineFunctionPass.h" -#include "llvm/Analysis/DebugInfo.h" #include "llvm/Support/DataTypes.h" #include "llvm/Target/TargetMachine.h" #include @@ -342,6 +341,10 @@ namespace llvm { void EmitGlobalConstant(const Constant* CV, unsigned AddrSpace = 0); virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV); + + /// processDebugLoc - Processes the debug information of each machine + /// instruction's DebugLoc. + void processDebugLoc(DebugLoc DL); /// printInlineAsm - This method formats and prints the specified machine /// instruction that is an inline asm. diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 319bbdbe655..0d9d77762b7 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -21,6 +21,7 @@ #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/DwarfWriter.h" +#include "llvm/Analysis/DebugInfo.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/raw_ostream.h" @@ -1305,6 +1306,22 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) const { } } +/// processDebugLoc - Processes the debug information of each machine +/// instruction's DebugLoc. +void AsmPrinter::processDebugLoc(DebugLoc DL) { + if (TAI->doesSupportDebugInformation() && DW->ShouldEmitDwarfDebug()) { + if (!DL.isUnknown()) { + static DebugLocTuple PrevDLT(0, ~0U, ~0U); + DebugLocTuple CurDLT = MF->getDebugLocTuple(DL); + + if (CurDLT.CompileUnit != 0 && PrevDLT != CurDLT) + printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col, + DICompileUnit(CurDLT.CompileUnit))); + + PrevDLT = CurDLT; + } + } +} /// printInlineAsm - This method formats and prints the specified machine /// instruction that is an inline asm. diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp index 3937fd104a7..c615abad506 100644 --- a/utils/TableGen/AsmWriterEmitter.cpp +++ b/utils/TableGen/AsmWriterEmitter.cpp @@ -649,18 +649,7 @@ void AsmWriterEmitter::run(std::ostream &O) { } O << "\";\n\n"; - O << " if (TAI->doesSupportDebugInformation() &&\n" - << " DW->ShouldEmitDwarfDebug()) {\n" - << " DebugLoc CurDL = MI->getDebugLoc();\n\n" - << " if (!CurDL.isUnknown()) {\n" - << " static DebugLocTuple PrevDLT(0, ~0U, ~0U);\n" - << " DebugLocTuple CurDLT = MF->getDebugLocTuple(CurDL);\n\n" - << " if (CurDLT.CompileUnit != 0 && PrevDLT != CurDLT)\n" - << " printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,\n" - << " DICompileUnit(CurDLT.CompileUnit)));\n\n" - << " PrevDLT = CurDLT;\n" - << " }\n" - << " }\n\n"; + O << " processDebugLoc(MI->getDebugLoc());\n\n"; O << " if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {\n" << " O << \"\\t\";\n"