2018-06-26 00:53:00 +08:00
|
|
|
//===--------------------- PipelinePrinter.h --------------------*- C++ -*-===//
|
2018-03-08 21:05:02 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// \file
|
|
|
|
///
|
2018-06-26 00:53:00 +08:00
|
|
|
/// This file implements class PipelinePrinter.
|
2018-03-09 00:08:43 +08:00
|
|
|
///
|
2018-06-26 00:53:00 +08:00
|
|
|
/// PipelinePrinter allows the customization of the performance report.
|
2018-03-08 21:05:02 +08:00
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2018-06-26 00:53:00 +08:00
|
|
|
#ifndef LLVM_TOOLS_LLVM_MCA_PIPELINEPRINTER_H
|
|
|
|
#define LLVM_TOOLS_LLVM_MCA_PIPELINEPRINTER_H
|
2018-03-08 21:05:02 +08:00
|
|
|
|
2018-06-26 00:53:00 +08:00
|
|
|
#include "Pipeline.h"
|
2018-08-25 04:24:53 +08:00
|
|
|
#include "Views/View.h"
|
2018-03-09 00:08:43 +08:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2018-03-08 21:05:02 +08:00
|
|
|
|
|
|
|
#define DEBUG_TYPE "llvm-mca"
|
|
|
|
|
|
|
|
namespace mca {
|
|
|
|
|
2018-05-01 23:54:18 +08:00
|
|
|
/// A printer class that knows how to collects statistics on the
|
2018-03-08 21:05:02 +08: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.
|
2018-06-26 00:53:00 +08:00
|
|
|
class PipelinePrinter {
|
|
|
|
Pipeline &P;
|
2018-03-09 00:08:43 +08:00
|
|
|
llvm::SmallVector<std::unique_ptr<View>, 8> Views;
|
2018-03-08 21:05:02 +08:00
|
|
|
|
|
|
|
public:
|
2018-06-26 00:53:00 +08:00
|
|
|
PipelinePrinter(Pipeline &pipeline) : P(pipeline) {}
|
2018-03-08 21:05:02 +08:00
|
|
|
|
2018-03-09 21:52:03 +08:00
|
|
|
void addView(std::unique_ptr<View> V) {
|
2018-06-26 00:53:00 +08:00
|
|
|
P.addEventListener(V.get());
|
2018-03-09 21:52:03 +08:00
|
|
|
Views.emplace_back(std::move(V));
|
|
|
|
}
|
2018-03-08 21:05:02 +08:00
|
|
|
|
2018-03-09 00:08:43 +08:00
|
|
|
void printReport(llvm::raw_ostream &OS) const;
|
2018-03-08 21:05:02 +08:00
|
|
|
};
|
|
|
|
} // namespace mca
|
|
|
|
|
2018-06-26 00:53:00 +08:00
|
|
|
#endif // LLVM_TOOLS_LLVM_MCA_PIPELINEPRINTER_H
|