Skip to content

Commit f8dba24

Browse files
committed
Workaround the breakage in r100616 by guarding all timers with
TimePassesIsEnabled. This should allow make check to pass. llvm-svn: 100618
1 parent fcc1414 commit f8dba24

File tree

3 files changed

+74
-32
lines changed

3 files changed

+74
-32
lines changed

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//===-- AsmPrinter.cpp - Common AsmPrinter code ---------------------------===//
21
//
32
// The LLVM Compiler Infrastructure
43
//
@@ -42,8 +41,15 @@
4241
#include "llvm/ADT/Statistic.h"
4342
#include "llvm/Support/ErrorHandling.h"
4443
#include "llvm/Support/Format.h"
44+
#include "llvm/Support/Timer.h"
4545
using namespace llvm;
4646

47+
namespace {
48+
const char *DWARFGroupName = "DWARF Emission";
49+
const char *DbgTimerName = "DWARF Debug Writer";
50+
const char *EHTimerName = "DWARF Exception Writer";
51+
} // end anonymous namespace
52+
4753
STATISTIC(EmittedInsts, "Number of machine instrs printed");
4854

4955
char AsmPrinter::ID = 0;
@@ -347,8 +353,22 @@ void AsmPrinter::EmitFunctionHeader() {
347353
}
348354

349355
// Emit pre-function debug and/or EH information.
350-
if (DE) DE->BeginFunction(MF);
351-
if (DD) DD->beginFunction(MF);
356+
if (DE) {
357+
if (TimePassesIsEnabled) {
358+
NamedRegionTimer T(EHTimerName, DWARFGroupName);
359+
DE->BeginFunction(MF);
360+
} else {
361+
DE->BeginFunction(MF);
362+
}
363+
}
364+
if (DD) {
365+
if (TimePassesIsEnabled) {
366+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
367+
DD->beginFunction(MF);
368+
} else {
369+
DD->beginFunction(MF);
370+
}
371+
}
352372
}
353373

354374
/// EmitFunctionEntryLabel - Emit the label that is the entrypoint for the
@@ -507,8 +527,14 @@ void AsmPrinter::EmitFunctionBody() {
507527

508528
++EmittedInsts;
509529

510-
if (ShouldPrintDebugScopes)
511-
DD->beginScope(II);
530+
if (ShouldPrintDebugScopes) {
531+
if (TimePassesIsEnabled) {
532+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
533+
DD->beginScope(II);
534+
} else {
535+
DD->beginScope(II);
536+
}
537+
}
512538

513539
if (isVerbose())
514540
EmitComments(*II, OutStreamer.GetCommentOS());
@@ -539,8 +565,14 @@ void AsmPrinter::EmitFunctionBody() {
539565
break;
540566
}
541567

542-
if (ShouldPrintDebugScopes)
543-
DD->endScope(II);
568+
if (ShouldPrintDebugScopes) {
569+
if (TimePassesIsEnabled) {
570+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
571+
DD->endScope(II);
572+
} else {
573+
DD->endScope(II);
574+
}
575+
}
544576
}
545577
}
546578

@@ -569,8 +601,22 @@ void AsmPrinter::EmitFunctionBody() {
569601
}
570602

571603
// Emit post-function debug information.
572-
if (DD) DD->endFunction(MF);
573-
if (DE) DE->EndFunction();
604+
if (DD) {
605+
if (TimePassesIsEnabled) {
606+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
607+
DD->endFunction(MF);
608+
} else {
609+
DD->endFunction(MF);
610+
}
611+
}
612+
if (DE) {
613+
if (TimePassesIsEnabled) {
614+
NamedRegionTimer T(EHTimerName, DWARFGroupName);
615+
DE->EndFunction();
616+
} else {
617+
DE->EndFunction();
618+
}
619+
}
574620
MMI->EndFunction();
575621

576622
// Print out jump tables referenced by the function.
@@ -588,11 +634,21 @@ bool AsmPrinter::doFinalization(Module &M) {
588634

589635
// Finalize debug and EH information.
590636
if (DE) {
591-
DE->EndModule();
637+
if (TimePassesIsEnabled) {
638+
NamedRegionTimer T(EHTimerName, DWARFGroupName);
639+
DE->EndModule();
640+
} else {
641+
DE->EndModule();
642+
}
592643
delete DE; DE = 0;
593644
}
594645
if (DD) {
595-
DD->endModule();
646+
if (TimePassesIsEnabled) {
647+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
648+
DD->endModule();
649+
} else {
650+
DD->endModule();
651+
}
596652
delete DD; DD = 0;
597653
}
598654

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,13 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
315315

316316
DwarfFrameSectionSym = DwarfInfoSectionSym = DwarfAbbrevSectionSym = 0;
317317
DwarfStrSectionSym = TextSectionSym = 0;
318-
319-
beginModule(M);
318+
319+
if (TimePassesIsEnabled) {
320+
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
321+
beginModule(M);
322+
} else {
323+
beginModule(M);
324+
}
320325
}
321326
DwarfDebug::~DwarfDebug() {
322327
for (unsigned j = 0, M = DIEBlocks.size(); j < M; ++j)
@@ -1844,8 +1849,6 @@ void DwarfDebug::constructSubprogramDIE(MDNode *N) {
18441849
/// content. Create global DIEs and emit initial debug info sections.
18451850
/// This is inovked by the target AsmPrinter.
18461851
void DwarfDebug::beginModule(Module *M) {
1847-
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
1848-
18491852
DebugInfoFinder DbgFinder;
18501853
DbgFinder.processModule(*M);
18511854

@@ -1908,7 +1911,6 @@ void DwarfDebug::beginModule(Module *M) {
19081911
/// endModule - Emit all Dwarf sections that should come after the content.
19091912
///
19101913
void DwarfDebug::endModule() {
1911-
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
19121914
if (!ModuleCU) return;
19131915

19141916
// Attach DW_AT_inline attribute with inlined subprogram DIEs.
@@ -2307,8 +2309,6 @@ bool DwarfDebug::extractScopeInformation() {
23072309
/// beginFunction - Gather pre-function debug information. Assumes being
23082310
/// emitted immediately after the function entry point.
23092311
void DwarfDebug::beginFunction(const MachineFunction *MF) {
2310-
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
2311-
23122312
if (!MMI->hasDebugInfo()) return;
23132313
if (!extractScopeInformation()) return;
23142314

@@ -2341,8 +2341,6 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
23412341
/// endFunction - Gather and emit post-function debug information.
23422342
///
23432343
void DwarfDebug::endFunction(const MachineFunction *MF) {
2344-
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
2345-
23462344
if (!MMI->hasDebugInfo() || DbgScopeMap.empty()) return;
23472345

23482346
if (CurrentFnDbgScope) {
@@ -2389,8 +2387,6 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
23892387
/// unique label that was emitted and which provides correspondence to
23902388
/// the source line list.
23912389
MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) {
2392-
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
2393-
23942390
StringRef Dir;
23952391
StringRef Fn;
23962392

llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,11 @@
3333
#include "llvm/Target/TargetRegisterInfo.h"
3434
#include "llvm/Support/Dwarf.h"
3535
#include "llvm/Support/FormattedStream.h"
36-
#include "llvm/Support/Timer.h"
3736
#include "llvm/ADT/SmallString.h"
3837
#include "llvm/ADT/StringExtras.h"
3938
#include "llvm/ADT/Twine.h"
4039
using namespace llvm;
4140

42-
namespace {
43-
const char *DWARFGroupName = "DWARF Emission";
44-
const char *EHTimerName = "DWARF Exception Writer";
45-
} // end anonymous namespace
46-
4741
DwarfException::DwarfException(AsmPrinter *A)
4842
: Asm(A), MMI(Asm->MMI), shouldEmitTable(false), shouldEmitMoves(false),
4943
shouldEmitTableModule(false), shouldEmitMovesModule(false) {}
@@ -896,8 +890,6 @@ void DwarfException::EmitExceptionTable() {
896890
/// EndModule - Emit all exception information that should come after the
897891
/// content.
898892
void DwarfException::EndModule() {
899-
NamedRegionTimer T(EHTimerName, DWARFGroupName);
900-
901893
if (Asm->MAI->getExceptionHandlingType() != ExceptionHandling::Dwarf)
902894
return;
903895

@@ -917,7 +909,6 @@ void DwarfException::EndModule() {
917909
/// BeginFunction - Gather pre-function exception information. Assumes it's
918910
/// being emitted immediately after the function entry point.
919911
void DwarfException::BeginFunction(const MachineFunction *MF) {
920-
NamedRegionTimer T(EHTimerName, DWARFGroupName);
921912
shouldEmitTable = shouldEmitMoves = false;
922913

923914
// If any landing pads survive, we need an EH table.
@@ -939,7 +930,6 @@ void DwarfException::BeginFunction(const MachineFunction *MF) {
939930
/// EndFunction - Gather and emit post-function exception information.
940931
///
941932
void DwarfException::EndFunction() {
942-
NamedRegionTimer T(EHTimerName, DWARFGroupName);
943933
if (!shouldEmitMoves && !shouldEmitTable) return;
944934

945935
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end",

0 commit comments

Comments
 (0)