LLVM  14.0.0git
View.h
Go to the documentation of this file.
1 //===----------------------- View.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 defines the main interface for Views. Each view contributes a
11 /// portion of the final report generated by the tool.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_MCA_VIEW_H
16 #define LLVM_MCA_VIEW_H
17 
18 #include "llvm/MC/MCInstPrinter.h"
20 #include "llvm/Support/JSON.h"
22 
23 namespace llvm {
24 namespace mca {
25 
26 class View : public HWEventListener {
27 public:
28  virtual ~View() = default;
29 
30  virtual void printView(llvm::raw_ostream &OS) const = 0;
31  virtual StringRef getNameAsString() const = 0;
32 
33  virtual json::Value toJSON() const { return "not implemented"; }
34  virtual bool isSerializable() const { return true; }
35 
36  void anchor() override;
37 };
38 } // namespace mca
39 } // namespace llvm
40 
41 #endif
llvm::json::Value
A Value is an JSON value of unknown type.
Definition: JSON.h:289
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::mca::View
Definition: View.h:26
llvm::mca::View::getNameAsString
virtual StringRef getNameAsString() const =0
llvm::mca::View::toJSON
virtual json::Value toJSON() const
Definition: View.h:33
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
JSON.h
MCInstPrinter.h
llvm::mca::View::anchor
void anchor() override
Definition: View.cpp:21
llvm::mca::View::~View
virtual ~View()=default
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::mca::View::printView
virtual void printView(llvm::raw_ostream &OS) const =0
llvm::mca::View::isSerializable
virtual bool isSerializable() const
Definition: View.h:34
HWEventListener.h
raw_ostream.h
llvm::mca::HWEventListener
Definition: HWEventListener.h:160