VPlanDominatorTree.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //===-- VPlanDominatorTree.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 implements dominator tree analysis for a single level of a VPlan's
  11. /// H-CFG.
  12. ///
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANDOMINATORTREE_H
  15. #define LLVM_TRANSFORMS_VECTORIZE_VPLANDOMINATORTREE_H
  16. #include "VPlan.h"
  17. #include "VPlanCFG.h"
  18. #include "llvm/ADT/GraphTraits.h"
  19. #include "llvm/IR/Dominators.h"
  20. #include "llvm/Support/GenericDomTree.h"
  21. namespace llvm {
  22. template <> struct DomTreeNodeTraits<VPBlockBase> {
  23. using NodeType = VPBlockBase;
  24. using NodePtr = VPBlockBase *;
  25. using ParentPtr = VPlan *;
  26. static NodePtr getEntryNode(ParentPtr Parent) { return Parent->getEntry(); }
  27. static ParentPtr getParent(NodePtr B) { return B->getPlan(); }
  28. };
  29. ///
  30. /// Template specialization of the standard LLVM dominator tree utility for
  31. /// VPBlockBases.
  32. using VPDominatorTree = DomTreeBase<VPBlockBase>;
  33. using VPDomTreeNode = DomTreeNodeBase<VPBlockBase>;
  34. /// Template specializations of GraphTraits for VPDomTreeNode.
  35. template <>
  36. struct GraphTraits<VPDomTreeNode *>
  37. : public DomTreeGraphTraitsBase<VPDomTreeNode,
  38. VPDomTreeNode::const_iterator> {};
  39. template <>
  40. struct GraphTraits<const VPDomTreeNode *>
  41. : public DomTreeGraphTraitsBase<const VPDomTreeNode,
  42. VPDomTreeNode::const_iterator> {};
  43. } // namespace llvm
  44. #endif // LLVM_TRANSFORMS_VECTORIZE_VPLANDOMINATORTREE_H