xref: /llvm-project/llvm/lib/Transforms/Vectorize/VPlanVerifier.h (revision f58ad3129c874aeda40ce720a0aede59480e02d6)
1 //===-- VPlanVerifier.h -----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// This file declares the class VPlanVerifier, which contains utility functions
12 /// to check the consistency of a VPlan. This includes the following kinds of
13 /// invariants:
14 ///
15 /// 1. Region/Block invariants:
16 ///   - Region's entry/exit block must have no predecessors/successors,
17 ///     respectively.
18 ///   - Block's parent must be the region immediately containing the block.
19 ///   - Linked blocks must have a bi-directional link (successor/predecessor).
20 ///   - All predecessors/successors of a block must belong to the same region.
21 ///   - Blocks must have no duplicated successor/predecessor.
22 ///
23 //===----------------------------------------------------------------------===//
24 
25 #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANVERIFIER_H
26 #define LLVM_TRANSFORMS_VECTORIZE_VPLANVERIFIER_H
27 
28 #include "VPlan.h"
29 
30 namespace llvm {
31 
32 /// Class with utility functions that can be used to check the consistency and
33 /// invariants of a VPlan, including the components of its H-CFG.
34 class VPlanVerifier {
35 public:
36   /// Verify the invariants of the H-CFG starting from \p TopRegion. The
37   /// verification process comprises the following steps:
38   /// 1. Region/Block verification: Check the Region/Block verification
39   /// invariants for every region in the H-CFG.
40   void verifyHierarchicalCFG(const VPRegionBlock *TopRegion) const;
41 };
42 } // namespace llvm
43 
44 #endif //LLVM_TRANSFORMS_VECTORIZE_VPLANVERIFIER_H
45