[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / llvm / tools / llvm-mca / PipelinePrinter.h
blobd89e913f979f6a72532db9a15fc3923968dac817
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 "llvm/ADT/SmallVector.h"
20 #include "llvm/MC/MCSubtargetInfo.h"
21 #include "llvm/MCA/Context.h"
22 #include "llvm/MCA/Pipeline.h"
23 #include "llvm/MCA/View.h"
24 #include "llvm/Support/raw_ostream.h"
26 #define DEBUG_TYPE "llvm-mca"
28 namespace llvm {
29 namespace mca {
31 class CodeRegion;
33 /// A printer class that knows how to collects statistics on the
34 /// code analyzed by the llvm-mca tool.
35 ///
36 /// This class knows how to print out the analysis information collected
37 /// during the execution of the code. Internally, it delegates to other
38 /// classes the task of printing out timeline information as well as
39 /// resource pressure.
40 class PipelinePrinter {
41 Pipeline &P;
42 const CodeRegion &Region;
43 unsigned RegionIdx;
44 const MCSubtargetInfo &STI;
45 const PipelineOptions &PO;
46 llvm::SmallVector<std::unique_ptr<View>, 8> Views;
48 void printRegionHeader(llvm::raw_ostream &OS) const;
49 json::Object getJSONReportRegion() const;
50 json::Object getJSONTargetInfo() const;
51 json::Object getJSONSimulationParameters() const;
53 public:
54 PipelinePrinter(Pipeline &Pipe, const CodeRegion &R, unsigned Idx,
55 const MCSubtargetInfo &STI, const PipelineOptions &PO)
56 : P(Pipe), Region(R), RegionIdx(Idx), STI(STI), PO(PO) {}
58 void addView(std::unique_ptr<View> V) {
59 P.addEventListener(V.get());
60 Views.emplace_back(std::move(V));
63 void printReport(llvm::raw_ostream &OS) const;
64 void printReport(json::Object &JO) const;
66 } // namespace mca
67 } // namespace llvm
69 #endif // LLVM_TOOLS_LLVM_MCA_PIPELINEPRINTER_H