Skip to content

Commit

Permalink
Workaround the breakage in r100616 by guarding all timers with
Browse files Browse the repository at this point in the history
TimePassesIsEnabled. This should allow make check to pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100618 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
edwintorok committed Apr 7, 2010
1 parent 5f017e8 commit 9c42107
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 32 deletions.
78 changes: 67 additions & 11 deletions lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//===-- AsmPrinter.cpp - Common AsmPrinter code ---------------------------===//
//
// The LLVM Compiler Infrastructure
//
Expand Down Expand Up @@ -42,8 +41,15 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Timer.h"
using namespace llvm;

namespace {
const char *DWARFGroupName = "DWARF Emission";
const char *DbgTimerName = "DWARF Debug Writer";
const char *EHTimerName = "DWARF Exception Writer";
} // end anonymous namespace

STATISTIC(EmittedInsts, "Number of machine instrs printed");

char AsmPrinter::ID = 0;
Expand Down Expand Up @@ -347,8 +353,22 @@ void AsmPrinter::EmitFunctionHeader() {
}

// Emit pre-function debug and/or EH information.
if (DE) DE->BeginFunction(MF);
if (DD) DD->beginFunction(MF);
if (DE) {
if (TimePassesIsEnabled) {
NamedRegionTimer T(EHTimerName, DWARFGroupName);
DE->BeginFunction(MF);
} else {
DE->BeginFunction(MF);
}
}
if (DD) {
if (TimePassesIsEnabled) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
DD->beginFunction(MF);
} else {
DD->beginFunction(MF);
}
}
}

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

++EmittedInsts;

if (ShouldPrintDebugScopes)
DD->beginScope(II);
if (ShouldPrintDebugScopes) {
if (TimePassesIsEnabled) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
DD->beginScope(II);
} else {
DD->beginScope(II);
}
}

if (isVerbose())
EmitComments(*II, OutStreamer.GetCommentOS());
Expand Down Expand Up @@ -539,8 +565,14 @@ void AsmPrinter::EmitFunctionBody() {
break;
}

if (ShouldPrintDebugScopes)
DD->endScope(II);
if (ShouldPrintDebugScopes) {
if (TimePassesIsEnabled) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
DD->endScope(II);
} else {
DD->endScope(II);
}
}
}
}

Expand Down Expand Up @@ -569,8 +601,22 @@ void AsmPrinter::EmitFunctionBody() {
}

// Emit post-function debug information.
if (DD) DD->endFunction(MF);
if (DE) DE->EndFunction();
if (DD) {
if (TimePassesIsEnabled) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
DD->endFunction(MF);
} else {
DD->endFunction(MF);
}
}
if (DE) {
if (TimePassesIsEnabled) {
NamedRegionTimer T(EHTimerName, DWARFGroupName);
DE->EndFunction();
} else {
DE->EndFunction();
}
}
MMI->EndFunction();

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

// Finalize debug and EH information.
if (DE) {
DE->EndModule();
if (TimePassesIsEnabled) {
NamedRegionTimer T(EHTimerName, DWARFGroupName);
DE->EndModule();
} else {
DE->EndModule();
}
delete DE; DE = 0;
}
if (DD) {
DD->endModule();
if (TimePassesIsEnabled) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
DD->endModule();
} else {
DD->endModule();
}
delete DD; DD = 0;
}

Expand Down
18 changes: 7 additions & 11 deletions lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,13 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)

DwarfFrameSectionSym = DwarfInfoSectionSym = DwarfAbbrevSectionSym = 0;
DwarfStrSectionSym = TextSectionSym = 0;

beginModule(M);

if (TimePassesIsEnabled) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
beginModule(M);
} else {
beginModule(M);
}
}
DwarfDebug::~DwarfDebug() {
for (unsigned j = 0, M = DIEBlocks.size(); j < M; ++j)
Expand Down Expand Up @@ -1844,8 +1849,6 @@ void DwarfDebug::constructSubprogramDIE(MDNode *N) {
/// content. Create global DIEs and emit initial debug info sections.
/// This is inovked by the target AsmPrinter.
void DwarfDebug::beginModule(Module *M) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);

DebugInfoFinder DbgFinder;
DbgFinder.processModule(*M);

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

// Attach DW_AT_inline attribute with inlined subprogram DIEs.
Expand Down Expand Up @@ -2307,8 +2309,6 @@ bool DwarfDebug::extractScopeInformation() {
/// beginFunction - Gather pre-function debug information. Assumes being
/// emitted immediately after the function entry point.
void DwarfDebug::beginFunction(const MachineFunction *MF) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);

if (!MMI->hasDebugInfo()) return;
if (!extractScopeInformation()) return;

Expand Down Expand Up @@ -2341,8 +2341,6 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
/// endFunction - Gather and emit post-function debug information.
///
void DwarfDebug::endFunction(const MachineFunction *MF) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);

if (!MMI->hasDebugInfo() || DbgScopeMap.empty()) return;

if (CurrentFnDbgScope) {
Expand Down Expand Up @@ -2389,8 +2387,6 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
/// unique label that was emitted and which provides correspondence to
/// the source line list.
MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);

StringRef Dir;
StringRef Fn;

Expand Down
10 changes: 0 additions & 10 deletions lib/CodeGen/AsmPrinter/DwarfException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,11 @@
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Timer.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h"
using namespace llvm;

namespace {
const char *DWARFGroupName = "DWARF Emission";
const char *EHTimerName = "DWARF Exception Writer";
} // end anonymous namespace

DwarfException::DwarfException(AsmPrinter *A)
: Asm(A), MMI(Asm->MMI), shouldEmitTable(false), shouldEmitMoves(false),
shouldEmitTableModule(false), shouldEmitMovesModule(false) {}
Expand Down Expand Up @@ -896,8 +890,6 @@ void DwarfException::EmitExceptionTable() {
/// EndModule - Emit all exception information that should come after the
/// content.
void DwarfException::EndModule() {
NamedRegionTimer T(EHTimerName, DWARFGroupName);

if (Asm->MAI->getExceptionHandlingType() != ExceptionHandling::Dwarf)
return;

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

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

Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end",
Expand Down

0 comments on commit 9c42107

Please sign in to comment.