Changeset View
Changeset View
Standalone View
Standalone View
lib/IR/LegacyPassManager.cpp
Show All 17 Lines | |||||
#include "llvm/IR/LegacyPassManagers.h" | #include "llvm/IR/LegacyPassManagers.h" | ||||
#include "llvm/IR/LegacyPassNameParser.h" | #include "llvm/IR/LegacyPassNameParser.h" | ||||
#include "llvm/IR/Module.h" | #include "llvm/IR/Module.h" | ||||
#include "llvm/Support/CommandLine.h" | #include "llvm/Support/CommandLine.h" | ||||
#include "llvm/Support/Debug.h" | #include "llvm/Support/Debug.h" | ||||
#include "llvm/Support/ErrorHandling.h" | #include "llvm/Support/ErrorHandling.h" | ||||
#include "llvm/Support/ManagedStatic.h" | #include "llvm/Support/ManagedStatic.h" | ||||
#include "llvm/Support/Mutex.h" | #include "llvm/Support/Mutex.h" | ||||
#include "llvm/Support/MutexGuard.h" | |||||
#include "llvm/Support/TimeValue.h" | #include "llvm/Support/TimeValue.h" | ||||
#include "llvm/Support/Timer.h" | #include "llvm/Support/Timer.h" | ||||
#include "llvm/Support/raw_ostream.h" | #include "llvm/Support/raw_ostream.h" | ||||
#include <algorithm> | #include <algorithm> | ||||
#include <map> | #include <map> | ||||
using namespace llvm; | using namespace llvm; | ||||
using namespace llvm::legacy; | using namespace llvm::legacy; | ||||
▲ Show 20 Lines • Show All 420 Lines • ▼ Show 20 Lines | |||||
namespace { | namespace { | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
/// TimingInfo Class - This class is used to calculate information about the | /// TimingInfo Class - This class is used to calculate information about the | ||||
/// amount of time each pass takes to execute. This only happens when | /// amount of time each pass takes to execute. This only happens when | ||||
/// -time-passes is enabled on the command line. | /// -time-passes is enabled on the command line. | ||||
/// | /// | ||||
static ManagedStatic<sys::SmartMutex<true> > TimingInfoMutex; | static ManagedStatic<sys::RecursiveDebugMutex> TimingInfoMutex; | ||||
class TimingInfo { | class TimingInfo { | ||||
DenseMap<Pass*, Timer*> TimingData; | DenseMap<Pass*, Timer*> TimingData; | ||||
TimerGroup TG; | TimerGroup TG; | ||||
public: | public: | ||||
// Use 'create' member to get this. | // Use 'create' member to get this. | ||||
TimingInfo() : TG("... Pass execution timing report ...") {} | TimingInfo() : TG("... Pass execution timing report ...") {} | ||||
Show All 12 Lines | public: | ||||
// null. It may be called multiple times. | // null. It may be called multiple times. | ||||
static void createTheTimeInfo(); | static void createTheTimeInfo(); | ||||
/// getPassTimer - Return the timer for the specified pass if it exists. | /// getPassTimer - Return the timer for the specified pass if it exists. | ||||
Timer *getPassTimer(Pass *P) { | Timer *getPassTimer(Pass *P) { | ||||
if (P->getAsPMDataManager()) | if (P->getAsPMDataManager()) | ||||
return nullptr; | return nullptr; | ||||
sys::SmartScopedLock<true> Lock(*TimingInfoMutex); | llvm::MutexGuard Lock(*TimingInfoMutex); | ||||
Timer *&T = TimingData[P]; | Timer *&T = TimingData[P]; | ||||
if (!T) | if (!T) | ||||
T = new Timer(P->getPassName(), TG); | T = new Timer(P->getPassName(), TG); | ||||
return T; | return T; | ||||
} | } | ||||
}; | }; | ||||
} // End of anon namespace | } // End of anon namespace | ||||
▲ Show 20 Lines • Show All 1,442 Lines • Show Last 20 Lines |