mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Refine the Dwarf writer timers so that they measure exception writing and debug
writing individually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66577 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -33,7 +33,6 @@ class Value;
|
|||||||
class Module;
|
class Module;
|
||||||
class GlobalVariable;
|
class GlobalVariable;
|
||||||
class TargetAsmInfo;
|
class TargetAsmInfo;
|
||||||
class Timer;
|
|
||||||
class raw_ostream;
|
class raw_ostream;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@@ -50,9 +49,6 @@ private:
|
|||||||
///
|
///
|
||||||
DwarfException *DE;
|
DwarfException *DE;
|
||||||
|
|
||||||
/// DwarfTimer - Timer for the Dwarf writer.
|
|
||||||
///
|
|
||||||
Timer *DwarfTimer;
|
|
||||||
public:
|
public:
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
|
|
||||||
|
@@ -1286,8 +1286,11 @@ class DwarfDebug : public Dwarf {
|
|||||||
//
|
//
|
||||||
DbgScope *RootDbgScope;
|
DbgScope *RootDbgScope;
|
||||||
|
|
||||||
// DbgScopeMap - Tracks the scopes in the current function.
|
/// DbgScopeMap - Tracks the scopes in the current function.
|
||||||
DenseMap<GlobalVariable *, DbgScope *> DbgScopeMap;
|
DenseMap<GlobalVariable *, DbgScope *> DbgScopeMap;
|
||||||
|
|
||||||
|
/// DebugTimer - Timer for the Dwarf debug writer.
|
||||||
|
Timer *DebugTimer;
|
||||||
|
|
||||||
struct FunctionDebugFrameInfo {
|
struct FunctionDebugFrameInfo {
|
||||||
unsigned Number;
|
unsigned Number;
|
||||||
@@ -1300,12 +1303,12 @@ class DwarfDebug : public Dwarf {
|
|||||||
std::vector<FunctionDebugFrameInfo> DebugFrames;
|
std::vector<FunctionDebugFrameInfo> DebugFrames;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
|
/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
|
||||||
/// be emitted.
|
/// be emitted.
|
||||||
///
|
///
|
||||||
bool ShouldEmitDwarfDebug() const { return shouldEmit; }
|
bool ShouldEmitDwarfDebug() const { return shouldEmit; }
|
||||||
|
|
||||||
|
private:
|
||||||
/// AssignAbbrevNumber - Define a unique number for the abbreviation.
|
/// AssignAbbrevNumber - Define a unique number for the abbreviation.
|
||||||
///
|
///
|
||||||
void AssignAbbrevNumber(DIEAbbrev &Abbrev) {
|
void AssignAbbrevNumber(DIEAbbrev &Abbrev) {
|
||||||
@@ -1516,8 +1519,6 @@ public:
|
|||||||
Die->AddValue(Attribute, Block->BestForm(), Value);
|
Die->AddValue(Attribute, Block->BestForm(), Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
/// AddSourceLine - Add location information to specified debug information
|
/// AddSourceLine - Add location information to specified debug information
|
||||||
/// entry.
|
/// entry.
|
||||||
void AddSourceLine(DIE *Die, const DIVariable *V) {
|
void AddSourceLine(DIE *Die, const DIVariable *V) {
|
||||||
@@ -2956,33 +2957,37 @@ public:
|
|||||||
// Main entry points.
|
// Main entry points.
|
||||||
//
|
//
|
||||||
DwarfDebug(raw_ostream &OS, AsmPrinter *A, const TargetAsmInfo *T)
|
DwarfDebug(raw_ostream &OS, AsmPrinter *A, const TargetAsmInfo *T)
|
||||||
: Dwarf(OS, A, T, "dbg")
|
: Dwarf(OS, A, T, "dbg"), MainCU(0),
|
||||||
, MainCU(NULL)
|
AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(),
|
||||||
, AbbreviationsSet(InitAbbreviationsSetSize)
|
ValuesSet(InitValuesSetSize), Values(), StringPool(), SectionMap(),
|
||||||
, Abbreviations()
|
SectionSourceLines(), didInitial(false), shouldEmit(false),
|
||||||
, ValuesSet(InitValuesSetSize)
|
RootDbgScope(0), DebugTimer(0) {
|
||||||
, Values()
|
if (TimePassesIsEnabled)
|
||||||
, StringPool()
|
DebugTimer = new Timer("Dwarf Debug Writer",
|
||||||
, SectionMap()
|
*getDwarfTimerGroup());
|
||||||
, SectionSourceLines()
|
|
||||||
, didInitial(false)
|
|
||||||
, shouldEmit(false)
|
|
||||||
, RootDbgScope(NULL)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
virtual ~DwarfDebug() {
|
virtual ~DwarfDebug() {
|
||||||
for (unsigned j = 0, M = Values.size(); j < M; ++j)
|
for (unsigned j = 0, M = Values.size(); j < M; ++j)
|
||||||
delete Values[j];
|
delete Values[j];
|
||||||
|
|
||||||
|
delete DebugTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SetDebugInfo - Create global DIEs and emit initial debug info sections.
|
/// SetDebugInfo - Create global DIEs and emit initial debug info sections.
|
||||||
/// This is inovked by the target AsmPrinter.
|
/// This is inovked by the target AsmPrinter.
|
||||||
void SetDebugInfo(MachineModuleInfo *mmi) {
|
void SetDebugInfo(MachineModuleInfo *mmi) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
// Create all the compile unit DIEs.
|
// Create all the compile unit DIEs.
|
||||||
ConstructCompileUnits();
|
ConstructCompileUnits();
|
||||||
|
|
||||||
if (CompileUnits.empty())
|
if (CompileUnits.empty()) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create DIEs for each of the externally visible global variables.
|
// Create DIEs for each of the externally visible global variables.
|
||||||
bool globalDIEs = ConstructGlobalVariableDIEs();
|
bool globalDIEs = ConstructGlobalVariableDIEs();
|
||||||
@@ -2992,8 +2997,12 @@ public:
|
|||||||
|
|
||||||
// If there is not any debug info available for any global variables
|
// If there is not any debug info available for any global variables
|
||||||
// and any subprograms then there is not any debug info to emit.
|
// and any subprograms then there is not any debug info to emit.
|
||||||
if (!globalDIEs && !subprogramDIEs)
|
if (!globalDIEs && !subprogramDIEs) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MMI = mmi;
|
MMI = mmi;
|
||||||
shouldEmit = true;
|
shouldEmit = true;
|
||||||
@@ -3020,6 +3029,9 @@ public:
|
|||||||
|
|
||||||
// Emit initial sections
|
// Emit initial sections
|
||||||
EmitInitial();
|
EmitInitial();
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// BeginModule - Emit all Dwarf sections that should come prior to the
|
/// BeginModule - Emit all Dwarf sections that should come prior to the
|
||||||
@@ -3031,7 +3043,11 @@ public:
|
|||||||
/// EndModule - Emit all Dwarf sections that should come after the content.
|
/// EndModule - Emit all Dwarf sections that should come after the content.
|
||||||
///
|
///
|
||||||
void EndModule() {
|
void EndModule() {
|
||||||
if (!ShouldEmitDwarfDebug()) return;
|
if (!ShouldEmitDwarfDebug())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
// Standard sections final addresses.
|
// Standard sections final addresses.
|
||||||
Asm->SwitchToSection(TAI->getTextSection());
|
Asm->SwitchToSection(TAI->getTextSection());
|
||||||
@@ -3082,15 +3098,21 @@ public:
|
|||||||
|
|
||||||
// Emit info into a debug macinfo section.
|
// Emit info into a debug macinfo section.
|
||||||
EmitDebugMacInfo();
|
EmitDebugMacInfo();
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// BeginFunction - Gather pre-function debug information. Assumes being
|
/// BeginFunction - Gather pre-function debug information. Assumes being
|
||||||
/// emitted immediately after the function entry point.
|
/// emitted immediately after the function entry point.
|
||||||
void BeginFunction(MachineFunction *MF) {
|
void BeginFunction(MachineFunction *MF) {
|
||||||
this->MF = MF;
|
|
||||||
|
|
||||||
if (!ShouldEmitDwarfDebug()) return;
|
if (!ShouldEmitDwarfDebug()) return;
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
|
this->MF = MF;
|
||||||
|
|
||||||
// Begin accumulating function debug information.
|
// Begin accumulating function debug information.
|
||||||
MMI->BeginFunction(MF);
|
MMI->BeginFunction(MF);
|
||||||
|
|
||||||
@@ -3103,6 +3125,9 @@ public:
|
|||||||
const SrcLineInfo &LineInfo = Lines[0];
|
const SrcLineInfo &LineInfo = Lines[0];
|
||||||
Asm->printLabel(LineInfo.getLabelID());
|
Asm->printLabel(LineInfo.getLabelID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EndFunction - Gather and emit post-function debug information.
|
/// EndFunction - Gather and emit post-function debug information.
|
||||||
@@ -3110,6 +3135,9 @@ public:
|
|||||||
void EndFunction(MachineFunction *MF) {
|
void EndFunction(MachineFunction *MF) {
|
||||||
if (!ShouldEmitDwarfDebug()) return;
|
if (!ShouldEmitDwarfDebug()) return;
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
// Define end label for subprogram.
|
// Define end label for subprogram.
|
||||||
EmitLabel("func_end", SubprogramCount);
|
EmitLabel("func_end", SubprogramCount);
|
||||||
|
|
||||||
@@ -3147,10 +3175,12 @@ public:
|
|||||||
DbgScopeMap.clear();
|
DbgScopeMap.clear();
|
||||||
RootDbgScope = NULL;
|
RootDbgScope = NULL;
|
||||||
}
|
}
|
||||||
Lines.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
Lines.clear();
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
|
}
|
||||||
|
|
||||||
/// ValidDebugInfo - Return true if V represents valid debug info value.
|
/// ValidDebugInfo - Return true if V represents valid debug info value.
|
||||||
bool ValidDebugInfo(Value *V) {
|
bool ValidDebugInfo(Value *V) {
|
||||||
@@ -3167,11 +3197,19 @@ public:
|
|||||||
if (!GV->hasInternalLinkage () && !GV->hasLinkOnceLinkage())
|
if (!GV->hasInternalLinkage () && !GV->hasLinkOnceLinkage())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
DIDescriptor DI(GV);
|
DIDescriptor DI(GV);
|
||||||
|
|
||||||
// Check current version. Allow Version6 for now.
|
// Check current version. Allow Version6 for now.
|
||||||
unsigned Version = DI.getVersion();
|
unsigned Version = DI.getVersion();
|
||||||
if (Version != LLVMDebugVersion && Version != LLVMDebugVersion6)
|
if (Version != LLVMDebugVersion && Version != LLVMDebugVersion6) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned Tag = DI.getTag();
|
unsigned Tag = DI.getTag();
|
||||||
switch (Tag) {
|
switch (Tag) {
|
||||||
@@ -3188,6 +3226,9 @@ public:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3195,10 +3236,17 @@ public:
|
|||||||
/// label. Returns a unique label ID used to generate a label and provide
|
/// label. Returns a unique label ID used to generate a label and provide
|
||||||
/// correspondence to the source line list.
|
/// correspondence to the source line list.
|
||||||
unsigned RecordSourceLine(Value *V, unsigned Line, unsigned Col) {
|
unsigned RecordSourceLine(Value *V, unsigned Line, unsigned Col) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
CompileUnit *Unit = CompileUnitMap[V];
|
CompileUnit *Unit = CompileUnitMap[V];
|
||||||
assert(Unit && "Unable to find CompileUnit");
|
assert(Unit && "Unable to find CompileUnit");
|
||||||
unsigned ID = MMI->NextLabelID();
|
unsigned ID = MMI->NextLabelID();
|
||||||
Lines.push_back(SrcLineInfo(Line, Col, Unit->getID(), ID));
|
Lines.push_back(SrcLineInfo(Line, Col, Unit->getID(), ID));
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
|
|
||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3206,8 +3254,15 @@ public:
|
|||||||
/// label. Returns a unique label ID used to generate a label and provide
|
/// label. Returns a unique label ID used to generate a label and provide
|
||||||
/// correspondence to the source line list.
|
/// correspondence to the source line list.
|
||||||
unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src) {
|
unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
unsigned ID = MMI->NextLabelID();
|
unsigned ID = MMI->NextLabelID();
|
||||||
Lines.push_back(SrcLineInfo(Line, Col, Src, ID));
|
Lines.push_back(SrcLineInfo(Line, Col, Src, ID));
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
|
|
||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3258,11 +3313,14 @@ public:
|
|||||||
/// as well.
|
/// as well.
|
||||||
unsigned getOrCreateSourceID(const std::string &DirName,
|
unsigned getOrCreateSourceID(const std::string &DirName,
|
||||||
const std::string &FileName) {
|
const std::string &FileName) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
unsigned DId;
|
unsigned DId;
|
||||||
StringMap<unsigned>::iterator DI = DirectoryIdMap.find(DirName);
|
StringMap<unsigned>::iterator DI = DirectoryIdMap.find(DirName);
|
||||||
if (DI != DirectoryIdMap.end())
|
if (DI != DirectoryIdMap.end()) {
|
||||||
DId = DI->getValue();
|
DId = DI->getValue();
|
||||||
else {
|
} else {
|
||||||
DId = DirectoryNames.size() + 1;
|
DId = DirectoryNames.size() + 1;
|
||||||
DirectoryIdMap[DirName] = DId;
|
DirectoryIdMap[DirName] = DId;
|
||||||
DirectoryNames.push_back(DirName);
|
DirectoryNames.push_back(DirName);
|
||||||
@@ -3270,9 +3328,9 @@ public:
|
|||||||
|
|
||||||
unsigned FId;
|
unsigned FId;
|
||||||
StringMap<unsigned>::iterator FI = SourceFileIdMap.find(FileName);
|
StringMap<unsigned>::iterator FI = SourceFileIdMap.find(FileName);
|
||||||
if (FI != SourceFileIdMap.end())
|
if (FI != SourceFileIdMap.end()) {
|
||||||
FId = FI->getValue();
|
FId = FI->getValue();
|
||||||
else {
|
} else {
|
||||||
FId = SourceFileNames.size() + 1;
|
FId = SourceFileNames.size() + 1;
|
||||||
SourceFileIdMap[FileName] = FId;
|
SourceFileIdMap[FileName] = FId;
|
||||||
SourceFileNames.push_back(FileName);
|
SourceFileNames.push_back(FileName);
|
||||||
@@ -3280,37 +3338,65 @@ public:
|
|||||||
|
|
||||||
DenseMap<std::pair<unsigned, unsigned>, unsigned>::iterator SI =
|
DenseMap<std::pair<unsigned, unsigned>, unsigned>::iterator SI =
|
||||||
SourceIdMap.find(std::make_pair(DId, FId));
|
SourceIdMap.find(std::make_pair(DId, FId));
|
||||||
if (SI != SourceIdMap.end())
|
|
||||||
|
if (SI != SourceIdMap.end()) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
|
|
||||||
return SI->second;
|
return SI->second;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned SrcId = SourceIds.size() + 1; // DW_AT_decl_file cannot be 0.
|
unsigned SrcId = SourceIds.size() + 1; // DW_AT_decl_file cannot be 0.
|
||||||
SourceIdMap[std::make_pair(DId, FId)] = SrcId;
|
SourceIdMap[std::make_pair(DId, FId)] = SrcId;
|
||||||
SourceIds.push_back(std::make_pair(DId, FId));
|
SourceIds.push_back(std::make_pair(DId, FId));
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
|
|
||||||
return SrcId;
|
return SrcId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RecordRegionStart - Indicate the start of a region.
|
/// RecordRegionStart - Indicate the start of a region.
|
||||||
///
|
///
|
||||||
unsigned RecordRegionStart(GlobalVariable *V) {
|
unsigned RecordRegionStart(GlobalVariable *V) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
DbgScope *Scope = getOrCreateScope(V);
|
DbgScope *Scope = getOrCreateScope(V);
|
||||||
unsigned ID = MMI->NextLabelID();
|
unsigned ID = MMI->NextLabelID();
|
||||||
if (!Scope->getStartLabelID()) Scope->setStartLabelID(ID);
|
if (!Scope->getStartLabelID()) Scope->setStartLabelID(ID);
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
|
|
||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RecordRegionEnd - Indicate the end of a region.
|
/// RecordRegionEnd - Indicate the end of a region.
|
||||||
///
|
///
|
||||||
unsigned RecordRegionEnd(GlobalVariable *V) {
|
unsigned RecordRegionEnd(GlobalVariable *V) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
DbgScope *Scope = getOrCreateScope(V);
|
DbgScope *Scope = getOrCreateScope(V);
|
||||||
unsigned ID = MMI->NextLabelID();
|
unsigned ID = MMI->NextLabelID();
|
||||||
Scope->setEndLabelID(ID);
|
Scope->setEndLabelID(ID);
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
|
|
||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RecordVariable - Indicate the declaration of a local variable.
|
/// RecordVariable - Indicate the declaration of a local variable.
|
||||||
///
|
///
|
||||||
void RecordVariable(GlobalVariable *GV, unsigned FrameIndex) {
|
void RecordVariable(GlobalVariable *GV, unsigned FrameIndex) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
DIDescriptor Desc(GV);
|
DIDescriptor Desc(GV);
|
||||||
DbgScope *Scope = NULL;
|
DbgScope *Scope = NULL;
|
||||||
|
|
||||||
if (Desc.getTag() == DW_TAG_variable) {
|
if (Desc.getTag() == DW_TAG_variable) {
|
||||||
// GV is a global variable.
|
// GV is a global variable.
|
||||||
DIGlobalVariable DG(GV);
|
DIGlobalVariable DG(GV);
|
||||||
@@ -3320,9 +3406,13 @@ public:
|
|||||||
DIVariable DV(GV);
|
DIVariable DV(GV);
|
||||||
Scope = getOrCreateScope(DV.getContext().getGV());
|
Scope = getOrCreateScope(DV.getContext().getGV());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(Scope && "Unable to find variable' scope");
|
assert(Scope && "Unable to find variable' scope");
|
||||||
DbgVariable *DV = new DbgVariable(DIVariable(GV), FrameIndex);
|
DbgVariable *DV = new DbgVariable(DIVariable(GV), FrameIndex);
|
||||||
Scope->AddVariable(DV);
|
Scope->AddVariable(DV);
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
DebugTimer->stopTimer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3365,6 +3455,9 @@ class DwarfException : public Dwarf {
|
|||||||
/// should be emitted.
|
/// should be emitted.
|
||||||
bool shouldEmitMovesModule;
|
bool shouldEmitMovesModule;
|
||||||
|
|
||||||
|
/// ExceptionTimer - Timer for the Dwarf exception writer.
|
||||||
|
Timer *ExceptionTimer;
|
||||||
|
|
||||||
/// EmitCommonEHFrame - Emit the common eh unwind frame.
|
/// EmitCommonEHFrame - Emit the common eh unwind frame.
|
||||||
///
|
///
|
||||||
void EmitCommonEHFrame(const Function *Personality, unsigned Index) {
|
void EmitCommonEHFrame(const Function *Personality, unsigned Index) {
|
||||||
@@ -3977,14 +4070,17 @@ public:
|
|||||||
// Main entry points.
|
// Main entry points.
|
||||||
//
|
//
|
||||||
DwarfException(raw_ostream &OS, AsmPrinter *A, const TargetAsmInfo *T)
|
DwarfException(raw_ostream &OS, AsmPrinter *A, const TargetAsmInfo *T)
|
||||||
: Dwarf(OS, A, T, "eh")
|
: Dwarf(OS, A, T, "eh"), shouldEmitTable(false), shouldEmitMoves(false),
|
||||||
, shouldEmitTable(false)
|
shouldEmitTableModule(false), shouldEmitMovesModule(false),
|
||||||
, shouldEmitMoves(false)
|
ExceptionTimer(0) {
|
||||||
, shouldEmitTableModule(false)
|
if (TimePassesIsEnabled)
|
||||||
, shouldEmitMovesModule(false)
|
ExceptionTimer = new Timer("Dwarf Exception Writer",
|
||||||
{}
|
*getDwarfTimerGroup());
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~DwarfException() {}
|
virtual ~DwarfException() {
|
||||||
|
delete ExceptionTimer;
|
||||||
|
}
|
||||||
|
|
||||||
/// SetModuleInfo - Set machine module information when it's known that pass
|
/// SetModuleInfo - Set machine module information when it's known that pass
|
||||||
/// manager has created it. Set by the target AsmPrinter.
|
/// manager has created it. Set by the target AsmPrinter.
|
||||||
@@ -4001,6 +4097,9 @@ public:
|
|||||||
/// EndModule - Emit all exception information that should come after the
|
/// EndModule - Emit all exception information that should come after the
|
||||||
/// content.
|
/// content.
|
||||||
void EndModule() {
|
void EndModule() {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
ExceptionTimer->startTimer();
|
||||||
|
|
||||||
if (shouldEmitMovesModule || shouldEmitTableModule) {
|
if (shouldEmitMovesModule || shouldEmitTableModule) {
|
||||||
const std::vector<Function *> Personalities = MMI->getPersonalities();
|
const std::vector<Function *> Personalities = MMI->getPersonalities();
|
||||||
for (unsigned i = 0; i < Personalities.size(); ++i)
|
for (unsigned i = 0; i < Personalities.size(); ++i)
|
||||||
@@ -4010,17 +4109,24 @@ public:
|
|||||||
E = EHFrames.end(); I != E; ++I)
|
E = EHFrames.end(); I != E; ++I)
|
||||||
EmitEHFrame(*I);
|
EmitEHFrame(*I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
ExceptionTimer->stopTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// BeginFunction - Gather pre-function exception information. Assumes being
|
/// BeginFunction - Gather pre-function exception information. Assumes being
|
||||||
/// emitted immediately after the function entry point.
|
/// emitted immediately after the function entry point.
|
||||||
void BeginFunction(MachineFunction *MF) {
|
void BeginFunction(MachineFunction *MF) {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
ExceptionTimer->startTimer();
|
||||||
|
|
||||||
this->MF = MF;
|
this->MF = MF;
|
||||||
shouldEmitTable = shouldEmitMoves = false;
|
shouldEmitTable = shouldEmitMoves = false;
|
||||||
if (MMI && TAI->doesSupportExceptionHandling()) {
|
|
||||||
|
|
||||||
|
if (MMI && TAI->doesSupportExceptionHandling()) {
|
||||||
// Map all labels and get rid of any dead landing pads.
|
// Map all labels and get rid of any dead landing pads.
|
||||||
MMI->TidyLandingPads();
|
MMI->TidyLandingPads();
|
||||||
|
|
||||||
// If any landing pads survive, we need an EH table.
|
// If any landing pads survive, we need an EH table.
|
||||||
if (MMI->getLandingPads().size())
|
if (MMI->getLandingPads().size())
|
||||||
shouldEmitTable = true;
|
shouldEmitTable = true;
|
||||||
@@ -4033,13 +4139,20 @@ public:
|
|||||||
// Assumes in correct section after the entry point.
|
// Assumes in correct section after the entry point.
|
||||||
EmitLabel("eh_func_begin", ++SubprogramCount);
|
EmitLabel("eh_func_begin", ++SubprogramCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldEmitTableModule |= shouldEmitTable;
|
shouldEmitTableModule |= shouldEmitTable;
|
||||||
shouldEmitMovesModule |= shouldEmitMoves;
|
shouldEmitMovesModule |= shouldEmitMoves;
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
ExceptionTimer->stopTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EndFunction - Gather and emit post-function exception information.
|
/// EndFunction - Gather and emit post-function exception information.
|
||||||
///
|
///
|
||||||
void EndFunction() {
|
void EndFunction() {
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
ExceptionTimer->startTimer();
|
||||||
|
|
||||||
if (shouldEmitMoves || shouldEmitTable) {
|
if (shouldEmitMoves || shouldEmitTable) {
|
||||||
EmitLabel("eh_func_end", SubprogramCount);
|
EmitLabel("eh_func_end", SubprogramCount);
|
||||||
EmitExceptionTable();
|
EmitExceptionTable();
|
||||||
@@ -4047,13 +4160,16 @@ public:
|
|||||||
// Save EH frame information
|
// Save EH frame information
|
||||||
EHFrames.
|
EHFrames.
|
||||||
push_back(FunctionEHFrameInfo(getAsm()->getCurrentFunctionEHName(MF),
|
push_back(FunctionEHFrameInfo(getAsm()->getCurrentFunctionEHName(MF),
|
||||||
SubprogramCount,
|
SubprogramCount,
|
||||||
MMI->getPersonalityIndex(),
|
MMI->getPersonalityIndex(),
|
||||||
MF->getFrameInfo()->hasCalls(),
|
MF->getFrameInfo()->hasCalls(),
|
||||||
!MMI->getLandingPads().empty(),
|
!MMI->getLandingPads().empty(),
|
||||||
MMI->getFrameMoves(),
|
MMI->getFrameMoves(),
|
||||||
MF->getFunction()));
|
MF->getFunction()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TimePassesIsEnabled)
|
||||||
|
ExceptionTimer->stopTimer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4377,15 +4493,11 @@ void DIE::dump() {
|
|||||||
///
|
///
|
||||||
|
|
||||||
DwarfWriter::DwarfWriter()
|
DwarfWriter::DwarfWriter()
|
||||||
: ImmutablePass(&ID), DD(0), DE(0), DwarfTimer(0) {
|
: ImmutablePass(&ID), DD(0), DE(0) {}
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer = new Timer("Dwarf Writer", *getDwarfTimerGroup());
|
|
||||||
}
|
|
||||||
|
|
||||||
DwarfWriter::~DwarfWriter() {
|
DwarfWriter::~DwarfWriter() {
|
||||||
delete DE;
|
delete DE;
|
||||||
delete DD;
|
delete DD;
|
||||||
delete DwarfTimer;
|
|
||||||
delete DwarfTimerGroup; DwarfTimerGroup = 0;
|
delete DwarfTimerGroup; DwarfTimerGroup = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4395,74 +4507,42 @@ void DwarfWriter::BeginModule(Module *M,
|
|||||||
MachineModuleInfo *MMI,
|
MachineModuleInfo *MMI,
|
||||||
raw_ostream &OS, AsmPrinter *A,
|
raw_ostream &OS, AsmPrinter *A,
|
||||||
const TargetAsmInfo *T) {
|
const TargetAsmInfo *T) {
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
DE = new DwarfException(OS, A, T);
|
DE = new DwarfException(OS, A, T);
|
||||||
DD = new DwarfDebug(OS, A, T);
|
DD = new DwarfDebug(OS, A, T);
|
||||||
DE->BeginModule(M);
|
DE->BeginModule(M);
|
||||||
DD->BeginModule(M);
|
DD->BeginModule(M);
|
||||||
DD->SetDebugInfo(MMI);
|
DD->SetDebugInfo(MMI);
|
||||||
DE->SetModuleInfo(MMI);
|
DE->SetModuleInfo(MMI);
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EndModule - Emit all Dwarf sections that should come after the content.
|
/// EndModule - Emit all Dwarf sections that should come after the content.
|
||||||
///
|
///
|
||||||
void DwarfWriter::EndModule() {
|
void DwarfWriter::EndModule() {
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
DE->EndModule();
|
DE->EndModule();
|
||||||
DD->EndModule();
|
DD->EndModule();
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// BeginFunction - Gather pre-function debug information. Assumes being
|
/// BeginFunction - Gather pre-function debug information. Assumes being
|
||||||
/// emitted immediately after the function entry point.
|
/// emitted immediately after the function entry point.
|
||||||
void DwarfWriter::BeginFunction(MachineFunction *MF) {
|
void DwarfWriter::BeginFunction(MachineFunction *MF) {
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
DE->BeginFunction(MF);
|
DE->BeginFunction(MF);
|
||||||
DD->BeginFunction(MF);
|
DD->BeginFunction(MF);
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EndFunction - Gather and emit post-function debug information.
|
/// EndFunction - Gather and emit post-function debug information.
|
||||||
///
|
///
|
||||||
void DwarfWriter::EndFunction(MachineFunction *MF) {
|
void DwarfWriter::EndFunction(MachineFunction *MF) {
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
DD->EndFunction(MF);
|
DD->EndFunction(MF);
|
||||||
DE->EndFunction();
|
DE->EndFunction();
|
||||||
|
|
||||||
if (MachineModuleInfo *MMI = DD->getMMI() ? DD->getMMI() : DE->getMMI())
|
if (MachineModuleInfo *MMI = DD->getMMI() ? DD->getMMI() : DE->getMMI())
|
||||||
// Clear function debug information.
|
// Clear function debug information.
|
||||||
MMI->EndFunction();
|
MMI->EndFunction();
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ValidDebugInfo - Return true if V represents valid debug info value.
|
/// ValidDebugInfo - Return true if V represents valid debug info value.
|
||||||
bool DwarfWriter::ValidDebugInfo(Value *V) {
|
bool DwarfWriter::ValidDebugInfo(Value *V) {
|
||||||
if (TimePassesIsEnabled)
|
return DD && DD->ValidDebugInfo(V);
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
bool Res = DD && DD->ValidDebugInfo(V);
|
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
|
|
||||||
return Res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RecordSourceLine - Records location information and associates it with a
|
/// RecordSourceLine - Records location information and associates it with a
|
||||||
@@ -4470,15 +4550,7 @@ bool DwarfWriter::ValidDebugInfo(Value *V) {
|
|||||||
/// correspondence to the source line list.
|
/// correspondence to the source line list.
|
||||||
unsigned DwarfWriter::RecordSourceLine(unsigned Line, unsigned Col,
|
unsigned DwarfWriter::RecordSourceLine(unsigned Line, unsigned Col,
|
||||||
unsigned Src) {
|
unsigned Src) {
|
||||||
if (TimePassesIsEnabled)
|
return DD->RecordSourceLine(Line, Col, Src);
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
unsigned Res = DD->RecordSourceLine(Line, Col, Src);
|
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
|
|
||||||
return Res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getOrCreateSourceID - Look up the source id with the given directory and
|
/// getOrCreateSourceID - Look up the source id with the given directory and
|
||||||
@@ -4487,78 +4559,32 @@ unsigned DwarfWriter::RecordSourceLine(unsigned Line, unsigned Col,
|
|||||||
/// as well.
|
/// as well.
|
||||||
unsigned DwarfWriter::getOrCreateSourceID(const std::string &DirName,
|
unsigned DwarfWriter::getOrCreateSourceID(const std::string &DirName,
|
||||||
const std::string &FileName) {
|
const std::string &FileName) {
|
||||||
if (TimePassesIsEnabled)
|
return DD->getOrCreateSourceID(DirName, FileName);
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
unsigned Res = DD->getOrCreateSourceID(DirName, FileName);
|
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
|
|
||||||
return Res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RecordRegionStart - Indicate the start of a region.
|
/// RecordRegionStart - Indicate the start of a region.
|
||||||
unsigned DwarfWriter::RecordRegionStart(GlobalVariable *V) {
|
unsigned DwarfWriter::RecordRegionStart(GlobalVariable *V) {
|
||||||
if (TimePassesIsEnabled)
|
return DD->RecordRegionStart(V);
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
unsigned Res = DD->RecordRegionStart(V);
|
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
|
|
||||||
return Res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RecordRegionEnd - Indicate the end of a region.
|
/// RecordRegionEnd - Indicate the end of a region.
|
||||||
unsigned DwarfWriter::RecordRegionEnd(GlobalVariable *V) {
|
unsigned DwarfWriter::RecordRegionEnd(GlobalVariable *V) {
|
||||||
if (TimePassesIsEnabled)
|
return DD->RecordRegionEnd(V);
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
unsigned Res = DD->RecordRegionEnd(V);
|
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
|
|
||||||
return Res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getRecordSourceLineCount - Count source lines.
|
/// getRecordSourceLineCount - Count source lines.
|
||||||
unsigned DwarfWriter::getRecordSourceLineCount() {
|
unsigned DwarfWriter::getRecordSourceLineCount() {
|
||||||
if (TimePassesIsEnabled)
|
return DD->getRecordSourceLineCount();
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
unsigned Res = DD->getRecordSourceLineCount();
|
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
|
|
||||||
return Res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RecordVariable - Indicate the declaration of a local variable.
|
/// RecordVariable - Indicate the declaration of a local variable.
|
||||||
///
|
///
|
||||||
void DwarfWriter::RecordVariable(GlobalVariable *GV, unsigned FrameIndex) {
|
void DwarfWriter::RecordVariable(GlobalVariable *GV, unsigned FrameIndex) {
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
DD->RecordVariable(GV, FrameIndex);
|
DD->RecordVariable(GV, FrameIndex);
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
|
/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
|
||||||
/// be emitted.
|
/// be emitted.
|
||||||
bool DwarfWriter::ShouldEmitDwarfDebug() const {
|
bool DwarfWriter::ShouldEmitDwarfDebug() const {
|
||||||
if (TimePassesIsEnabled)
|
return DD->ShouldEmitDwarfDebug();
|
||||||
DwarfTimer->startTimer();
|
|
||||||
|
|
||||||
bool Res = DD->ShouldEmitDwarfDebug();
|
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
|
||||||
DwarfTimer->stopTimer();
|
|
||||||
|
|
||||||
return Res;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user