CodeGenCoverage.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //== llvm/Support/CodeGenCoverage.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 This file provides rule coverage tracking for tablegen-erated CodeGen.
  14. //===----------------------------------------------------------------------===//
  15. #ifndef LLVM_SUPPORT_CODEGENCOVERAGE_H
  16. #define LLVM_SUPPORT_CODEGENCOVERAGE_H
  17. #include "llvm/ADT/BitVector.h"
  18. namespace llvm {
  19. class MemoryBuffer;
  20. class CodeGenCoverage {
  21. protected:
  22. BitVector RuleCoverage;
  23. public:
  24. using const_covered_iterator = BitVector::const_set_bits_iterator;
  25. CodeGenCoverage();
  26. void setCovered(uint64_t RuleID);
  27. bool isCovered(uint64_t RuleID) const;
  28. iterator_range<const_covered_iterator> covered() const;
  29. bool parse(MemoryBuffer &Buffer, StringRef BackendName);
  30. bool emit(StringRef FilePrefix, StringRef BackendName) const;
  31. void reset();
  32. };
  33. } // namespace llvm
  34. #endif // LLVM_SUPPORT_CODEGENCOVERAGE_H
  35. #ifdef __GNUC__
  36. #pragma GCC diagnostic pop
  37. #endif