|
39 | 39 | #include "llvm/System/Path.h"
|
40 | 40 | using namespace llvm;
|
41 | 41 |
|
| 42 | +namespace { |
| 43 | + const char *DWARFGroupName = "DWARF Emission"; |
| 44 | + const char *DbgTimerName = "DWARF Debug Writer"; |
| 45 | +} // end anonymous namespace |
| 46 | + |
42 | 47 | //===----------------------------------------------------------------------===//
|
43 | 48 |
|
44 | 49 | /// Configuration values for initial hash set sizes (log2).
|
@@ -305,22 +310,17 @@ DbgScope::~DbgScope() {
|
305 | 310 | DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
|
306 | 311 | : Asm(A), MMI(Asm->MMI), ModuleCU(0),
|
307 | 312 | AbbreviationsSet(InitAbbreviationsSetSize),
|
308 |
| - CurrentFnDbgScope(0), DebugTimer(0) { |
| 313 | + CurrentFnDbgScope(0) { |
309 | 314 | NextStringPoolNumber = 0;
|
310 | 315 |
|
311 | 316 | DwarfFrameSectionSym = DwarfInfoSectionSym = DwarfAbbrevSectionSym = 0;
|
312 | 317 | DwarfStrSectionSym = TextSectionSym = 0;
|
313 | 318 |
|
314 |
| - if (TimePassesIsEnabled) |
315 |
| - DebugTimer = new Timer("Dwarf Debug Writer"); |
316 |
| - |
317 | 319 | beginModule(M);
|
318 | 320 | }
|
319 | 321 | DwarfDebug::~DwarfDebug() {
|
320 | 322 | for (unsigned j = 0, M = DIEBlocks.size(); j < M; ++j)
|
321 | 323 | DIEBlocks[j]->~DIEBlock();
|
322 |
| - |
323 |
| - delete DebugTimer; |
324 | 324 | }
|
325 | 325 |
|
326 | 326 | MCSymbol *DwarfDebug::getStringPoolEntry(StringRef Str) {
|
@@ -1844,7 +1844,7 @@ void DwarfDebug::constructSubprogramDIE(MDNode *N) {
|
1844 | 1844 | /// content. Create global DIEs and emit initial debug info sections.
|
1845 | 1845 | /// This is inovked by the target AsmPrinter.
|
1846 | 1846 | void DwarfDebug::beginModule(Module *M) {
|
1847 |
| - TimeRegion Timer(DebugTimer); |
| 1847 | + NamedRegionTimer T(DbgTimerName, DWARFGroupName); |
1848 | 1848 |
|
1849 | 1849 | DebugInfoFinder DbgFinder;
|
1850 | 1850 | DbgFinder.processModule(*M);
|
@@ -1908,10 +1908,8 @@ void DwarfDebug::beginModule(Module *M) {
|
1908 | 1908 | /// endModule - Emit all Dwarf sections that should come after the content.
|
1909 | 1909 | ///
|
1910 | 1910 | void DwarfDebug::endModule() {
|
1911 |
| - if (!ModuleCU) |
1912 |
| - return; |
1913 |
| - |
1914 |
| - TimeRegion Timer(DebugTimer); |
| 1911 | + NamedRegionTimer T(DbgTimerName, DWARFGroupName); |
| 1912 | + if (!ModuleCU) return; |
1915 | 1913 |
|
1916 | 1914 | // Attach DW_AT_inline attribute with inlined subprogram DIEs.
|
1917 | 1915 | for (SmallPtrSet<DIE *, 4>::iterator AI = InlinedSubprogramDIEs.begin(),
|
@@ -2309,11 +2307,10 @@ bool DwarfDebug::extractScopeInformation() {
|
2309 | 2307 | /// beginFunction - Gather pre-function debug information. Assumes being
|
2310 | 2308 | /// emitted immediately after the function entry point.
|
2311 | 2309 | void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
| 2310 | + NamedRegionTimer T(DbgTimerName, DWARFGroupName); |
| 2311 | + |
2312 | 2312 | if (!MMI->hasDebugInfo()) return;
|
2313 |
| - |
2314 |
| - TimeRegion Timer(DebugTimer); |
2315 |
| - if (!extractScopeInformation()) |
2316 |
| - return; |
| 2313 | + if (!extractScopeInformation()) return; |
2317 | 2314 |
|
2318 | 2315 | collectVariableInfo();
|
2319 | 2316 |
|
@@ -2344,10 +2341,9 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
2344 | 2341 | /// endFunction - Gather and emit post-function debug information.
|
2345 | 2342 | ///
|
2346 | 2343 | 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; |
2351 | 2347 |
|
2352 | 2348 | if (CurrentFnDbgScope) {
|
2353 | 2349 | // Define end label for subprogram.
|
@@ -2393,7 +2389,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
|
2393 | 2389 | /// unique label that was emitted and which provides correspondence to
|
2394 | 2390 | /// the source line list.
|
2395 | 2391 | MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) {
|
2396 |
| - TimeRegion Timer(DebugTimer); |
| 2392 | + NamedRegionTimer T(DbgTimerName, DWARFGroupName); |
2397 | 2393 |
|
2398 | 2394 | StringRef Dir;
|
2399 | 2395 | StringRef Fn;
|
@@ -2429,7 +2425,7 @@ MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) {
|
2429 | 2425 | /// well.
|
2430 | 2426 | unsigned DwarfDebug::getOrCreateSourceID(const std::string &DirName,
|
2431 | 2427 | const std::string &FileName) {
|
2432 |
| - TimeRegion Timer(DebugTimer); |
| 2428 | + NamedRegionTimer T(DbgTimerName, DWARFGroupName); |
2433 | 2429 | return GetOrCreateSourceID(DirName.c_str(), FileName.c_str());
|
2434 | 2430 | }
|
2435 | 2431 |
|
|
0 commit comments