Workaround the breakage in r100616 by guarding all timers with

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
This commit is contained in:
Torok Edwin
2010-04-07 10:44:46 +00:00
parent 5f017e8086
commit 9c4210794e
3 changed files with 74 additions and 32 deletions

View File

@@ -1,4 +1,3 @@
//===-- AsmPrinter.cpp - Common AsmPrinter code ---------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -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;
@@ -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
@@ -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());
@@ -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);
}
}
}
}
@@ -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.
@@ -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;
}