1 | //== llvm/Support/CodeGenCoverage.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 This file provides rule coverage tracking for tablegen-erated CodeGen. |
9 | //===----------------------------------------------------------------------===// |
10 | |
11 | #ifndef LLVM_SUPPORT_CODEGENCOVERAGE_H |
12 | #define LLVM_SUPPORT_CODEGENCOVERAGE_H |
13 | |
14 | #include "llvm/ADT/BitVector.h" |
15 | |
16 | namespace llvm { |
17 | class MemoryBuffer; |
18 | |
19 | class CodeGenCoverage { |
20 | protected: |
21 | BitVector RuleCoverage; |
22 | |
23 | public: |
24 | using const_covered_iterator = BitVector::const_set_bits_iterator; |
25 | |
26 | CodeGenCoverage(); |
27 | |
28 | void setCovered(uint64_t RuleID); |
29 | bool isCovered(uint64_t RuleID) const; |
30 | iterator_range<const_covered_iterator> covered() const; |
31 | |
32 | bool parse(MemoryBuffer &Buffer, StringRef BackendName); |
33 | bool emit(StringRef FilePrefix, StringRef BackendName) const; |
34 | void reset(); |
35 | }; |
36 | } // namespace llvm |
37 | |
38 | #endif // LLVM_SUPPORT_CODEGENCOVERAGE_H |
39 | |