2018-06-25 18:53:00 +02:00
|
|
|
//===--------------------- PipelinePrinter.h --------------------*- C++ -*-===//
|
2018-03-08 14:05:02 +01:00
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// 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
|
2018-03-08 14:05:02 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// \file
|
|
|
|
///
|
2018-06-25 18:53:00 +02:00
|
|
|
/// This file implements class PipelinePrinter.
|
2018-03-08 17:08:43 +01:00
|
|
|
///
|
2018-06-25 18:53:00 +02:00
|
|
|
/// PipelinePrinter allows the customization of the performance report.
|
2018-03-08 14:05:02 +01:00
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2018-06-25 18:53:00 +02:00
|
|
|
#ifndef LLVM_TOOLS_LLVM_MCA_PIPELINEPRINTER_H
|
|
|
|
#define LLVM_TOOLS_LLVM_MCA_PIPELINEPRINTER_H
|
2018-03-08 14:05:02 +01:00
|
|
|
|
2018-08-24 22:24:53 +02:00
|
|
|
#include "Views/View.h"
|
2018-03-08 17:08:43 +01:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2018-12-17 09:08:31 +01:00
|
|
|
#include "llvm/MCA/Pipeline.h"
|
2018-03-08 17:08:43 +01:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2018-03-08 14:05:02 +01:00
|
|
|
|
|
|
|
#define DEBUG_TYPE "llvm-mca"
|
|
|
|
|
2018-10-30 16:56:08 +01:00
|
|
|
namespace llvm {
|
2018-03-08 14:05:02 +01:00
|
|
|
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.
|
2018-06-25 18:53:00 +02:00
|
|
|
class PipelinePrinter {
|
|
|
|
Pipeline &P;
|
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-06-25 18:53:00 +02:00
|
|
|
PipelinePrinter(Pipeline &pipeline) : P(pipeline) {}
|
2018-03-08 14:05:02 +01:00
|
|
|
|
2018-03-09 14:52:03 +01:00
|
|
|
void addView(std::unique_ptr<View> V) {
|
2018-06-25 18:53:00 +02:00
|
|
|
P.addEventListener(V.get());
|
2018-03-09 14:52:03 +01:00
|
|
|
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
|
2018-10-30 16:56:08 +01:00
|
|
|
} // namespace llvm
|
2018-03-08 14:05:02 +01:00
|
|
|
|
2018-06-25 18:53:00 +02:00
|
|
|
#endif // LLVM_TOOLS_LLVM_MCA_PIPELINEPRINTER_H
|