Put code that generates debug labels into TableGen so that it can be used by

everyone.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64978 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2009-02-18 23:12:06 +00:00
parent f570e621ab
commit cb819f13d7
9 changed files with 26 additions and 25 deletions

View File

@ -51,17 +51,17 @@ namespace llvm {
///
unsigned FunctionNumber;
/// DW -This is needed because printDeclare() has to insert
/// DbgVariable entries into the dwarf table. This is a short term hack
/// that ought be fixed soon.
DwarfWriter *DW;
// GCMetadataPrinters - The garbage collection metadata printer table.
typedef DenseMap<GCStrategy*,GCMetadataPrinter*> gcp_map_type;
typedef gcp_map_type::iterator gcp_iterator;
gcp_map_type GCMetadataPrinters;
protected:
/// DW -This is needed because printDeclare() has to insert
/// DbgVariable entries into the dwarf table. This is a short term hack
/// that ought be fixed soon.
DwarfWriter *DW;
// Necessary for external weak linkage support
std::set<const GlobalValue*> ExtWeakSymbols;

View File

@ -20,6 +20,7 @@
#include "llvm/Type.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/Compiler.h"

View File

@ -22,6 +22,7 @@
#include "llvm/Module.h"
#include "llvm/Type.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetMachine.h"

View File

@ -23,6 +23,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFrameInfo.h"

View File

@ -14,12 +14,13 @@
#include "PIC16AsmPrinter.h"
#include "PIC16TargetAsmInfo.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Mangler.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/Module.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Mangler.h"
using namespace llvm;

View File

@ -19,6 +19,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h"

View File

@ -26,6 +26,7 @@
#include "llvm/Type.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/Support/Mangler.h"
#include "llvm/Support/raw_ostream.h"
@ -725,23 +726,6 @@ bool X86ATTAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
++EmittedInsts;
if (TAI->doesSupportDebugInformation()) {
const Function *F = MF->getFunction();
// FIXME: Support more than '-Os'.
if (F->hasFnAttr(Attribute::OptimizeForSize)) {
static DebugLoc PrevDL = DebugLoc::getUnknownLoc();
DebugLoc CurDL = MI->getDebugLoc();
if (!CurDL.isUnknown() && PrevDL != CurDL) {
DebugLocTuple DLT = MF->getDebugLocTuple(CurDL);
printLabel(DW->RecordSourceLine(DLT.Line, DLT.Col, DLT.Src));
}
PrevDL = CurDL;
}
}
// Call the autogenerated instruction printer routines.
printInstruction(MI);
}

View File

@ -25,6 +25,7 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/Support/Mangler.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetOptions.h"

View File

@ -640,6 +640,17 @@ void AsmWriterEmitter::run(std::ostream &O) {
}
O << "\";\n\n";
O << " {\n"
<< " const MachineFunction *MF = MI->getParent()->getParent();\n"
<< " static DebugLoc PrevDL = DebugLoc::getUnknownLoc();\n"
<< " DebugLoc CurDL = MI->getDebugLoc();\n\n"
<< " if (!CurDL.isUnknown() && PrevDL != CurDL) {\n"
<< " DebugLocTuple DLT = MF->getDebugLocTuple(CurDL);\n"
<< " printLabel(DW->RecordSourceLine(DLT.Line, DLT.Col, DLT.Src));\n"
<< " }\n\n"
<< " PrevDL = CurDL;\n"
<< " }\n";
O << " if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {\n"
<< " O << \"\\t\";\n"
<< " printInlineAsm(MI);\n"