VPlanVerifier.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //===-- VPlanVerifier.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. ///
  9. /// \file
  10. /// This file declares the class VPlanVerifier, which contains utility functions
  11. /// to check the consistency of a VPlan. This includes the following kinds of
  12. /// invariants:
  13. ///
  14. /// 1. Region/Block invariants:
  15. /// - Region's entry/exit block must have no predecessors/successors,
  16. /// respectively.
  17. /// - Block's parent must be the region immediately containing the block.
  18. /// - Linked blocks must have a bi-directional link (successor/predecessor).
  19. /// - All predecessors/successors of a block must belong to the same region.
  20. /// - Blocks must have no duplicated successor/predecessor.
  21. ///
  22. //===----------------------------------------------------------------------===//
  23. #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANVERIFIER_H
  24. #define LLVM_TRANSFORMS_VECTORIZE_VPLANVERIFIER_H
  25. namespace llvm {
  26. class VPRegionBlock;
  27. class VPlan;
  28. /// Struct with utility functions that can be used to check the consistency and
  29. /// invariants of a VPlan, including the components of its H-CFG.
  30. struct VPlanVerifier {
  31. /// Verify the invariants of the H-CFG starting from \p TopRegion. The
  32. /// verification process comprises the following steps:
  33. /// 1. Region/Block verification: Check the Region/Block verification
  34. /// invariants for every region in the H-CFG.
  35. void verifyHierarchicalCFG(const VPRegionBlock *TopRegion) const;
  36. /// Verify invariants for general VPlans. Currently it checks the following:
  37. /// 1. all phi-like recipes must be at the beginning of a block, with no other
  38. /// recipes in between. Note that currently there is still an exception for
  39. /// VPBlendRecipes.
  40. static bool verifyPlanIsValid(const VPlan &Plan);
  41. };
  42. } // namespace llvm
  43. #endif //LLVM_TRANSFORMS_VECTORIZE_VPLANVERIFIER_H