llvm/llvm/lib/IR/PassTimingInfo.cpp

//===- PassTimingInfo.cpp - LLVM Pass Timing Implementation ---------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements the LLVM Pass Timing infrastructure for both
// new and legacy pass managers.
//
// PassTimingInfo Class - This class is used to calculate information about the
// amount of time each pass takes to execute.  This only happens when
// -time-passes is enabled on the command line.
//
//===----------------------------------------------------------------------===//

#include "llvm/IR/PassTimingInfo.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/PassInstrumentation.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/TypeName.h"
#include "llvm/Support/raw_ostream.h"
#include <string>

usingnamespacellvm;

#define DEBUG_TYPE

namespace llvm {

bool TimePassesIsEnabled =;
bool TimePassesPerRun =;

static cl::opt<bool, true> EnableTiming(
    "time-passes", cl::location(TimePassesIsEnabled), cl::Hidden,
    cl::desc("Time each pass, printing elapsed time for each on exit"));

static cl::opt<bool, true> EnableTimingPerRun(
    "time-passes-per-run", cl::location(TimePassesPerRun), cl::Hidden,
    cl::desc("Time each pass run, printing elapsed time for each run on exit"),
    cl::callback([](const bool &) {}));

namespace {
namespace legacy {

//===----------------------------------------------------------------------===//
// Legacy pass manager's PassTimingInfo implementation

/// Provides an interface for collecting pass timing information.
///
/// It was intended to be generic but now we decided to split
/// interfaces completely. This is now exclusively for legacy-pass-manager use.
class PassTimingInfo {};

static ManagedStatic<sys::SmartMutex<true>> TimingInfoMutex;

PassTimingInfo::PassTimingInfo() :{}

PassTimingInfo::~PassTimingInfo() {}

void PassTimingInfo::init() {}

/// Prints out timing information and then resets the timers.
void PassTimingInfo::print(raw_ostream *OutStream) {}

Timer *PassTimingInfo::newPassTimer(StringRef PassID, StringRef PassDesc) {}

Timer *PassTimingInfo::getPassTimer(Pass *P, PassInstanceID Pass) {}

PassTimingInfo *PassTimingInfo::TheTimeInfo;
} // namespace legacy
} // namespace

Timer *getPassTimer(Pass *P) {}

/// If timing is enabled, report the times collected up to now and then reset
/// them.
void reportAndResetTimings(raw_ostream *OutStream) {}

//===----------------------------------------------------------------------===//
// Pass timing handling for the New Pass Manager
//===----------------------------------------------------------------------===//

/// Returns the timer for the specified pass invocation of \p PassID.
/// Each time it creates a new timer.
Timer &TimePassesHandler::getPassTimer(StringRef PassID, bool IsPass) {}

TimePassesHandler::TimePassesHandler(bool Enabled, bool PerRun)
    :{}

TimePassesHandler::TimePassesHandler()
    :{}

void TimePassesHandler::setOutStream(raw_ostream &Out) {}

void TimePassesHandler::print() {}

LLVM_DUMP_METHOD void TimePassesHandler::dump() const {}

static bool shouldIgnorePass(StringRef PassID) {}

void TimePassesHandler::startPassTimer(StringRef PassID) {}

void TimePassesHandler::stopPassTimer(StringRef PassID) {}

void TimePassesHandler::startAnalysisTimer(StringRef PassID) {}

void TimePassesHandler::stopAnalysisTimer(StringRef PassID) {}

void TimePassesHandler::registerCallbacks(PassInstrumentationCallbacks &PIC) {}

} // namespace llvm