2018-03-08 14:05:02 +01:00
|
|
|
//===--------------------- BackendPrinter.h ---------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// \file
|
|
|
|
///
|
|
|
|
/// This file implements class BackendPrinter.
|
2018-03-08 17:08:43 +01:00
|
|
|
///
|
2018-03-09 14:52:03 +01:00
|
|
|
/// BackendPrinter allows the customization of the performance report.
|
2018-03-08 14:05:02 +01:00
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_TOOLS_LLVM_MCA_BACKENDPRINTER_H
|
|
|
|
#define LLVM_TOOLS_LLVM_MCA_BACKENDPRINTER_H
|
|
|
|
|
|
|
|
#include "Backend.h"
|
2018-03-09 14:52:03 +01:00
|
|
|
#include "View.h"
|
2018-03-08 17:08:43 +01:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2018-03-08 14:05:02 +01:00
|
|
|
|
|
|
|
#define DEBUG_TYPE "llvm-mca"
|
|
|
|
|
|
|
|
namespace mca {
|
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// A printer class that knows how to collects statistics on the
|
2018-03-08 14:05:02 +01:00
|
|
|
/// code analyzed by the llvm-mca tool.
|
|
|
|
///
|
|
|
|
/// This class knows how to print out the analysis information collected
|
|
|
|
/// during the execution of the code. Internally, it delegates to other
|
|
|
|
/// classes the task of printing out timeline information as well as
|
|
|
|
/// resource pressure.
|
|
|
|
class BackendPrinter {
|
2018-03-09 14:52:03 +01:00
|
|
|
Backend &B;
|
2018-03-08 17:08:43 +01:00
|
|
|
llvm::SmallVector<std::unique_ptr<View>, 8> Views;
|
2018-03-08 14:05:02 +01:00
|
|
|
|
|
|
|
public:
|
2018-03-09 14:52:03 +01:00
|
|
|
BackendPrinter(Backend &backend) : B(backend) {}
|
2018-03-08 14:05:02 +01:00
|
|
|
|
2018-03-09 14:52:03 +01:00
|
|
|
void addView(std::unique_ptr<View> V) {
|
|
|
|
B.addEventListener(V.get());
|
|
|
|
Views.emplace_back(std::move(V));
|
|
|
|
}
|
2018-03-08 14:05:02 +01:00
|
|
|
|
2018-03-08 17:08:43 +01:00
|
|
|
void printReport(llvm::raw_ostream &OS) const;
|
2018-03-08 14:05:02 +01:00
|
|
|
};
|
|
|
|
} // namespace mca
|
|
|
|
|
|
|
|
#endif
|