Skip to content

Commit fcc1414

Browse files
committed
Use the "NamedGroupTimer" class to categorize DWARF emission better.
llvm-svn: 100616
1 parent 43c275f commit fcc1414

File tree

4 files changed

+28
-41
lines changed

4 files changed

+28
-41
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
#include "llvm/System/Path.h"
4040
using namespace llvm;
4141

42+
namespace {
43+
const char *DWARFGroupName = "DWARF Emission";
44+
const char *DbgTimerName = "DWARF Debug Writer";
45+
} // end anonymous namespace
46+
4247
//===----------------------------------------------------------------------===//
4348

4449
/// Configuration values for initial hash set sizes (log2).
@@ -305,22 +310,17 @@ DbgScope::~DbgScope() {
305310
DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
306311
: Asm(A), MMI(Asm->MMI), ModuleCU(0),
307312
AbbreviationsSet(InitAbbreviationsSetSize),
308-
CurrentFnDbgScope(0), DebugTimer(0) {
313+
CurrentFnDbgScope(0) {
309314
NextStringPoolNumber = 0;
310315

311316
DwarfFrameSectionSym = DwarfInfoSectionSym = DwarfAbbrevSectionSym = 0;
312317
DwarfStrSectionSym = TextSectionSym = 0;
313318

314-
if (TimePassesIsEnabled)
315-
DebugTimer = new Timer("Dwarf Debug Writer");
316-
317319
beginModule(M);
318320
}
319321
DwarfDebug::~DwarfDebug() {
320322
for (unsigned j = 0, M = DIEBlocks.size(); j < M; ++j)
321323
DIEBlocks[j]->~DIEBlock();
322-
323-
delete DebugTimer;
324324
}
325325

326326
MCSymbol *DwarfDebug::getStringPoolEntry(StringRef Str) {
@@ -1844,7 +1844,7 @@ void DwarfDebug::constructSubprogramDIE(MDNode *N) {
18441844
/// content. Create global DIEs and emit initial debug info sections.
18451845
/// This is inovked by the target AsmPrinter.
18461846
void DwarfDebug::beginModule(Module *M) {
1847-
TimeRegion Timer(DebugTimer);
1847+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
18481848

18491849
DebugInfoFinder DbgFinder;
18501850
DbgFinder.processModule(*M);
@@ -1908,10 +1908,8 @@ void DwarfDebug::beginModule(Module *M) {
19081908
/// endModule - Emit all Dwarf sections that should come after the content.
19091909
///
19101910
void DwarfDebug::endModule() {
1911-
if (!ModuleCU)
1912-
return;
1913-
1914-
TimeRegion Timer(DebugTimer);
1911+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
1912+
if (!ModuleCU) return;
19151913

19161914
// Attach DW_AT_inline attribute with inlined subprogram DIEs.
19171915
for (SmallPtrSet<DIE *, 4>::iterator AI = InlinedSubprogramDIEs.begin(),
@@ -2309,11 +2307,10 @@ bool DwarfDebug::extractScopeInformation() {
23092307
/// beginFunction - Gather pre-function debug information. Assumes being
23102308
/// emitted immediately after the function entry point.
23112309
void DwarfDebug::beginFunction(const MachineFunction *MF) {
2310+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
2311+
23122312
if (!MMI->hasDebugInfo()) return;
2313-
2314-
TimeRegion Timer(DebugTimer);
2315-
if (!extractScopeInformation())
2316-
return;
2313+
if (!extractScopeInformation()) return;
23172314

23182315
collectVariableInfo();
23192316

@@ -2344,10 +2341,9 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
23442341
/// endFunction - Gather and emit post-function debug information.
23452342
///
23462343
void DwarfDebug::endFunction(const MachineFunction *MF) {
2347-
if (!MMI->hasDebugInfo() ||
2348-
DbgScopeMap.empty()) return;
2349-
2350-
TimeRegion Timer(DebugTimer);
2344+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
2345+
2346+
if (!MMI->hasDebugInfo() || DbgScopeMap.empty()) return;
23512347

23522348
if (CurrentFnDbgScope) {
23532349
// Define end label for subprogram.
@@ -2393,7 +2389,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
23932389
/// unique label that was emitted and which provides correspondence to
23942390
/// the source line list.
23952391
MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) {
2396-
TimeRegion Timer(DebugTimer);
2392+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
23972393

23982394
StringRef Dir;
23992395
StringRef Fn;
@@ -2429,7 +2425,7 @@ MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) {
24292425
/// well.
24302426
unsigned DwarfDebug::getOrCreateSourceID(const std::string &DirName,
24312427
const std::string &FileName) {
2432-
TimeRegion Timer(DebugTimer);
2428+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
24332429
return GetOrCreateSourceID(DirName.c_str(), FileName.c_str());
24342430
}
24352431

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class MachineFrameInfo;
3333
class MachineLocation;
3434
class MachineModuleInfo;
3535
class MCAsmInfo;
36-
class Timer;
3736
class DIEAbbrev;
3837
class DIE;
3938
class DIEBlock;
@@ -208,9 +207,6 @@ class DwarfDebug {
208207
/// label location to indicate scope boundries in dwarf debug info.
209208
DebugLoc PrevInstLoc;
210209

211-
/// DebugTimer - Timer for the Dwarf debug writer.
212-
Timer *DebugTimer;
213-
214210
struct FunctionDebugFrameInfo {
215211
unsigned Number;
216212
std::vector<MachineMove> Moves;

llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,16 @@
3939
#include "llvm/ADT/Twine.h"
4040
using namespace llvm;
4141

42+
namespace {
43+
const char *DWARFGroupName = "DWARF Emission";
44+
const char *EHTimerName = "DWARF Exception Writer";
45+
} // end anonymous namespace
46+
4247
DwarfException::DwarfException(AsmPrinter *A)
4348
: Asm(A), MMI(Asm->MMI), shouldEmitTable(false), shouldEmitMoves(false),
44-
shouldEmitTableModule(false), shouldEmitMovesModule(false),
45-
ExceptionTimer(0) {
46-
if (TimePassesIsEnabled)
47-
ExceptionTimer = new Timer("DWARF Exception Writer");
48-
}
49+
shouldEmitTableModule(false), shouldEmitMovesModule(false) {}
4950

50-
DwarfException::~DwarfException() {
51-
delete ExceptionTimer;
52-
}
51+
DwarfException::~DwarfException() {}
5352

5453
/// EmitCIE - Emit a Common Information Entry (CIE). This holds information that
5554
/// is shared among many Frame Description Entries. There is at least one CIE
@@ -897,14 +896,14 @@ void DwarfException::EmitExceptionTable() {
897896
/// EndModule - Emit all exception information that should come after the
898897
/// content.
899898
void DwarfException::EndModule() {
899+
NamedRegionTimer T(EHTimerName, DWARFGroupName);
900+
900901
if (Asm->MAI->getExceptionHandlingType() != ExceptionHandling::Dwarf)
901902
return;
902903

903904
if (!shouldEmitMovesModule && !shouldEmitTableModule)
904905
return;
905906

906-
TimeRegion Timer(ExceptionTimer);
907-
908907
const std::vector<Function *> Personalities = MMI->getPersonalities();
909908

910909
for (unsigned I = 0, E = Personalities.size(); I < E; ++I)
@@ -918,7 +917,7 @@ void DwarfException::EndModule() {
918917
/// BeginFunction - Gather pre-function exception information. Assumes it's
919918
/// being emitted immediately after the function entry point.
920919
void DwarfException::BeginFunction(const MachineFunction *MF) {
921-
TimeRegion Timer(ExceptionTimer);
920+
NamedRegionTimer T(EHTimerName, DWARFGroupName);
922921
shouldEmitTable = shouldEmitMoves = false;
923922

924923
// If any landing pads survive, we need an EH table.
@@ -940,9 +939,9 @@ void DwarfException::BeginFunction(const MachineFunction *MF) {
940939
/// EndFunction - Gather and emit post-function exception information.
941940
///
942941
void DwarfException::EndFunction() {
942+
NamedRegionTimer T(EHTimerName, DWARFGroupName);
943943
if (!shouldEmitMoves && !shouldEmitTable) return;
944944

945-
TimeRegion Timer(ExceptionTimer);
946945
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end",
947946
Asm->getFunctionNumber()));
948947

llvm/lib/CodeGen/AsmPrinter/DwarfException.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class MachineFunction;
2828
class MCAsmInfo;
2929
class MCExpr;
3030
class MCSymbol;
31-
class Timer;
3231
class Function;
3332
class AsmPrinter;
3433

@@ -82,9 +81,6 @@ class DwarfException {
8281
/// should be emitted.
8382
bool shouldEmitMovesModule;
8483

85-
/// ExceptionTimer - Timer for the Dwarf exception writer.
86-
Timer *ExceptionTimer;
87-
8884
/// EmitCIE - Emit a Common Information Entry (CIE). This holds information
8985
/// that is shared among many Frame Description Entries. There is at least
9086
/// one CIE in every non-empty .debug_frame section.

0 commit comments

Comments
 (0)