[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / tools / llvm-mca / PipelinePrinter.h
blob004309cd7b8e2d01caa1ae617a2380376f46d56c
1 //===--------------------- PipelinePrinter.h --------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 ///
10 /// This file implements class PipelinePrinter.
11 ///
12 /// PipelinePrinter allows the customization of the performance report.
13 ///
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_TOOLS_LLVM_MCA_PIPELINEPRINTER_H
17 #define LLVM_TOOLS_LLVM_MCA_PIPELINEPRINTER_H
19 #include "Views/View.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/MCA/Pipeline.h"
22 #include "llvm/Support/raw_ostream.h"
24 #define DEBUG_TYPE "llvm-mca"
26 namespace llvm {
27 namespace mca {
29 /// A printer class that knows how to collects statistics on the
30 /// code analyzed by the llvm-mca tool.
31 ///
32 /// This class knows how to print out the analysis information collected
33 /// during the execution of the code. Internally, it delegates to other
34 /// classes the task of printing out timeline information as well as
35 /// resource pressure.
36 class PipelinePrinter {
37 Pipeline &P;
38 llvm::SmallVector<std::unique_ptr<View>, 8> Views;
40 public:
41 PipelinePrinter(Pipeline &pipeline) : P(pipeline) {}
43 void addView(std::unique_ptr<View> V) {
44 P.addEventListener(V.get());
45 Views.emplace_back(std::move(V));
48 void printReport(llvm::raw_ostream &OS) const;
50 } // namespace mca
51 } // namespace llvm
53 #endif // LLVM_TOOLS_LLVM_MCA_PIPELINEPRINTER_H