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"
19 #include "llvm/MCA/HWEventListener.h"
20 #include "llvm/Support/JSON.h"
21 #include "llvm/Support/raw_ostream.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
42