mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
change AsmPrinter to use DwarfDebug/DwarfException directly
instead of going through DwarfWriter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100405 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -42,14 +42,15 @@ namespace llvm {
|
|||||||
class MachineJumpTableInfo;
|
class MachineJumpTableInfo;
|
||||||
class MachineModuleInfo;
|
class MachineModuleInfo;
|
||||||
class MachineMove;
|
class MachineMove;
|
||||||
|
class MCAsmInfo;
|
||||||
class MCInst;
|
class MCInst;
|
||||||
class MCContext;
|
class MCContext;
|
||||||
class MCSection;
|
class MCSection;
|
||||||
class MCStreamer;
|
class MCStreamer;
|
||||||
class MCSymbol;
|
class MCSymbol;
|
||||||
class DwarfWriter;
|
class DwarfDebug;
|
||||||
|
class DwarfException;
|
||||||
class Mangler;
|
class Mangler;
|
||||||
class MCAsmInfo;
|
|
||||||
class TargetLoweringObjectFile;
|
class TargetLoweringObjectFile;
|
||||||
class TargetData;
|
class TargetData;
|
||||||
class Twine;
|
class Twine;
|
||||||
@ -59,9 +60,6 @@ namespace llvm {
|
|||||||
/// asm writers.
|
/// asm writers.
|
||||||
class AsmPrinter : public MachineFunctionPass {
|
class AsmPrinter : public MachineFunctionPass {
|
||||||
public:
|
public:
|
||||||
/// DW - If available, this is a pointer to the current dwarf writer.
|
|
||||||
DwarfWriter *DW;
|
|
||||||
|
|
||||||
/// Target machine description.
|
/// Target machine description.
|
||||||
///
|
///
|
||||||
TargetMachine &TM;
|
TargetMachine &TM;
|
||||||
@ -107,8 +105,14 @@ namespace llvm {
|
|||||||
|
|
||||||
/// If VerboseAsm is set, a pointer to the loop info for this
|
/// If VerboseAsm is set, a pointer to the loop info for this
|
||||||
/// function.
|
/// function.
|
||||||
///
|
|
||||||
MachineLoopInfo *LI;
|
MachineLoopInfo *LI;
|
||||||
|
|
||||||
|
/// DD - If the target supports dwarf debug info, this pointer is non-null.
|
||||||
|
DwarfDebug *DD;
|
||||||
|
|
||||||
|
/// DE - If the target supports dwarf exception info, this pointer is
|
||||||
|
/// non-null.
|
||||||
|
DwarfException *DE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit AsmPrinter(TargetMachine &TM, MCStreamer &Streamer);
|
explicit AsmPrinter(TargetMachine &TM, MCStreamer &Streamer);
|
||||||
|
@ -13,8 +13,9 @@
|
|||||||
|
|
||||||
#define DEBUG_TYPE "asm-printer"
|
#define DEBUG_TYPE "asm-printer"
|
||||||
#include "llvm/CodeGen/AsmPrinter.h"
|
#include "llvm/CodeGen/AsmPrinter.h"
|
||||||
|
#include "DwarfDebug.h"
|
||||||
|
#include "DwarfException.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/CodeGen/DwarfWriter.h"
|
|
||||||
#include "llvm/CodeGen/GCMetadataPrinter.h"
|
#include "llvm/CodeGen/GCMetadataPrinter.h"
|
||||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||||
@ -62,12 +63,14 @@ AsmPrinter::AsmPrinter(TargetMachine &tm, MCStreamer &Streamer)
|
|||||||
OutContext(Streamer.getContext()),
|
OutContext(Streamer.getContext()),
|
||||||
OutStreamer(Streamer),
|
OutStreamer(Streamer),
|
||||||
LastMI(0), LastFn(0), Counter(~0U), SetCounter(0) {
|
LastMI(0), LastFn(0), Counter(~0U), SetCounter(0) {
|
||||||
DW = 0; MMI = 0; LI = 0;
|
DD = 0; DE = 0; MMI = 0; LI = 0;
|
||||||
GCMetadataPrinters = 0;
|
GCMetadataPrinters = 0;
|
||||||
VerboseAsm = Streamer.isVerboseAsm();
|
VerboseAsm = Streamer.isVerboseAsm();
|
||||||
}
|
}
|
||||||
|
|
||||||
AsmPrinter::~AsmPrinter() {
|
AsmPrinter::~AsmPrinter() {
|
||||||
|
assert(DD == 0 && DE == 0 && "Debug/EH info didn't get finalized");
|
||||||
|
|
||||||
if (GCMetadataPrinters != 0) {
|
if (GCMetadataPrinters != 0) {
|
||||||
gcp_map_type &GCMap = getGCMap(GCMetadataPrinters);
|
gcp_map_type &GCMap = getGCMap(GCMetadataPrinters);
|
||||||
|
|
||||||
@ -108,7 +111,6 @@ void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
|
|||||||
MachineFunctionPass::getAnalysisUsage(AU);
|
MachineFunctionPass::getAnalysisUsage(AU);
|
||||||
AU.addRequired<MachineModuleInfo>();
|
AU.addRequired<MachineModuleInfo>();
|
||||||
AU.addRequired<GCModuleInfo>();
|
AU.addRequired<GCModuleInfo>();
|
||||||
AU.addRequired<DwarfWriter>();
|
|
||||||
if (isVerbose())
|
if (isVerbose())
|
||||||
AU.addRequired<MachineLoopInfo>();
|
AU.addRequired<MachineLoopInfo>();
|
||||||
}
|
}
|
||||||
@ -148,9 +150,11 @@ bool AsmPrinter::doInitialization(Module &M) {
|
|||||||
OutStreamer.AddBlankLine();
|
OutStreamer.AddBlankLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
if (MAI->doesSupportDebugInformation())
|
||||||
if (DW)
|
DD = new DwarfDebug(this, &M);
|
||||||
DW->BeginModule(&M, this);
|
|
||||||
|
if (MAI->doesSupportExceptionHandling())
|
||||||
|
DE = new DwarfException(this);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -344,8 +348,8 @@ void AsmPrinter::EmitFunctionHeader() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit pre-function debug and/or EH information.
|
// Emit pre-function debug and/or EH information.
|
||||||
if (MAI->doesSupportDebugInformation() || MAI->doesSupportExceptionHandling())
|
if (DE) DE->BeginFunction(MF);
|
||||||
DW->BeginFunction(MF);
|
if (DD) DD->beginFunction(MF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitFunctionEntryLabel - Emit the label that is the entrypoint for the
|
/// EmitFunctionEntryLabel - Emit the label that is the entrypoint for the
|
||||||
@ -439,8 +443,7 @@ void AsmPrinter::EmitFunctionBody() {
|
|||||||
// Emit target-specific gunk before the function body.
|
// Emit target-specific gunk before the function body.
|
||||||
EmitFunctionBodyStart();
|
EmitFunctionBodyStart();
|
||||||
|
|
||||||
bool ShouldPrintDebugScopes =
|
bool ShouldPrintDebugScopes = DD && MMI->hasDebugInfo();
|
||||||
DW && MAI->doesSupportDebugInformation() &&DW->ShouldEmitDwarfDebug();
|
|
||||||
|
|
||||||
// Print out code for the function.
|
// Print out code for the function.
|
||||||
bool HasAnyRealCode = false;
|
bool HasAnyRealCode = false;
|
||||||
@ -457,7 +460,7 @@ void AsmPrinter::EmitFunctionBody() {
|
|||||||
++EmittedInsts;
|
++EmittedInsts;
|
||||||
|
|
||||||
if (ShouldPrintDebugScopes)
|
if (ShouldPrintDebugScopes)
|
||||||
DW->BeginScope(II);
|
DD->beginScope(II);
|
||||||
|
|
||||||
if (isVerbose())
|
if (isVerbose())
|
||||||
EmitComments(*II, OutStreamer.GetCommentOS());
|
EmitComments(*II, OutStreamer.GetCommentOS());
|
||||||
@ -483,7 +486,7 @@ void AsmPrinter::EmitFunctionBody() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ShouldPrintDebugScopes)
|
if (ShouldPrintDebugScopes)
|
||||||
DW->EndScope(II);
|
DD->endScope(II);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,8 +515,9 @@ void AsmPrinter::EmitFunctionBody() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit post-function debug information.
|
// Emit post-function debug information.
|
||||||
if (MAI->doesSupportDebugInformation() || MAI->doesSupportExceptionHandling())
|
if (DD) DD->endFunction(MF);
|
||||||
DW->EndFunction(MF);
|
if (DE) DE->EndFunction();
|
||||||
|
MMI->EndFunction();
|
||||||
|
|
||||||
// Print out jump tables referenced by the function.
|
// Print out jump tables referenced by the function.
|
||||||
EmitJumpTableInfo();
|
EmitJumpTableInfo();
|
||||||
@ -528,9 +532,15 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
EmitGlobalVariable(I);
|
EmitGlobalVariable(I);
|
||||||
|
|
||||||
// Emit final debug information.
|
// Finalize debug and EH information.
|
||||||
if (MAI->doesSupportDebugInformation() || MAI->doesSupportExceptionHandling())
|
if (DE) {
|
||||||
DW->EndModule();
|
DE->EndModule();
|
||||||
|
delete DE; DE = 0;
|
||||||
|
}
|
||||||
|
if (DD) {
|
||||||
|
DD->endModule();
|
||||||
|
delete DD; DD = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// If the target wants to know about weak references, print them all.
|
// If the target wants to know about weak references, print them all.
|
||||||
if (MAI->getWeakRefDirective()) {
|
if (MAI->getWeakRefDirective()) {
|
||||||
@ -594,7 +604,7 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
EmitEndOfAsmFile(M);
|
EmitEndOfAsmFile(M);
|
||||||
|
|
||||||
delete Mang; Mang = 0;
|
delete Mang; Mang = 0;
|
||||||
DW = 0; MMI = 0;
|
MMI = 0;
|
||||||
|
|
||||||
OutStreamer.Finish();
|
OutStreamer.Finish();
|
||||||
return false;
|
return false;
|
||||||
|
@ -299,7 +299,7 @@ DbgScope::~DbgScope() {
|
|||||||
delete Variables[j];
|
delete Variables[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
DwarfDebug::DwarfDebug(AsmPrinter *A)
|
DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
|
||||||
: Asm(A), MMI(Asm->MMI), ModuleCU(0),
|
: Asm(A), MMI(Asm->MMI), ModuleCU(0),
|
||||||
AbbreviationsSet(InitAbbreviationsSetSize),
|
AbbreviationsSet(InitAbbreviationsSetSize),
|
||||||
CurrentFnDbgScope(0), DebugTimer(0) {
|
CurrentFnDbgScope(0), DebugTimer(0) {
|
||||||
@ -310,6 +310,8 @@ DwarfDebug::DwarfDebug(AsmPrinter *A)
|
|||||||
|
|
||||||
if (TimePassesIsEnabled)
|
if (TimePassesIsEnabled)
|
||||||
DebugTimer = new Timer("Dwarf Debug Writer");
|
DebugTimer = new Timer("Dwarf Debug Writer");
|
||||||
|
|
||||||
|
beginModule(M);
|
||||||
}
|
}
|
||||||
DwarfDebug::~DwarfDebug() {
|
DwarfDebug::~DwarfDebug() {
|
||||||
for (unsigned j = 0, M = DIEBlocks.size(); j < M; ++j)
|
for (unsigned j = 0, M = DIEBlocks.size(); j < M; ++j)
|
||||||
@ -1791,9 +1793,6 @@ void DwarfDebug::constructSubprogramDIE(MDNode *N) {
|
|||||||
/// content. Create global DIEs and emit initial debug info sections.
|
/// content. Create global DIEs and emit initial debug info sections.
|
||||||
/// This is inovked by the target AsmPrinter.
|
/// This is inovked by the target AsmPrinter.
|
||||||
void DwarfDebug::beginModule(Module *M) {
|
void DwarfDebug::beginModule(Module *M) {
|
||||||
if (!Asm->MAI->doesSupportDebugInformation())
|
|
||||||
return;
|
|
||||||
|
|
||||||
MMI = Asm->MMI;
|
MMI = Asm->MMI;
|
||||||
|
|
||||||
TimeRegion Timer(DebugTimer);
|
TimeRegion Timer(DebugTimer);
|
||||||
|
@ -513,7 +513,7 @@ public:
|
|||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// Main entry points.
|
// Main entry points.
|
||||||
//
|
//
|
||||||
DwarfDebug(AsmPrinter *A);
|
DwarfDebug(AsmPrinter *A, Module *M);
|
||||||
virtual ~DwarfDebug();
|
virtual ~DwarfDebug();
|
||||||
|
|
||||||
/// beginModule - Emit all Dwarf sections that should come prior to the
|
/// beginModule - Emit all Dwarf sections that should come prior to the
|
||||||
|
@ -38,8 +38,7 @@ DwarfWriter::~DwarfWriter() {
|
|||||||
/// content.
|
/// content.
|
||||||
void DwarfWriter::BeginModule(Module *M, AsmPrinter *A) {
|
void DwarfWriter::BeginModule(Module *M, AsmPrinter *A) {
|
||||||
DE = new DwarfException(A);
|
DE = new DwarfException(A);
|
||||||
DD = new DwarfDebug(A);
|
DD = new DwarfDebug(A, M);
|
||||||
DD->beginModule(M);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EndModule - Emit all Dwarf sections that should come after the content.
|
/// EndModule - Emit all Dwarf sections that should come after the content.
|
||||||
|
Reference in New Issue
Block a user