1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

Workaround the breakage in r100616 by guarding all timers with

TimePassesIsEnabled. This should allow make check to pass.

llvm-svn: 100618
This commit is contained in:
Torok Edwin 2010-04-07 10:44:46 +00:00
parent 8282504a14
commit 9028487b8b
3 changed files with 74 additions and 32 deletions

View File

@ -1,4 +1,3 @@
//===-- AsmPrinter.cpp - Common AsmPrinter code ---------------------------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -42,8 +41,15 @@
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h" #include "llvm/Support/Format.h"
#include "llvm/Support/Timer.h"
using namespace llvm; 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"); STATISTIC(EmittedInsts, "Number of machine instrs printed");
char AsmPrinter::ID = 0; char AsmPrinter::ID = 0;
@ -347,8 +353,22 @@ void AsmPrinter::EmitFunctionHeader() {
} }
// Emit pre-function debug and/or EH information. // Emit pre-function debug and/or EH information.
if (DE) DE->BeginFunction(MF); if (DE) {
if (DD) DD->beginFunction(MF); 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 /// EmitFunctionEntryLabel - Emit the label that is the entrypoint for the
@ -507,8 +527,14 @@ void AsmPrinter::EmitFunctionBody() {
++EmittedInsts; ++EmittedInsts;
if (ShouldPrintDebugScopes) if (ShouldPrintDebugScopes) {
DD->beginScope(II); if (TimePassesIsEnabled) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
DD->beginScope(II);
} else {
DD->beginScope(II);
}
}
if (isVerbose()) if (isVerbose())
EmitComments(*II, OutStreamer.GetCommentOS()); EmitComments(*II, OutStreamer.GetCommentOS());
@ -539,8 +565,14 @@ void AsmPrinter::EmitFunctionBody() {
break; break;
} }
if (ShouldPrintDebugScopes) if (ShouldPrintDebugScopes) {
DD->endScope(II); 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. // Emit post-function debug information.
if (DD) DD->endFunction(MF); if (DD) {
if (DE) DE->EndFunction(); 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(); MMI->EndFunction();
// Print out jump tables referenced by the function. // Print out jump tables referenced by the function.
@ -588,11 +634,21 @@ bool AsmPrinter::doFinalization(Module &M) {
// Finalize debug and EH information. // Finalize debug and EH information.
if (DE) { if (DE) {
DE->EndModule(); if (TimePassesIsEnabled) {
NamedRegionTimer T(EHTimerName, DWARFGroupName);
DE->EndModule();
} else {
DE->EndModule();
}
delete DE; DE = 0; delete DE; DE = 0;
} }
if (DD) { if (DD) {
DD->endModule(); if (TimePassesIsEnabled) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
DD->endModule();
} else {
DD->endModule();
}
delete DD; DD = 0; delete DD; DD = 0;
} }

View File

@ -315,8 +315,13 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
DwarfFrameSectionSym = DwarfInfoSectionSym = DwarfAbbrevSectionSym = 0; DwarfFrameSectionSym = DwarfInfoSectionSym = DwarfAbbrevSectionSym = 0;
DwarfStrSectionSym = TextSectionSym = 0; DwarfStrSectionSym = TextSectionSym = 0;
beginModule(M); if (TimePassesIsEnabled) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
beginModule(M);
} else {
beginModule(M);
}
} }
DwarfDebug::~DwarfDebug() { DwarfDebug::~DwarfDebug() {
for (unsigned j = 0, M = DIEBlocks.size(); j < M; ++j) for (unsigned j = 0, M = DIEBlocks.size(); j < M; ++j)
@ -1844,8 +1849,6 @@ void DwarfDebug::constructSubprogramDIE(MDNode *N) {
/// content. Create global DIEs and emit initial debug info sections. /// content. Create global DIEs and emit initial debug info sections.
/// This is inovked by the target AsmPrinter. /// This is inovked by the target AsmPrinter.
void DwarfDebug::beginModule(Module *M) { void DwarfDebug::beginModule(Module *M) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
DebugInfoFinder DbgFinder; DebugInfoFinder DbgFinder;
DbgFinder.processModule(*M); DbgFinder.processModule(*M);
@ -1908,7 +1911,6 @@ void DwarfDebug::beginModule(Module *M) {
/// endModule - Emit all Dwarf sections that should come after the content. /// endModule - Emit all Dwarf sections that should come after the content.
/// ///
void DwarfDebug::endModule() { void DwarfDebug::endModule() {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
if (!ModuleCU) return; if (!ModuleCU) return;
// Attach DW_AT_inline attribute with inlined subprogram DIEs. // Attach DW_AT_inline attribute with inlined subprogram DIEs.
@ -2307,8 +2309,6 @@ bool DwarfDebug::extractScopeInformation() {
/// beginFunction - Gather pre-function debug information. Assumes being /// beginFunction - Gather pre-function debug information. Assumes being
/// emitted immediately after the function entry point. /// emitted immediately after the function entry point.
void DwarfDebug::beginFunction(const MachineFunction *MF) { void DwarfDebug::beginFunction(const MachineFunction *MF) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
if (!MMI->hasDebugInfo()) return; if (!MMI->hasDebugInfo()) return;
if (!extractScopeInformation()) return; if (!extractScopeInformation()) return;
@ -2341,8 +2341,6 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
/// endFunction - Gather and emit post-function debug information. /// endFunction - Gather and emit post-function debug information.
/// ///
void DwarfDebug::endFunction(const MachineFunction *MF) { void DwarfDebug::endFunction(const MachineFunction *MF) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
if (!MMI->hasDebugInfo() || DbgScopeMap.empty()) return; if (!MMI->hasDebugInfo() || DbgScopeMap.empty()) return;
if (CurrentFnDbgScope) { if (CurrentFnDbgScope) {
@ -2389,8 +2387,6 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
/// unique label that was emitted and which provides correspondence to /// unique label that was emitted and which provides correspondence to
/// the source line list. /// the source line list.
MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) { MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) {
NamedRegionTimer T(DbgTimerName, DWARFGroupName);
StringRef Dir; StringRef Dir;
StringRef Fn; StringRef Fn;

View File

@ -33,17 +33,11 @@
#include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Support/Dwarf.h" #include "llvm/Support/Dwarf.h"
#include "llvm/Support/FormattedStream.h" #include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Timer.h"
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h" #include "llvm/ADT/Twine.h"
using namespace llvm; using namespace llvm;
namespace {
const char *DWARFGroupName = "DWARF Emission";
const char *EHTimerName = "DWARF Exception Writer";
} // end anonymous namespace
DwarfException::DwarfException(AsmPrinter *A) DwarfException::DwarfException(AsmPrinter *A)
: Asm(A), MMI(Asm->MMI), shouldEmitTable(false), shouldEmitMoves(false), : Asm(A), MMI(Asm->MMI), shouldEmitTable(false), shouldEmitMoves(false),
shouldEmitTableModule(false), shouldEmitMovesModule(false) {} shouldEmitTableModule(false), shouldEmitMovesModule(false) {}
@ -896,8 +890,6 @@ void DwarfException::EmitExceptionTable() {
/// EndModule - Emit all exception information that should come after the /// EndModule - Emit all exception information that should come after the
/// content. /// content.
void DwarfException::EndModule() { void DwarfException::EndModule() {
NamedRegionTimer T(EHTimerName, DWARFGroupName);
if (Asm->MAI->getExceptionHandlingType() != ExceptionHandling::Dwarf) if (Asm->MAI->getExceptionHandlingType() != ExceptionHandling::Dwarf)
return; return;
@ -917,7 +909,6 @@ void DwarfException::EndModule() {
/// BeginFunction - Gather pre-function exception information. Assumes it's /// BeginFunction - Gather pre-function exception information. Assumes it's
/// being emitted immediately after the function entry point. /// being emitted immediately after the function entry point.
void DwarfException::BeginFunction(const MachineFunction *MF) { void DwarfException::BeginFunction(const MachineFunction *MF) {
NamedRegionTimer T(EHTimerName, DWARFGroupName);
shouldEmitTable = shouldEmitMoves = false; shouldEmitTable = shouldEmitMoves = false;
// If any landing pads survive, we need an EH table. // If any landing pads survive, we need an EH table.
@ -939,7 +930,6 @@ void DwarfException::BeginFunction(const MachineFunction *MF) {
/// EndFunction - Gather and emit post-function exception information. /// EndFunction - Gather and emit post-function exception information.
/// ///
void DwarfException::EndFunction() { void DwarfException::EndFunction() {
NamedRegionTimer T(EHTimerName, DWARFGroupName);
if (!shouldEmitMoves && !shouldEmitTable) return; if (!shouldEmitMoves && !shouldEmitTable) return;
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end", Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end",