View.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===----------------------- View.h -----------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. /// \file
  14. ///
  15. /// This file defines the main interface for Views. Each view contributes a
  16. /// portion of the final report generated by the tool.
  17. ///
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_MCA_VIEW_H
  20. #define LLVM_MCA_VIEW_H
  21. #include "llvm/MC/MCInstPrinter.h"
  22. #include "llvm/MCA/HWEventListener.h"
  23. #include "llvm/Support/JSON.h"
  24. #include "llvm/Support/raw_ostream.h"
  25. namespace llvm {
  26. namespace mca {
  27. class View : public HWEventListener {
  28. public:
  29. virtual ~View() = default;
  30. virtual void printView(llvm::raw_ostream &OS) const = 0;
  31. virtual StringRef getNameAsString() const = 0;
  32. virtual json::Value toJSON() const { return "not implemented"; }
  33. virtual bool isSerializable() const { return true; }
  34. void anchor() override;
  35. };
  36. } // namespace mca
  37. } // namespace llvm
  38. #endif
  39. #ifdef __GNUC__
  40. #pragma GCC diagnostic pop
  41. #endif